Commit 9110beb6 authored by Alessandro CERIONI's avatar Alessandro CERIONI
Browse files

Environment agnostic docker compose file.

parent 22a4652d
Pipeline #2475 passed with stages
in 4 minutes and 36 seconds
......@@ -2,39 +2,62 @@ stages:
- build
- deploy
variables:
USER_SUPPORT_MAILBOX: alpha-test@erasme.org
build_development:
stage: build
only:
- master
- development
script:
- export NODE_ENV=DEV
- export TAG=dev
- export MAIL_SERVICE_BIND_PORT=3000
- export RABBITMQ_GUI_PORT=15672
- docker-compose build
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose push
build_release:
stage: build
only:
- tags
except:
- /^(?!master).+@/
script:
- export TAG=$CI_COMMIT_TAG
- export MAIL_SERVICE_BIND_PORT=3000
- export RABBITMQ_GUI_PORT=15672
- docker-compose build
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose push
deploy_development:
stage: deploy
only:
- master
- development
script:
- export NODE_ENV=DEV
- export TAG=dev
- export MAIL_SERVICE_BIND_PORT=3001
- export RABBITMQ_GUI_PORT=15672
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose pull
- docker-compose --project-name service-email-${TAG} up -d
- docker-compose --project-name service-email-${TAG} up -d --force-recreate
environment:
name: development
deploy_staging:
stage: deploy
only:
- master
- development
when: manual
script:
- export TAG=staging
- export NODE_ENV=REC
- sed -i 's/DEV_/REC_/g' docker-compose.yml
- export MAIL_SERVICE_BIND_PORT=3101
- export RABBITMQ_GUI_PORT=15673
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- TAG=dev docker-compose pull
- docker tag $CI_REGISTRY/refonte-data/service-email:dev $CI_REGISTRY/refonte-data/service-email:${TAG}
- docker push $CI_REGISTRY/refonte-data/service-email:${TAG}
- docker-compose --project-name service-email-${TAG} up -d
- docker-compose --project-name service-email-${TAG} up -d --force-recreate
environment:
name: staging
\ No newline at end of file
FROM node:8
FROM node:8-alpine
# Create app directory
WORKDIR /app
......
version: '3.1'
version: "3.1"
services:
service-email:
container_name: service-email-${TAG}
mail-service:
build: .
image: registry.alpha.grandlyon.com/refonte-data/service-email:${TAG}
ports:
- ${DEV_SERVICE_EMAIL_PORT}:3000
- ${MAIL_SERVICE_BIND_PORT}:3000
environment:
- NODE_ENV=${NODE_ENV}
- PLATEFORM_DATA_EMAIL=${DEV_PLATEFORM_DATA_EMAIL}
- RABBITMQ_USER=${DEV_RABBITMQ_USER}
- RABBITMQ_PASSWORD=${DEV_RABBITMQ_PASSWORD}
- USER_SUPPORT_MAILBOX=${USER_SUPPORT_MAILBOX}
- RABBITMQ_USER=rabbitmq-user
- RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD}
- GROUP_HEADER=x-consumer-groups
- EMAIL_WRITER_GROUP_NAME=email-writer
restart: unless-stopped
rabbitmq:
image: 'rabbitmq:3-management-alpine'
container_name: rabbitmq-${TAG}
image: rabbitmq:3-management-alpine
ports:
- ${DEV_RABBITMQ_STANDARD_PORT}:5672 # standard port for communication
- ${DEV_RABBITMQ_INTERFACE_PORT}:15672 # graphique interface
# - ${RABBITMQ_LISTENING_PORT}:5672 # standard port for communication
- ${RABBITMQ_GUI_PORT}:15672 # graphic interface
environment:
- RABBITMQ_DEFAULT_USER=${DEV_RABBITMQ_USER}
- RABBITMQ_DEFAULT_PASS=${DEV_RABBITMQ_PASSWORD}
- RABBITMQ_DEFAULT_USER=rabbitmq-user
- RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}
volumes:
- rabbitmqPersistence:/var/lib/rabbitmq
restart: unless-stopped
- rabbitmq-data-volume:/var/lib/rabbitmq
restart: unless-stopped
volumes:
rabbitmqPersistence:
\ No newline at end of file
rabbitmq-data-volume:
{
"name": "service-email",
"version": "0.0.0",
"version": "1.0.0",
"description": "description",
"author": "",
"license": "MIT",
......
......@@ -20,7 +20,7 @@ export class ConfigService {
// Initializing conf with values from var env
this._config.rabbitMQ.user = process.env.RABBITMQ_USER;
this._config.rabbitMQ.password = process.env.RABBITMQ_PASSWORD;
this._config.plateformDataEmail = process.env.PLATEFORM_DATA_EMAIL;
this._config.userSupportMailbox = process.env.USER_SUPPORT_MAILBOX;
this._config.groupNames.emailWriter = process.env.EMAIL_WRITER_GROUP_NAME;
this._config.groupHeader = process.env.GROUP_HEADER;
}
......
......@@ -6,7 +6,7 @@ export const config = {
port: '5672',
},
mailerQueue: 'portail-data-send-email',
plateformDataEmail: '',
userSupportMailbox: '',
imageHost: 'https://highway-to-data.alpha.grandlyon.com/email-template-assets',
groupNames: {
emailWriter: '',
......
RABBITMQ_USER=
RABBITMQ_PASSWORD=
PLATEFORM_DATA_EMAIL=
\ No newline at end of file
USER_SUPPORT_MAILBOX=
\ No newline at end of file
......@@ -36,7 +36,7 @@ export class EmailService {
});
const adminEmail = new EmailWithoutFrom();
adminEmail.to = [this.config.plateformDataEmail];
adminEmail.to = [this.config.userSupportMailbox];
adminEmail.replyTo = contactForm.email;
adminEmail.subject = contactForm.subject;
adminEmail.html = adminEmailBody;
......@@ -73,7 +73,7 @@ export class EmailService {
imageHost: this.config.imageHost,
});
const feedbackEmail = new EmailWithoutFrom();
feedbackEmail.to = [this.config.plateformDataEmail];
feedbackEmail.to = [this.config.userSupportMailbox];
feedbackEmail.subject = 'Feedback';
feedbackEmail.html = feedbackEmailBody;
......@@ -89,7 +89,7 @@ export class EmailService {
const mailerQueue = this.config.mailerQueue;
let email = new Email();
email.from = this.config.plateformDataEmail;
email.from = this.config.userSupportMailbox;
email = Object.assign(email, emailInfo);
Logger.log('[-] send method');
......
Supports Markdown
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