Skip to content
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
5 changes: 2 additions & 3 deletions backup_manager/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ RUN apt-get update && apt-get -y install cron openssh-server less rsync nano

# Create a user named `backupreader` for reading database backups
RUN useradd --create-home --shell /bin/bash backupreader
USER backupreader
RUN mkdir -p /home/backupreader/backups
RUN mkdir -p /home/backupreader/backups && chown backupreader /home/backupreader/backups
VOLUME /home/backupreader/backups
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this make backups be stored inside a docker volume?

I think there's a strong case to be made to keep backups outside of the docker ecosystem - as simple files which can be manipulated directly. Also deploy_tool has logic in it for blowing-away volumes, and it's feels to easily to accidentally delete all our backups when tidying up "unused" docker resources.


# Set up periodic backup
USER root
COPY backup_manager/backup.cron /etc/cron.d/database-backup
RUN chmod 0644 /etc/cron.d/database-backup && \
crontab /etc/cron.d/database-backup && \
Expand Down
2 changes: 1 addition & 1 deletion backup_manager/scripts/backup_mysql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ chmod 644 ${BACKUP}

ls -lah ${BACKUP}

touch $BASE_PATH/last_success
touch "$BASE_PATH/last_success_${USER}"

echo "==============="
2 changes: 2 additions & 0 deletions backup_manager/scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

echo ">>> RopeWiki setup beginning..."

chown backupreader /home/backupreader/backups

if [ -z "${RW_ROOT_DB_PASSWORD}" ]; then
echo "Disabling backups because RW_ROOT_DB_PASSWORD wasn't set"
touch /do_not_backup_db
Expand Down
4 changes: 2 additions & 2 deletions deploy_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ def create_db(site_config: SiteConfig, options: List[str]):
if site_config.db_volume in volumes:
run_cmd('docker volume rm {db_volume}'.format(db_volume=site_config.db_volume))

# Bring the database and backup manager up
run_docker_compose(f'up -d {site_config.db_service} {site_config.backup_manager_service}', site_config)
# Bring the database up
run_docker_compose(f'up -d {site_config.db_service}', site_config)

# Wait for container to come up
log('>> Waiting for MySQL database to initialize...')
Expand Down