Skip to content

Commit 1db2da4

Browse files
committed
Remove systemd strict rules
1 parent 13b06ee commit 1db2da4

2 files changed

Lines changed: 57 additions & 3 deletions

File tree

deploy/nasaspaceapps.service.template

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ RestartSec=10
1515
# Security hardening
1616
NoNewPrivileges=true
1717
PrivateTmp=true
18-
ProtectSystem=strict
1918
ProtectHome=true
2019
ReadWritePaths=/opt/nasa-sky-explorer/logs
2120

docs/OPS_REFERENCE.md

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,19 @@ sudo ss -ltnp 'sport = :80'
5050
# Check all listening ports
5151
sudo ss -ltnp
5252

53-
# Test local connectivity
53+
# Test local connectivity (use GET, not HEAD)
54+
curl http://localhost/
55+
56+
# HEAD requests return 405 - this is normal!
5457
curl -I http://localhost/
58+
# Returns: HTTP/1.1 405 Method Not Allowed (expected behavior)
5559

5660
# Test from outside (replace with your IP)
57-
curl -I http://YOUR_EC2_IP/
61+
curl http://YOUR_EC2_IP/
5862
```
5963

64+
**Note:** The FastAPI root endpoint only accepts GET requests. If you use `curl -I` (HEAD request), you'll get a 405 "Method Not Allowed" response. This doesn't mean the app is broken - use `curl http://localhost/` instead to see the actual HTML response.
65+
6066
## Application Directory
6167

6268
```bash
@@ -119,6 +125,55 @@ cat /opt/nasa-sky-explorer/.github/workflows/deploy.yml
119125

120126
## Troubleshooting
121127

128+
### SystemD service fails but app is running
129+
130+
If `systemctl status` shows the service failing, but the app responds on port 80:
131+
132+
```bash
133+
# Check what process is actually running
134+
ps aux | grep uvicorn
135+
sudo ss -ltnp 'sport = :80'
136+
```
137+
138+
**Cause:** The systemd service failed to start, so the deploy script's fallback nohup process is running instead.
139+
140+
**Solution:** Fix the systemd service and restart properly:
141+
142+
```bash
143+
# 1. Stop the fallback process
144+
sudo pkill -f "uvicorn src.server:app"
145+
146+
# 2. Update the service file (if needed after a deploy)
147+
sudo cp /opt/nasa-sky-explorer/deploy/nasaspaceapps.service.template \
148+
/etc/systemd/system/nasaspaceapps.service
149+
150+
# 3. Reload and restart
151+
sudo systemctl daemon-reload
152+
sudo systemctl restart nasaspaceapps.service
153+
154+
# 4. Check it's working
155+
sudo systemctl status nasaspaceapps.service
156+
```
157+
158+
### curl returns "405 Method Not Allowed"
159+
160+
If `curl -I http://localhost/` returns HTTP 405:
161+
162+
```bash
163+
curl -I http://localhost/
164+
# HTTP/1.1 405 Method Not Allowed
165+
# allow: GET
166+
```
167+
168+
**This is normal!** The FastAPI root endpoint only accepts GET requests, not HEAD requests.
169+
170+
**Solution:** Use a GET request instead:
171+
172+
```bash
173+
curl http://localhost/
174+
# Should return HTML content
175+
```
176+
122177
### Application won't start
123178

124179
```bash

0 commit comments

Comments
 (0)