Editing FoolFuuka/Install/Debian

From Bibliotheca Anonoma

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 20: Line 20:
Then, Comment out repo in {{ic|/etc/apt/sources.list.d/*}} and add to end:
Then, Comment out repo in {{ic|/etc/apt/sources.list.d/*}} and add to end:


<pre>deb http://ppa.launchpad.net/builds/sphinxsearch-stable/ubuntu precise main  
<pre> deb http://ppa.launchpad.net/builds/sphinxsearch-stable/ubuntu precise main  
deb-src http://ppa.launchpad.net/builds/sphinxsearch-stable/ubuntu precise main </pre>
  deb-src http://ppa.launchpad.net/builds/sphinxsearch-stable/ubuntu precise main </pre>
<pre>sudo apt-get update</pre>
<pre>sudo apt-get update</pre>
== Install all the needed packages. ==
== Install all the needed packages. ==


Nginx, HHVM, PHP5 Cli, PHP5 Curl, MariaDB, OpenJDK w/ compilier, Maven, Sphinxsearch
Nginx, HHVM, PHP5 Cli, PHP5 Curl, MariaDB, OpenJDK w/ compilier, Maven
 
<pre>sudo apt-get install git nginx hhvm php5-fpm php5-cli php5-curl php5-mysqlnd mariadb-server libmariadbclient-dev mariadb-client imagemagick openjdk-7-jre openjdk-7-jdk openjdk-7-jre-lib maven sphinxsearch</pre>


<pre>sudo apt-get install git nginx hhvm php5-cli php5-curl php5-fpm php5-mysqlnd mariadb-server libmariadbclient-dev mariadb-client imagemagick openjdk-7-jre openjdk-7-jdk openjdk-7-jre-lib maven -y
sudo apt-get install phpmyadmin</pre>
== Install composer for downloading FoolFuuka dependencies. ==
== Install composer for downloading FoolFuuka dependencies. ==


Line 47: Line 46:
Then remove the line starting with hhvm.server.port, and in its place add the following one:
Then remove the line starting with hhvm.server.port, and in its place add the following one:


<pre>hhvm.server.file_socket=/var/run/hhvm/hhvm.sock</pre>
<pre> hhvm.server.file_socket=/var/run/hhvm/hhvm.sock</pre>
 
== Set required php.ini vars. ==
== Set required php.ini vars. ==
{{hc|sudo nano /etc/php5/fpm/php.ini|<nowiki>
{{hc|sudo nano /etc/hhvm/php.ini|<nowiki>
date.timezone = UTC
  date.timezone = UTC
upload_max_filesize = 32M
  upload_max_filesize = 32M
post_max_size = 32M
  post_max_size = 32M
</nowiki>}}
</nowiki>}}
== Restart HHVM ==
== Restart HHVM ==


Line 73: Line 70:
composer install </pre>
composer install </pre>
== Install Foolfuuka Plugins ==
== Install Foolfuuka Plugins ==
You may need to find the repo on their github if their site doesn't work: https://github.com/FoolCode


<pre>cd ~/foolfuuka/app/foolz/foolframe/plugins
<pre>cd ~/foolfuuka/app/foolz/foolframe/plugins
mkdir foolz
mkdir foolz
cd foolz
cd foolz
git clone https://github.com/FoolCode/foolframe-plugin-articles.git</pre>
git clone -c http.sslVerify=false https://dev.foolz.us/foolframe-plugins/foolframe-plugin-articles.git</pre>
 
<!-- Or use <https://github.com/FoolCode/foolframe-plugin-articles> if that's not available -->
 
<pre>cd ~/foolfuuka/app/foolz/foolfuuka/plugins
<pre>cd ~/foolfuuka/app/foolz/foolfuuka/plugins
mkdir foolz
mkdir foolz
cd foolz
cd foolz
git clone https://github.com/FoolCode/foolfuuka-plugin-board-statistics.git
git clone -c http.sslVerify=false https://dev.foolz.us/foolfuuka-plugins/foolfuuka-plugin-board-statistics.git
git clone https://github.com/FoolCode/foolfuuka-plugin-dice-roll.git
git clone -c http.sslVerify=false https://dev.foolz.us/foolfuuka-plugins/foolfuuka-plugin-dice-roll.git
git clone https://github.com/FoolCode/foolfuuka-plugin-quests.git</pre>
git clone -c http.sslVerify=false https://dev.foolz.us/foolfuuka-plugins/foolfuuka-plugin-quests.git</pre>
 
== Set Permissions and Group for FoolFuuka Directory ==
== Set Permissions and Group for FoolFuuka Directory ==


<pre>sudo chmod -Rf 775 ~/foolfuuka
<pre>chmod -Rf 775 ~/foolfuuka
sudo chown -Rf www-data:www-data ~/foolfuuka</pre>
chown -Rf www-data:www-data ~/foolfuuka</pre>


== Configure Nginx to host foolfuuka ==
== Configure Nginx to host foolfuuka ==
Line 101: Line 92:
         index index.php index.html index.htm;
         index index.php index.html index.htm;


        client_max_body_size 32M; # set to the same as max PHP upload size in HHVM
         location / {
         location / {
                 try_files $uri $uri/ /index.php$is_args$args;
                 try_files $uri $uri/ /index.php$is_args$args;
         }
         }
        location ~ \.php$ {
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
</nowiki>}}
</nowiki>}}
== Restart Nginx ==
== Restart Nginx ==


<pre>sudo service nginx restart</pre>
<pre>sudo service nginx restart</pre>
== Create the database and install Foolfuuka user accounts. ==
== Create the database and install Foolfuuka user accounts. ==
{{Warning|Don't use this command: {{ic|sudo mysql_install_db}}}}


<pre>sudo mysql_secure_installation</pre>
<pre>sudo mysql_secure_installation</pre>
Line 135: Line 118:


{{hc|sudo nano /etc/mysql/my.cnf|<nowiki>
{{hc|sudo nano /etc/mysql/my.cnf|<nowiki>
[client]
  [client]
default-character-set = utf8mb4
  default-character-set = utf8mb4


[mysql]
  [mysql]
default-character-set = utf8mb4
  default-character-set = utf8mb4


[mysqld]
  [mysqld]
character-set-client-handshake = FALSE
  character-set-client-handshake = FALSE
character-set-server = utf8mb4
  character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
  collation-server = utf8mb4_general_ci
</nowiki>}}
</nowiki>}}
== Restart MariaDB ==
== Restart MariaDB ==


Line 167: Line 149:


{{hc|sudo nano /etc/security/limits.conf|
{{hc|sudo nano /etc/security/limits.conf|
* soft nofile 63545
  * soft nofile 63545
* hard nofile 63545
  * hard nofile 63545
* soft nproc 63545
  * soft nproc 63545
* hard nproc 63545
  * hard nproc 63545
}}
}}


Line 176: Line 158:


{{hc|sudo nano /etc/mysql/my.cnf|<nowiki>
{{hc|sudo nano /etc/mysql/my.cnf|<nowiki>
# Put this after [mysqld]
  # Put this after [mysqld]
open-files-limit=40000
  open-files-limit=40000
</nowiki>}}
</nowiki>}}


Line 183: Line 165:
sudo reboot</pre>
sudo reboot</pre>
<pre>mysql -u root -p
<pre>mysql -u root -p
set global default_storage_engine=TokuDB;
  set global default_storage_engine=TokuDB;
SET GLOBAL log_bin_trust_function_creators = 1;</pre>
  SET GLOBAL log_bin_trust_function_creators = 1;</pre>
Now, Install FoolFuuka at the website using foolfuuka credentials
Now, Install FoolFuuka at the website using foolfuuka credentials


Line 201: Line 183:
Insert the following JSON into that file:
Insert the following JSON into that file:


<pre>
<pre>###
{"settings": {
{"settings": {
   "dumperEngine": "DumperJSON",
   "dumperEngine": "DumperJSON",
Line 306: Line 288:
   }
   }
}}
}}
</pre>
###</pre>
 
== Start asagi (There is a better way to do this). ==
== Start asagi (There is a better way to do this). ==


Maybe we should use systemd for it...
Maybe we should use systemd for it...
[http://www.fasterj.com/articles/oraclecollectors1.shtml UseParallelGC] adds Parallelization to the garbage collector, which really helps for Java.


<pre>screen java -XX:+UseParallelGC -XX:+UseParallelOldGC -verbose:gc -jar asagi.jar</pre>
<pre>screen java -XX:+UseParallelGC -XX:+UseParallelOldGC -verbose:gc -jar asagi.jar</pre>


ATC of Desuarchive prefers these parameters, which have two customizations.  
ATC of Desuarchive prefers these parameters. For the first parameter, Java by default will use half your system memory, so you can set your own hard memory roof to reduce usage or increase it. The permsize is about the permanent generation objects: depends on your heap size.
 
# For the first parameter, Java by default will use 1/4th your system memory, so you can set your own hard memory roof to reduce usage or increase it. He used {{ic|6144m}}.
#* If you aren't archiving more than 8 boards, this probably won't be an issue that you need to deal with.
# The permsize is about the permanent generation objects: depends on your heap size.
#* This setting is probably related to how many boards are on Desuarchive, but Sunako doesn't had that sort of issue.


<pre>screen java -Xmx6144m -XX:+UseParallelGC -XX:+UseParallelOldGC -verbose:gc -XX:MaxPermSize=512m -jar asagi.jar</pre>
<pre>screen java -Xmx6144m -XX:+UseParallelGC -XX:+UseParallelOldGC -verbose:gc -XX:MaxPermSize=512m -jar asagi.jar</pre>


Now, Configure asagi as the database and remove the table prefix from FoolFuuka.
Now, Configure asagi as the database and remove the table prefix from FoolFuuka
== Install FoolFuuka ==
 
The installer is quite self explanatory, just make sure to remove the Boards prefix.
 
Also make sure to install imagemagick and set the path in the config to it.
 
{{Note|In the installer one should have FoolFuuka table prefix set (default is fine ff_). But after installing one needs to set BOARD PREFIX to blank since asagi doesn't have any. FoolFuuka table prefix != board table prefix. Here's [https://github.com/p0wer0n/FoolFrame/commit/3368e24dc9d89b881460f8c876ddb91c78b5b955 a code change that does it.]}}


== Add boards, Configure Sphinx ==
== Add boards, Configure Sphinx ==


To configure Sphinx Search, take the following links:
http://IP/admin &gt; Search &gt; Generate Config.
 
http://IP/admin -> Search -> Generate Config.
http://IP/admin -> Boards -> Edit -> Check Use SphinxSearch as search engine.
On the Search panel, change the working directory (on Ubuntu) to the following:
<pre>
/var/lib/sphinxsearch
</pre>
 
=== Supplement Sphinxsearch ===
 
<pre>
cd /var/run
sudo mkdir sphinxsearch
sudo chmod -Rf 777 sphinxsearch
</pre>
 
=== Start Sphinxsearch ===
<pre>
sudo nano /etc/default/sphinxsearch
</pre>
Change the following line from
<pre>START=no</pre>
to
<pre>START=yes</pre>
Save and run the following command
<pre>sudo /etc/init.d/sphinxsearch start</pre>
 
 
Right-click and copy this config out of Foolfuuka and add your MySQL database information for asagi.
Change the following line from
<pre>pid_file = /var/lib/sphinxsearch/searchd.pid</pre>
to
<pre>pid_file = /var/run/sphinxsearch/searchd.pid </pre>
 
Then, paste this to <code>/etc/sphinxsearch/sphinx.conf</code>
 
If anything errors, kill any running instance of asagi and restart it
 
=== Build the indexes ===
 
<pre>sudo indexer *_ancient --rotate</pre>
<pre>sudo indexer *_main --rotate</pre>
 
=== Configure Crontab ===
<pre>
sudo nano /etc/crontab
</pre>
<pre>
@hourly sudo -u sphinxsearch /usr/bin/indexer --rotate *_delta > /dev/null
@daily sudo -u sphinxsearch /usr/bin/indexer --rotate *_main > /dev/null
@monthly sudo -u sphinxsearch /usr/bin/indexer --rotate *_ancient > /dev/null
</pre>
 
 
=== Adding Archives ===
 
Inject your sql file into the asagi database (assuming that your sql file is called "dump.sql"):
<pre>mysql -u root -p asagi < dump.sql</pre>
 
Then, in the admin panel, simply add the board that corresponds to the board you injected.
 
== Extra configuration ==
 
Depending on which distro you use or how many posts you have, some configs might need to be changed.
 
=== Fixing thumbnail creation ===
 
Foolfuuka might not be able to generate thumbnails for images to be posted. If so, check:
<pre>$ whereis convert
convert: /usr/bin/convert /usr/share/man/man1/convert.1.gz
</pre>
and make sure it is the same value in Admin panel -> general -> Imagemagick Convert
 
=== For Huge Boards: Problem with random dropped posts/threads due to stats triggers ===
 
When Desuarchive was configured with a new server using the 4plebs fork of FoolFuuka and Asagi, it was a mystery why /a/ was behind in archiving. Normal posts were being bled somehow.
 
But everything was running fine configuration-wise. No asagi errors. Nothing. And all other boards were great.
 
However, ''just get rid of stats triggers/procedures'' and it should be fine.
 
Asagi has triggers that update {{ic|_daily}} and {{ic|_users}} tables. FFuuka stats plugin reads those tables and make stats. Probably the {{ic|_users}} table was messed up/too large for /a/, so it slows down inserts because the update runs before it.
 
4plebs is working on stats plugins that does it without them, since stats calc on insert isn't a smart idea.
 
==== Procedure ====
 
I just removed the calls to stats procedures. Should work but check it out first. But should leave the procedures there (commented out?) so that you can go back.
 
# Stop Asagi.
# Run the code below:
# Start Asagi.
 
{{lc|<nowiki>
DROP TRIGGER IF EXISTS "after_ins_a";
 
delimiter //
 
CREATE TRIGGER "after_ins_a" AFTER INSERT ON "a"
FOR EACH ROW
BEGIN
  IF NEW.op = 1 THEN
    CALL create_thread_a(NEW.num, NEW.timestamp);
  END IF;
  CALL update_thread_a(NEW.thread_num);
END//


DROP TRIGGER IF EXISTS "after_del_a"//
Copy config out of FF and add your MySQL database information. Paste this to /etc/sphinxsearch/sphinx.conf


CREATE TRIGGER "after_del_a" AFTER DELETE ON "a"
Build the indexes
FOR EACH ROW
BEGIN
  CALL update_thread_a(OLD.thread_num);
  IF OLD.op = 1 THEN
    CALL delete_thread_a(OLD.num);
  END IF;
  IF OLD.media_hash IS NOT NULL THEN
    CALL delete_image_a(OLD.media_id);
  END IF;
END//


<pre>sudo indexer 3_ancient a_ancient aco_ancient adv_ancient an_ancient asp_ancient b_ancient biz_ancient c_ancient cgl_ancient ck_ancient cm_ancient co_ancient d_ancient diy_ancient e_ancient f_ancient fa_ancient fit_ancient g_ancient gd_ancient gif_ancient h_ancient hc_ancient hm_ancient his_ancient hr_ancient i_ancient ic_ancient int_ancient jp_ancient k_ancient lgbt_ancient lit_ancient m_ancient mlp_ancient mu_ancient n_ancient news_ancient o_ancient out_ancient p_ancient po_ancient pol_ancient qa_ancient qst_ancient r_ancient r9k_ancient s_ancient s4s_ancient sci_ancient soc_ancient sp_ancient t_ancient tg_ancient toy_ancient trash_ancient trv_ancient tv_ancient u_ancient v_ancient vg_ancient vp_ancient vr_ancient w_ancient wg_ancient wsg_ancient wsr_ancient x_ancient y_ancient --rotate</pre>
<pre>sudo indexer 3_main a_main aco_main adv_main an_main asp_main b_main biz_main c_main cgl_main ck_main cm_main co_main d_main diy_main e_main f_main fa_main fit_main g_main gd_main gif_main h_main hc_main hm_main his_main hr_main i_main ic_main int_main jp_main k_main lgbt_main lit_main m_main mlp_main mu_main n_main news_main o_main out_main p_main po_main pol_main qa_main qst_main r_main r9k_main s_main s4s_main sci_main soc_main sp_main t_main tg_main toy_main trash_main trv_main tv_main u_main v_main vg_main vp_main vr_main w_main wg_main wsg_main wsr_main x_main y_main --rotate</pre>
Configure Crontab


delimiter ;
<pre>  */3  * * * * indexer 3_delta a_delta aco_delta adv_delta an_delta asp_delta b_delta biz_delta c_delta cgl_delta ck_delta cm_delta co_delta d_delta diy_delta e_delta f_delta fa_delta fit_delta g_delta gd_delta gif_delta h_delta hc_delta hm_delta his_delta hr_delta i_delta ic_delta int_delta jp_delta k_delta lgbt_delta lit_delta m_delta mlp_delta mu_delta n_delta news_delta o_delta out_delta p_delta po_delta pol_delta qa_delta qst_delta r_delta r9k_delta s_delta s4s_delta sci_delta soc_delta sp_delta t_delta tg_delta toy_delta trash_delta trv_delta tv_delta u_delta v_delta vg_delta vp_delta vr_delta w_delta wg_delta wsg_delta wsr_delta x_delta y_delta --rotate --quiet
</nowiki>|lang=sql}}
  0 */6 * * * indexer 3_main a_main aco_main adv_main an_main asp_main b_main biz_main c_main cgl_main ck_main cm_main co_main d_main diy_main e_main f_main fa_main fit_main g_main gd_main gif_main h_main hc_main hm_main his_main hr_main i_main ic_main int_main jp_main k_main lgbt_main lit_main m_main mlp_main mu_main n_main news_main o_main out_main p_main po_main pol_main qa_main qst_main r_main r9k_main s_main s4s_main sci_main soc_main sp_main t_main tg_main toy_main trash_main trv_main tv_main u_main v_main vg_main vp_main vr_main w_main wg_main wsg_main wsr_main x_main y_main --rotate --quiet</pre>
Please note that all contributions to Bibliotheca Anonoma are considered to be released under the Creative Commons Attribution-ShareAlike (see Bibliotheca Anonoma:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)

Templates used on this page: