Commit 74d039f7 authored by Guillaume Cornut's avatar Guillaume Cornut Committed by Raphaël Flores
Browse files

fix: MR feedback. Remove public beta & other fixes.

parent 2e1a9ab2
...@@ -5,8 +5,10 @@ stages: ...@@ -5,8 +5,10 @@ stages:
- staging - staging
- production - production
image: urgi/docker-browsers:latest image: urgi/docker-browsers:latest
# Disable the Gradle daemon for Continuous Integration servers as correctness # Disable the Gradle daemon for Continuous Integration servers as correctness
# is usually a priority over speed in CI environments. Using a fresh # is usually a priority over speed in CI environments. Using a fresh
# runtime for each build is more reliable since the runtime is completely # runtime for each build is more reliable since the runtime is completely
...@@ -17,6 +19,7 @@ variables: ...@@ -17,6 +19,7 @@ variables:
APP_NAME: gpds APP_NAME: gpds
JAR_PATH: "backend/build/libs/${APP_NAME}.jar" JAR_PATH: "backend/build/libs/${APP_NAME}.jar"
# Gradle cache for all jobs # Gradle cache for all jobs
cache: cache:
key: "$CI_COMMIT_REF_NAME" key: "$CI_COMMIT_REF_NAME"
...@@ -24,14 +27,16 @@ cache: ...@@ -24,14 +27,16 @@ cache:
- ".gradle" - ".gradle"
- "frontend/.gradle/" - "frontend/.gradle/"
- "frontend/node_modules/" - "frontend/node_modules/"
- "$JAR_PATH"
# TESTS # TESTS
lint: lint:
stage: test stage: test
script: "./gradlew lint" script: "./gradlew lint"
test-frontend: test-frontend:
stage: test stage: test
script: "./gradlew :frontend:test --parallel" script: "./gradlew :frontend:test --parallel"
...@@ -40,6 +45,7 @@ test-frontend: ...@@ -40,6 +45,7 @@ test-frontend:
junit: junit:
- "./frontend/karma-junit-tests-report/TEST*.xml" - "./frontend/karma-junit-tests-report/TEST*.xml"
test-backend: test-backend:
stage: test stage: test
script: "./gradlew :backend:test --parallel" script: "./gradlew :backend:test --parallel"
...@@ -62,8 +68,10 @@ test-backend: ...@@ -62,8 +68,10 @@ test-backend:
junit: junit:
- "./backend/build/test-results/test/TEST-*.xml" - "./backend/build/test-results/test/TEST-*.xml"
# BUILD # BUILD
build: build:
stage: build stage: build
script: script:
...@@ -78,8 +86,10 @@ build: ...@@ -78,8 +86,10 @@ build:
- backend/src/**/* - backend/src/**/*
- frontend/**/* - frontend/**/*
# DEPLOY # DEPLOY
.deploy-to-vm: &deploy_to_vm .deploy-to-vm: &deploy_to_vm
# Hidden job which serves as template for executed jobs below. # Hidden job which serves as template for executed jobs below.
# See https://docs.gitlab.com/ee/ci/yaml/#anchors # See https://docs.gitlab.com/ee/ci/yaml/#anchors
...@@ -90,31 +100,28 @@ build: ...@@ -90,31 +100,28 @@ build:
- ssh-add <(echo "${SSH_PRIVATE_KEY}") - ssh-add <(echo "${SSH_PRIVATE_KEY}")
- ssh -o StrictHostKeyChecking=no root@${SERVER_IP} 'echo "Successfully connected on $(hostname)"' - ssh -o StrictHostKeyChecking=no root@${SERVER_IP} 'echo "Successfully connected on $(hostname)"'
script: script:
# Copy jar and data (cleaning them before) to the server # Copy jar
- "scp ./$JAR_PATH root@${SERVER_IP}:/opt/${APP_NAME}/${APP_NAME}-${ENV}.jar" - scp ./$JAR_PATH root@${SERVER_IP}:/opt/${APP_NAME}/${APP_NAME}-${ENV}.jar
# Restarting service with the updated jar and the according Spring profiles enabled # Restarting service with the updated jar and the according Spring profiles enabled
- "ssh root@${SERVER_IP} \"systemctl restart ${APP_NAME}-${ENV}\"" - ssh root@${SERVER_IP} "systemctl restart ${APP_NAME}@${ENV}"
- eval $(ssh-agent -k) - eval $(ssh-agent -k)
- "echo \"Deploy done. Application should be available at: http://${SERVER_IP}:${APP_PORT}/${CONTEXT_PATH} \"" - echo "Deploy done. Application should be available at http://${SERVER_IP}:${APP_PORT}/${CONTEXT_PATH}"
only:
changes:
- .gitlab-ci.yml
- backend/src/**/*
- frontend/**/*
deploy-to-prod: deploy-to-staging:
stage: production stage: staging
variables: variables:
ENV: prod ENV: staging
APP_PORT: ${PROD_GPDS_PORT} APP_PORT: ${STAGING_GPDS_PORT}
CONTEXT_PATH: ${PROD_GPDS_CONTEXT_PATH} CONTEXT_PATH: ${STAGING_GPDS_CONTEXT_PATH}
<<: *deploy_to_vm <<: *deploy_to_vm
only: only:
refs: refs:
- master - master
when: manual changes:
allow_failure: false - .gitlab-ci.yml
- backend/src/**/*
- frontend/**/*
deploy-to-beta: deploy-to-beta:
...@@ -127,64 +134,63 @@ deploy-to-beta: ...@@ -127,64 +134,63 @@ deploy-to-beta:
only: only:
refs: refs:
- branches - branches
except: changes:
refs: - .gitlab-ci.yml
- master - backend/src/**/*
- frontend/**/*
when: manual
allow_failure: false allow_failure: false
deploy-to-staging: deploy-to-int:
stage: staging
variables:
ENV: staging
APP_PORT: ${STAGING_GPDS_PORT}
CONTEXT_PATH: ${STAGING_GPDS_CONTEXT_PATH}
<<: *deploy_to_vm
only:
refs:
- master
deploy-to-private-prod:
stage: production stage: production
variables: variables:
ENV: private-prod ENV: int
APP_PORT: ${PRIVATE_PROD_GPDS_PORT} APP_PORT: ${INT_GPDS_PORT}
CONTEXT_PATH: ${PRIVATE_PROD_GPDS_CONTEXT_PATH} CONTEXT_PATH: ${INT_GPDS_CONTEXT_PATH}
<<: *deploy_to_vm <<: *deploy_to_vm
only: only:
refs: refs:
- master - master
changes:
- .gitlab-ci.yml
- backend/src/**/*
- frontend/**/*
when: manual when: manual
allow_failure: false allow_failure: false
deploy-to-private-int: deploy-to-public-prod:
stage: production stage: production
variables: variables:
ENV: private-int ENV: public-prod
APP_PORT: ${PRIVATE_INT_GPDS_PORT} APP_PORT: ${PUBLIC_PROD_GPDS_PORT}
CONTEXT_PATH: ${PRIVATE_INT_GPDS_CONTEXT_PATH} CONTEXT_PATH: ${PUBLIC_PROD_GPDS_CONTEXT_PATH}
<<: *deploy_to_vm <<: *deploy_to_vm
only: only:
refs: refs:
- master - master
changes:
- .gitlab-ci.yml
- backend/src/**/*
- frontend/**/*
when: manual when: manual
allow_failure: false allow_failure: false
deploy-to-private-beta: deploy-to-private-prod:
stage: staging stage: production
variables: variables:
ENV: private-beta ENV: private-prod
APP_PORT: ${PRIVATE_BETA_GPDS_PORT} APP_PORT: ${PRIVATE_PROD_GPDS_PORT}
CONTEXT_PATH: ${PRIVATE_BETA_GPDS_CONTEXT_PATH} CONTEXT_PATH: ${PRIVATE_PROD_GPDS_CONTEXT_PATH}
<<: *deploy_to_vm <<: *deploy_to_vm
only: only:
refs:
- branches
except:
refs: refs:
- master - master
changes:
- .gitlab-ci.yml
- backend/src/**/*
- frontend/**/*
when: manual when: manual
allow_failure: false allow_failure: false
...@@ -105,7 +105,7 @@ The details of this remote server are filled in the `bootstrap.yml` file. ...@@ -105,7 +105,7 @@ The details of this remote server are filled in the `bootstrap.yml` file.
By default, it tries to connect to the remote server on http://localhost:8888 By default, it tries to connect to the remote server on http://localhost:8888
but it can of course be changed, or even configured via the `SPRING_CONFIG_URI` environment variable. but it can of course be changed, or even configured via the `SPRING_CONFIG_URI` environment variable.
It will try to fetch the configuration for the application name `rare`, and the default profile. It will try to fetch the configuration for the application name `gpds`, and the default profile.
If such a configuration is not found, it will then fallback to the local `application.yml` properties. If such a configuration is not found, it will then fallback to the local `application.yml` properties.
To avoid running the Spring Cloud config server every time when developing the application, To avoid running the Spring Cloud config server every time when developing the application,
all the properties are still available in `application.yml` even if they are configured on the remote Spring Cloud server as well. all the properties are still available in `application.yml` even if they are configured on the remote Spring Cloud server as well.
...@@ -114,7 +114,7 @@ If you want to use the Spring Cloud config app locally, ...@@ -114,7 +114,7 @@ If you want to use the Spring Cloud config app locally,
see https://forgemia.inra.fr/urgi-is/data-discovery-config see https://forgemia.inra.fr/urgi-is/data-discovery-config
The configuration is currently only read on startup, The configuration is currently only read on startup,
meaning the application has to be reboot if the configuration is changed on the Spring Cloud server. meaning the application has to be rebooted if the configuration is changed on the Spring Cloud server.
For a dynamic reload without restarting the application, For a dynamic reload without restarting the application,
see http://cloud.spring.io/spring-cloud-static/Finchley.SR1/single/spring-cloud.html#refresh-scope see http://cloud.spring.io/spring-cloud-static/Finchley.SR1/single/spring-cloud.html#refresh-scope
to check what has to be changed. to check what has to be changed.
...@@ -124,14 +124,4 @@ and append the `--spring.cloud.config.label=<branch name to test>` parameter whe ...@@ -124,14 +124,4 @@ and append the `--spring.cloud.config.label=<branch name to test>` parameter whe
More info on how pass a parameter to a Spring Boot app: More info on how pass a parameter to a Spring Boot app:
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config
### Application port & context path See the [`data-discovery-config` README.md file](https://forgemia.inra.fr/urgi-is/data-discovery-config/blob/master/README.md) for the list of application environments (server ports and context paths).
| | GPDS GnpIS |
| :------------: | :---------------------- |
| dev | :8060/gnpis/gpds |
| beta | :8061/gnpis/gpds-beta |
| staging | :8062/staging/gnpis/gpds |
| prod | :8063/gnpis/gpds |
| private prod | :8064/private/gnpis/gpds |
| private beta | :8065/beta/gnpis/gpds |
| private int | :8066/int/gnpis/gpds |
Markdown is supported
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