chore(logs): improve logs for iplan #1274
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
name: Server CI | |
env: | |
AWS_REGION: il-central-1 | |
ECR_REPOSITORY: 072085314121.dkr.ecr.il-central-1.amazonaws.com/meirim-server | |
on: | |
push: | |
paths: | |
- server/** | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
services: | |
test_mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
ports: | |
- 33060:3306 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: use node v${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: cache node modules | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cache | |
!~/.cache/exclude | |
**/node_modules | |
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: ${{ runner.OS }}-build-${{ env.cache-name }} | |
${{ runner.OS }}-build- | |
${{ runner.OS }}- | |
- name: install server dependencies | |
working-directory: server | |
run: npm install | |
- name: create database | |
run: mysql --protocol=tcp --host=localhost --port=33060 --user=root --password=password -e "CREATE DATABASE test_meirim character set UTF8 collate utf8_bin; SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY,',''));" | |
- name: test | |
working-directory: server | |
run: npm run test | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@0e613a0980cbf65ed5b322eb7a1e075d28913a83 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@62f4f872db3836360b72999f4b87f1ff13310f3a | |
- name: use node 14.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14.x | |
- name: install server dependencies | |
working-directory: server | |
run: npm install | |
- uses: mr-smithers-excellent/docker-build-push@v6 | |
id: build-image | |
with: | |
dockerfile: server/Dockerfile | |
image: meirim-server | |
registry: 072085314121.dkr.ecr.il-central-1.amazonaws.com | |
directory: server | |
tags: ${{github.sha}} | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CI_ACCESS_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CI_SECRET_KEY }} | |
deploy-staging: | |
environment: staging | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@0e613a0980cbf65ed5b322eb7a1e075d28913a83 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
- name: Fill in the new image ID in the Amazon ECS task definition | |
id: task-def | |
uses: aws-actions/amazon-ecs-render-task-definition@c804dfbdd57f713b6c079302a4c01db7017a36fc | |
with: | |
task-definition: server/.aws/staging-task-definition.json | |
container-name: ${{ vars.CONTAINER_NAME }} | |
image: "072085314121.dkr.ecr.il-central-1.amazonaws.com/meirim-server:${{github.sha}}" | |
environment-variables: | | |
SERVER_SESSION_SECRET=${{ secrets.SERVER_SESSION_SECRET }} | |
SERVER_CYPHER_SECRET=${{ secrets.SERVER_CYPHER_SECRET }} | |
SERVER_PAYMENT_SERVICE_MASOF_ID=${{ secrets.SERVER_PAYMENT_SERVICE_MASOF_ID }} | |
SERVER_PAYMENT_SERVICE_API_KEY=${{ secrets.SERVER_PAYMENT_SERVICE_API_KEY }} | |
SERVER_PAYMENT_SERVICE_PASS=${{ secrets.SERVER_PAYMENT_SERVICE_PASS }} | |
SERVER_DATABASE_HOST=${{ secrets.SERVER_DATABASE_HOST }} | |
SERVER_DATABASE_USER=${{ secrets.SERVER_DATABASE_USER }} | |
SERVER_DATABASE_PASSWORD=${{ secrets.SERVER_DATABASE_PASSWORD }} | |
SERVER_EMAIL_SMTP_HOST=${{ secrets.SERVER_EMAIL_SMTP_HOST }} | |
SERVER_EMAIL_SMTP_AUTH_USER=${{ secrets.SERVER_EMAIL_SMTP_AUTH_USER }} | |
SERVER_EMAIL_SMTP_AUTH_PASSWORD=${{ secrets.SERVER_EMAIL_SMTP_AUTH_PASSWORD }} | |
SERVER_EMAIL_SMTP_AUTH_TEMPLATE_PASS=${{ secrets.SERVER_EMAIL_SMTP_AUTH_TEMPLATE_PASS }} | |
SERVER_EMAIL_DIGEST_PLANS=${{ secrets.SERVER_EMAIL_DIGEST_PLANS }} | |
SERVER_PROXY_API_KEY=${{ secrets.SERVER_PROXY_API_KEY }} | |
SERVER_SENTRY_DSN=${{ secrets.SERVER_SENTRY_DSN }} | |
AWS_ACCESS_KEY_ID=${{ secrets.SERVER_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY=${{ secrets.SERVER_AWS_SECRET_ACCESS_KEY }} | |
SERVER_CORALOGIX_SERVICE_NAME=${{ vars.SERVER_CORALOGIX_SERVICE_NAME }} | |
SERVER_CORALOGIX_API_KEY=${{secrets.SERVER_CORALOGIX_API_KEY}} | |
SERVER_GEOCODER_API_KEY=${{secrets.SERVER_GEOCODER_API_KEY}} | |
VERSION=${{github.sha}} | |
NODE_ENV=staging | |
- name: Deploy Amazon ECS task definition | |
uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a | |
with: | |
task-definition: ${{ steps.task-def.outputs.task-definition }} | |
service: ${{ vars.ECS_SERVICE }} | |
cluster: ${{ vars.ECS_CLUSTER }} | |
wait-for-service-stability: true | |
deploy-prod: | |
if: github.ref == 'refs/heads/master' | |
environment: prod | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@0e613a0980cbf65ed5b322eb7a1e075d28913a83 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
- name: Fill in the new image ID in the Amazon ECS task definition | |
id: task-def | |
uses: aws-actions/amazon-ecs-render-task-definition@c804dfbdd57f713b6c079302a4c01db7017a36fc | |
with: | |
task-definition: server/.aws/production-task-definition.json | |
container-name: ${{ vars.CONTAINER_NAME }} | |
image: "072085314121.dkr.ecr.il-central-1.amazonaws.com/meirim-server:${{github.sha}}" | |
environment-variables: | | |
SERVER_SESSION_SECRET=${{ secrets.SERVER_SESSION_SECRET }} | |
SERVER_CYPHER_SECRET=${{ secrets.SERVER_CYPHER_SECRET }} | |
SERVER_PAYMENT_SERVICE_MASOF_ID=${{ secrets.SERVER_PAYMENT_SERVICE_MASOF_ID }} | |
SERVER_PAYMENT_SERVICE_API_KEY=${{ secrets.SERVER_PAYMENT_SERVICE_API_KEY }} | |
SERVER_PAYMENT_SERVICE_PASS=${{ secrets.SERVER_PAYMENT_SERVICE_PASS }} | |
SERVER_DATABASE_HOST=${{ secrets.SERVER_DATABASE_HOST }} | |
SERVER_DATABASE_USER=${{ secrets.SERVER_DATABASE_USER }} | |
SERVER_DATABASE_PASSWORD=${{ secrets.SERVER_DATABASE_PASSWORD }} | |
SERVER_EMAIL_SMTP_HOST=${{ secrets.SERVER_EMAIL_SMTP_HOST }} | |
SERVER_EMAIL_SMTP_AUTH_USER=${{ secrets.SERVER_EMAIL_SMTP_AUTH_USER }} | |
SERVER_EMAIL_SMTP_AUTH_PASSWORD=${{ secrets.SERVER_EMAIL_SMTP_AUTH_PASSWORD }} | |
SERVER_EMAIL_SMTP_AUTH_TEMPLATE_PASS=${{ secrets.SERVER_EMAIL_SMTP_AUTH_TEMPLATE_PASS }} | |
SERVER_EMAIL_DIGEST_PLANS=${{ secrets.SERVER_EMAIL_DIGEST_PLANS }} | |
SERVER_PROXY_API_KEY=${{ secrets.SERVER_PROXY_API_KEY }} | |
SERVER_SENTRY_DSN=${{ secrets.SERVER_SENTRY_DSN }} | |
VERSION=${{github.sha}} | |
AWS_ACCESS_KEY_ID=${{ secrets.SERVER_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY=${{ secrets.SERVER_AWS_SECRET_ACCESS_KEY }} | |
SERVER_CORALOGIX_SERVICE_NAME=${{ vars.SERVER_CORALOGIX_SERVICE_NAME }} | |
SERVER_CORALOGIX_API_KEY=${{secrets.SERVER_CORALOGIX_API_KEY}} | |
SERVER_GEOCODER_API_KEY=${{secrets.SERVER_GEOCODER_API_KEY}} | |
NODE_ENV=production | |
- name: Deploy Amazon ECS task definition | |
uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a | |
with: | |
task-definition: ${{ steps.task-def.outputs.task-definition }} | |
service: ${{ vars.ECS_SERVICE }} | |
cluster: ${{ vars.ECS_CLUSTER }} | |
wait-for-service-stability: true |