FoolFuuka/Install/Ubuntu16: Difference between revisions

From Bibliotheca Anonoma
No edit summary
 
(45 intermediate revisions by 3 users not shown)
Line 4: Line 4:


__NOTOC__
__NOTOC__
== PHP7 Dependencies ==
We actually use PHP 7 now so here are the known dependencies (substitute php7.2 for your favorite point version):
<pre>
apt-get install php7.2-cli php7.2-fpm php7.2-bcmath php7.2-json php7.2-opcache php7.2-readline php7.2-curl php7.2-mysql php7.2-mbstring php7.2-gd php7.2-zip php7.2-xml
apt-get install git nginx percona-server-server-5.7 imagemagick maven openjdk-9-jdk-headless redis-server
apt-get install percona-server-tokudb-5.7
</pre>
php7.2-pdo is also required, but php7.2-mysql should bring it in as a dependency.
== Prepare things ==
== Prepare things ==


Line 12: Line 25:
[https://docs.hhvm.com/hhvm/installation/linux#ubuntu-16.10-yakkety from docs.hhvm.com]
[https://docs.hhvm.com/hhvm/installation/linux#ubuntu-16.10-yakkety from docs.hhvm.com]
<pre>sudo apt-get install software-properties-common
<pre>sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xB4112585D386EB94
sudo add-apt-repository &quot;deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main&quot;</pre>
sudo add-apt-repository &quot;deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main&quot;</pre>


== Add repo for MariaDB 10.1 ==
== Add repo for Percona Server for MySQL 5.7 ==


[https://downloads.mariadb.org/mariadb/repositories/#mirror=accretive from downloads.mariadb.org]
[https://www.percona.com/doc/percona-server/5.7/installation/apt_repo.html from www.percona.com]


<pre>sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
<pre>wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb
sudo add-apt-repository &quot;deb [arch=amd64,i386,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu xenial main&quot;</pre>
dpkg -i percona-release_0.1-4.$(lsb_release -sc)_all.deb</pre>


== Add repo for NGINX Stable ==
== Add repo for NGINX Stable ==
Line 28: Line 41:
<pre>wget https://nginx.org/keys/nginx_signing.key
<pre>wget https://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
sudo apt-key add nginx_signing.key
sudo add-apt-repository &quot;deb http://nginx.org/packages/ubuntu/ xenial nginx&quot;</pre>
sudo add-apt-repository &quot;deb http://nginx.org/packages/ubuntu/ $(lsb_release -sc) nginx&quot;</pre>


== Add repo for sphinxsearch ==
== Add repo for sphinxsearch ==


{{Note|Todo}}
[http://sphinxsearch.com/docs/current/installing-debian.html from sphinxsearch.com]
<pre>sudo add-apt-repository ppa:builds/sphinxsearch-rel22</pre>


== Install all the needed packages. ==
== Install all the needed packages. ==
Line 39: Line 53:


<pre>sudo apt-get update
<pre>sudo apt-get update
sudo apt-get install git nginx hhvm mariadb-server mariadb-client imagemagick maven openjdk-8-jdk-headless</pre>
sudo apt-get install git nginx hhvm percona-server-server-5.7 percona-server-tokudb-5.7 imagemagick maven openjdk-9-jdk-headless redis-server sphinxsearch</pre>


== Install composer for downloading FoolFuuka dependencies. ==
== Install composer for downloading FoolFuuka dependencies. ==
Line 62: Line 76:
upload_max_filesize = 32M
upload_max_filesize = 32M
post_max_size = 32M
post_max_size = 32M
hhvm.mysql.socket = /var/run/mysqld/mysqld.sock
pdo_mysql.default_socket = /var/run/mysqld/mysqld.sock
mysqli.socket = /var/run/mysqld/mysqld.sock
</nowiki>}}
</nowiki>}}


== Enable the hhvm service. ==
== Enable the hhvm service. ==


<pre>sudo systemctl enable hhvm
<pre>sudo systemctl enable hhvm</pre>
sudo systemctl start hhvm</pre>


== Download FoolFuuka and install dependencies. ==
== Download FoolFuuka and install dependencies. ==
Line 105: Line 121:
== Set Permissions and Group for FoolFuuka Directory ==
== Set Permissions and Group for FoolFuuka Directory ==


<pre>sudo chown -Rf www-data:www-data /var/www/foolfuuka</pre>
<pre>sudo mkdir /var/www/foolfuuka/public/foolfuuka/boards/
sudo chown -Rf www-data:www-data /var/www/foolfuuka
sudo chmod 777 /var/www/foolfuuka/public/foolfuuka/boards/</pre>


== Configure Nginx to host foolfuuka ==
== Install hhvm with nginx ==


{{hc|sudo nano /etc/nginx/sites-enabled/default|<nowiki>
Change the user in /etc/nginx/nginx.conf to www-data
        root /home/ubuntu/foolfuuka/public;
        index index.php index.html index.htm;


        client_max_body_size 32M; # set to the same as max PHP upload size in HHVM
{{hc|sudo nano /etc/nginx/hhvm.conf|<nowiki>
        location / {
location ~ \.(hh|php)$ {
                try_files $uri $uri/ /index.php$is_args$args;
    fastcgi_keep_conn on;
        }
    fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include        fastcgi_params;
}
</nowiki>}}


        location ~ \.php$ {
== Configure Nginx to host foolfuuka ==
                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>}}
Create this file
{{hc|sudo nano /etc/nginx/sites-enabled/archive.conf|<nowiki>
server {
listen 80;
listen [::]:80;
#listen 443 ssl;
#listen [::]:443 ssl;
 
#ssl_certificate /etc/nginx/ssl/myarchive.local.crt;
#ssl_certificate_key /etc/nginx/ssl/myarchive.local.key;


== Install hhvm with nginx ==
root /var/www/foolfuuka/public;
index index.php;


<pre>TODO</pre>
server_name myarchive.local;
include hhvm.conf;


== Restart Nginx ==
client_max_body_size 2M;


<pre>sudo service nginx restart</pre>
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
}
</nowiki>}}


== Disable transparent_hugepage ==
== Disable transparent_hugepage ==


<pre>su -c 'echo never > /sys/kernel/mm/transparent_hugepage/enabled'</pre>
Add this to your /etc/rc.local file
<pre>su -c 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' &</pre>


<pre>sudo nano /etc/default/grub</pre>
<pre>sudo nano /etc/default/grub</pre>
Line 154: Line 186:
}}
}}


== edit MariaDB to use utf8mb4 for correct unicode processing ==
== edit Percona to use utf8mb4 for correct unicode processing ==
Enable toku (Find and Uncomment the load module)


{{hc|sudo nano /etc/mysql/my.cnf|<nowiki>
<pre>ps-admin --enable-tokudb -u root -p</pre>
[client]
You may need to run that command again. Check the output to verify.
default-character-set = utf8mb4


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


{{hc|sudo nano /etc/mysql/percona-server.conf.d/mysqld.cnf|<nowiki>
[mysqld]
[mysqld]
character-set-client-handshake = FALSE
character-set-client-handshake = FALSE
Line 168: Line 203:
collation-server = utf8mb4_general_ci
collation-server = utf8mb4_general_ci
open-files-limit=40000
open-files-limit=40000
skip-log-bin
default_storage_engine = TokuDB
max_connections = 1000
[client]
default-character-set = utf8mb4
</nowiki>}}
</nowiki>}}


Enable toku (Find and Uncomment the load module)
<pre>sudo systemctl stop mysql
 
<pre>sudo nano /etc/mysql/conf.d/tokudb.cnf </pre>
 
<pre>sudo service mysql stop
sudo reboot</pre>
sudo reboot</pre>


Line 180: Line 217:


<pre>sudo mysql_secure_installation</pre>
<pre>sudo mysql_secure_installation</pre>
<pre>mysql -uroot -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;
   SET GLOBAL log_bin_trust_function_creators = 1;
   CREATE USER 'asagi'@'localhost' IDENTIFIED BY 'pass';   
   CREATE USER 'asagi'@'localhost' IDENTIFIED BY 'pass';   
   CREATE USER 'foolfuuka'@'localhost' IDENTIFIED BY 'pass';
   CREATE USER 'foolfuuka'@'localhost' IDENTIFIED BY 'pass';
  CREATE USER 'sphinx'@'localhost' IDENTIFIED BY 'pass';
   CREATE DATABASE asagi DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;
   CREATE DATABASE asagi DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;
   CREATE DATABASE foolfuuka DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;
   CREATE DATABASE foolfuuka DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;
Line 190: Line 228:
   GRANT ALL PRIVILEGES ON `asagi`. * TO 'foolfuuka'@'localhost';
   GRANT ALL PRIVILEGES ON `asagi`. * TO 'foolfuuka'@'localhost';
   GRANT ALL PRIVILEGES ON `foolfuuka`. * TO 'foolfuuka'@'localhost';
   GRANT ALL PRIVILEGES ON `foolfuuka`. * TO 'foolfuuka'@'localhost';
  GRANT SELECT ON `asagi`.* TO 'sphinx'@'localhost';
  GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, TRIGGER, SHOW VIEW ON `asagi`.`index_counters` TO 'sphinx'@'localhost' WITH GRANT OPTION;
   FLUSH PRIVILEGES;
   FLUSH PRIVILEGES;
   exit</pre>
   exit</pre>
Line 195: Line 235:
== Install and compile Asagi from source. ==
== Install and compile Asagi from source. ==


<pre>cd ~
<pre>
git clone https://github.com/FoolCode/asagi.git
sudo adduser asagi
sudo su asagi
cd ~
git clone https://github.com/desuarchive/asagi.git
cd asagi
cd asagi
mvn package assembly:single
mvn package assembly:single
mv target/asagi-0.4.0-SNAPSHOT-full.jar ./asagi.jar</pre>
mv target/asagi-0.4.0-SNAPSHOT-full.jar ./asagi.jar</pre>
== Configure Asagi ==
== Configure Asagi ==


<pre>cp asagi.json.example asagi.json
<pre>nano asagi.json</pre>
nano asagi.json</pre>


Insert the following JSON into that file:
Insert the following JSON into that file:
Line 218: Line 261:
       "host": "localhost",
       "host": "localhost",
       "username": "asagi",
       "username": "asagi",
       "password": "afj8a428dauwj",
       "password": "pass",
       "charset": "utf8mb4",
       "charset": "utf8mb4",
       "path": "/home/ubuntu/foolfuuka/public/foolfuuka/boards/",
       "path": "/var/www/foolfuuka/public/foolfuuka/boards/",
       "useOldDirectoryStructure": false,
       "useOldDirectoryStructure": false,
       "webserverGroup": "www-data",
       "webserverGroup": "www-data",
Line 229: Line 272:
       "refreshDelay": 30,
       "refreshDelay": 30,
       "throttleAPI": true,
       "throttleAPI": true,
       "throttleURL": "api.4cdn.org",
       "throttleURL": "a.4cdn.org",
       "throttleMillisec": 11100,
       "throttleMillisec": 11100,


Line 340: Line 383:
Also make sure to install imagemagick and set the path in the config to it.
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.]}}
{{Note|<nowiki>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.</nowiki>}}


== Add boards, Configure Sphinx ==
== Add boards, Configure Sphinx ==
Line 351: Line 394:
<pre>
<pre>
/var/lib/sphinxsearch
/var/lib/sphinxsearch
</pre>
=== Supplement Sphinxsearch ===
<pre>
cd /var/run
sudo mkdir sphinxsearch
sudo chmod -Rf 777 sphinxsearch
</pre>
</pre>


Line 385: Line 420:
=== Build the indexes ===
=== Build the indexes ===


<pre>sudo indexer *_ancient --rotate</pre>
<pre>sudo indexer *_ancient --rotate
<pre>sudo indexer *_main --rotate</pre>
sudo indexer *_main --rotate
sudo indexer *_delta --rotate</pre>


=== Configure Crontab ===
=== Configure Crontab ===
<pre>
<pre>
sudo nano /etc/crontab
sudo crontab -e
</pre>
</pre>
<pre>
<pre>
Line 397: Line 433:
@monthly sudo -u sphinxsearch /usr/bin/indexer --rotate *_ancient > /dev/null
@monthly sudo -u sphinxsearch /usr/bin/indexer --rotate *_ancient > /dev/null
</pre>
</pre>


=== Adding Archives ===
=== Adding Archives ===
Line 405: Line 440:


Then, in the admin panel, simply add the board that corresponds to the board you injected.
Then, in the admin panel, simply add the board that corresponds to the board you injected.
{{Note| This only applies if you are importing a new board. For importing a dump to an existing board table, you will need to use the fuuka-to-asagi tool found in the [https://github.com/FoolCode/asagi-toolkit asagi-toolkit]}}


== Extra configuration ==
== Extra configuration ==
Line 417: Line 454:
</pre>
</pre>
and make sure it is the same value in Admin panel -> general -> Imagemagick Convert
and make sure it is the same value in Admin panel -> general -> Imagemagick Convert
=== Enable Redis Cache ===
{{hc|nano /var/www/foolfuuka/app/foolz/foolframe/config/cache.php|<nowiki>
<?php
return array (
  'type' => 'redis',
  'format' => 'smart_json',
  'prefix' => 'foolframe_TUi_',
  'servers' =>
  array (
  ),
);</nowiki>}}
<!-- Oddities: Create /etc/tmpfiles.d/mysql.conf

Latest revision as of 23:22, 25 August 2019

This guide was written by ATC of desuarchive, and is designed for Debian/Ubuntu Linux servers. This guide is designed for Ubuntu 16.04 LTS servers (xenial).

Work in progress.


PHP7 Dependencies[edit]

We actually use PHP 7 now so here are the known dependencies (substitute php7.2 for your favorite point version):

apt-get install php7.2-cli php7.2-fpm php7.2-bcmath php7.2-json php7.2-opcache php7.2-readline php7.2-curl php7.2-mysql php7.2-mbstring php7.2-gd php7.2-zip php7.2-xml 
apt-get install git nginx percona-server-server-5.7 imagemagick maven openjdk-9-jdk-headless redis-server
apt-get install percona-server-tokudb-5.7

php7.2-pdo is also required, but php7.2-mysql should bring it in as a dependency.

Prepare things[edit]

apt-get update
apt-get upgrade

Add the keys for HipHop Virtual Machine[edit]

from docs.hhvm.com

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xB4112585D386EB94
sudo add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main"

Add repo for Percona Server for MySQL 5.7[edit]

from www.percona.com

wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb
dpkg -i percona-release_0.1-4.$(lsb_release -sc)_all.deb

Add repo for NGINX Stable[edit]

from nginx.org

wget https://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
sudo add-apt-repository "deb http://nginx.org/packages/ubuntu/ $(lsb_release -sc) nginx"

Add repo for sphinxsearch[edit]

from sphinxsearch.com

sudo add-apt-repository ppa:builds/sphinxsearch-rel22

Install all the needed packages.[edit]

Nginx, HHVM, PHP5 Cli, PHP5 Curl, MariaDB, Maven (includes java), Sphinxsearch

sudo apt-get update
sudo apt-get install git nginx hhvm percona-server-server-5.7 percona-server-tokudb-5.7 imagemagick maven openjdk-9-jdk-headless redis-server sphinxsearch

Install composer for downloading FoolFuuka dependencies.[edit]

from getcomposer.org

curl -sS https://getcomposer.org/installer | php

Move composer to bin[edit]

sudo mv composer.phar /usr/local/bin/composer

Edit HHVM config to use a unix socket.[edit]

sudo mkdir /var/run/hhvm/
sudo chown www-data:www-data /var/run/hhvm/
sudo nano /etc/hhvm/server.ini

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

hhvm.server.file_socket=/var/run/hhvm/hhvm.sock

Add required php.ini vars.[edit]

sudo nano /etc/hhvm/php.ini
date.timezone = UTC
upload_max_filesize = 32M
post_max_size = 32M
hhvm.mysql.socket = /var/run/mysqld/mysqld.sock
pdo_mysql.default_socket = /var/run/mysqld/mysqld.sock
mysqli.socket = /var/run/mysqld/mysqld.sock

Enable the hhvm service.[edit]

sudo systemctl enable hhvm

Download FoolFuuka and install dependencies.[edit]

cd /var/www/
git clone https://github.com/pleebe/FoolFuuka.git foolfuuka
cd foolfuuka
composer dump-autoload --optimize
composer install 

Choose 'Y' to 3rd party assets.

Install Foolfuuka Plugins[edit]

You may need to find the repo on their github if their site doesn't work: https://github.com/FoolCode

cd /var/www/foolfuuka/app/foolz/foolframe/plugins
mkdir foolz
cd foolz
git clone https://github.com/pleebe/foolframe-plugin-articles.git
cd /var/www/foolfuuka/app/foolz/foolfuuka/plugins
mkdir foolz
cd foolz
git clone https://github.com/pleebe/foolfuuka-plugin-board-statistics.git
git clone https://github.com/FoolCode/foolfuuka-plugin-dice-roll.git
git clone https://github.com/pleebe/foolfuuka-plugin-intel-share.git
git clone https://github.com/pleebe/foolfuuka-plugin-popup-report.git
git clone https://github.com/FoolCode/foolfuuka-plugin-quests.git
git clone https://github.com/pleebe/foolfuuka-plugin-spam-guard.git
git clone https://github.com/pleebe/foolfuuka-plugin-thread-chunk.git
git clone https://github.com/pleebe/foolfuuka-plugin-adverts.git
git clone https://github.com/pleebe/foolfuuka-plugin-external-links.git
git clone https://github.com/pleebe/foolfuuka-plugin-fortune.git
git clone https://github.com/pleebe/foolfuuka-plugin-cloudflare-cache-purge.git
git clone https://github.com/pleebe/foolfuuka-plugin-table.git

Set Permissions and Group for FoolFuuka Directory[edit]

sudo mkdir /var/www/foolfuuka/public/foolfuuka/boards/
sudo chown -Rf www-data:www-data /var/www/foolfuuka
sudo chmod 777 /var/www/foolfuuka/public/foolfuuka/boards/

Install hhvm with nginx[edit]

Change the user in /etc/nginx/nginx.conf to www-data

sudo nano /etc/nginx/hhvm.conf
location ~ \.(hh|php)$ {
    fastcgi_keep_conn on;
    fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

Configure Nginx to host foolfuuka[edit]

Create this file

sudo nano /etc/nginx/sites-enabled/archive.conf
server {
	listen 80;
	listen [::]:80;
	#listen 443 ssl;
	#listen [::]:443 ssl;

	#ssl_certificate /etc/nginx/ssl/myarchive.local.crt;
	#ssl_certificate_key /etc/nginx/ssl/myarchive.local.key;

	root /var/www/foolfuuka/public;
	index index.php;

	server_name myarchive.local;
	include hhvm.conf;

	client_max_body_size 2M;

	location / {
		try_files $uri $uri/ /index.php$is_args$args;
	}
}

Disable transparent_hugepage[edit]

Add this to your /etc/rc.local file

su -c 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' &
sudo nano /etc/default/grub

append transparent_hugepage=never to GRUB_CMDLINE_LINUX_DEFAULT, then save the file

sudo update-grub

Raise file limit[edit]

sudo nano /etc/security/limits.conf
* soft nofile 63545
* hard nofile 63545
* soft nproc 63545
* hard nproc 63545

edit Percona to use utf8mb4 for correct unicode processing[edit]

Enable toku (Find and Uncomment the load module)

ps-admin --enable-tokudb -u root -p

You may need to run that command again. Check the output to verify.

sudo nano /etc/mysql/conf.d/mysql.cnf
[mysql]
default-character-set = utf8mb4
sudo nano /etc/mysql/percona-server.conf.d/mysqld.cnf
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
open-files-limit=40000
skip-log-bin
default_storage_engine = TokuDB
max_connections = 1000

[client]
default-character-set = utf8mb4
sudo systemctl stop mysql
sudo reboot

Create the database and install Foolfuuka user accounts.[edit]

sudo mysql_secure_installation
mysql -u root -p
  SET GLOBAL default_storage_engine=TokuDB;
  SET GLOBAL log_bin_trust_function_creators = 1;
  CREATE USER 'asagi'@'localhost' IDENTIFIED BY 'pass';  
  CREATE USER 'foolfuuka'@'localhost' IDENTIFIED BY 'pass';
  CREATE USER 'sphinx'@'localhost' IDENTIFIED BY 'pass';
  CREATE DATABASE asagi DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;
  CREATE DATABASE foolfuuka DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;
  GRANT ALL PRIVILEGES ON `asagi`. * TO 'asagi'@'localhost';
  GRANT ALL PRIVILEGES ON `asagi`. * TO 'foolfuuka'@'localhost';
  GRANT ALL PRIVILEGES ON `foolfuuka`. * TO 'foolfuuka'@'localhost';
  GRANT SELECT ON `asagi`.* TO 'sphinx'@'localhost';
  GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, TRIGGER, SHOW VIEW ON `asagi`.`index_counters` TO 'sphinx'@'localhost' WITH GRANT OPTION;
  FLUSH PRIVILEGES;
  exit

Install and compile Asagi from source.[edit]

sudo adduser asagi
sudo su asagi
cd ~
git clone https://github.com/desuarchive/asagi.git
cd asagi
mvn package assembly:single
mv target/asagi-0.4.0-SNAPSHOT-full.jar ./asagi.jar

Configure Asagi[edit]

nano asagi.json

Insert the following JSON into that file:

{"settings": {
  "dumperEngine": "DumperJSON",
  "sourceEngine": "YotsubaJSON",

  "boardSettings": {
    "default": {
      "engine": "Mysql",
      "database": "asagi",
      "host": "localhost",
      "username": "asagi",
      "password": "pass",
      "charset": "utf8mb4",
      "path": "/var/www/foolfuuka/public/foolfuuka/boards/",
      "useOldDirectoryStructure": false,
      "webserverGroup": "www-data",
      "thumbThreads": 3,
      "mediaThreads": 0,
      "newThreadsThreads": 3,
      "deletedThreadsThresholdPage": 8,
      "refreshDelay": 30,
      "throttleAPI": true,
      "throttleURL": "a.4cdn.org",
      "throttleMillisec": 11100,

      "threadRefreshRate": 10,
      "pageSettings": [
        {"delay": 30, "pages": [0, 1]},
        {"delay": 500, "pages": [2, 3, 4, 5, 6, 7, 8]},
        {"delay": 30, "pages": [9, 10]}
      ]
    },

    "3": {},
    "a": {},
    "aco": {},
    "adv": {},
    "an": {},
    "asp": {},
    "b": {},
    "biz": {},
    "c": {},
    "cgl": {},
    "ck": {},
    "cm": {},
    "co": {},
    "d": {},
    "diy": {},
    "e": {},
    "f": {},
    "fa": {},
    "fit": {},
    "g": {},
    "gd": {},
    "gif": {},
    "h": {},
    "hc": {},
    "hm": {},
    "his": {},
    "hr": {},
    "i": {},
    "ic": {},
    "int": {},
    "jp": {},
    "k": {},
    "lgbt": {},
    "lit": {},
    "m": {},
    "mlp": {},
    "mu": {},
    "n": {},
    "news": {},
    "o": {},
    "out": {},
    "p": {},
    "po": {},
    "pol": {},
    "qa": {},
    "qst": {},
    "r": {},
    "r9k": {},
    "s": {},
    "s4s": {},
    "sci": {},
    "soc": {},
    "sp": {},
    "t": {},
    "tg": {},
    "toy": {},
    "trash": {},
    "trv": {},
    "tv": {},
    "u": {},
    "v": {},
    "vg": {},
    "vp": {},
    "vr": {},
    "w": {},
    "wg": {},
    "wsg": {},
    "wsr": {},
    "x": {},
    "y": {}
  }
}}

Start asagi (There is a better way to do this).[edit]

Maybe we should use systemd for it...

UseParallelGC adds Parallelization to the garbage collector, which really helps for Java.

screen java -XX:+UseParallelGC -XX:+UseParallelOldGC -verbose:gc -jar asagi.jar

ATC of Desuarchive prefers these parameters, which have two customizations.

  1. 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 6144m.
    • If you aren't archiving more than 8 boards, this probably won't be an issue that you need to deal with.
  2. 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.
screen java -Xmx6144m -XX:+UseParallelGC -XX:+UseParallelOldGC -verbose:gc -XX:MaxPermSize=512m -jar asagi.jar

Install FoolFuuka[edit]

Now, Install FoolFuuka at the website using foolfuuka credentials Then, Configure asagi as the database and remove the table prefix from 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.

Add boards, Configure Sphinx[edit]

To configure Sphinx Search, take the following links:

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:

/var/lib/sphinxsearch

Start Sphinxsearch[edit]

sudo nano /etc/default/sphinxsearch

Change the following line from

START=no

to

START=yes

Save and run the following command

sudo /etc/init.d/sphinxsearch start


Right-click and copy this config out of Foolfuuka and add your MySQL database information for asagi. Change the following line from

pid_file = /var/lib/sphinxsearch/searchd.pid

to

pid_file = /var/run/sphinxsearch/searchd.pid 

Then, paste this to /etc/sphinxsearch/sphinx.conf

If anything errors, kill any running instance of asagi and restart it

Build the indexes[edit]

sudo indexer *_ancient --rotate
sudo indexer *_main --rotate
sudo indexer *_delta --rotate

Configure Crontab[edit]

sudo crontab -e
@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

Adding Archives[edit]

Inject your sql file into the asagi database (assuming that your sql file is called "dump.sql"):

mysql -u root -p asagi < dump.sql

Then, in the admin panel, simply add the board that corresponds to the board you injected.

Note: This only applies if you are importing a new board. For importing a dump to an existing board table, you will need to use the fuuka-to-asagi tool found in the asagi-toolkit

Extra configuration[edit]

Depending on which distro you use, some configs might need to be changed.

Fixing thumbnail creation[edit]

Foolfuuka might not be able to generate thumbnails for images to be posted. If so, check:

$ whereis convert
convert: /usr/bin/convert /usr/share/man/man1/convert.1.gz

and make sure it is the same value in Admin panel -> general -> Imagemagick Convert


Enable Redis Cache[edit]

nano /var/www/foolfuuka/app/foolz/foolframe/config/cache.php
<?php 
return array (
  'type' => 'redis',
  'format' => 'smart_json',
  'prefix' => 'foolframe_TUi_',
  'servers' => 
  array (
  ),
);