Skip to content
Snippets Groups Projects
Commit 5c5d6e84 authored by FORESTIER Fabien's avatar FORESTIER Fabien
Browse files

Remove deployment job from the CI as a dedicated project has been created

parent c80694f4
Branches
No related tags found
1 merge request!3Update the license
Pipeline #3817 passed
stages: stages:
- sonar-analysis - sonar-analysis
- build - build
- deploy
variables: variables:
PROXY_HOST_TARGET: https://download.data.grandlyon.com
SONAR_URL: https://sonarqube.forge.grandlyon.com SONAR_URL: https://sonarqube.forge.grandlyon.com
sonarqube: sonarqube:
stage: sonar-analysis stage: sonar-analysis
only: only:
- development - master
before_script: before_script:
- export PATH=$PATH:/usr/local/bin/sonar-scanner-3.2.0.1227-linux/bin/ - export PATH=$PATH:/usr/local/bin/sonar-scanner-3.2.0.1227-linux/bin/
- export NODE_PATH=$NODE_PATH:`npm root -g` - export NODE_PATH=$NODE_PATH:`npm root -g`
...@@ -30,11 +28,12 @@ build_development: ...@@ -30,11 +28,12 @@ build_development:
only: only:
- development - development
script: script:
- export TAG=dev - export TAG=$CI_COMMIT_SHORT_SHA
- export PROXY_MVT_BIND_PORT=9002 - export PROXY_MVT_BIND_PORT=9002
- docker-compose build - docker-compose build
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose push - docker-compose push
- "curl -X POST -F token=$CI_JOB_TOKEN -F ref=master -F variables[TAG]=${TAG} https://forge.grandlyon.com/api/v4/projects/336/trigger/pipeline"
build_release: build_release:
stage: build stage: build
...@@ -45,41 +44,4 @@ build_release: ...@@ -45,41 +44,4 @@ build_release:
- export PROXY_MVT_BIND_PORT=9002 - export PROXY_MVT_BIND_PORT=9002
- docker-compose build - docker-compose build
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose push - docker-compose push
\ No newline at end of file
deploy_development:
stage: deploy
only:
- development
script:
- export TAG=dev
- export PROXY_MVT_BIND_PORT=9003
- export ELASTICSEARCH_URL=https://data-reloaded-dev.alpha.grandlyon.com/api/es-consumer-aware
- export TECHNICAL_ACCOUNT_USERNAME=$TECHNICAL_ACCOUNT_USERNAME
- export TECHNICAL_ACCOUNT_PASSWORD=$TECHNICAL_ACCOUNT_PASSWORD
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose pull
- docker-compose --project-name proxy-map-services-${TAG} up -d --force-recreate
environment:
name: development
deploy_staging:
stage: deploy
only:
- development
when: manual
script:
- export TAG=staging
- export PROXY_MVT_BIND_PORT=9103
- export ELASTICSEARCH_URL=https://data-reloaded-rec.alpha.grandlyon.com/api/es-consumer-aware
- export TECHNICAL_ACCOUNT_USERNAME=$TECHNICAL_ACCOUNT_USERNAME
- export TECHNICAL_ACCOUNT_PASSWORD=$TECHNICAL_ACCOUNT_PASSWORD
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- TAG=dev docker-compose pull
- export REGISTRY_PATH=web-et-numerique/web-et-numerique-internet/data.grandlyon.com/web-portal/components/proxies/web-mapping-services
- docker tag $CI_REGISTRY/$REGISTRY_PATH:dev $CI_REGISTRY/$REGISTRY_PATH:${TAG}
- docker push $CI_REGISTRY/$REGISTRY_PATH:${TAG}
- docker-compose --project-name proxy-map-services-${TAG} up -d --force-recreate
environment:
name: staging
# Web mapping services proxy
## Installation
This proxy has been developed with [Node.js](https://nodejs.org/en/) and the [http-proxy](https://www.npmjs.com/package/http-proxy) node module.
You will need to install Node.js on your computer. Then you will need to install the project's dependencies. Go to the root of the project and run the following command.
```bash
npm install
```
## Environment variables
In order to run the code, some environment variables are needed. They are specified in the `template.env` file at the root of the project.
For a local deployment:
1. `cp template.env .env`
2. Edit .env according to the chosen configuration
The values will be read from the file by default when running with docker. If you run the service outside of docker you can export those variables.
## Running the app without docker
```bash
# development
npm run start
```
## Running the app with docker
```bash
# build
docker-compose build
# deploy
docker-compose up [-d]
# build and deploy
docker-compose up --build [-d]
```
...@@ -8,11 +8,11 @@ services: ...@@ -8,11 +8,11 @@ services:
ports: ports:
- ${PROXY_MVT_BIND_PORT}:9000 - ${PROXY_MVT_BIND_PORT}:9000
environment: environment:
- REDIS_SENTINEL_HOST=redis-sentinel-1 - REDIS_SENTINEL_HOST=${REDIS_SENTINEL_HOST}
- REDIS_SENTINEL_PORT=26379 - REDIS_SENTINEL_PORT=${REDIS_SENTINEL_PORT}
- REDIS_GROUP_NAME=mymaster - REDIS_GROUP_NAME=${REDIS_MASTER_SET}
- REDIS_AUTHORIZED_TTL=86400 - REDIS_AUTHORIZED_TTL=${REDIS_AUTHORIZED_TTL}
- REDIS_UNAUTHORIZED_TTL=60 - REDIS_UNAUTHORIZED_TTL=${REDIS_UNAUTHORIZED_TTL}
- ELASTICSEARCH_URL=${ELASTICSEARCH_URL} - ELASTICSEARCH_URL=${ELASTICSEARCH_URL}
- TECHNICAL_ACCOUNT_USERNAME=${TECHNICAL_ACCOUNT_USERNAME} - TECHNICAL_ACCOUNT_USERNAME=${TECHNICAL_ACCOUNT_USERNAME}
- TECHNICAL_ACCOUNT_PASSWORD=${TECHNICAL_ACCOUNT_PASSWORD} - TECHNICAL_ACCOUNT_PASSWORD=${TECHNICAL_ACCOUNT_PASSWORD}
...@@ -24,7 +24,7 @@ services: ...@@ -24,7 +24,7 @@ services:
redis-master: redis-master:
image: 'bitnami/redis:latest' image: 'bitnami/redis:latest'
environment: environment:
- ALLOW_EMPTY_PASSWORD=yes - ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}
volumes: volumes:
- redis-master:/bitnami/redis/data - redis-master:/bitnami/redis/data
restart: unless-stopped restart: unless-stopped
...@@ -32,8 +32,8 @@ services: ...@@ -32,8 +32,8 @@ services:
redis-sentinel-1: redis-sentinel-1:
image: 'bitnami/redis-sentinel:latest' image: 'bitnami/redis-sentinel:latest'
environment: environment:
- REDIS_MASTER_HOST=redis-master - REDIS_MASTER_HOST=${REDIS_MASTER_HOST}
- REDIS_MASTER_SET=mymaster - REDIS_MASTER_SET=${REDIS_MASTER_SET}
volumes: volumes:
- redis-sentinel-1:/bitnami/redis/data - redis-sentinel-1:/bitnami/redis/data
restart: unless-stopped restart: unless-stopped
...@@ -42,7 +42,7 @@ services: ...@@ -42,7 +42,7 @@ services:
image: 'bitnami/redis:latest' image: 'bitnami/redis:latest'
command: redis-server --bind 0.0.0.0 --slaveof redis-master 6379 --dir /bitnami/redis/data command: redis-server --bind 0.0.0.0 --slaveof redis-master 6379 --dir /bitnami/redis/data
environment: environment:
- ALLOW_EMPTY_PASSWORD=yes - ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}
volumes: volumes:
- redis-slave-1:/bitnami/redis/data - redis-slave-1:/bitnami/redis/data
restart: unless-stopped restart: unless-stopped
......
TAG=<tag of the image to be used> TAG=<tag of the image to be used>
PROXY_MVT_PORT_BIND_PORT=<proxy port> PROXY_MAP_SERVICES_BIND_PORT=<proxy port>
TECHNICAL_ACCOUNT_PASSWORD=<username of the technical account which has access to all wms and mvt> TECHNICAL_ACCOUNT_PASSWORD=<username of the technical account which has access to all wms and mvt>
TECHNICAL_ACCOUNT_USERNAME=<password of the technical account> TECHNICAL_ACCOUNT_USERNAME=<password of the technical account>
ELASTICSEARCH_URL=<url of the elasticsearch instance> ELASTICSEARCH_URL=<url of the elasticsearch instance>
PROXY_HOST_TARGET=<url of the map services> PROXY_HOST_TARGET=<url of the map services>
\ No newline at end of file REDIS_MASTER_HOST=<host of the redis master>
REDIS_SENTINEL_PORT=<port of the redis sentinel>
REDIS_SENTINEL_HOST=<host of the redis sentinel>
REDIS_MASTER_SET=<name of the group of the different sentinels>
REDIS_AUTHORIZED_TTL=<time in seconds for which the key/value will be stored in redis when the user has access to the layer>
REDIS_UNAUTHORIZED_TTL=<Time in seconds for which the key/value pair will be stored in redis when the user doesn't have access to the layer>
ALLOW_EMPTY_PASSWORD=<whether empty password is allowed or not for redis, ex: 'yes'>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment