Commit e8432c64 authored by José Gato Luis's avatar José Gato Luis
Browse files

preparing ci/cd workflow

parent d0ba6edd
Pipeline #1553 passed with stages
in 1 minute and 55 seconds
node_modules
.git
*.log
cert
config/extra/infrastructure.js
config/extra/secrets.js
deployment/rancher-compose.env
image: docker:1.12.6
# we need this service to run gitlab-ci process in a gitlab runner in docker
# executor mode (which is how we configure our runners)
variables:
CONTAINER_TEST_IMAGE: jgato/aeon-events-manager:$CI_BUILD_REF
CONTAINER_RELEASE_IMAGE: jgato/aeon-events-manager
RANCHER_COMPOSE_DOWNLOAD: "https://releases.rancher.com/compose/v0.12.5/rancher-compose-linux-amd64-v0.12.5.tar.gz"
RANCHER_COMPOSE_TAR: "rancher-compose-linux-amd64-v0.12.5.tar.gz"
RANCHER_COMPOSE_DIR: "rancher-compose-v0.12.5"
PROJECT_NAME: "AEON-Platform "
before_script:
- LAST_DOCKER_RELEASE=`cat package.json | grep version | cut -d':' -f 2 | cut -d'"' -f 2`
- CONTAINER_RELEASE_IMAGE="$CONTAINER_RELEASE_IMAGE:$LAST_DOCKER_RELEASE-alpine"
- echo "-u $USER_DOCKER -p $PASSWD_DOCKER -e $EMAIL_DOCKER"
- docker info
- docker login -u $USER_DOCKER -p $PASSWD_DOCKER -e $EMAIL_DOCKER
stages:
- build
- test
- test_clean
- deploy
- deploy_clean
build_job:
stage: build
script:
- echo "Building the image $CONTAINER_TEST_IMAGE alpine version"
- docker build -t $CONTAINER_TEST_IMAGE -f Dockerfile.alpine .
- docker push $CONTAINER_TEST_IMAGE
only:
- /^[0-9]{2}-.*$/
- development
test_job:
stage: test
script:
- echo "Testing the image"
- docker run $CONTAINER_TEST_IMAGE test
only:
- /^[0-9]{2}-.*$/
- development
clean_test_job:
stage: test_clean
script:
- echo "here we should delete test image, but now allowed in docker hub"
when: on_failure
only:
- /^[0-9]{2}-.*$/
- development
deploy_job:
stage: deploy
script:
- docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE
- docker push $CONTAINER_RELEASE_IMAGE
- echo "Download rancher compose"
- wget $RANCHER_COMPOSE_DOWNLOAD
- tar -zxvf $RANCHER_COMPOSE_TAR
- ls -l ./$RANCHER_COMPOSE_DIR/
- alias rancher-compose=$PWD/$RANCHER_COMPOSE_DIR/rancher-compose
- cd deployment
- rancher-compose --version
- rancher-compose --debug --project-name $PROJECT_NAME --url $RANCHER_URL --access-key $RANCHER_PUBLIC --secret-key $RANCHER_PRIVATE up --force-upgrade --pull -d Events-Manager
- rancher-compose --debug --project-name $PROJECT_NAME --url $RANCHER_URL --access-key $RANCHER_PUBLIC --secret-key $RANCHER_PRIVATE up --confirm-upgrade -d Events-Manager
environment: Development-Rancher
only:
- development
deploy_clean_job:
stage: deploy_clean
script:
- echo "Download rancher compose"
- wget $RANCHER_COMPOSE_DOWNLOAD
- tar -zxvf $RANCHER_COMPOSE_TAR
- ls -l ./$RANCHER_COMPOSE_DIR/
- alias rancher-compose=$PWD/$RANCHER_COMPOSE_DIR/rancher-compose
- cd deployment
- echo "Something went wrong, rolling back upgraded service"
- rancher-compose --debug --project-name $PROJECT_NAME --url $RANCHER_URL --access-key $RANCHER_PUBLIC --secret-key $RANCHER_PRIVATE up --rollback -d Events-Manager
when: on_failure
only:
- development
version: '2'
volumes:
MONGO-Storage:
external: true
driver: rancher-nfs
AEON-Config-Volume:
external: true
driver: 'null'
RABBIT-Storage:
external: true
driver: rancher-nfs
services:
Proxy:
image: rancher/lb-service-haproxy:v0.7.5
ports:
- 3000:3000/tcp
- 8000:8000/tcp
- 7789:7789/tcp
labels:
io.rancher.scheduler.affinity:host_label: deviceID=Rancher-host4
io.rancher.container.agent.role: environmentAdmin
io.rancher.container.create_agent: 'true'
Mongo:
image: jgato/aeon-mongo:3.2.14
stdin_open: true
volumes:
- AEON-Config-Volume:/etc/aeon/config:ro
- MONGO-Storage:/data/db:nocopy
tty: true
user: nobody
labels:
io.rancher.container.pull_image: always
io.rancher.scheduler.affinity:host_label: deviceid=Rancher-host4
Rabbit:
image: jgato/aeon-rabbitmq:3.6.6-management-alpine
hostname: localhost
stdin_open: true
volumes:
- AEON-Config-Volume:/etc/aeon/config:ro
- RABBIT-Storage:/var/lib/rabbitmq:nocopy
tty: true
ports:
- 15672:15672/tcp
user: nobody
labels:
io.rancher.container.pull_image: always
io.rancher.scheduler.affinity:host_label: deviceid=Rancher-host4
Dashboard:
image: jgato/aeon-dashboard:0.3.0-alpine
stdin_open: true
volumes:
- AEON-Config-Volume:/etc/aeon/config/:ro
tty: true
command:
- start
labels:
io.rancher.container.pull_image: always
API:
image: jgato/aeon-api:0.3.0-alpine
stdin_open: true
volumes:
- AEON-Config-Volume:/etc/aeon/config/:ro
tty: true
links:
- Mongo:MONGO
- Rabbit:RABBIT
command:
- start
labels:
io.rancher.container.pull_image: always
Events-Manager:
image: jgato/aeon-events-manager:0.3.0-alpine
stdin_open: true
volumes:
- AEON-Config-Volume:/etc/aeon/config/:ro
tty: true
links:
- Mongo:MONGO
- Rabbit:RABBIT
command:
- start
labels:
io.rancher.container.pull_image: always
version: '2'
services:
Proxy:
scale: 1
start_on_create: true
lb_config:
certs: []
default_cert: '*.atosresearch.eu'
port_rules:
- hostname: aeon-dev.atosresearch.eu
path: ''
priority: 1
protocol: https
service: API
source_port: 3000
target_port: 3000
- hostname: aeon-dev.atosresearch.eu
priority: 2
protocol: https
service: Dashboard
source_port: 8000
target_port: 8000
- hostname: aeon-dev.atosresearch.eu
path: ''
priority: 3
protocol: https
service: Events-Manager
source_port: 7789
target_port: 7789
health_check:
healthy_threshold: 2
response_timeout: 2000
port: 42
unhealthy_threshold: 3
initializing_timeout: 60000
interval: 2000
reinitializing_timeout: 60000
Mongo:
scale: 1
start_on_create: true
Rabbit:
scale: 1
start_on_create: true
Dashboard:
scale: 3
start_on_create: true
API:
scale: 3
start_on_create: true
Events-Manager:
scale: 1
start_on_create: true
{
"name": "aeon-event-manager",
"version": "0.3.0",
"private": true,
"description": "AEON Events Manager. AEON service to manage subscriptions",
"repository": "https://gitlab.atosresearch.eu/ari/aeon-events-manager/",
"scripts": {
"start": "node app"
"start": "node app",
"test": "node test.js"
},
"dependencies": {
"broker-manager": " https://gitlab.atosresearch.eu/ari/aeon-broker-manager/raw/master/broker-manager-0.3.0.tgz",
......
console.log("All test passed ;) ");
return 0;
\ No newline at end of file
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