Update uvicorn port #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to EC2 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Create deployment bundle | |
| run: | | |
| set -euo pipefail | |
| tar czf nasa-skyview.tar.gz requirements.txt src web deploy | |
| - name: Upload application bundle | |
| uses: appleboy/scp-action@v0.1.7 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USER }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| source: "nasa-skyview.tar.gz" | |
| target: "/tmp/nasa-skyview" | |
| - name: Deploy to EC2 | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USER }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| script: | | |
| set -euo pipefail | |
| ARCHIVE="/tmp/nasa-skyview/nasa-skyview.tar.gz" | |
| APP_SRC="/tmp/nasa-skyview/app" | |
| INSTALL_DIR="${{ secrets.EC2_INSTALL_DIR || '/opt/nasa-skyview' }}" | |
| PYTHON_BIN="${{ secrets.EC2_PYTHON_BIN || 'python3' }}" | |
| rm -rf "$APP_SRC" | |
| mkdir -p "$APP_SRC" | |
| tar xzf "$ARCHIVE" -C "$APP_SRC" | |
| chmod +x "$APP_SRC/deploy/deploy.sh" | |
| "$APP_SRC/deploy/deploy.sh" "$APP_SRC" "$INSTALL_DIR" "$PYTHON_BIN" | |
| rm -rf "$APP_SRC" "$ARCHIVE" |