Tool:Verification pages

From Wikitech
Jump to navigation Jump to search
Toolforge tools
Crystal Clear app package utilities.png Verification pages
Description Generates verification pages for users to verify statements about politicians for entry into Wikidata.
Keywords verification, wikidata
Author(s) mySociety Democratic Commons Team
Maintainer(s) (View all)
Source code https://github.com/mysociety/verification-pages
License No license specified

Controlling the service

Start

become verification-pages
webservice --backend=kubernetes ruby2 start /data/project/verification-pages/verification-pages/script/toolforge-start

Stop

become verification-pages
webservice --backend=kubernetes ruby2 stop

Update code and restart

Toolforge doesn't currently, at least as far as I understand, offer zero-downtime deploys, so there will be a short time while deploying where the webapp will return a 502 error. This should resolve itself once the Kubernetes pod has started up correctly.

become verification-pages
cd verification-pages
git pull
bundle check || bundle install
bin/rails db:migrate assets:precompile
webservice --backend=kubernetes ruby2 restart

Sometimes when running that last restart command you'll see a Python stacktrace from the webservice tool. This appears to be harmless, but it's prudent to check that the service has correctly by checking the running pods and viewing the logs for the service using the Kubernetes commands below.

Kubernetes commands

Check which pods are running

kubectl get pods

View logs for a pod

First copy the pod name from the output of kubectl get pods and then run:

kubectl logs -f <POD-NAME>

Cron jobs

In order to install the crontab I ran the following commands:

become verification-pages
crontab -e

Then I added the following crontab entry, which refreshes all prompts at 05:00 UTC:

0 5 * * *  /usr/bin/jsub -N cron-tools.verification-pages-1 -once -quiet /data/project/verification-pages/verification-pages/script/toolforge-cron.daily

That runs ./script/toolforge-cron.daily from the verification-pages repo, which currently just runs the script to pull in new statements from suggestions-store.