Code servicing IEM API requests. Requires python 3.11+. Utilizes database schema found with akrherz/iem-database.
This repository includes a systemd unit template for running the published GHCR image with Podman:
config/systemd/iem-web-services-podman.serviceconfig/systemd/iemws.env.example
- Podman installed (
/usr/bin/podman). - Host paths available:
/mesonet/data(mounted read-only into container at same path)/mnt/mesonet2(mounted read-only for symlink targets under/mesonet/data)/opt/bufkit(mounted read-only into container at same path)- host syslog socket (default
/dev/log) if telemetry is emitted via syslog
- Configure publish binding in
iemws.env:- local proxy on same host:
PUBLISH_HOST=127.0.0.1 - proxy on remote host:
PUBLISH_HOST=0.0.0.0or a specific interface IP
- local proxy on same host:
- Create runtime env file:
sudo mkdir -p /etc/iem-web-services
sudo cp config/systemd/iemws.env.example /etc/iem-web-services/iemws.env
sudo $EDITOR /etc/iem-web-services/iemws.envUse per-database host variables in iemws.env for sharded deployments (for
example IEMWS_DBHOST_MESOSITE, IEMWS_DBHOST_IEM, IEMWS_DBHOST_POSTGIS).
- Create a Podman secret from your shard-aware PostgreSQL passfile:
install -m 600 /path/to/pgpass /tmp/iemws.pgpass
sudo podman secret create iemws-pgpass /tmp/iemws.pgpass
rm -f /tmp/iemws.pgpassSet PGPASS_SECRET in iemws.env if you use a different secret name.
Set PUBLISH_HOST and PUBLISH_PORT in iemws.env to control where Podman
publishes the API port.
Telemetry emitted via pyiem.webutil.write_telemetry() should usually go to the
host rsyslog socket, not directly to the centralized collector. This keeps relay
policy, buffering, and forwarding centralized on the host. The systemd unit bind
mounts SYSLOG_SOCKET to /dev/log inside the container.
- Install and enable the service:
sudo cp config/systemd/iem-web-services-podman.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now iem-web-services-podman.service- Verify:
sudo systemctl status iem-web-services-podman.service
sudo journalctl -u iem-web-services-podman.service -f
curl -sS http://127.0.0.1:8000/api/1/servertime.jsonThe unit pulls ghcr.io/akrherz/iem-web-services:latest on each restart.
sudo systemctl restart iem-web-services-podman.service