/**
* Jenkinsfile to deploy multiple Docker containers based on docker-compose into a DEV server and run any test.
* This pipeline will run the Docker containers, execute the tests and then stop and remove the containers from the DEV
* server automatically.
**/
pipeline {
agent any
environment {
// Keep as is the following two lines
PRIVATE_REGISTRY = "https://registry.curex-project.eu:443/curex-local/"
ARTIFACTORY_URL = "registry.curex-project.eu:443/curex-local/"
HOST_IP = "116.203.166.220"
DEPLOYMENT_HOST = "${HOST_IP}:2376"
DEPLOYMENT_HOST_CREDENTIALS = "vm2-creds"
// KEA specific
APP_NAME = "KEA"
APP_ENV = "production"
APP_DEBUG = "true"
APP_URL = "https://kea.curex-project.eu"
KIBANA_PORT = "5601"
GRAFANA_PORT = "3000"
LOG_CHANNEL = "stack"
DB_CONNECTION = "pgsql"
DB_HOST = "timescaledb"
DB_PORT = "5432"
DB_DATABASE = "kea"
DB_USERNAME = "postgres"
DB_PASSWORD = "postgres"
BROADCAST_DRIVER = "log"
CACHE_DRIVER = "file"
QUEUE_CONNECTION = "sync"
SESSION_DRIVER = "file"
SESSION_LIFETIME = "120"
JWT_TTL = "1440"
ELASTICSEARCH_HOST = "elasticsearch"
ELASTICSEARCH_PORT = "9200"
ELASTICSEARCH_SCHEME = "http"
MQTT_HOST = "mosquitto"
MQTT_PORT = "1883"
MQTT_DEBUG = "false"
MQTT_QOS = "0"
MQTT_RETAIN = "0"
MLTD_HOST = "mltd"
MLTD_PORT = "5000"
OD_HOST = "od"
OD_PORT = "9091"
}
stages {
stage('Checkout the source code') {
steps {
checkout scm
}
}
stage('Deploy Docker containers in DEV server') {
steps {
script {
docker.withServer("$DEPLOYMENT_HOST", "$DEPLOYMENT_HOST_CREDENTIALS") {
docker.withRegistry("$PRIVATE_REGISTRY" , 'artifactory') {
echo 'Deploying the specified Docker containers in DEV server'
sh 'sh deploy_hetzner.sh'
}
}
}
}
}
}
}