Skip to content

Commit

Permalink
Add pipeline job for deployment to production VPS Ubuntu server after…
Browse files Browse the repository at this point in the history
… build testings
  • Loading branch information
dotpep committed Feb 29, 2024
1 parent 25719a4 commit 83c47cc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
29 changes: 23 additions & 6 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Pulling Git Repo
- name: Checkout Pulling Git Repo
uses: actions/checkout@v4

- name: Install Python version 3.10
Expand Down Expand Up @@ -70,11 +70,28 @@ jobs:
# run: echo ${{ steps.docker_build.outputs.digest }}

deploy:
runs-on: ubuntu-20.04
needs: build
steps:
- name: Test deploying steps
run: echo "going to deploy some stuff"
environment:
name: production
runs-on: ubuntu-20.04
needs: build
steps:
- name: Checkout Pulling Git Repo
uses: actions/checkout@v4

- name: Deploy to VPS Ubuntu VM server and Executing ssh commands
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PROD_HOST }}
username: ${{ secrets.PROD_USERNAME }}
password: ${{ secrets.PROD_PASSWORD }}
script: |
cd api/src
git pull
echo ${{ secrets.PROD_PASSWORD }} | sudo -S systemctl restart api
# login to our vps ubuntu server with ssh
# cd api/src
# git pull
# systemctl restart api

#docker:
# runs-on: ubuntu-20.04
Expand Down
3 changes: 2 additions & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
app.include_router(auth.router)

app.get('/', tags=["Welcome Home Page"])(lambda: {
"message": "Welcome to my Social Media API powered by FastAPI, API documentation in '/docs' and `/redoc` endpoint.",
"message": "Welcome to my Social Media API powered by FastAPI, API documentation in '/docs' and `/redoc` endpoint. \
Succesfully deployed to production VPS Ubuntu Server with CI/CD Github Pipline.",
"source_code": "https://github.com/dotpep/social-media-api",
"domain_name": "https://dotpep.xyz/"})

Expand Down

0 comments on commit 83c47cc

Please sign in to comment.