ECS-NodeJS-server
Setup
- Setup your aws credentials and aws profile using
aws configure --profile <aws profile>
npm install
- use
yarn start
to run in offline mode` yarn deploy:dev
to deploy dev environmentyarn deploy:live
to deploy to live
Environment variables
Environment variables can be setup in .env
file
Deploying
- Install and setup your aws cli with an aws profile using
aws config --profile=<aws profile>
- use
yarn deploy:dev
oryarn deploy:live
to build and deploy Docker images to amazon ECR and force a new deployment and start a new service running on the ECS cluster with the new docker image. ECS will then take care of drowning the old service to match the configured desired number of running tasks.
Releasing
This repo uses semantic-release, commitizen, commitlint, husky and conventional commits in order to automate the release proccess
Setup/Prequisites
- The user needs to have a
GH_TOKEN
environment variable set with a valid git token that has push access to the repository which can be generated following these steps - the token can be added into a
~/.bash_profile
to avoid manually setting it before running the command. - The script should be run from the release branch only (default: master) otherwise it will fail. To change the release branch you can edit the "release" section in the
package.json
file to temporarily set the release branch as follows
"release": {
...
"branch": "feature/integrate-semantic-release"
...
}
Usage
yarn commit
will run commitizen cli to generate a conventional style commit messageyarn release
will do a dry-run of the release without pushing or changing any filesyarn release --no-ci
will do a real release. We could potentially use this to automate releases when new commits/PRs land in the master branch Details
A release will
- Bump the version in
package.json
according to semantic versioning (semver) based on the changes/commit messages (fix/perf = patch, feat = minor, breaking = major) - Create a git tag
- Generate a CHANGELOG.md with the latest changes since the last release
- Push the changes to the repository & create a git release