Skip to content

Commit

Permalink
Adjust Docker image so that cronjobs are loaded from /config/cron
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandesu committed Feb 13, 2024
1 parent c264aef commit 882ff25
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ services:
- mongo
volumes:
- ./data/config:/config
# To run dumps on a schedule, you can define cronjobs with this file
# - ./data/cron:/etc/cron.d/cron
- ./data/dumps:/usr/src/app/bartoc/data/dumps
- ./data/reports:/usr/src/app/bartoc/data/reports
environment:
Expand Down Expand Up @@ -104,7 +102,7 @@ For more info about how to use these commands, please refer to [this section](ht
**Note:** If local files are imported, these have to be mounted into the container first, and the path inside the container has to be given. For example, you could mount the host folder `./data/imports` to `/imports` inside the container and then use the path `/imports/myfile.ndjson` with the import command.

### Scheduled Dumps
Cron is configured inside the container to allow scheduled dumps. You can provide a cronfile by mounting it into `/etc/cron.d/cron`. Example cronfile:
Cron is configured inside the container to allow scheduled dumps. You can provide a cronfile by mounting it into `/config/cron`. Example cronfile:

```cron
00 04 * * * cd /usr/src/app/bartoc && npm run dump update > /proc/1/fd/1 2>/proc/1/fd/2
Expand Down
2 changes: 0 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ services:
- mongo
volumes:
- ./data/config:/config
# To run dumps on a schedule, you can define cronjobs with this file
# - ./data/cron:/etc/cron.d/cron
- ./data/dumps:/usr/src/app/bartoc/data/dumps
- ./data/reports:/usr/src/app/bartoc/data/reports
environment:
Expand Down
4 changes: 2 additions & 2 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

if [ -f /etc/cron.d/cron ]; then
if [ -f /config/cron ]; then
echo "Found cron file, initializing crontab"
crontab /etc/cron.d/cron
crontab /config/cron
crond start
fi

Expand Down

0 comments on commit 882ff25

Please sign in to comment.