Better launch, cleaner shutdown (wip)

This commit is contained in:
Remy Moll
2022-08-11 13:42:45 +02:00
parent bc5eaba519
commit 9ca4985853
14 changed files with 147 additions and 37 deletions

View File

@@ -36,25 +36,32 @@ Upload mode is much simpler, it goes over the exisiting database and operates on
* For normal `production` mode run:
`docker compose --env-file env/production up`
`docker compose --env-file env/production run news_fetch`
* For `debug` mode, you will likely want interactivity, so you need to run:
* For `debug` mode run:
`docker compose --env-file env/debug up -d && docker compose --env-file env/debug exec news_fetch bash && docker compose --env-file env/debug down`
which should automatically shutdown the containers once you are done. (`ctrl+d` to exit the container shell). If not, re-run `docker compose --env-file env/debug down` manually.
`docker compose --env-file env/debug run news_fetch`
which drops you into an interactive shell (`ctrl+d` to exit the container shell).
> Note:
> The live-mounted code is now under `/code`. Note that the `DEBUG=true` environment variable is still set. If you want to test things on production, run `export DEBUG=false`. Running `python runner.py` will now run the newly written code but, with the production database and storage.
* For `check` mode, some env-variables are also changed and you still require interactivity. You don't need the geckodriver service however. The simplest way is to run
`docker compose --env-file env/check run news_fetch`
`docker compose --env-file env/check run --no-deps --rm news_fetch`
* Finally, for `upload` mode no interactivity is required and no additional services are required. Simply run:
`docker compose --env-file env/upload run news_fetch`
`docker compose --env-file env/upload run --no-deps --rm news_fetch`
### Stopping
Run
`docker compose --env-file env/production down`
which terminates all containers associated with the `docker-compose.yaml`.
## Building
@@ -70,3 +77,9 @@ In docker compose, run
## Roadmap:
[_] handle paywalled sites like faz, spiegel, ... through their dedicated sites (see nexisuni.com for instance), available through the ETH network
## Manual Sync to NAS:
I use `rsync`. Mounting the NAS locally, I navigate to the location of the local folder (notice the trailing slash). Then run
`rsync -Razq --no-perms --no-owner --no-group --temp-dir=/tmp --progress --log-file=rsync.log <local folder>/ "<remote>"`
where `<remote>` is the location where the NAS is mounted. (options:`R` - relative paths , `a` - archive mode (multiple actions), `z` - ??, `q` - quiet. We also don't copy most of the metadata and we keep a log of the transfers.)