Name: WikiLovesMonuments
Owner: Wikimedia Deutschland e.V.
Description: Enable easier image uploads on the German Wikipedia for Wiki Loves Monuments competition.
Created: 2015-07-15 16:50:22.0
Updated: 2017-12-06 05:26:34.0
Pushed: 2015-10-20 16:44:36.0
Size: 1552
Language: Python
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This repo is a collection of code enabling easier image uploads on the German Wikipedia for Wiki Loves Monuments competition.
The code consists of two parts:
The tool name is wlm-de-utils
. All following commands must be carried out with the tool account, not your personal Tool Labs account. To switch to the tool account, run the following command after logging in with your personal Tool Labs account:
become wlm-de-utils
Generally, the WikiLovesMonuments
repository is checked out in the tool home directory.
Whenever you want to deploy a new version, just do a git pull
in the repository directory. However, there are some things that must be done afterwards:
Restart the web service:
ervice stop
ervice --release trusty uwsgi-plain start
Restart the commons bot:
ikiLovesMonuments/update-bot
p commonsbot
rt -N commonsbot -l release=trusty -wd /data/project/wlm-de-utils/WikiLovesMonuments/update-bot/ /data/project/wlm-de-utils/WikiLovesMonuments/update-bot/run_commonsbot.sh
The following steps have been taken manually on the Tool Labs server and only need to be done again if the account was somehow deleted/destroyed.
The relevant configuration files are in the directory wlm-de-utils. All the files there must be placed in the home directory of the wlm-de-utils
tool account.
The command
virtualenv ~/env
creates a Python virtual environment where modules can be installed without root permissions and without affecting the rest of the system. Copy the files .bashrc
and .bash_profile
to the tool home directory to ensure that the virtual environment is activated whenever the tool account is used.
To manually activate the environment without logging out, use the command
ce $HOME/env/bin/activate
Follow the install instructions in the README file for the bot.
Create a password file named WikiLovesMonuments/update-bot/secretsfile
. The contents of the file should look like this:
("WLMUploadVorlageBot", "password-of-the-bot")
Replace the password and set the file access to only the user (chmod 600).
Add the following line to the user-config.py:
password_file = "secretsfile"
Make sure that the Python virtual environment (see above) is activated. Then follow the install instructions from README file for the forward script.
Copy the configuration file uwsgi.ini to the home directory.
Create the file settings.py
in the home directory. You can use the template from the wlm-de-utils directory. You must fill the variable
REDIS_CACHE_PREFIX` with a random string, for example one generated with the command
ssl rand -base64 32
Start the web service with the command
ervice --release trusty uwsgi-plain start
You can monitor the file uwsgi.log
in the home directory to check if the web server is running. When a line containing spawned uWSGI worker
shows up, the script is ready. Test with the link
https://tools.wmflabs.org/wlm-de-utils/redirect/Liste_der_Baudenkmäler_in_Abtswind/wlm-de-by?id=D-6-75-111-5&lat=49.77168&lon=10.37051
to check if the redirect works.