Skip to content

Commit

Permalink
refactor: deploy backend documentation to server
Browse files Browse the repository at this point in the history
Took 27 minutes
  • Loading branch information
rokartur committed Jun 21, 2024
1 parent a8193fb commit 2680eee
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 22 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,57 @@ jobs:
screen -S fitplanconnect-backend -X quit
screen -S fitplanconnect-backend -d -m bun run dev
exit
deploy-backend-docs:
name: Deploy Backend Documentation
runs-on: ubuntu-latest
environment: production

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Remove old files from server
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_SERVER_NAME }}
username: ${{ secrets.SSH_SERVER_USERNAME }}
password: ${{ secrets.SSH_SERVER_PASS }}
port: ${{ secrets.SSH_SERVER_PORT }}
script: |
rm -rf ${{ secrets.SSH_SERVER_BACKEND_DOCS_PATH }}*
- name: Deploy backend docs to server
uses: wlixcc/[email protected]
with:
username: ${{ secrets.SSH_SERVER_USERNAME }}
server: ${{ secrets.SSH_SERVER_NAME }}
port: ${{ secrets.SSH_SERVER_PORT }}
password: ${{ secrets.SSH_SERVER_PASS }}
local_path: "./backend/*"
remote_path: ${{ secrets.SSH_SERVER_BACKEND_DOCS_PATH }}

- name: Create .env file
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_SERVER_NAME }}
username: ${{ secrets.SSH_SERVER_USERNAME }}
password: ${{ secrets.SSH_SERVER_PASS }}
port: ${{ secrets.SSH_SERVER_PORT }}
script: |
cd ${{ secrets.SSH_SERVER_BACKEND_DOCS_PATH }}
echo -e 'OAUTH_CLIENT_ID="${{ secrets.OAUTH_CLIENT_ID }}"\nOAUTH_CLIENT_SECRET="${{ secrets.OAUTH_CLIENT_SECRET }}"\nOAUTH_REDIRECT_URI="${{ secrets.OAUTH_REDIRECT_URI }}"\nDB_URL="${{ secrets.DB_URL }}"\nSTRIPE_PUBLISHABLE_KEY="${{ secrets.STRIPE_PUBLISHABLE_KEY }}"\nSTRIPE_SECRET_KEY="${{ secrets.STRIPE_SECRET_KEY }}"\nSTRIPE_SUCCESS_KEY="${{ secrets.STRIPE_SUCCESS_KEY }}"' > .env
- name: Run backend documentation
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_SERVER_NAME }}
username: ${{ secrets.SSH_SERVER_USERNAME }}
password: ${{ secrets.SSH_SERVER_PASS }}
port: ${{ secrets.SSH_SERVER_PORT }}
script: |
cd ${{ secrets.SSH_SERVER_BACKEND_PATH }}
bun install
screen -S fitplanconnect-backend-docs -X quit
screen -S fitplanconnect-backend-docs -d -m bun run dev
exit
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ FitPlan Connect is a scheduling app that has earned recognition as one of the be
## 🇵🇱 Summary


## Resources
- [Website](https://fitplanconnect.site/)
- [Documentation](https://fitplanconnect.site/docs)
- [API](https://fitplanconnect.site/api)
- [GitHub](https://github.com/rokartur/fitplanconnect)
- [Figma Design](https://www.figma.com/design/EDRxiPZHsJCeHKlrh08gsY/fitplanconnect?node-id=0-1&t=V9B6evOnen69xHga-1)
- [Figma Concept](https://www.figma.com/board/RMC8nNxTpV9zmUGCyHQcvy/fitplanconnect?node-id=0-1&t=5IN80e5pnA5W9Tyq-1)

## License
[“Commons Clause” License Condition v1.0](https://github.com/rokartur/fitplanconnect/?tab=License-1-ov-file)

Expand Down
16 changes: 8 additions & 8 deletions backend/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const app = new Elysia()
.use(Logestic.preset('common'))
.use(cors())
.use(swagger({
path: '/api/docs',
path: '/swagger',
documentation: {
info: {
title: 'FitPlan Connect API Documentation',
Expand All @@ -19,13 +19,13 @@ const app = new Elysia()
}
}))
.use(compression())
// .use(
// rateLimit({
// max: 20,
// duration: 300000,
// responseMessage: 'Too many requests, please try again later.',
// }),
// )
.use(
rateLimit({
max: 50,
duration: 300000,
responseMessage: 'Too many requests, please try again later.',
}),
)
.use(
autoload({
prefix: '/api',
Expand Down
14 changes: 0 additions & 14 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@ http {
proxy_set_header Connection "upgrade";
}

location /api/docs {
proxy_pass http://0.0.0.0:7702/docs;
client_max_body_size 4M;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

proxy_pass_request_headers on;
proxy_set_header Host 0.0.0.0:7702;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}

location /api/ {
proxy_pass http://0.0.0.0:7702/api/;
client_max_body_size 4M;
Expand Down

0 comments on commit 2680eee

Please sign in to comment.