Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add local cron-jobs container for testing cron things #10000

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ services:
# postgres data anywhere).
- ./docker/ol-db-init.sh:/docker-entrypoint-initdb.d/ol-db-init.sh

cron-jobs:
build:
context: .
dockerfile: docker/Dockerfile.oldev
environment:
- CRONTAB_FILE=/etc/cron.d/cron.local
volumes:
- ./docker/cron.local:/etc/cron.d/cron.local:ro
# Persistent volume mount for installed git submodules
- ol-vendor:/openlibrary/vendor
- .:/openlibrary

covers:
build:
context: .
Expand Down
6 changes: 0 additions & 6 deletions compose.production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,13 @@ services:
cron-jobs:
profiles: ["ol-home0"]
image: "${OLIMAGE:-openlibrary/olbase:latest}"
hostname: "$HOSTNAME"
user: root
command: docker/ol-cron-start.sh
restart: unless-stopped
env_file:
- ../olsystem/etc/cron-jobs.env
volumes:
- ../olsystem/etc/cron.d/openlibrary.ol_home0:/etc/cron.d/openlibrary.ol_home0:ro
- ../olsystem:/olsystem
- /1/var/tmp:/1/var/tmp
networks:
- webnet
- dbnet

infobase:
profiles: ["ol-home0"]
Expand Down
9 changes: 9 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ services:
networks:
- webnet

cron-jobs:
image: "${OLIMAGE:-oldev:latest}"
hostname: "${HOSTNAME:-$HOST}"
user: root
command: docker/ol-cron-start.sh
networks:
- webnet
- dbnet

covers:
image: "${OLIMAGE:-oldev:latest}"
environment:
Expand Down
6 changes: 6 additions & 0 deletions docker/cron.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Cron files apparently don't get the normal PATH the rest
# of the OS gets, so force set it here otherwise python
# won't be findable.
PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

* * * * * su openlibrary -c "echo hello" > /proc/1/fd/1 2>/proc/1/fd/2
2 changes: 1 addition & 1 deletion docker/ol-cron-start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

crontab /etc/cron.d/openlibrary.ol_home0
crontab "$CRONTAB_FILE"
cron -f -L2
Loading