Skip to content

uyscuti-wiki/TWLight

 
 

Repository files navigation

README.md

The Wikipedia Library Card Platform app, available at http://wikipedialibrary.wmflabs.org.

Quick Installation for Developers

  • Get Docker and Docker Compose
  • Fire up an empty TWLight instance docker-compose build && docker-compose up
  • Run migrations docker-compose exec twlight /app/bin/virtualenv_migrate.sh
  • See the thing running on localhost
  • Get an interactive shell docker-compose exec twlight bash

Further guidance for developers, including a guide to setting the project up with PyCharm, can be found at docs/developer.md.

Quick setup notes for Debian Servers

The staging environment is used in the following examples.

  • Configure the upstream Docker Repository and install the latest version of Docker CE
  • Install Docker Compose
  • Add yourself (or your shared system user) to the docker group sudo usermod -a -G docker ${USER} then logout and log back in.
  • Clone this repository git clone https://github.com/WikipediaLibrary/TWLight.git (ideally into a shared directory like /srv) and checkout appropriate branch
  • docker swarm init
  • Create secrets, but with real values:
printf "This is a secret" | docker secret create DJANGO_DB_NAME -
printf "This is a secret" | docker secret create DJANGO_DB_USER -
printf "This is a secret" | docker secret create DJANGO_DB_PASSWORD -
printf "This is a secret" | docker secret create MYSQL_ROOT_PASSWORD -
printf "This is a secret" | docker secret create SECRET_KEY -
printf "This is a secret" | docker secret create TWLIGHT_OAUTH_CONSUMER_KEY -
printf "This is a secret" | docker secret create TWLIGHT_OAUTH_CONSUMER_SECRET -
printf "This is a secret" | docker secret create TWLIGHT_EZPROXY_SECRET -
  • deploy for your environment docker stack deploy -c docker-compose.yml -c docker-compose.staging.yml twlight_staging
    • Repeat this step if you add secrets after deployment or update your docker-compose files.
  • Restore state from a backup docker exec -t $(docker ps -q -f name=twlight_staging_twlight) /app/bin/virtualenv_restore.sh /app/backup/dd.hh.tar.gz
  • Get an interactive shell docker exec -it $(docker ps -q -f name=twlight_staging_twlight) bash
  • Enable cron tasks for Django tasks and for applying updated Docker images:
> crontab -e
# Run django_cron tasks.
*/5 * * * *  docker exec -t $(docker ps -q -f name=twlight_staging_twlight) /app/bin/twlight_docker_entrypoint.sh python manage.py runcrons
# Update the running TWLight service if there is a new image. The initial pull is just to verify that the image is valid. Otherwise an inaccessible image could break the service.
*/5 * * * *  docker pull wikipedialibrary/twlight:branch_staging >/dev/null && docker service update --image wikipedialibrary/twlight:branch_staging twlight_staging_twlight

Build Status

Dependabot Status

Coverage Status - master branch

About

Library Card Platform for The Wikipedia Library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 64.5%
  • HTML 17.2%
  • JavaScript 12.2%
  • CSS 3.1%
  • Shell 2.9%
  • Dockerfile 0.1%