Skip to content
Snippets Groups Projects
Commit 5ab1b839 authored by Jeremy M Fee's avatar Jeremy M Fee
Browse files

Merge branch 'mageDeploy' into 'master'

Mage deploy

See merge request !10
parents d3bf0d90 585fcf0c
No related branches found
No related tags found
1 merge request!10Mage deploy
Pipeline #19581 passed
...@@ -75,6 +75,40 @@ variables: ...@@ -75,6 +75,40 @@ variables:
variables: variables:
PYTHON_VERSION: 3.8 PYTHON_VERSION: 3.8
.deploy:
cache: {}
extends:
- .adjust_image_names
image: ${CODE_REGISTRY}/ghsc/hazdev/cloud-formation/hazdev-build-runner:latest
script:
- git clone ${GENERIC_SWARM_DEPLOY_REPO} generic-deploy
- cp -v
generic-deploy/default.config.sh
generic-deploy/default.funcs.sh
generic-deploy/deploy.sh
scripts/.
- export APP_NAME=${APP_NAME}
- export IMAGE_NAME=${IMAGE_NAME}
- export REGISTRY=${CI_REGISTRY_IMAGE}
- export STACK_NAME=${APP_NAME}
- ./scripts/deploy.sh
stage: deploy
tags:
- deploy
- swarm
variables:
APP_NAME: geomag-algorithms
.mage:
variables:
DATA_HOST: 'cwbpub.cr.usgs.gov'
DATA_PORT: '2060'
DATA_TYPE: 'edge'
.staging:
only:
- master@ghsc/geomag/geomag-algorithms
- tags@ghsc/geomag/geomag-algorithms
## -------------------------------------------------- ## --------------------------------------------------
# Test Stage # Test Stage
## -------------------------------------------------- ## --------------------------------------------------
...@@ -106,3 +140,15 @@ Build Algorithms Docker Image: ...@@ -106,3 +140,15 @@ Build Algorithms Docker Image:
- .build_docker_image - .build_docker_image
variables: variables:
APP_NAME: geomag-algorithms APP_NAME: geomag-algorithms
## --------------------------------------------------
# Deploy Stage
## --------------------------------------------------
Deploy Mage01:
extends:
- .deploy
- .staging
- .mage
variables:
APP_NAME: geomag-algorithms
export SITE_URL="${SITE_URL_PREFIX}geomag${SITE_URL_SUFFIX}";
export SERVICE_MAP=(
"/${BASE_HREF}":'web'
);
# Algorithms Environment Variables
export DATA_HOST=${DATA_HOST:-cwbpub.cr.usgs.gov}
export DATA_PORT=${DATA_PORT:-2060}
export DATA_TYPE=${DATA_TYPE:-edge}
# This file contains any custom functions / hooks for the geomag-algorithms
# deployment process.
preStackDeployHook () {
writeYmlFile;
}
##
# Write a customized YML file for deploying the stack. Necessary because
# by default, YML files do not allow variables for defining configs.
##
writeYmlFile () {
local ymlFileName="${APP_NAME}.yml";
cat <<-EO_YML > ${ymlFileName}
version: "3.5"
services:
# Do not change the name of the "web" service without also updating the
# custom.funcs.sh and the custom.config.sh as well. Probably just do not
# ever do this...
web:
image: ${REGISTRY}/${IMAGE_NAME}
deploy:
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s
replicas: 3
update_config:
order: start-first
parallelism: 3
ports:
- 8000
environment:
- BASE_HREF=${BASE_HREF}
- DATA_HOST=${DATA_HOST}
- DATA_PORT=${DATA_PORT}
- DATA_TYPE=${DATA_TYPE}
- SITE_URL=${SITE_URL}
- WEBSERVICE=true
EO_YML
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment