diff --git a/.gitattributes b/.gitattributes index 202d6a44..d9664728 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,4 +5,5 @@ manage text eol=lf *.sh text eol=lf *.md text eol=lf -*.json text eol=lf \ No newline at end of file +*.json text eol=lf +*.conf text eol=lf \ No newline at end of file diff --git a/jenkins/deploy-to-prod-Jenkinsfile b/jenkins/deploy-to-prod-Jenkinsfile index f4d6be3e..74e74d98 100644 --- a/jenkins/deploy-to-prod-Jenkinsfile +++ b/jenkins/deploy-to-prod-Jenkinsfile @@ -2,7 +2,7 @@ // In other words all of the images that are currently deployed in TEST will be tagged for deployment to PROD. // Define these in the order they should be deployed. -def APP_NAMES = ['postgresql', 'nginx-proxy', 'weasyprint', 'edivorce-django'] +def APP_NAMES = ['postgresql', 'nginx-proxy', 'weasyprint', 'edivorce-django', 'backup'] def SOURCE_TAG = 'test' def DESTINATION_TAG = 'prod' diff --git a/jenkins/deploy-to-test-Jenkinsfile b/jenkins/deploy-to-test-Jenkinsfile index d22cf702..cfb698c4 100644 --- a/jenkins/deploy-to-test-Jenkinsfile +++ b/jenkins/deploy-to-test-Jenkinsfile @@ -2,7 +2,7 @@ // In other words all of the images that are currently deployed in DEV will be tagged for deployment to TEST. // Define these in the order they should be deployed. -def APP_NAMES = ['postgresql', 'nginx-proxy', 'weasyprint', 'edivorce-django'] +def APP_NAMES = ['postgresql', 'nginx-proxy', 'weasyprint', 'edivorce-django', 'backup'] def SOURCE_TAG = 'dev' def DESTINATION_TAG = 'test' diff --git a/openshift/backup-build.param b/openshift/backup-build.param new file mode 100644 index 00000000..7e16a23a --- /dev/null +++ b/openshift/backup-build.param @@ -0,0 +1,14 @@ +#========================================================= +# OpenShift template parameters for: +# Component: . +# Template File: templates/backup/backup-build.json +#========================================================= +NAME=backup +GIT_REPO_URL=https://github.com/BCDevOps/backup-container.git +GIT_REF=master +SOURCE_CONTEXT_DIR=/docker +SOURCE_IMAGE_KIND=DockerImage +SOURCE_IMAGE_NAME=registry.access.redhat.com/rhscl/postgresql-10-rhel7 +SOURCE_IMAGE_TAG=latest +DOCKER_FILE_PATH=Dockerfile +OUTPUT_IMAGE_TAG=latest diff --git a/openshift/backup-deploy.dev.param b/openshift/backup-deploy.dev.param new file mode 100644 index 00000000..f684e99c --- /dev/null +++ b/openshift/backup-deploy.dev.param @@ -0,0 +1,27 @@ +#========================================================= +# OpenShift template parameters for: +# Component: . +# Template File: templates/backup/backup-deploy.json +#========================================================= +# NAME=backup +# SOURCE_IMAGE_NAME=backup +# IMAGE_NAMESPACE=jag-csb-edivorce-tools +TAG_NAME=dev +# POSTGRESQL_HOST_NAME=postgresql +# BACKUP_STRATEGY=rolling +# BACKUP_DIR=/backups/ +# NUM_BACKUPS= +# DAILY_BACKUPS= +# WEEKLY_BACKUPS= +# MONTHLY_BACKUPS= +# BACKUP_PERIOD=1d +# CONFIG_FILE_NAME=backup.conf +# CONFIG_MAP_NAME=backup-conf +# CONFIG_MOUNT_PATH=/ +# PERSISTENT_VOLUME_NAME=backup-pvc +# PERSISTENT_VOLUME_SIZE=20Gi +# PERSISTENT_VOLUME_CLASS=gluster-file +# CPU_REQUEST=0 +# CPU_LIMIT=0 +# MEMORY_REQUEST=0Mi +# MEMORY_LIMIT=0Mi diff --git a/openshift/backup-deploy.overrides.sh b/openshift/backup-deploy.overrides.sh new file mode 100644 index 00000000..5e24a862 --- /dev/null +++ b/openshift/backup-deploy.overrides.sh @@ -0,0 +1,29 @@ +# ======================================================================== +# Special Deployment Parameters needed for the backup instance. +# ------------------------------------------------------------------------ +# The generated config map is used to update the Backup configuration. +# ======================================================================== + +CONFIG_MAP_NAME=backup-conf +SOURCE_FILE=./config/backup.conf +OUTPUT_FORMAT=json +OUTPUT_FILE=backup-conf-configmap_DeploymentConfig.json + +generateConfigMap() { + _config_map_name=${1} + _source_file=${2} + _output_format=${3} + _output_file=${4} + if [ -z "${_config_map_name}" ] || [ -z "${_source_file}" ] || [ -z "${_output_format}" ] || [ -z "${_output_file}" ]; then + echo -e \\n"generateConfigMap; Missing parameter!"\\n + exit 1 + fi + + oc create configmap ${_config_map_name} --from-file ${_source_file} --dry-run -o ${_output_format} > ${_output_file} +} + +generateConfigMap "${CONFIG_MAP_NAME}" "${SOURCE_FILE}" "${OUTPUT_FORMAT}" "${OUTPUT_FILE}" + +SPECIALDEPLOYPARMS="" +echo ${SPECIALDEPLOYPARMS} + diff --git a/openshift/backup-deploy.param b/openshift/backup-deploy.param new file mode 100644 index 00000000..7462b3fb --- /dev/null +++ b/openshift/backup-deploy.param @@ -0,0 +1,27 @@ +#========================================================= +# OpenShift template parameters for: +# Component: . +# Template File: templates/backup/backup-deploy.json +#========================================================= +NAME=backup +SOURCE_IMAGE_NAME=backup +IMAGE_NAMESPACE=jag-csb-edivorce-tools +TAG_NAME=dev +POSTGRESQL_HOST_NAME=postgresql +BACKUP_STRATEGY=rolling +BACKUP_DIR=/backups/ +NUM_BACKUPS= +DAILY_BACKUPS= +WEEKLY_BACKUPS= +MONTHLY_BACKUPS= +BACKUP_PERIOD=1d +CONFIG_FILE_NAME=backup.conf +CONFIG_MAP_NAME=backup-conf +CONFIG_MOUNT_PATH=/ +PERSISTENT_VOLUME_NAME=backup-pvc +PERSISTENT_VOLUME_SIZE=20Gi +PERSISTENT_VOLUME_CLASS=gluster-file +CPU_REQUEST=0 +CPU_LIMIT=0 +MEMORY_REQUEST=0Mi +MEMORY_LIMIT=0Mi diff --git a/openshift/backup-deploy.prod.param b/openshift/backup-deploy.prod.param new file mode 100644 index 00000000..38a66706 --- /dev/null +++ b/openshift/backup-deploy.prod.param @@ -0,0 +1,27 @@ +#========================================================= +# OpenShift template parameters for: +# Component: . +# Template File: templates/backup/backup-deploy.json +#========================================================= +# NAME=backup +# SOURCE_IMAGE_NAME=backup +# IMAGE_NAMESPACE=jag-csb-edivorce-tools +TAG_NAME=prod +# POSTGRESQL_HOST_NAME=postgresql +# BACKUP_STRATEGY=rolling +# BACKUP_DIR=/backups/ +# NUM_BACKUPS= +# DAILY_BACKUPS= +# WEEKLY_BACKUPS= +# MONTHLY_BACKUPS= +# BACKUP_PERIOD=1d +# CONFIG_FILE_NAME=backup.conf +# CONFIG_MAP_NAME=backup-conf +# CONFIG_MOUNT_PATH=/ +# PERSISTENT_VOLUME_NAME=backup-pvc +# PERSISTENT_VOLUME_SIZE=20Gi +# PERSISTENT_VOLUME_CLASS=gluster-file +# CPU_REQUEST=0 +# CPU_LIMIT=0 +# MEMORY_REQUEST=0Mi +# MEMORY_LIMIT=0Mi diff --git a/openshift/backup-deploy.test.param b/openshift/backup-deploy.test.param new file mode 100644 index 00000000..b2a38315 --- /dev/null +++ b/openshift/backup-deploy.test.param @@ -0,0 +1,27 @@ +#========================================================= +# OpenShift template parameters for: +# Component: . +# Template File: templates/backup/backup-deploy.json +#========================================================= +# NAME=backup +# SOURCE_IMAGE_NAME=backup +# IMAGE_NAMESPACE=jag-csb-edivorce-tools +TAG_NAME=test +# POSTGRESQL_HOST_NAME=postgresql +# BACKUP_STRATEGY=rolling +# BACKUP_DIR=/backups/ +# NUM_BACKUPS= +# DAILY_BACKUPS= +# WEEKLY_BACKUPS= +# MONTHLY_BACKUPS= +# BACKUP_PERIOD=1d +# CONFIG_FILE_NAME=backup.conf +# CONFIG_MAP_NAME=backup-conf +# CONFIG_MOUNT_PATH=/ +# PERSISTENT_VOLUME_NAME=backup-pvc +# PERSISTENT_VOLUME_SIZE=20Gi +# PERSISTENT_VOLUME_CLASS=gluster-file +# CPU_REQUEST=0 +# CPU_LIMIT=0 +# MEMORY_REQUEST=0Mi +# MEMORY_LIMIT=0Mi diff --git a/openshift/config/backup.conf b/openshift/config/backup.conf new file mode 100644 index 00000000..f794c9a4 --- /dev/null +++ b/openshift/config/backup.conf @@ -0,0 +1,13 @@ +# ========================================================= +# List the databases you want backed up here. +# Databases will be backed up in the order they are listed. +# +# The entries must be in one of the following forms: +# - / +# - :/ +# +# Examples: +# - postgresql/my_database +# - postgresql:5432/my_database +# -------------------------------------------------------- +postgresql:5432/default \ No newline at end of file diff --git a/openshift/settings.sh b/openshift/settings.sh index 27a027a4..2ead84d6 100644 --- a/openshift/settings.sh +++ b/openshift/settings.sh @@ -9,11 +9,7 @@ export components="." # The templates that should not have their GIT referances(uri and ref) over-ridden # Templates NOT in this list will have they GIT referances over-ridden # with the values of GIT_URI and GIT_REF -export -a skip_git_overrides="schema-spy-build.json s2i-nginx-build.json" - -# The templates that should not have their GIT referances(uri and ref) over-ridden -# Templates NOT in this list will have they GIT referances over-ridden with the values of GIT_URI and GIT_REF -export skip_git_overrides="" +export -a skip_git_overrides="schema-spy-build.json s2i-nginx-build.json backup-build.json" # The builds to be triggered after buildconfigs created (not auto-triggered) export builds=""