Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Seasight Impact Layers — Nginx Service

Nginx service on a Debian VPS that serves tidal impact GeoJSON files for the Seasight application. The Seasight FastAPI backend proxies requests to this service via the GEOJSON_VPS_URL environment variable.

Prerequisites

  • Debian VPS with root/sudo access
  • nginx already installed and running (port 80 is in use)
  • GeoJSON files already present at /home/apps/seasight/impact-layers/shapefiles_v1/

Expected VPS directory structure

/home/apps/seasight/impact-layers/shapefiles_v1/
├── Regions/
│   └── coastal_lsg.geojson
├── Coastal_Buildings/
│   └── building_alp_*.geojson
├── Coastal_Roads/
│   └── roads_alp_*.geojson
├── Coastal_Landcover/
│   └── latest_alp_*.geojson
└── Flood_Inundation/
    └── elevation_nowater_alp_*.geojson

Setup

1. Copy files to VPS

From your local machine (in this directory):

scp -r nginx/ scripts/ systemd/ root@<vps-ip>:/tmp/seasight-layers-setup/

2. Run setup script on VPS

ssh root@<vps-ip>
cd /tmp/seasight-layers-setup
bash scripts/setup-vps.sh

The script will:

  1. Verify nginx is installed and the layers directory exists
  2. Copy seasight-layers.conf to /etc/nginx/sites-available/
  3. Symlink it to /etc/nginx/sites-enabled/
  4. Install seasight-layers-ctl to /usr/local/bin/
  5. Install and enable seasight-layers.service
  6. Test the nginx config
  7. Reload nginx

3. Verify

# Directory listing (JSON)
curl http://localhost:8080/layers/

# Individual file
curl http://localhost:8080/layers/Regions/coastal_lsg.geojson

4. Configure Seasight backend

Set the GEOJSON_VPS_URL environment variable in the Seasight backend:

GEOJSON_VPS_URL=http://<vps-ip>:8080/layers

The backend endpoints map as follows:

Backend endpoint VPS URL
GET /layers http://<vps-ip>:8080/layers/
GET /layers/Coastal_Buildings/building_alp_0_50.geojson http://<vps-ip>:8080/layers/Coastal_Buildings/building_alp_0_50.geojson

Files

layers/
├── README.md                          # This file
├── nginx/
│   └── seasight-layers.conf           # nginx server block config
├── scripts/
│   └── setup-vps.sh                   # Run on VPS to deploy
└── systemd/
    ├── seasight-layers.service         # systemd unit (start/stop/status)
    └── seasight-layers-ctl             # Control script for the service

Managing the Service

systemctl start seasight-layers      # Enable site + reload nginx
systemctl stop seasight-layers       # Disable site + reload nginx
systemctl status seasight-layers     # Check if active
seasight-layers-ctl reload           # Reload nginx config

HTTPS (Future)

When a domain is configured for the VPS:

  1. Point DNS to the VPS IP
  2. Install certbot: apt install certbot python3-certbot-nginx
  3. Run: certbot --nginx -d <domain>
  4. Update GEOJSON_VPS_URL to use https://

Troubleshooting

  • 403 on listing: Check that /home/apps/seasight/impact-layers/shapefiles_v1/ exists and is readable by nginx
  • Port 8080 already in use: Check ss -tlnp | grep 8080 and stop the conflicting service
  • nginx won't reload: Run nginx -t to see the exact config error
  • CORS errors in browser: Verify the add_header directives are present in the nginx config

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages