From eeaff7a9fee770d1070a573b789af502211531d1 Mon Sep 17 00:00:00 2001 From: Dennis Twardowsky Date: Sat, 13 Nov 2021 00:40:48 +0100 Subject: [PATCH] Removed backup, just database and user creation --- README.md | 3 +-- entrypoint.sh | 46 ---------------------------------------------- 2 files changed, 1 insertion(+), 48 deletions(-) diff --git a/README.md b/README.md index fedc4ee..d1aa50e 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ docker run --rm \ -e DB_DATABASE=database_to_create \ -e DB_USER=user_to_create \ -e DB_PASSWORD=user_password \ - bboehmke/db-helper + dtwardow/db-helper ``` In compose file: @@ -51,5 +51,4 @@ Available Configuration Parameters - **DB_DATABASE**: Database to create - **DB_USER**: User to create with access to `DB_DATABASE` - **DB_PASSWORD**: Password of `DB_USER` -- **BACKUP_SCHEDULE**: If set an SQL dump of the database is created automatically all `15min`, `hourly`, `daily`, `weekly` or `monthly` - **PG_EXTENSIONS**: List of postgres extensions (only for postgresql) diff --git a/entrypoint.sh b/entrypoint.sh index ae67e41..c593a9e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -97,27 +97,6 @@ postgresql_init() { fi } -postgresql_auto_backup() { - case ${BACKUP_SCHEDULE} in - 15min|hourly|daily|weekly|monthly) - # create backup dir - mkdir -p /backup - - # create backup script - cat > /etc/periodic/${BACKUP_SCHEDULE}/backup < /backup/${DB_DATABASE}_\${now}.sql.gz -EOF - chmod +x /etc/periodic/${BACKUP_SCHEDULE}/backup - ;; - esac -} - - mysql_clear_init() { result=`mysql -P $DB_PORT -u$DB_ROOT_USER -p$DB_ROOT_PASSWORD -h$DB_HOST -Bse "show databases like '$DB_DATABASE';"` if [ $result ]; then @@ -148,25 +127,6 @@ mysql_init() { mysql -P $DB_PORT -u$DB_ROOT_USER -p$DB_ROOT_PASSWORD -h$DB_HOST -Bse "GRANT ALL PRIVILEGES ON \`$DB_DATABASE\`.* TO '$DB_USER'@'%';" } -mysql_auto_backup() { - case ${BACKUP_SCHEDULE} in - 15min|hourly|daily|weekly|monthly) - # create backup dir - mkdir -p /backup - - # create backup script - cat > /etc/periodic/${BACKUP_SCHEDULE}/backup < /backup/${DB_DATABASE}_\${now}.sql.gz -EOF - chmod +x /etc/periodic/${BACKUP_SCHEDULE}/backup - ;; - esac -} - - case ${1} in app:init|app:clear_init) check_database_connection @@ -182,8 +142,6 @@ case ${1} in postgresql_clear_init ;; esac - - postgresql_auto_backup ;; mysql) @@ -196,12 +154,8 @@ case ${1} in mysql_clear_init ;; esac - - mysql_auto_backup ;; esac - - exec /usr/sbin/crond -f ;; *) exec "$@"