Skip to content

Commit 8fe3f8c

Browse files
committed
Fix CI/CD
1 parent caf53cc commit 8fe3f8c

2 files changed

Lines changed: 22 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Populate these secrets so `.github/workflows/deploy.yml` can transfer the code a
111111
- Copies the code into `/opt/nasa-skyview/app`.
112112
- Creates/updates a Python virtual environment in `/opt/nasa-skyview/venv`.
113113
- Installs Python dependencies with `pip`.
114-
- Installs/updates the systemd unit file `deploy/nasa-skyview.service`.
114+
- Generates a fresh `/etc/systemd/system/nasa-skyview.service` tailored to the install paths.
115115
- Restarts the `nasa-skyview` service (serving on port 8000 by default).
116116

117117
Logs are written to `/var/log/nasa-skyview.log` and `/var/log/nasa-skyview.err`, and cached SkyView tiles persist in `/opt/nasa-skyview/outputs`.

deploy/deploy.sh

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,27 @@ mkdir -p "$OUTPUT_DIR"
4242
sudo touch "$LOG_DIR/nasa-skyview.log" "$LOG_DIR/nasa-skyview.err"
4343
sudo chown "$USER":"$USER" "$LOG_DIR/nasa-skyview.log" "$LOG_DIR/nasa-skyview.err"
4444

45-
sudo cp "$SOURCE_DIR/deploy/nasa-skyview.service" "$SERVICE_FILE"
46-
sudo sed -i "s|@@APP_DIR@@|$APP_DIR|g" "$SERVICE_FILE"
47-
sudo sed -i "s|@@VENV_DIR@@|$VENV_DIR|g" "$SERVICE_FILE"
45+
sudo tee "$SERVICE_FILE" >/dev/null <<EOF
46+
[Unit]
47+
Description=NASA SkyView Prototype
48+
After=network-online.target
49+
Wants=network-online.target
50+
51+
[Service]
52+
Type=simple
53+
WorkingDirectory=$APP_DIR
54+
Environment=PYTHONUNBUFFERED=1
55+
Environment=UVICORN_PORT=8000
56+
ExecStartPre=/usr/bin/mkdir -p $OUTPUT_DIR
57+
ExecStart=$VENV_DIR/bin/uvicorn src.server:app --host 0.0.0.0 --port \${UVICORN_PORT}
58+
Restart=on-failure
59+
RestartSec=5
60+
StandardOutput=append:$LOG_DIR/nasa-skyview.log
61+
StandardError=append:$LOG_DIR/nasa-skyview.err
62+
63+
[Install]
64+
WantedBy=multi-user.target
65+
EOF
4866

4967
sudo systemctl daemon-reload
5068
sudo systemctl enable nasa-skyview.service

0 commit comments

Comments
 (0)