Synt light-weight node backend service
npm install synt_backend> Nodejs API Backend service for Synt, access through Synt API or Syntbeheer
> Author: Adriaan De Bolle - adriaandebolle.com
- Requirements
> npm
> mysql
``shell
$ npm install
`
- Database
`shell`
$ cd mysql
$ npx sequelize-cli db:migrate && npx sequelize-cli db:seed:all
> ONLY for local development, reinit database
`shell`
$ npx sequelize-cli db:seed:undo:all && npx sequelize-cli db:migrate:undo:all && npx sequelize-cli db:migrate && npx sequelize-cli db:seed:all
NODE_ENV=production npx sequelize-cli db:seed:undo:all && NODE_ENV=production npx sequelize-cli db:migrate:undo:all && NODE_ENV=production npx sequelize-cli db:migrate && NODE_ENV=production npx sequelize-cli db:seed:all
NODE_ENV=production npx sequelize-cli db:seed --seed 20210118103211-notification-settings.js
NODE_ENV=production npx sequelize-cli db:seed --seed 20210728100151-associate-notification-settings.js
NODE_ENV=production npx sequelize-cli db:seed:undo --seed 20210728100151-associate-notification-settings.js
> Create model (model + migration)
`shell`
$ npx sequelize-cli model:generate --name Yeas --attributes type:enum,version:integer,consent_given_at:date
> Create association (migration)
`shell`
$ npx sequelize-cli migration:create --name example
> Use babel-node before node starts index
- start app
`shell`
$ npm run start:dev
> Server
- check running process
``
$ forever list
- stop process
``
$ forever stop [pid]
More info: Private Git packages
Install CodeDeploy Agent on EC2(image)
Get rid off relative path by using typescript
Use npm run build to precompile babel in production: info
- ssh to ssh -i ~/.ssh/synt-key-pair.pem ubuntu@34.242.114.0:max_revisions: 1
- change in /etc/codedeploy-agent/conf/codedeployagent.ymlsudo rm -rf /opt/codedeploy-agent/deployment-root/ca203350-bc6e-40a1-b01f-d4ca17fcdff7/*
- clean up the folder sudo service codedeploy-agent stop
- restart the service and then sudo service codedeploy-agent start
- docker-compose -f docker-compose.yml up --build
- docker-compose -f docker-compose.yml up db
- docker-compose up --build
- docker build -t synt-backend .
- docker run -p 8000:8000 --network synt_backend_my-network synt-backend:latest`
aws ecr --profile synt get-login-password --region eu-west-1 | docker login --username AWS --password-stdin 635199656487.dkr.ecr.eu-west-1.amazonaws.com
docker tag synt-backend:latest 635199656487.dkr.ecr.eu-west-1.amazonaws.com/synt-backend:latest
docker push 635199656487.dkr.ecr.eu-west-1.amazonaws.com/synt-backend:latest