Skip to content

Production deployment

Benjamin edited this page Dec 30, 2022 · 9 revisions

API production deployment

How to deploy the API

Deployment done with Github Actions and Azure App Service.

You first need to merge your changes to master using if possible the git flow release start vXX.X.X command.

Don't forget to update the version number on the swagger file and on the package.json file on the release branch before running git flow release finish vXX.X.X.

When the merge on master is completed, you should create a release for the newly pushed tag.

Initial Setup

You first need to install the az CLI.

Create the Azure Web App

az login
az account list-locations
az group create --location francecentral --name grottocenter-api
az appservice plan create --resource-group grottocenter-api --name grottocenter-api-plan --is-linux --sku B2
az webapp create --resource-group grottocenter-api --plan grottocenter-api-plan --name grottocenter-api --https-only true --runtime "NODE:18-lts"

Configure logs

az webapp log config --resource-group grottocenter-api --name grottocenter-api --web-server-logging filesystem
az webapp config appsettings set --resource-group grottocenter-api --name grottocenter-api --settings WEBSITE_HTTPLOGGING_RETENTION_DAYS=7
az webapp log config --resource-group grottocenter-api --name grottocenter-api --docker-container-logging filesystem

Extra configurations

Add all outbound IPs of the azure web app into :

  • the firewall of the AWS RDS (database)
  • the firewall of the LightSail instance (ES)
  • set all environmental variables :

image

TODO

  • Custom domain (api.grottocenter.org)
  • Deployment slot (to master instead of develop)

AWS deployment

PostGreSQL

Deployment of the PostGreSQL database on Amazon RDS : https://docs.google.com/document/d/1nmfGdScWYBWa91L0SRd7LrH5XK_DQKbkGMtVdDQlmgg/edit?usp=sharing

API (deprecated)

Now the production API is deployed on Azure Deployment of the Grottocenter3 application on EC2 : https://docs.google.com/document/d/1h8cdmlkZJG5SANKLfQQpOR1kNjMQiSKqb-N-LhM1Zlk/edit?usp=sharing

ElasticSearch and Logstash

Elasticsearch and Logstash scripts

On LightSail instance, you will find a folder called docker-elk/gc_scripts. It contains various scripts to help you monitor and manage ES and LS instances.