Skip to content

Update main.py

Update main.py #10

Workflow file for this run

name: Deploy to H100
on:
push:
branches: [ main ]
paths:
- 'backend/**'
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install sshpass
run: sudo apt-get install -y sshpass
- name: Deploy with rsync
env:
SSH_PASS: ${{ secrets.SSH_PASSWORD }}
run: |
sshpass -p "$SSH_PASS" rsync -avz --delete \
-e "ssh -o StrictHostKeyChecking=no" \
--exclude '.env' \
--exclude 'venv/' \
--exclude '__pycache__/' \
--exclude '*.pyc' \
./backend/ [email protected]:/home/ubuntu/backend/
- name: Setup and install dependencies
env:
SSH_PASS: ${{ secrets.SSH_PASSWORD }}
run: |
sshpass -p "$SSH_PASS" ssh -o StrictHostKeyChecking=no [email protected] '
sudo apt-get update && \
sudo apt-get install -y python3-venv && \
cd /home/ubuntu/backend && \
python3 -m venv venv && \
source venv/bin/activate && \
pip install -r requirements.txt && \
# Kill any existing uvicorn process
pkill -f uvicorn || true && \
# Start the server in the background
nohup uvicorn main:app --host 0.0.0.0 --port 8000 > server.log 2>&1 &
'