Commit 2f4814cb authored by Matija Obreza's avatar Matija Obreza

Merge branch '175-genesys-ci' into 'master'

Resolve "Genesys CI"

Closes #175

See merge request !86
parents 73299961 80d220cf
......@@ -4,22 +4,22 @@ variables:
DOCKER_VERSION: latest
stages:
- compile
# - compile
- package
- dockerize
- deploy
compile and test:
stage: compile
image: dockerhub.croptrust.org/docker/custom/maven-with-compass:latest
except:
- master
- production
- tags
script:
- echo "CI_COMMIT_REF_SLUG ${CI_COMMIT_REF_SLUG}"
- echo "CI_ENVIRONMENT_SLUG ${CI_ENVIRONMENT_SLUG}"
- MAVEN_OPTS="${MAVEN_OPTS} -Dorg.slf4j.simpleLogger.defaultLogLevel=warn" mvn compile test -B -U
# compile and test:
# stage: compile
# image: dockerhub.croptrust.org/docker/custom/maven-with-compass:latest
# except:
# - master
# - production
# - tags
# script:
# - echo "CI_COMMIT_REF_SLUG ${CI_COMMIT_REF_SLUG}"
# - echo "CI_ENVIRONMENT_SLUG ${CI_ENVIRONMENT_SLUG}"
# - MAVEN_OPTS="${MAVEN_OPTS} -Dorg.slf4j.simpleLogger.defaultLogLevel=warn" mvn compile test -B -U
.package_template: &maven_package
image: dockerhub.croptrust.org/docker/custom/maven-with-compass:latest
......@@ -42,7 +42,7 @@ package genesys:
package genesys branch:
<<: *maven_package
stage: package
when: manual
# when: manual
allow_failure: false
except:
- master
......@@ -53,10 +53,9 @@ package genesys branch:
.docker_image_template: &docker_image
image: docker:${DOCKER_VERSION}
before_script:
# Configuration
- echo Building docker image ${CI_REGISTRY_IMAGE} on ${DOCKER_HOST}
- echo Registry ${CI_REGISTRY} user=${CI_REGISTRY_USER} ${CI_REGISTRY_PASSWORD}
script:
# Configuration
- TLS_PATH=~/.docker/${DOCKER_HOST}/certs && mkdir -p ${TLS_PATH}
- echo "${DOCKER_TLS_CA}" > ${TLS_PATH}/ca.pem
- echo "${DOCKER_TLS_KEY}" > ${TLS_PATH}/key.pem
......@@ -64,8 +63,7 @@ package genesys branch:
- export DOCKER_TLS_VERIFY=1
- export DOCKER_CERT_PATH=${TLS_PATH}
- DOCKER_CMD="docker --tlsverify=false"
# - ls -la ${DOCKER_CERT_PATH}
# - set | grep DOCKER
script:
# Actions
- cp target/*.war docker
- cd docker
......@@ -112,8 +110,8 @@ deploy for review:
# when: manual
allow_failure: false
environment:
name: review/$CI_COMMIT_REF_SLUG
url: https://${CI_COMMIT_REF_SLUG}.review.genesys-pgr.org
name: genesys/${CI_COMMIT_REF_SLUG}
url: https://${CI_ENVIRONMENT_SLUG}.review.genesys-pgr.org
on_stop: remove review instance
script:
# Address the swarm
......@@ -133,11 +131,11 @@ deploy for review:
else
export IMAGE_TAG="${GENESYS_VERSION}-${CI_COMMIT_REF_SLUG}";
fi
- echo Deploying ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} for review as https\://${CI_COMMIT_REF_SLUG}.review.genesys\-pgr.org
- echo Deploying ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} for review as https\://${CI_ENVIRONMENT_SLUG}.review.genesys\-pgr.org
- envsubst < docker/review-compose-template.yml > review-composed.yml
- cat review-composed.yml
- ${DOCKER_CMD} stack rm genesys-${CI_COMMIT_REF_SLUG}-review || true
- ${DOCKER_CMD} stack deploy -c review-composed.yml genesys-${CI_COMMIT_REF_SLUG}-review
- ${DOCKER_CMD} stack rm ${CI_ENVIRONMENT_SLUG} || true
- ${DOCKER_CMD} stack deploy -c review-composed.yml ${CI_ENVIRONMENT_SLUG}
remove review instance:
stage: deploy
......@@ -149,10 +147,10 @@ remove review instance:
variables:
GIT_STRATEGY: none
environment:
name: review/$CI_COMMIT_REF_SLUG
name: genesys/${CI_COMMIT_REF_SLUG}
action: stop
script:
- echo Removing review https\://${CI_COMMIT_REF_SLUG}.review.genesys\-pgr.org
- echo Removing review https\://${CI_ENVIRONMENT_SLUG}.review.genesys\-pgr.org
# Address the swarm
- export DOCKER_HOST=swarm.genesys-pgr.org
# Configuration
......@@ -164,7 +162,7 @@ remove review instance:
- export DOCKER_CERT_PATH=${TLS_PATH}
- DOCKER_CMD=docker
# Actions
- ${DOCKER_CMD} stack rm genesys-${CI_COMMIT_REF_SLUG}-review || true
- ${DOCKER_CMD} stack rm ${CI_ENVIRONMENT_SLUG} || true
deploy on staging server:
stage: deploy
......
......@@ -5,8 +5,8 @@ services:
image: ${CI_REGISTRY_IMAGE}:${IMAGE_TAG}
environment:
- spring.profiles.active=dev
- JAVA_OPTIONS=-Xms1800M -Xmx2800M -server -Dnetworkaddress.cache.ttl=10
- base.host=${CI_COMMIT_REF_SLUG}.review.genesys-pgr.org
- JAVA_OPTIONS=-Xms1800M -Xmx1800M -server -Dnetworkaddress.cache.ttl=10
- base.host=${CI_ENVIRONMENT_SLUG}.review.genesys-pgr.org
- robots.allow=false
- db.url=jdbc:hsqldb:mem:genesys;sql.syntax_mys=true
- db.driverClassName=org.hsqldb.jdbc.JDBCDriver
......@@ -15,7 +15,7 @@ services:
- db.showSql=false
- db.hbm2ddl=true
- auto.createContent=true
- hibernate.dialect=org.hibernate.dialect.HSQLDialect
- hibernate.dialect=org.genesys.blocks.util.BetterHSQLDialect
- base.cookie-secure=true
networks:
- traefik-net
......@@ -25,10 +25,10 @@ services:
- app=genesys-review
- traefik.port=8080
- traefik.docker.network=traefik-net
- traefik.frontend.rule=Host:${CI_COMMIT_REF_SLUG}.review.genesys-pgr.org
- traefik.frontend.rule=Host:${CI_ENVIRONMENT_SLUG}.review.genesys-pgr.org
resources:
limits:
memory: 3g
memory: 2g
cpus: '2'
reservations:
memory: 2g
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment