Skip to content

Commit

Permalink
Merge pull request #1842 from SEED-platform/update-versions
Browse files Browse the repository at this point in the history
Fix backups, lock kombu
  • Loading branch information
axelstudios committed Mar 8, 2019
2 parents 0469a1d + 4345b0d commit 8dcdf7e
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 12 deletions.
5 changes: 0 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,3 @@
#### How should this be manually tested?
#### What are the relevant tickets?
#### Screenshots (if appropriate)
#### Definition of Done:
- [ ] Is there appropriate test coverage? (e.g. ChefSpec, Mocha/Chai, Python, etc.)
- [ ] Does this PR require a Selenium test? (e.g. Browser-specific bugs or complicated UI bugs)
- [ ] Does this PR require a regression test? All fixes require a regression test.
- [ ] Does this add new dependencies? If so, do pip or npm requirements need to be updated?
2 changes: 1 addition & 1 deletion bin/backup_database.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Nightly backups - crontab
# 0 0 * * * /home/ubuntu/prj/seed/bin/backup_database.sh <db_name> <db_username> <db_password> <media_dir>
# 0 0 * * * /home/ubuntu/prj/seed/bin/backup_database.sh <db_name> <db_username> <db_password> <media_dir> >> /home/ubuntu/seed-backups/cron.log 2>&1

DB_NAME=$1
DB_USERNAME=$2
Expand Down
12 changes: 12 additions & 0 deletions docker-compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ services:
- $HOME/seed-backups:/backups
ports:
- "5432:5432"
logging:
options:
max-size: 50m
deploy:
restart_policy:
condition: on-failure
Expand All @@ -29,6 +32,9 @@ services:
window: 120s
db-redis:
image: 127.0.0.1:5000/redis
logging:
options:
max-size: 50m
deploy:
restart_policy:
condition: on-failure
Expand Down Expand Up @@ -60,6 +66,9 @@ services:
- seed_media:/seed/media
ports:
- "80:80"
logging:
options:
max-size: 50m
deploy:
restart_policy:
condition: on-failure
Expand All @@ -84,6 +93,9 @@ services:
volumes:
- seed_media:/seed/media
command: /seed/docker/start_celery_docker.sh
logging:
options:
max-size: 50m
deploy:
restart_policy:
condition: on-failure
Expand Down
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ services:
- seed_pgdata:/var/lib/postgresql/data
ports:
- "5432:5432"
logging:
options:
max-size: 50m
db-redis:
image: redis:5.0.1
web:
Expand All @@ -40,6 +43,9 @@ services:
- seed_media:/seed/media
ports:
- "80:80"
logging:
options:
max-size: 50m
web-celery:
image: seedplatform/seed:latest
build: .
Expand All @@ -57,13 +63,19 @@ services:
- web
volumes:
- seed_media:/seed/media
logging:
options:
max-size: 50m
oep-city-1:
# This is a placeholder. If needed, follow the instructions to enable: https://cloud.docker.com/u/seedplatform/repository/docker/seedplatform/oep
image: seedplatform/oep:1.1
depends_on:
- web
environment:
- OEP_DISABLED=true
logging:
options:
max-size: 50m
volumes:
seed_pgdata:
external: true
Expand Down
6 changes: 3 additions & 3 deletions docker/backup_database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# system. Also, the location of the backups is hardcoded to ~/seed-backups.

# To create nightly backups, add the following to your crontab
# 0 0 * * * /home/ubuntu/prj/seed/docker/backup_database.sh <db_name> <db_username>
# 0 0 * * * /home/ubuntu/prj/seed/docker/backup_database.sh <db_name> <db_username> >> /home/ubuntu/seed-backups/cron.log 2>&1

DB_NAME=$1
DB_USERNAME=$2
Expand All @@ -25,7 +25,7 @@ if [[ (-z ${DB_NAME}) || (-z ${DB_USERNAME}) ]] ; then
fi

# currently the backup directory is hard coded
BACKUP_DIR=~/seed-backups
BACKUP_DIR=/home/ubuntu/seed-backups
mkdir -p ${BACKUP_DIR}

# db_password is set from the environment variables in docker-compose. The docker stack must
Expand All @@ -37,7 +37,7 @@ docker exec $(docker ps -f "name=db-postgres" --format "{{.ID}}") pg_dump -U ${D
# Backup the media directory (uploads, especially buildingsync). In docker-land this is
# just a container volume, so create a new container with the volume attached and tar it up.
echo "docker run --rm -it -v seed_media:/backup/media -v $BACKUP_DIR:/backup/dir/ alpine:3.8 tar zcvf $(media_file_name) /backup/media"
docker run --rm -it -v seed_media:/backup/media -v $BACKUP_DIR:/backup/dir/ alpine:3.8 tar zcvf $(media_file_name) /backup/media
docker run --rm -v seed_media:/backup/media -v $BACKUP_DIR:/backup/dir/ alpine:3.8 tar zcvf $(media_file_name) /backup/media

# Delete files older than 45 days.
find ${BACKUP_DIR} -mtime +45 -type f -name '*.dump' -delete
Expand Down
1 change: 1 addition & 0 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ modeltranslation==0.25
psycopg2-binary==2.7.5

# background process management
kombu==4.2.2.post1 # 4.4 breaks celery without upgrading py-redis (redis below)
celery==4.2.1
django-redis-cache==1.7.1
django_compressor==2.2
Expand Down
6 changes: 3 additions & 3 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

# general
autopep8==1.4
coverage==4.5.1
coveralls==1.5.1
coverage==4.5.2
coveralls==1.6.0
tox==2.9.1

# python testing
Expand All @@ -16,7 +16,7 @@ coveralls-merge==0.0.3
vcrpy==2.0.1

# static code analysis
flake8==3.5.0
flake8==3.7.7
pycodestyle==2.3.1

# documentation and spelling
Expand Down

0 comments on commit 8dcdf7e

Please sign in to comment.