-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from ferrumnet/staging
Staging
- Loading branch information
Showing
60 changed files
with
2,618 additions
and
6,727 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: Build, Upload and Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
|
||
env: | ||
AppName: gateway-backend | ||
Region: us-east-2 | ||
|
||
jobs: | ||
Build: | ||
runs-on: ubuntu-latest | ||
env: | ||
s3-bucket: ferrum-gateway-pipeline-artifacts-dev | ||
s3-filename: dev-aws-codedeploy-${{ github.sha }} | ||
Environment: dev | ||
AppName: gateway-backend | ||
# strategy: | ||
# matrix: | ||
# # python-version: [3.8] | ||
# # node-version: ['12.x'] | ||
# # appname: ['aws-codedeploy'] | ||
# # deploy-group: ['staging'] | ||
# s3-bucket: ['ferrum-pipeline-artifacts'] | ||
# s3-filename: ['staging-aws-codedeploy-${{ github.sha }}'] | ||
# AppName: ['gateway-backend'] | ||
# Environment: ['dev'] | ||
|
||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-2 | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Build, tag, and push image to Amazon ECR | ||
run: | | ||
docker build -t ${{ secrets.ECR_REGISTRY }}:latest . | ||
docker push ${{ secrets.ECR_REGISTRY }}:latest | ||
- name: AWS Deploy push | ||
run: | | ||
echo "export Region=${{ env.Region }}" >> set_env.sh | ||
echo "export Environment=${{ env.Environment }}" >> set_env.sh | ||
echo "export AppName=${{ env.AppName }}" >> set_env.sh | ||
echo "export ECR_REGISTRY=${{ secrets.ECR_REGISTRY }}" >> set_env.sh | ||
aws deploy push \ | ||
--application-name gateway-backend-dev \ | ||
--s3-location s3://${{ env.s3-bucket }}/${{ env.s3-filename }}.zip \ | ||
--source . | ||
# --description "This is a revision for the ${{ matrix.appname }}-${{ github.sha }}" \ | ||
# --ignore-hidden-files \ | ||
Deploy: | ||
needs: [Build] | ||
runs-on: ubuntu-latest | ||
env: | ||
s3-bucket: ferrum-gateway-pipeline-artifacts-dev | ||
s3-filename: dev-aws-codedeploy-${{ github.sha }} | ||
Environment: dev | ||
AppName: gateway-backend | ||
steps: | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-2 | ||
|
||
|
||
- name: CodeDeploy Deployment Api | ||
id: deploy_api | ||
run: | | ||
aws deploy create-deployment \ | ||
--application-name ${{ secrets.CODE_DEPLOY_APP }} \ | ||
--deployment-group-name ${{ secrets.DEPLOYMENT_GROUP_API }} \ | ||
--deployment-config-name CodeDeployDefault.OneAtATime \ | ||
--s3-location bucket=${{ env.s3-bucket }},key=${{ env.s3-filename }}.zip,bundleType=zip | ||
# --github-location repository=${{ github.repository }},commitId=${{ github.sha }} | ||
- name: CodeDeploy Deployment Cron | ||
id: deploy_cron | ||
run: | | ||
aws deploy create-deployment \ | ||
--application-name ${{ secrets.CODE_DEPLOY_APP }} \ | ||
--deployment-group-name ${{ secrets.DEPLOYMENT_GROUP_CRON }} \ | ||
--deployment-config-name CodeDeployDefault.OneAtATime \ | ||
--s3-location bucket=${{ env.s3-bucket }},key=${{ env.s3-filename }}.zip,bundleType=zip | ||
# --github-location repository=${{ github.repository }},commitId=${{ github.sha }} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,4 +47,3 @@ public/ | |
/.serverless | ||
dockerBuild.sh | ||
package-lock.json | ||
config/config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,12 @@ | ||
FROM node:16 | ||
|
||
# Create app directory | ||
WORKDIR /usr/src/app | ||
WORKDIR /app | ||
|
||
# Install app dependencies | ||
# A wildcard is used to ensure both package.json AND package-lock.json are copied | ||
# where available (npm@5+) | ||
COPY package*.json ./ | ||
COPY . /app | ||
|
||
RUN npm install | ||
# If you are building your code for production | ||
# RUN npm ci --only=production | ||
|
||
# Bundle app source | ||
COPY . . | ||
|
||
EXPOSE 8080 | ||
CMD [ "node", "server.js" ] | ||
|
||
CMD [ "node", "server.js" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
# Gateway Backend | ||
|
||
install latest node packages | ||
install latest npm packages | ||
sudo npm i | ||
nodemone server.js or node server.js | ||
app will run on 8080 port, you can update in server.js | ||
1. Install latest node packages | ||
2. Install latest npm packages | ||
3. sudo npm i | ||
4. nodemone server.js [env] [type] | ||
5. env can be: dev || qa || uat || staging || prod | ||
6. type can be: api || cron | ||
7. For example: nodemone server.js dev api | ||
8. node server.js [env] [type] | ||
9. pm2 start server.js -- [env] [type] --name "server" | ||
10. App will run on 8080 port, you can update in server.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.