Nova Resource:Wikisource/IA Upload
This page documents how to set up a VPS for the IA Upload tool in the Wikisource project.
Web server
Install and configure Apache, PHP, ImageMagick, and DjVuLibre.
sudo apt install php php-common php-cli php-fpm php-json php-xml php-intl php-curl php-zip apache2 libapache2-mod-php composer imagemagick djvulibre-bin
Create the web server configuration file at /etc/apache2/sites-available/ia-upload.conf
with the following:
<VirtualHost *:80>
ServerName ia-upload.wmcloud.org
DocumentRoot /var/www/tool/public
<Directory /var/www/tool/public/>
Options Indexes FollowSymLinks
AllowOverride All
RewriteEngine On
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</Directory>
</VirtualHost>
Enable some Apache modules, and the web server configuration (and disable the default site, which isn't used):
sudo a2enmod rewrite
sudo a2ensite ia-upload
sudo a2dissite 000-default
sudo apache2ctl graceful
ImageMagick
Set /etc/ImageMagick-6/policy.xml
to have the following values (or larger):[1]
<policymap>
<policy domain="resource" name="memory" value="2GiB" />
<policy domain="resource" name="map" value="2GiB" />
<policy domain="resource" name="area" value="256MB" />
</policymap>
Tool
Clone the repository, first removing the html/
directory created by Apache.
cd /var/www
sudo rm -rf html
sudo git clone https://github.com/wikisource/ia-upload.git tool
sudo chown -R www-data:www-data tool
Install dependencies with Composer (this also will create the config.ini
file):
cd tool
sudo -- sudo -u www-data composer install --no-dev -o
Create a OAuth 1.0a consumer on Meta Wiki, and add its key and secret to config.ini
. Also add its ID, to be used for the recent changes link.
Crontab
Set up crontab for user `www-data`:
MAILTO=tools.ia-upload@tools.wmflabs.org
*/12 * * * * /var/www/tool/bin/ia-upload jobs > /dev/null
@daily /var/www/tool/bin/ia-upload prune
Data volume
The job queue is stored on a volume, mounted at /ia-upload
and symlinked to the tool's directory:
$ sudo ln -s /ia-upload/jobqueue /var/www/tool/jobqueue
See also
- Tool:IA Upload, the former home as a Toolforge tool.
References
- ↑ See also Phabricator:T335332