Skip to content

Modular logistics and supply chain operating system (LSOS)

Fix the deploy script. Change the cd accordingly.

Eugene Dementyev8de660d51a25
diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml
index bfb799a6..6b042301 100644
--- a/.github/workflows/cd.yml
+++ b/.github/workflows/cd.yml
@@ -2,11 +2,11 @@ name: Fleetbase CI/CD
on:
push:
- branches: [ "deploy/*" ]
+ branches: ["deploy/*"]
concurrency:
- group: ${{ github.ref }}
- cancel-in-progress: true
+ group: ${{ github.ref }}
+ cancel-in-progress: true
env:
PROJECT: ${{ secrets.PROJECT }}
@@ -17,62 +17,62 @@ jobs:
runs-on: ubuntu-latest
permissions:
id-token: write # This is required for requesting the JWT
- contents: read # This is required for actions/checkout
+ contents: read # This is required for actions/checkout
steps:
- - name: Checkout Code
- uses: actions/checkout@v3
- with:
- submodules: recursive
+ - name: Checkout Code
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v2
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v2
- - name: Set Dynamic ENV Vars
- run: |
+ - name: Set Dynamic ENV Vars
+ run: |
SHORT_COMMIT=$(echo $GITHUB_SHA | cut -c -8)
echo "VERSION=${SHORT_COMMIT}" >> $GITHUB_ENV
echo "STACK=$(basename $GITHUB_REF)" >> $GITHUB_ENV
- - name: Configure AWS Credentials
- uses: aws-actions/configure-aws-credentials@v4
- with:
- role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_NUMBER }}:role/${{ env.PROJECT }}-${{ env.STACK }}-deployer
- role-session-name: github
- aws-region: ${{ secrets.AWS_REGION }}
-
- - name: Login to Amazon ECR
- id: login-ecr
- uses: aws-actions/amazon-ecr-login@v1
-
- - name: Prepare Composer Auth Secret
- run: |
- if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then
- echo '{"github-oauth": {"github.com": "'${{ secrets._GITHUB_AUTH_TOKEN }}'"}}' > composer-auth.json
- else
- echo '{}' > composer-auth.json
- fi
-
- - name: Build and Release
- uses: docker/bake-action@v2
- env:
- REGISTRY: ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT }}-${{ env.STACK }}
- VERSION: ${{ env.VERSION }}
- CACHE: type=gha
- with:
- push: true
- files: |
- ./docker-bake.hcl
-
- - name: Download ecs-tool
- run: |
+ - name: Configure AWS Credentials
+ uses: aws-actions/configure-aws-credentials@v4
+ with:
+ role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_NUMBER }}:role/${{ env.PROJECT }}-${{ env.STACK }}-deployer
+ role-session-name: github
+ aws-region: ${{ secrets.AWS_REGION }}
+
+ - name: Login to Amazon ECR
+ id: login-ecr
+ uses: aws-actions/amazon-ecr-login@v1
+
+ - name: Prepare Composer Auth Secret
+ run: |
+ if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then
+ echo '{"github-oauth": {"github.com": "'${{ secrets._GITHUB_AUTH_TOKEN }}'"}}' > composer-auth.json
+ else
+ echo '{}' > composer-auth.json
+ fi
+
+ - name: Build and Release
+ uses: docker/bake-action@v2
+ env:
+ REGISTRY: ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT }}-${{ env.STACK }}
+ VERSION: ${{ env.VERSION }}
+ CACHE: type=gha
+ with:
+ push: true
+ files: |
+ ./docker-bake.hcl
+
+ - name: Download ecs-tool
+ run: |
wget -O ecs-tool.tar.gz https://github.com/springload/ecs-tool/releases/download/1.9.6/ecs-tool_1.9.6_linux_amd64.tar.gz && tar -xvf ecs-tool.tar.gz ecs-tool
-
- - name: Deploy the images πŸš€
- run: |-
+
+ - name: Deploy the images πŸš€
+ run: |-
set -eu
# run deploy.sh script before deployments
- env "ECS_RUN.SERVICE=app" "ECS_RUN.LAUNCH_TYPE=FARGATE" ./ecs-tool run -l "ecs-tool" --image_tag '{container_name}-${{ env.VERSION }}' --cluster ${{ env.PROJECT }}-${{ env.STACK }} --task_definition ${{ env.PROJECT }}-${{ env.STACK }}-app --container_name app /fleetbase/api/deploy.sh
+ env "ECS_RUN.SERVICE=app" "ECS_RUN.LAUNCH_TYPE=FARGATE" ./ecs-tool run -l "ecs-tool" --image_tag '{container_name}-${{ env.VERSION }}' --cluster ${{ env.PROJECT }}-${{ env.STACK }} --task_definition ${{ env.PROJECT }}-${{ env.STACK }}-app --container_name app ./deploy.sh
./ecs-tool deploy --image_tag '{container_name}-${{ env.VERSION }}' --cluster ${{ env.PROJECT }}-${{ env.STACK }} -s app -s scheduler -s events
build_frontend:
@@ -81,29 +81,29 @@ jobs:
runs-on: ubuntu-latest
permissions:
id-token: write # This is required for requesting the JWT
- contents: read # This is required for actions/checkout
+ contents: read # This is required for actions/checkout
steps:
- - name: Checkout
- uses: actions/checkout@v3
- with:
- submodules: true
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ submodules: true
- - name: Set Dynamic ENV Vars
- run: |
+ - name: Set Dynamic ENV Vars
+ run: |
SHORT_COMMIT=$(echo $GITHUB_SHA | cut -c -8)
echo "VERSION=${SHORT_COMMIT}" >> $GITHUB_ENV
echo "STACK=$(basename $GITHUB_REF)" >> $GITHUB_ENV
- - name: Configure AWS Credentials
- uses: aws-actions/configure-aws-credentials@v2
- with:
- role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_NUMBER }}:role/${{ env.PROJECT }}-${{ env.STACK }}-deployer
- role-session-name: github
- aws-region: ${{ secrets.AWS_REGION }}
+ - name: Configure AWS Credentials
+ uses: aws-actions/configure-aws-credentials@v2
+ with:
+ role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_NUMBER }}:role/${{ env.PROJECT }}-${{ env.STACK }}-deployer
+ role-session-name: github
+ aws-region: ${{ secrets.AWS_REGION }}
- - name: Get infra-provided configuration
- run: |
+ - name: Get infra-provided configuration
+ run: |
set -eu
wget -O- https://github.com/springload/ssm-parent/releases/download/1.8.0/ssm-parent_1.8.0_linux_amd64.tar.gz | tar xvzf - ssm-parent
@@ -112,52 +112,52 @@ jobs:
# remove double quotes and pipe into the env
cat /tmp/dotenv.file | sed -e 's/"//g' >> $GITHUB_ENV
- - name: Install Node.js
- uses: actions/setup-node@v3
- with:
- node-version: 16
-
- - uses: pnpm/action-setup@v2
- name: Install pnpm
- id: pnpm-install
- with:
- version: 8
- run_install: false
-
- - name: Get pnpm Store Directory
- id: pnpm-cache
- shell: bash
- run: |
- echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
-
- - uses: actions/cache@v3
- name: Setup pnpm Cache
- with:
- path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
- key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
- restore-keys: |
- ${{ runner.os }}-pnpm-store-
-
- - name: Check for _GITHUB_AUTH_TOKEN and create .npmrc
- run: |
- if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then
- echo "//npm.pkg.github.com/:_authToken=${{ secrets._GITHUB_AUTH_TOKEN }}" > .npmrc
- fi
- working-directory: ./console
-
- - name: Install dependencies
- run: pnpm install
- working-directory: ./console
-
- - name: Build
- run: |
- set -eu
-
- pnpm build
- working-directory: ./console
-
- - name: Deploy Console πŸš€
- run: |
+ - name: Install Node.js
+ uses: actions/setup-node@v3
+ with:
+ node-version: 16
+
+ - uses: pnpm/action-setup@v2
+ name: Install pnpm
+ id: pnpm-install
+ with:
+ version: 8
+ run_install: false
+
+ - name: Get pnpm Store Directory
+ id: pnpm-cache
+ shell: bash
+ run: |
+ echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
+
+ - uses: actions/cache@v3
+ name: Setup pnpm Cache
+ with:
+ path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
+ key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
+ restore-keys: |
+ ${{ runner.os }}-pnpm-store-
+
+ - name: Check for _GITHUB_AUTH_TOKEN and create .npmrc
+ run: |
+ if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then
+ echo "//npm.pkg.github.com/:_authToken=${{ secrets._GITHUB_AUTH_TOKEN }}" > .npmrc
+ fi
+ working-directory: ./console
+
+ - name: Install dependencies
+ run: pnpm install
+ working-directory: ./console
+
+ - name: Build
+ run: |
+ set -eu
+
+ pnpm build
+ working-directory: ./console
+
+ - name: Deploy Console πŸš€
+ run: |
set -u
DEPLOY_BUCKET=${STATIC_DEPLOY_BUCKET:-${{ env.PROJECT }}-${{ env.STACK }}}
diff --git a/api/deploy.sh b/api/deploy.sh
index 9b88fc13..d4a61eb7 100755
--- a/api/deploy.sh
+++ b/api/deploy.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Exit the script as soon as a command fails
set -e
@@ -16,4 +16,4 @@ php artisan sandbox:migrate --force
php artisan fleetbase:seed
# Restart queue
-php artisan queue:restart
\ No newline at end of file
+php artisan queue:restart