From ff7eaaeb9cbb17d836e74197738a2523ade95443 Mon Sep 17 00:00:00 2001
From: FORESTIER Fabien <fabien.forestier@soprasteria.com>
Date: Tue, 16 Jul 2019 17:24:59 +0200
Subject: [PATCH] Use diffrent port for redis in dev and rec env + update
 package to version 3.2.2

---
 .gitlab-ci.yml     | 12 ++++++++++++
 docker-compose.yml |  8 ++++----
 package.json       |  2 +-
 template.env       |  2 ++
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4ad06c4..b863f59 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -15,6 +15,9 @@ build_development:
   script:
     - export TAG=dev
     - export MIDDLEWARE_LEGACY_SERVICE_BIND_PORT=3004
+    - export REDIS_SENTINEL_PORT=26379
+    - export REDIS_SLAVE_PORT=6380
+    - export REDIS_MASTER_PORT=6379
     - docker-compose build 
     - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
     - docker-compose push
@@ -28,6 +31,9 @@ build_release:
   script:
     - export TAG=$(echo $CI_COMMIT_TAG | sed 's/v//g')
     - export MIDDLEWARE_LEGACY_SERVICE_BIND_PORT=3004
+    - export REDIS_SENTINEL_PORT=26379
+    - export REDIS_SLAVE_PORT=6380
+    - export REDIS_MASTER_PORT=6379
     - docker-compose build
     - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
     - docker-compose push
@@ -39,6 +45,9 @@ deploy_development:
   script:
     - export TAG=dev
     - export MIDDLEWARE_LEGACY_SERVICE_BIND_PORT=3004
+    - export REDIS_SENTINEL_PORT=26379
+    - export REDIS_SLAVE_PORT=6380
+    - export REDIS_MASTER_PORT=6379
     - export SERVICE_EMAIL_URL=http://vm-refonte-data-2:9000/email
     - export FRONT_END_URL=https://data-reloaded-dev.alpha.grandlyon.com/fr
     - export API_KEY=$DEV_API_KEY
@@ -56,6 +65,9 @@ deploy_staging:
   script:
     - export TAG=staging
     - export MIDDLEWARE_LEGACY_SERVICE_BIND_PORT=3104
+    - export REDIS_SENTINEL_PORT=26479
+    - export REDIS_SLAVE_PORT=6480
+    - export REDIS_MASTER_PORT=6479
     - export SERVICE_EMAIL_URL=http://vm-refonte-data-2:9100/email
     - export FRONT_END_URL=https://data-reloaded-rec.alpha.grandlyon.com/fr
     - export API_KEY=$REC_API_KEY
diff --git a/docker-compose.yml b/docker-compose.yml
index ac2d17e..9cb5449 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -19,7 +19,7 @@ services:
       - ACCESS_TOKEN_COOKIE_KEY=${ACCESS_TOKEN_COOKIE_KEY}
       - IMAGE_HOST=https://minio.alpha.grandlyon.com/email-template-assets
       - REDIS_SENTINEL_HOST=redis-sentinel-1
-      - REDIS_SENTINEL_PORT=26379
+      - REDIS_SENTINEL_PORT=${REDIS_SENTINEL_PORT}
       - REDIS_GROUP_NAME=mymaster
     restart: unless-stopped
     depends_on:
@@ -30,7 +30,7 @@ services:
     environment:
       - ALLOW_EMPTY_PASSWORD=yes
     ports:
-      - '6379:6379'
+      - '${REDIS_MASTER_PORT}:6379'
     volumes:
       - redis-master:/bitnami/redis/data
 
@@ -40,7 +40,7 @@ services:
       - REDIS_MASTER_HOST=redis-master
       - REDIS_MASTER_SET=mymaster
     ports:
-      - '26379:26379'
+      - '${REDIS_SENTINEL_PORT}:26379'
     volumes:
       - redis-sentinel-1:/bitnami/redis/data
 
@@ -50,7 +50,7 @@ services:
     environment:
       - ALLOW_EMPTY_PASSWORD=yes
     ports:
-      - '6380:6379'
+      - '${REDIS_SLAVE_PORT}:6379'
     volumes:
       - redis-slave-1:/bitnami/redis/data
 
diff --git a/package.json b/package.json
index e7be581..6caca95 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "legacy-auth-middleware",
-  "version": "3.2.1",
+  "version": "3.2.2",
   "description": "",
   "author": "",
   "license": "MIT",
diff --git a/template.env b/template.env
index 6fbe1b8..14c7851 100644
--- a/template.env
+++ b/template.env
@@ -11,4 +11,6 @@ ACCESS_TOKEN_COOKIE_KEY=<cookie key where the access token will be stored>
 IMAGE_HOST=<host of the images present in the emails body>
 REDIS_SENTINEL_HOST=<redis sentinel host>
 REDIS_SENTINEL_PORT=<redis sentinel port>
+REDIS_MASTER_PORT=<redis master port>
+REDIS_SLAVE_PORT=<redis slave port>
 REDIS_GROUP_NAME=<group name containing a master, and one or more slaves>
\ No newline at end of file
-- 
GitLab