Loading .gitlab-ci.yml +2 −2 Original line number Diff line number Diff line Loading @@ -10,5 +10,5 @@ stages: .docker-build: variables: IMAGE_NAME_VARIABLE_NAME: BACKUP_DB_IMAGE_NAME IMAGE_TAG_VARIABLE_NAME: BACKUP_DB_IMAGE_TAG IMAGE_NAME_VARIABLE_NAME: BACKUP_POSTGRESQL_IMAGE_NAME IMAGE_TAG_VARIABLE_NAME: BACKUP_POSTGRESQL_IMAGE_TAG LICENSE 0 → 100644 +21 −0 Original line number Diff line number Diff line MIT License Copyright (c) 2021 REDMIC Project / Postgres Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. README.md +29 −27 Original line number Diff line number Diff line # Backup DB Backup DB is a docker for create database backup (PostgreSQL) and uploads to AWS S3. Also sends metrics a Prometheus through PushGateWay. # Backup PostgreSQL Backup PostgreSQL is a service for creating PostgreSQL database backups and uploading them to AWS S3 (or S3-compatible service). Also sends metrics to Prometheus through Pushgateway.  # Variables ## Variables | Name | Description | Default | |---------------------------|-----------------------------------|---------------------- | |-----------------------|-------------------------------|-------------------| | POSTGRES_USER | Database username | postgres | | POSTGRES_PASSWORD | Database password | password | | POSTGRES_HOSTNAME | Database hostname | postgresql | Loading @@ -20,9 +21,10 @@ PushGateWay. | PUSHGATEWAY_JOB | PushGateWay job name | POSTGRES_HOSTNAME | | GZIP | Compression ratio | -9 | # Metrics ## Metrics | Name | Description | |-----------------------------------------------------------|-----------------------------------------------------------| |----------------------------------------------------------|----------------------------------------------------------| | backup_db{label="redmic"} | Outcome of the backup database job (0=failed, 1=success) | | backup_duration_seconds{label="redmic",stage="dump"} | Duration of create dump execution in seconds | | backup_duration_seconds{label="redmic",stage="compress"} | Duration of compress dump execution in seconds | Loading backup-db-deployment.ymldeleted 100644 → 0 +0 −111 Original line number Diff line number Diff line include: - project: 'redmic-project/gitlab-ci-templates' ref: master file: '/_deployment.yml' .deploy-backup-db-stage: &deploy-backup-db-stage stage: deploy-backup-db .deploy-backup-db: variables: &deploy-backup-db-variables DEPLOY_DIR_NAME: deploy_backup-db BACKUP_DB_REPOSITORY_URL: https://gitlab.com/redmic-project/postgres/backup-db BACKUP_DB_REPOSITORY_BRANCH: dev BACKUP_DB_DEPLOY_FILES: .env docker-compose.tmpl.yml docker-compose.dev.yml docker-compose.prod.yml .deploy-backup-db-before_script: &deploy-backup-db-before_script before_script: - > mkdir -p ${DEPLOY_DIR_NAME}; cd ${DEPLOY_DIR_NAME}; urlBase="${BACKUP_DB_REPOSITORY_URL}/-/raw/${BACKUP_DB_REPOSITORY_BRANCH}/deploy"; for deployFile in ${BACKUP_DB_DEPLOY_FILES}; do wget -q "$(echo ${urlBase}/${deployFile})"; done; cd -; .deploy-backup-db-development: extends: .deploy-development <<: *deploy-backup-db-stage variables: <<: *deploy-backup-db-variables <<: *deploy-backup-db-before_script environment: name: dev/backup-db .deploy-backup-db-production: extends: .deploy-production <<: *deploy-backup-db-stage variables: <<: *deploy-backup-db-variables <<: *deploy-backup-db-before_script environment: name: pro/backup-db .deploy-backup-db-branch-base: variables: &deploy-backup-db-branch-base-variables DD_IMAGE_NAME: ${CI_REGISTRY_IMAGE}/${CI_COMMIT_REF_SLUG} DD_IMAGE_TAG: ${CI_COMMIT_SHA} .deploy-backup-db-support-branch: &deploy-backup-db-support-branch rules: - if: $CI_MERGE_REQUEST_ID || $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "schedule" || $CI_COMMIT_BRANCH == "master" when: never - if: $CI_COMMIT_BRANCH when: manual allow_failure: true deploy-backup-db-support-branch-development: extends: .deploy-backup-db-development variables: <<: *deploy-backup-db-branch-base-variables <<: *deploy-backup-db-support-branch .deploy-backup-db-stable-branch: &deploy-backup-db-stable-branch rules: - if: $CI_MERGE_REQUEST_ID || $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "schedule" when: never - if: $CI_COMMIT_BRANCH == "master" when: manual allow_failure: true deploy-backup-db-stable-branch-development: extends: .deploy-backup-db-development variables: <<: *deploy-backup-db-branch-base-variables <<: *deploy-backup-db-stable-branch deploy-backup-db-stable-branch-production: extends: .deploy-backup-db-production variables: <<: *deploy-backup-db-branch-base-variables <<: *deploy-backup-db-stable-branch .deploy-backup-db-tag-base: variables: &deploy-backup-db-tag-base-variables DD_IMAGE_NAME: ${CI_REGISTRY_IMAGE} DD_IMAGE_TAG: ${CI_COMMIT_TAG} .deploy-backup-db-tag: &deploy-backup-db-tag rules: - if: $CI_COMMIT_TAG when: manual allow_failure: true deploy-backup-db-tag-development: extends: .deploy-backup-db-development variables: <<: *deploy-backup-db-tag-base-variables <<: *deploy-backup-db-tag deploy-backup-db-tag-production: extends: .deploy-backup-db-production variables: <<: *deploy-backup-db-tag-base-variables <<: *deploy-backup-db-tag deploy/docker-compose.prod.yml +1 −1 Original line number Diff line number Diff line version: '3.5' services: backup-db: backup-postgresql: deploy: placement: constraints: Loading Loading
.gitlab-ci.yml +2 −2 Original line number Diff line number Diff line Loading @@ -10,5 +10,5 @@ stages: .docker-build: variables: IMAGE_NAME_VARIABLE_NAME: BACKUP_DB_IMAGE_NAME IMAGE_TAG_VARIABLE_NAME: BACKUP_DB_IMAGE_TAG IMAGE_NAME_VARIABLE_NAME: BACKUP_POSTGRESQL_IMAGE_NAME IMAGE_TAG_VARIABLE_NAME: BACKUP_POSTGRESQL_IMAGE_TAG
LICENSE 0 → 100644 +21 −0 Original line number Diff line number Diff line MIT License Copyright (c) 2021 REDMIC Project / Postgres Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
README.md +29 −27 Original line number Diff line number Diff line # Backup DB Backup DB is a docker for create database backup (PostgreSQL) and uploads to AWS S3. Also sends metrics a Prometheus through PushGateWay. # Backup PostgreSQL Backup PostgreSQL is a service for creating PostgreSQL database backups and uploading them to AWS S3 (or S3-compatible service). Also sends metrics to Prometheus through Pushgateway.  # Variables ## Variables | Name | Description | Default | |---------------------------|-----------------------------------|---------------------- | |-----------------------|-------------------------------|-------------------| | POSTGRES_USER | Database username | postgres | | POSTGRES_PASSWORD | Database password | password | | POSTGRES_HOSTNAME | Database hostname | postgresql | Loading @@ -20,9 +21,10 @@ PushGateWay. | PUSHGATEWAY_JOB | PushGateWay job name | POSTGRES_HOSTNAME | | GZIP | Compression ratio | -9 | # Metrics ## Metrics | Name | Description | |-----------------------------------------------------------|-----------------------------------------------------------| |----------------------------------------------------------|----------------------------------------------------------| | backup_db{label="redmic"} | Outcome of the backup database job (0=failed, 1=success) | | backup_duration_seconds{label="redmic",stage="dump"} | Duration of create dump execution in seconds | | backup_duration_seconds{label="redmic",stage="compress"} | Duration of compress dump execution in seconds | Loading
backup-db-deployment.ymldeleted 100644 → 0 +0 −111 Original line number Diff line number Diff line include: - project: 'redmic-project/gitlab-ci-templates' ref: master file: '/_deployment.yml' .deploy-backup-db-stage: &deploy-backup-db-stage stage: deploy-backup-db .deploy-backup-db: variables: &deploy-backup-db-variables DEPLOY_DIR_NAME: deploy_backup-db BACKUP_DB_REPOSITORY_URL: https://gitlab.com/redmic-project/postgres/backup-db BACKUP_DB_REPOSITORY_BRANCH: dev BACKUP_DB_DEPLOY_FILES: .env docker-compose.tmpl.yml docker-compose.dev.yml docker-compose.prod.yml .deploy-backup-db-before_script: &deploy-backup-db-before_script before_script: - > mkdir -p ${DEPLOY_DIR_NAME}; cd ${DEPLOY_DIR_NAME}; urlBase="${BACKUP_DB_REPOSITORY_URL}/-/raw/${BACKUP_DB_REPOSITORY_BRANCH}/deploy"; for deployFile in ${BACKUP_DB_DEPLOY_FILES}; do wget -q "$(echo ${urlBase}/${deployFile})"; done; cd -; .deploy-backup-db-development: extends: .deploy-development <<: *deploy-backup-db-stage variables: <<: *deploy-backup-db-variables <<: *deploy-backup-db-before_script environment: name: dev/backup-db .deploy-backup-db-production: extends: .deploy-production <<: *deploy-backup-db-stage variables: <<: *deploy-backup-db-variables <<: *deploy-backup-db-before_script environment: name: pro/backup-db .deploy-backup-db-branch-base: variables: &deploy-backup-db-branch-base-variables DD_IMAGE_NAME: ${CI_REGISTRY_IMAGE}/${CI_COMMIT_REF_SLUG} DD_IMAGE_TAG: ${CI_COMMIT_SHA} .deploy-backup-db-support-branch: &deploy-backup-db-support-branch rules: - if: $CI_MERGE_REQUEST_ID || $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "schedule" || $CI_COMMIT_BRANCH == "master" when: never - if: $CI_COMMIT_BRANCH when: manual allow_failure: true deploy-backup-db-support-branch-development: extends: .deploy-backup-db-development variables: <<: *deploy-backup-db-branch-base-variables <<: *deploy-backup-db-support-branch .deploy-backup-db-stable-branch: &deploy-backup-db-stable-branch rules: - if: $CI_MERGE_REQUEST_ID || $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "schedule" when: never - if: $CI_COMMIT_BRANCH == "master" when: manual allow_failure: true deploy-backup-db-stable-branch-development: extends: .deploy-backup-db-development variables: <<: *deploy-backup-db-branch-base-variables <<: *deploy-backup-db-stable-branch deploy-backup-db-stable-branch-production: extends: .deploy-backup-db-production variables: <<: *deploy-backup-db-branch-base-variables <<: *deploy-backup-db-stable-branch .deploy-backup-db-tag-base: variables: &deploy-backup-db-tag-base-variables DD_IMAGE_NAME: ${CI_REGISTRY_IMAGE} DD_IMAGE_TAG: ${CI_COMMIT_TAG} .deploy-backup-db-tag: &deploy-backup-db-tag rules: - if: $CI_COMMIT_TAG when: manual allow_failure: true deploy-backup-db-tag-development: extends: .deploy-backup-db-development variables: <<: *deploy-backup-db-tag-base-variables <<: *deploy-backup-db-tag deploy-backup-db-tag-production: extends: .deploy-backup-db-production variables: <<: *deploy-backup-db-tag-base-variables <<: *deploy-backup-db-tag
deploy/docker-compose.prod.yml +1 −1 Original line number Diff line number Diff line version: '3.5' services: backup-db: backup-postgresql: deploy: placement: constraints: Loading