docker container with website for Hanami's birth pool
  • JavaScript 69.8%
  • HTML 20%
  • CSS 5.7%
  • Dockerfile 4.5%
Find a file
2025-09-05 01:06:50 -05:00
frontend Initial docker files upload 2025-09-05 01:03:59 -05:00
docker-compose.yml Initial docker files upload 2025-09-05 01:06:50 -05:00
Dockerfile Initial docker files upload 2025-09-05 00:54:51 -05:00
package.json Initial docker files upload 2025-09-05 00:33:34 -05:00
README.md Initial docker files upload 2025-09-05 00:58:59 -05:00
server.js Initial docker files upload 2025-09-05 00:33:34 -05:00

Hanami Birthday Pool — Dockerized

One-container Express + SQLite app that serves both the frontend and a small API. Static site is under /hanami-pool, API is under /hanami-pool-api. Designed to sit behind your existing NGINX reverse proxy.

Quick start

cd hanami-pool
cp .env.sample .env   # set ADMIN_TOKEN
docker compose up -d --build

Local test: http://localhost:8080/hanami-pool

Persistent data

SQLite database stored in a docker volume named hanami_pool_data. Data path in container: /app/data/hanami.db.

Admin

  • Visit /hanami-pool/admin/
  • Enter the admin token (set ADMIN_TOKEN in .env)
  • You can delete entries and export CSV
  • API requires header x-admin-token: <token>

NGINX reverse proxy example

Make sure you do prefix locations (not exact) and include trailing slashes to avoid rewrite loops.


upstream hanami_pool_upstream {
    server 10.0.0.194:8080;  # assuming upstream on 10.0.0.194:8080, replace with actual docker IP
    keepalive 32;
}

# serve frontend under /hanami-pool/ (note the slash) 
location ^~ /hanami-pool/ {
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_pass http://hanami_pool_upstream/hanami-pool/;
}

# API under /hanami-pool-api/
location ^~ /hanami-pool-api/ {
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_pass http://hanami_pool_upstream/hanami-pool-api/;
}

Common gotcha: avoid an exact location = /hanami-pool with another location /hanami-pool/ — that triggers the error you saw. Use only the ^~ /hanami-pool/ prefix form above.

Env vars

  • ADMIN_TOKEN (required): token for admin actions
  • BASE_PATH (optional, default /hanami-pool): where the frontend is mounted
  • API_BASE (optional, default /hanami-pool-api): API mount

Backup / Restore

  • Backup: docker run --rm -v hanami_pool_data:/data -v $PWD:/backup alpine sh -lc 'cp -a /data/* /backup/'
  • Restore: reverse the copy into a fresh volume.

Update

  • Pull any changes, then: docker compose pull && docker compose up -d --build

env sample

ADMIN_TOKEN=super-secret-admin-token
BASE_PATH=/hanami-pool
API_BASE=/hanami-pool-api
TZ=America/Chicago
BASE_PATH=/
API_BASE=/hanami-pool-api

Made for Seans home-lab. 🌸