diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 69f9841530eff139b96bfe432773f24e3cbc3696..a9f53a2e16e3c8385e47b03583806fbe961c68f7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,30 +1,14 @@ stages: - sonar-analysis - build - - deploy variables: - USER_SUPPORT_MAILBOX: alpha-test@erasme.org - SMTP_HOST: mail0.erasme.org - SMTP_PORT: 25 SONAR_URL: https://sonarqube.forge.grandlyon.com - # ADDITIONAL_FEEDBACK_EMAILS: - -build_development: - stage: build - only: - - development - script: - - export TAG=dev - - export MAIL_SERVICE_BIND_PORT=3000 - - docker-compose build - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - - docker-compose push sonarqube: stage: sonar-analysis only: - - development + - 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` @@ -39,47 +23,25 @@ sonarqube: -Dsonar.projectKey=${SONAR_PROJECT_KEY} -Dsonar.login=${SONAR_TOKEN} -build_release: +build_development: stage: build only: - - tags + - development script: - - export TAG=$(echo $CI_COMMIT_TAG | sed 's/v//g') + - export TAG=$CI_COMMIT_SHORT_SHA + - export echo ${TAG} - export MAIL_SERVICE_BIND_PORT=3000 - - docker-compose build + - 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 MAIL_SERVICE_BIND_PORT=3001 - - export MAIL_SUBJECT_PREFIX=alpha - - export NO_REPLY_MAIL_ADDRESS=no-reply@erasme.org - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - - docker-compose pull - - docker-compose --project-name service-email-${TAG} up -d --force-recreate - environment: - name: development -deploy_staging: - stage: deploy +build_release: + stage: build only: - - development - when: manual + - tags script: - - export TAG=staging - - export MAIL_SERVICE_BIND_PORT=3101 - - export MAIL_SUBJECT_PREFIX=alpha - - export NO_REPLY_MAIL_ADDRESS=no-reply@erasme.org + - export TAG=$(echo $CI_COMMIT_TAG | sed 's/v//g') + - export MAIL_SERVICE_BIND_PORT=3000 + - docker-compose build - 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/services/mailer - - docker tag $CI_REGISTRY/$REGISTRY_PATH:dev $CI_REGISTRY/$REGISTRY_PATH:${TAG} - - docker push $CI_REGISTRY/$REGISTRY_PATH:${TAG} - - docker-compose --project-name service-email-${TAG} up -d --force-recreate - environment: - name: staging \ No newline at end of file + - docker-compose push diff --git a/README.md b/README.md index 83a433808efc1f0f06bffbd2825d59d635a7faaf..77e1c0af6ac88cfe41026bb226cc7e7e570d2ccb 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,13 @@ +# Mailer service + ## Installation +This service has been developed with the [NestJS](https://nestjs.com/) framework. It requires [Node.js](https://nodejs.org/en/) in order to run. + +Once Node.js installed on your computer, you will need to install the project's dependencies. Go to the root of the project and run the following command. + ```bash -$ npm install +npm install ``` ## Environment variables @@ -13,7 +19,7 @@ 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, but you can override any of those by exporting manually the variable before launching the service. +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 @@ -21,26 +27,26 @@ You will need to provide a healthy connection to a database in order for the ser ```bash # development -$ npm run start +npm run start # watch mode -$ npm run start:dev +npm run start:dev # production mode -$ npm run start:prod +npm run start:prod ``` ## Running the app with docker ```bash # build -$ docker-compose build +docker-compose build # deploy -$ docker-compose up [-d] +docker-compose up [-d] # build and deploy -$ docker-compose up --build [-d] +docker-compose up --build [-d] ``` <!-- ## Test @@ -54,6 +60,4 @@ $ npm run test:e2e # test coverage $ npm run test:cov -``` --> - - +``` --> \ No newline at end of file