A starter app to go from nodejs code all the way to a production deployment.
NodeJSExpressJSTypeScript
cors- to enable CORS accesshelmet- for basic protectionmorgan- for loggingdotenv- to load environment files (only used in local development)
Uses docker compose to run the project locally. Also uses ts-node-dev to monitor typescript file changes and restart the process. The commands have been put in a makefile for ease of use
To start:
docker-compose up --build -dTo stop:
docker-compose downWe use copilot to deploy our application.
All services will be deployed in the same application - platform
There are 2 environments available - test and prod
Each project is deployed as a service in the same application - platform
To create a new service:
copilot init -a platform -d "./Dockerfile" -t "Load Balanced Web Service" -n {{NAME}}
# Give No when prompted to deployThen go to manifest.yml and change http-path to '/'
http:
path: '/'To deploy/re-deploy the service:
# In Test
copilot deploy -e test
# In Prod
copilot deploy -e prodTo delete a service
# In Test
copilot svc delete -e test -n {{NAME}}
# In Prod
copilot svc delete -e prod -n {{NAME}}The following command allows us to add a new env var.
copilot secret init
It will end with instructions to modify the manifest.yml file.
After updating the env variable, need to redeploy the service.
Ensure the following Env Variables are added in gitlab
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION