Skip to content
Snippets Groups Projects
Commit 068f6ca1 authored by ncastejon's avatar ncastejon
Browse files

Merge branch 'development' of...

Merge branch 'development' of forge.grandlyon.com:web-et-numerique/web-et-numerique-internet/data.grandlyon.com/web-portal/components/proxies/web-mapping-services into ign-proxy
parents 9ea731be 5c5d6e84
No related branches found
No related tags found
1 merge request!4v1.1.0
stages:
- sonar-analysis
- build
- deploy
variables:
PROXY_HOST_TARGET: https://download.data.grandlyon.com
SONAR_URL: https://sonarqube.forge.grandlyon.com
sonarqube:
stage: sonar-analysis
only:
- master
before_script:
- export PATH=$PATH:/usr/local/bin/sonar-scanner-3.2.0.1227-linux/bin/
- export NODE_PATH=$NODE_PATH:`npm root -g`
script:
- >
sonar-scanner
-Dsonar.projectName=${SONAR_PROJECT_KEY}
-Dsonar.projectVersion=1.0
-Dsonar.sourceEncoding=UTF-8
-Dsonar.projectBaseDir=.
-Dsonar.host.url=${SONAR_URL}
-Dsonar.projectKey=${SONAR_PROJECT_KEY}
-Dsonar.login=${SONAR_TOKEN}
build_development:
stage: build
only:
- development
script:
- export TAG=dev
- export TAG=$CI_COMMIT_SHORT_SHA
- export PROXY_MVT_BIND_PORT=9002
- docker-compose build
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- 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:
stage: build
......@@ -25,41 +44,4 @@ build_release:
- export PROXY_MVT_BIND_PORT=9002
- docker-compose build
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose push
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
- docker-compose push
\ No newline at end of file
# 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:
ports:
- ${PROXY_MVT_BIND_PORT}:9000
environment:
- REDIS_SENTINEL_HOST=redis-sentinel-1
- REDIS_SENTINEL_PORT=26379
- REDIS_GROUP_NAME=mymaster
- REDIS_AUTHORIZED_TTL=86400
- REDIS_UNAUTHORIZED_TTL=60
- REDIS_SENTINEL_HOST=${REDIS_SENTINEL_HOST}
- REDIS_SENTINEL_PORT=${REDIS_SENTINEL_PORT}
- REDIS_GROUP_NAME=${REDIS_MASTER_SET}
- REDIS_AUTHORIZED_TTL=${REDIS_AUTHORIZED_TTL}
- REDIS_UNAUTHORIZED_TTL=${REDIS_UNAUTHORIZED_TTL}
- ELASTICSEARCH_URL=${ELASTICSEARCH_URL}
- TECHNICAL_ACCOUNT_USERNAME=${TECHNICAL_ACCOUNT_USERNAME}
- TECHNICAL_ACCOUNT_PASSWORD=${TECHNICAL_ACCOUNT_PASSWORD}
......@@ -24,7 +24,7 @@ services:
redis-master:
image: 'bitnami/redis:latest'
environment:
- ALLOW_EMPTY_PASSWORD=yes
- ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}
volumes:
- redis-master:/bitnami/redis/data
restart: unless-stopped
......@@ -32,8 +32,8 @@ services:
redis-sentinel-1:
image: 'bitnami/redis-sentinel:latest'
environment:
- REDIS_MASTER_HOST=redis-master
- REDIS_MASTER_SET=mymaster
- REDIS_MASTER_HOST=${REDIS_MASTER_HOST}
- REDIS_MASTER_SET=${REDIS_MASTER_SET}
volumes:
- redis-sentinel-1:/bitnami/redis/data
restart: unless-stopped
......@@ -42,7 +42,7 @@ services:
image: 'bitnami/redis:latest'
command: redis-server --bind 0.0.0.0 --slaveof redis-master 6379 --dir /bitnami/redis/data
environment:
- ALLOW_EMPTY_PASSWORD=yes
- ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}
volumes:
- redis-slave-1:/bitnami/redis/data
restart: unless-stopped
......
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_USERNAME=<password of the technical account>
ELASTICSEARCH_URL=<url of the elasticsearch instance>
PROXY_HOST_TARGET=<url of the map services>
\ No newline at end of file
PROXY_HOST_TARGET=<url of the map services>
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