Skip to content

Commit

Permalink
Merge pull request #88 from coolworld2049/microservices-k8s
Browse files Browse the repository at this point in the history
Microservices k8s
  • Loading branch information
coolworld2049 authored Jun 2, 2023
2 parents 34fc236 + 8844e35 commit 0a1fc57
Show file tree
Hide file tree
Showing 124 changed files with 5,472 additions and 269,059 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
PROJECT_NAME=fastapi-ecommerce
STAGE=prod

DOCKER_USER=coolworldocker
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '19 20 * * target_db'
- cron: '19 20 * * 3'

jobs:
analyze:
Expand Down
113 changes: 59 additions & 54 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,59 @@
#file: noinspection YAMLSchemaValidation
name: Deploy
on:
pull_request:
branches:
- master
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build images and publish to registry
run: |
echo "${{ secrets.ENV_FILE }}" > .env
echo "${{ secrets.AUTH_SERVICE_ENV_FILE }}" > src/auth_service/.env.prod
echo "${{ secrets.STORE_SERVICE_ENV_FILE }}" > src/store_service/.env.prod
export STAGE=test
cd hack
bash cpenv.sh
bash artifact.sh
bash start.sh
cd ..
build:
name: Production Deployment
needs: [ test ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: scp-action
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_USERNAME }}
port: ${{ secrets.SSH_PORT }}
password: ${{ secrets.SERVER_PASSWORD }}
source: "."
target: "/root/fastapi_ecommerce/"

- name: source_db.sh
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_USERNAME }}
port: ${{ secrets.SSH_PORT }}
password: ${{ secrets.SERVER_PASSWORD }}
script: |
cd /root/fastapi_ecommerce/
echo "${{ secrets.ENV_FILE }}" > .env
echo "${{ secrets.AUTH_SERVICE_ENV_FILE }}" > src/auth_service/.env.prod
echo "${{ secrets.STORE_SERVICE_ENV_FILE }}" > src/store_service/.env.prod
cd hack
bash cpenv.sh
bash restart.sh
##file: noinspection YAMLSchemaValidation
#name: Deploy
#on:
# pull_request:
# branches:
# - master
#jobs:
# test:
# name: Test
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Build images and publish to registry
# run: |
# echo "${{ secrets.ENV_FILE }}" > .env
# echo "${{ secrets.AUTH_SERVICE_ENV_FILE }}" > src/auth_service/.env.prod
# echo "${{ secrets.STORE_SERVICE_ENV_FILE }}" > src/store_service/.env.prod
# export STAGE=test
# cd hack
# bash convert.sh
# source ../.env
# bash artifact.sh -u $DOCKER_USER -p $DOCKER_PASSWORD --docker
# bash artifact.sh -u $PYPI_USER -p $PYPI_PASSWORD --pypi
# cd ../deployment/compose/
# bash start.sh
# cd ../../..
# build:
# name: Production Deployment
# needs: [ test ]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: scp-action
# uses: appleboy/scp-action@master
# with:
# host: ${{ secrets.SERVER_IP }}
# username: ${{ secrets.SERVER_USERNAME }}
# port: ${{ secrets.SSH_PORT }}
# password: ${{ secrets.SERVER_PASSWORD }}
# source: "."
# target: "/root/fastapi_ecommerce/"
#
# - name: start
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.SERVER_IP }}
# username: ${{ secrets.SERVER_USERNAME }}
# port: ${{ secrets.SSH_PORT }}
# password: ${{ secrets.SERVER_PASSWORD }}
# script: |
# cd /root/fastapi_ecommerce/
# echo "${{ secrets.ENV_FILE }}" > .env
# echo "${{ secrets.AUTH_SERVICE_ENV_FILE }}" > src/auth_service/.env.prod
# echo "${{ secrets.STORE_SERVICE_ENV_FILE }}" > src/store_service/.env.prod
# cd hack
# bash convert.sh
# cd ../deployment/compose/
# bash restart.sh
# cd ../../..
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,4 @@ cython_debug/
/.generated/
!/databases/auth_service_postgresql/dumps/tmp/.s.PGSQL.5432.lock
/monitoring/pmm_server/.volumes/
!/deployment/k8s/k8s/values.yaml
14 changes: 14 additions & 0 deletions .idea/dataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0a1fc57

Please sign in to comment.