|Description||Generates verification pages for users to verify statements about politicians for entry into Wikidata.|
|Author(s)||mySociety Democratic Commons Team|
|License||No license specified|
Controlling the service
become verification-pages webservice --backend=kubernetes ruby2 start /data/project/verification-pages/verification-pages/script/toolforge-start
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
bundle install can error due to https://github.com/bundler/bundler/issues/4367. running
bundle install --jobs 1 should eventually work.
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.
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>
Errors starting the webservice
Be sure to use the full start command otherwise you might see an error similar to:
Traceback (most recent call last): File "/usr/bin/webservice-runner", line 30, in <module> webservice.run(port) File "/usr/lib/python2.7/dist-packages/toollabs/webservice/services/genericwebservice.py", line 18, in run os.execv('/bin/sh', ['/bin/sh', '-c', self.extra_args]) TypeError: execv() arg 2 must contain only strings
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
./script/toolforge-cron.daily from the verification-pages repo, which currently just runs the script to pull in new statements from suggestions-store.