File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
117117Logs are written to ` /var/log/nasa-skyview.log ` and ` /var/log/nasa-skyview.err ` , and cached SkyView tiles persist in ` /opt/nasa-skyview/outputs ` .
Original file line number Diff line number Diff line change @@ -42,9 +42,27 @@ mkdir -p "$OUTPUT_DIR"
4242sudo touch " $LOG_DIR /nasa-skyview.log" " $LOG_DIR /nasa-skyview.err"
4343sudo 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
4967sudo systemctl daemon-reload
5068sudo systemctl enable nasa-skyview.service
You can’t perform that action at this time.
0 commit comments