thermograph/terraform/modules/thermograph-host/templates/thermograph.env.tftpl
Emi Griffith a26ca72834 Self-host the ERA5 archive via Open-Meteo (object storage) (#224)
Get the 45-year historical record off the rate-limited public Open-Meteo
archive API by running a private Open-Meteo instance that serves the
era5_seamless blend (0.1° ERA5-Land + 0.25° ERA5 for gusts) from the
compressed .om archive in object storage, mounted on the host with rclone.

- climate.py: make ARCHIVE_URL env-driven (THERMOGRAPH_ARCHIVE_URL) and pin
  models=era5_seamless on the archive fetches only, so a self-hosted instance
  serves the same 0.1° resolution; forecast path unchanged. The public API's
  default is already seamless, so dev/beta (URL unset) behave identically.
- docker-compose.openmeteo.yml: open-meteo-api + two rolling sync workers
  (era5_land 0.1°, era5 0.25° for gusts), bind-mounting the object-storage
  mount; the overlay points the app at the local instance.
- Makefile: om-up / om-down / om-backfill (one-time full-history backfill).
- Terraform: per-host openmeteo flag layers the overlay, renders OM_DATA_DIR,
  and provisions the host rclone systemd mount from the bucket credentials.
- deploy/openmeteo: operator runbook + rclone mount unit template.
2026-07-20 13:16:56 +00:00

96 lines
3.5 KiB
Text

# /etc/thermograph.env — RENDERED BY TERRAFORM. Do not edit on the host; change the
# tfvars and re-apply. Read by `docker compose` (interpolation) and loaded into the
# app container (env_file in docker-compose.yml). Mirrors deploy/thermograph.env.example.
# Port uvicorn binds inside the container (compose publishes it on the host).
PORT=${app_port}
# --- PostgreSQL (docker-compose stack) ------------------------------------------
# Initializes the db container AND builds the app's THERMOGRAPH_DATABASE_URL.
POSTGRES_PASSWORD=${postgres_password}
# Provided explicitly for parity with the example; the app service also derives this
# from POSTGRES_PASSWORD in docker-compose.yml.
THERMOGRAPH_DATABASE_URL=${database_url}
# --- Container sizing (consumed by docker-compose.yml interpolation) -------------
# Terraform sizes the containers per host. Defaults in compose are 4 / 4 / 2 / 8g.
WORKERS=${workers}
APP_CPUS=${app_cpus}
DB_CPUS=${db_cpus}
DB_MEMORY=${db_memory}
%{ if openmeteo ~}
# --- Self-hosted Open-Meteo archive (docker-compose.openmeteo.yml) ---------------
# Host rclone mount of the ERA5 object-storage bucket; the overlay bind-mounts it
# into the Open-Meteo containers. THERMOGRAPH_ARCHIVE_URL is set by the overlay.
OM_DATA_DIR=${om_data_dir}
%{ endif ~}
# --- Serving --------------------------------------------------------------------
THERMOGRAPH_BASE=${base}
THERMOGRAPH_BASE_URL=${base_url}
# Secure cookie is only sent over HTTPS: 1 behind Caddy TLS, 0 on a plain-HTTP host.
THERMOGRAPH_COOKIE_SECURE=${cookie_secure}
# --- Auth -----------------------------------------------------------------------
# Signs email-confirm / password-reset tokens; pinned so links survive restarts.
THERMOGRAPH_AUTH_SECRET=${auth_secret}
# --- Web Push (VAPID) -----------------------------------------------------------
# Pinned so existing browser subscriptions keep receiving across restarts.
THERMOGRAPH_VAPID_PRIVATE_KEY=${vapid_private_key}
THERMOGRAPH_VAPID_PUBLIC_KEY=${vapid_public_key}
%{ if vapid_contact != "" ~}
THERMOGRAPH_VAPID_CONTACT=${vapid_contact}
%{ endif ~}
# --- SEO verification (optional) ------------------------------------------------
%{ if google_verify != "" ~}
THERMOGRAPH_GOOGLE_VERIFY=${google_verify}
%{ endif ~}
%{ if bing_verify != "" ~}
THERMOGRAPH_BING_VERIFY=${bing_verify}
%{ endif ~}
# --- Outbound email (optional) --------------------------------------------------
%{ if mail_backend != "" ~}
THERMOGRAPH_MAIL_BACKEND=${mail_backend}
%{ endif ~}
%{ if smtp_host != "" ~}
THERMOGRAPH_SMTP_HOST=${smtp_host}
%{ endif ~}
%{ if smtp_port != "" ~}
THERMOGRAPH_SMTP_PORT=${smtp_port}
%{ endif ~}
%{ if smtp_user != "" ~}
THERMOGRAPH_SMTP_USER=${smtp_user}
%{ endif ~}
%{ if smtp_password != "" ~}
THERMOGRAPH_SMTP_PASSWORD=${smtp_password}
%{ endif ~}
%{ if smtp_starttls != "" ~}
THERMOGRAPH_SMTP_STARTTLS=${smtp_starttls}
%{ endif ~}
%{ if mail_from != "" ~}
THERMOGRAPH_MAIL_FROM=${mail_from}
%{ endif ~}
%{ if mail_reply_to != "" ~}
THERMOGRAPH_MAIL_REPLY_TO=${mail_reply_to}
%{ endif ~}
# --- Discord (optional) ---------------------------------------------------------
%{ if discord_webhook != "" ~}
THERMOGRAPH_DISCORD_WEBHOOK=${discord_webhook}
%{ endif ~}
%{ if discord_public_key != "" ~}
THERMOGRAPH_DISCORD_PUBLIC_KEY=${discord_public_key}
%{ endif ~}
%{ if discord_app_id != "" ~}
THERMOGRAPH_DISCORD_APP_ID=${discord_app_id}
%{ endif ~}
%{ if discord_bot_token != "" ~}
THERMOGRAPH_DISCORD_BOT_TOKEN=${discord_bot_token}
%{ endif ~}
%{ if discord_client_secret != "" ~}
THERMOGRAPH_DISCORD_CLIENT_SECRET=${discord_client_secret}
%{ endif ~}