Skip to content

Commit

Permalink
Merge pull request #1490 from dchiller/i1489-fix-backup-cron
Browse files Browse the repository at this point in the history
Fix cron script issues related to docker version upgrade on new servers
  • Loading branch information
dchiller authored May 30, 2024
2 parents 2752216 + 07db05e commit e0b5a97
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cron/management/manage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
DOCKER_COMPOSE_FILE=$1 # This is the path to the docker-compose file.
COMMAND=$2 # This is the command to execute.

/usr/local/bin/docker-compose -f $DOCKER_COMPOSE_FILE exec -T django python manage.py $COMMAND
/usr/local/bin/docker compose -f $DOCKER_COMPOSE_FILE exec -T django python manage.py $COMMAND
6 changes: 3 additions & 3 deletions cron/postgres/db_backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ BACKUP_FILENAME=$(date "+%Y-%m-%dT%H:%M:%S").sql.gz # This is th

# Create the backup and copy it to the daily backup directory
mkdir -p $BACKUP_DIR/daily $BACKUP_DIR/weekly $BACKUP_DIR/monthly $BACKUP_DIR/yearly
/usr/bin/docker exec cantusdb_postgres_1 /usr/local/bin/postgres_backup.sh $BACKUP_FILENAME
/usr/bin/docker cp cantusdb_postgres_1:/var/lib/postgresql/backups/$BACKUP_FILENAME $BACKUP_DIR/daily
/usr/bin/docker exec cantusdb_postgres_1 rm /var/lib/postgresql/backups/$BACKUP_FILENAME
/usr/bin/docker exec cantusdb-postgres-1 /usr/local/bin/postgres_backup.sh $BACKUP_FILENAME
/usr/bin/docker cp cantusdb-postgres-1:/var/lib/postgresql/backups/$BACKUP_FILENAME $BACKUP_DIR/daily
/usr/bin/docker exec cantusdb-postgres-1 rm /var/lib/postgresql/backups/$BACKUP_FILENAME

# Manage retention of daily backups
FILES_TO_REMOVE=$(ls -td $BACKUP_DIR/daily/* | tail -n +8)
Expand Down
3 changes: 3 additions & 0 deletions docker-compose-dev-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
dockerfile: ./django/Dockerfile
args:
PROJECT_ENVIRONMENT: DEVELOPMENT
container_name: cantusdb-django-1
volumes:
- ./:/code/cantusdb_project
- static_volume:/resources/static
Expand All @@ -31,6 +32,7 @@ services:
ports:
- 80:80
- 443:443
container_name: cantusdb-nginx-1
volumes:
- ./config/nginx/conf.d:/etc/nginx/conf.d
- static_volume:/resources/static
Expand All @@ -45,6 +47,7 @@ services:
build:
context: ./postgres
env_file: ./config/envs/dev_env
container_name: cantusdb-postgres-1
volumes:
- postgres_data:/var/lib/postgresql/data/
ports:
Expand Down
5 changes: 3 additions & 2 deletions docker-compose-development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# When building the project locally, replace the contents of docker-compose.yml with the
# contents of this file.


version: '3'

services:
Expand All @@ -12,6 +11,7 @@ services:
dockerfile: ./django/Dockerfile
args:
PROJECT_ENVIRONMENT: DEVELOPMENT
container_name: cantusdb-django-1
volumes:
- ./django/cantusdb_project:/code/cantusdb_project
- static_volume:/resources/static
Expand All @@ -23,13 +23,13 @@ services:
- postgres
command: [ "python", "manage.py", "runserver", "0:8000" ]


nginx:
build:
context: ./nginx
ports:
- 80:80
- 443:443
container_name: cantusdb-nginx-1
volumes:
- ./config/nginx/conf.d:/etc/nginx/conf.d
- static_volume:/resources/static
Expand All @@ -46,6 +46,7 @@ services:
env_file: ./config/envs/dev_env
ports:
- 5432:5432
container_name: cantusdb-postgres-1
volumes:
- postgres_data:/var/lib/postgresql/data/
restart: always
Expand Down

0 comments on commit e0b5a97

Please sign in to comment.