garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /deploy/cartopolis-atlas.service

raw

# Cartopolis atlas — map data, terrain tiles and (later) accounts, as it runs on
# code.garage44.eu. `docs/notes/atlas.md` has the design.
#
# Installed at /etc/systemd/system/cartopolis-atlas.service. A native binary under
# systemd, for the reason the simulator is one (see cartopolis-sim.service): the
# Forgejo runner and this host are the same machine, so a deploy is a file copy.
#
# **Its own process and its own user**, never the simulator's: pipeline work and
# terrain cutting are seconds of CPU, and the simulator's runtime is shared with
# the 20 Hz tick. It writes two places: its data directory and the map data tree
# Caddy serves as 3dbag.cartopolis.org. The
# second belongs to `ubuntu` (the TypeScript pipeline wrote it as that user), so
# the service runs with group `ubuntu` and umask 0002: what it creates stays
# writable by the other writers, and the directories it writes into need g+w.
#
# Listens on the docker0 gateway only, like the simulator's HTTP listener, so it
# is reachable from off the machine through Caddy and nothing else.
# `/data/cartopolis/atlas/atlas.toml`:
#
#   listen = "172.17.0.1:4749"
#   data_dir = "/data/cartopolis/atlas/data"
#   upstream_concurrency = 3
#   site_dir = "/data/3dbag/site"
#   admin_api = "http://172.17.0.1:4748"
[Unit]
Description=Cartopolis atlas
Documentation=https://code.garage44.eu/jeroen/cartopolis
After=network-online.target docker.service
Wants=network-online.target

[Service]
Type=simple
User=cartoatlas
Group=ubuntu
UMask=0002
WorkingDirectory=/data/cartopolis/atlas
ExecStart=/data/cartopolis/atlas/atlas --config /data/cartopolis/atlas/atlas.toml
Restart=always
RestartSec=3s
Environment=RUST_LOG=info

ReadWritePaths=/data/cartopolis/atlas/data
ReadWritePaths=/data/3dbag/site
ReadWritePaths=/data/agent/state
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target