Update README with notes on crontab setup for servers.
@@ -11,11 +11,12 @@ The Wikipedia Library Card Platform app, available at http://wikipedialibrary.wm
- Get an interactive shell `docker-compose exec twlight bash`
## Quick setup notes for Debian Servers
+The staging environment is used in the following examples.
- Configure the upstream [Docker Repository](https://docs.docker.com/install/linux/docker-ce/debian/#install-using-the-repository) and install the latest version of Docker CE
- Install [Docker Compose](https://docs.docker.com/compose/install)
-- Add yourself 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` and checkout appropriate branch
+- 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:
```
@@ -27,9 +28,17 @@ 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 -
```
-- deploy for your environment, here's staging `docker stack deploy -c docker-compose.yml -c docker-compose.staging.yml twlight_staging`
+- deploy for your environment `docker stack deploy -c docker-compose.yml -c docker-compose.staging.yml twlight_staging`
- 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.
+*/5 * * * * docker service update --image wikipedialibrary/twlight:branch_staging twlight_staging_twlight
+```
See [twlight_puppet](https://github.com/WikipediaLibrary/twlight_puppet) if you want to set things up on WMF servers, and [twlight_vagrant](https://github.com/WikipediaLibrary/twlight_vagrant) if you want to change things.
