Skip to content

Commit dbb943e

Browse files
committed
Remove binding to port 80 from deploy script.
1 parent 1db2da4 commit dbb943e

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

deploy/nasaspaceapps.service.template

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@ ExecStart=/opt/nasa-sky-explorer/.venv/bin/uvicorn src.server:app --host 0.0.0.0
1212
Restart=always
1313
RestartSec=10
1414

15+
# Capability to bind to port 80
16+
AmbientCapabilities=CAP_NET_BIND_SERVICE
17+
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
18+
1519
# Security hardening
1620
NoNewPrivileges=true
1721
PrivateTmp=true
1822
ProtectHome=true
19-
ReadWritePaths=/opt/nasa-sky-explorer/logs
2023

2124
# Logging
22-
StandardOutput=append:/opt/nasa-sky-explorer/logs/uvicorn.log
23-
StandardError=append:/opt/nasa-sky-explorer/logs/uvicorn.log
25+
StandardOutput=journal
26+
StandardError=journal
27+
SyslogIdentifier=nasaspaceapps
2428

2529
[Install]
2630
WantedBy=multi-user.target

deploy/remote_deploy.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,8 @@ pip install -r requirements.txt
3131
deactivate || true
3232
EOSCRIPT
3333

34-
# Apply capability to allow binding to port 80 (if port < 1024)
35-
if [ "${UVICORN_PORT}" -lt 1024 ]; then
36-
REAL_PYTHON=$(readlink -f "${APP_DIR}/.venv/bin/python")
37-
if [ -f "${REAL_PYTHON}" ]; then
38-
echo "Applying cap_net_bind_service to ${REAL_PYTHON}..."
39-
setcap 'cap_net_bind_service=+ep' "${REAL_PYTHON}" || echo "Warning: Failed to set capability"
40-
fi
41-
fi
34+
# Note: Port 80 binding is handled by systemd AmbientCapabilities
35+
# No need to set capabilities on the Python binary
4236

4337
LOG_DIR="${APP_DIR}/logs"
4438
mkdir -p "${LOG_DIR}"

0 commit comments

Comments
 (0)