A train to your services.
trainman is a small HTTP service you run on your local network. It listens on
port 80 and maps short paths like /foo to full URLs like
http://192.168.1.10:8080, answering with a redirect. Point a DNS entry such
as go at the machine running trainman, and typing go/foo in the browser
takes you straight to the mapped local URL.
From Dockerhub:
docker run --rm -p 80:8080 ricmaco/trainman
Or build it yourself:
docker build -t trainman .
docker run --rm -p 80:8080 trainman
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
sudo mkdir -p /opt/trainman /var/lib/trainman
sudo useradd --system --home /opt/trainman trainman || true
sudo git clone https://git.sr.ht/~ricmaco/trainman /opt/trainman
sudo chown -R trainman:trainman /opt/trainman /var/lib/trainman
sudo -u trainman bash -c 'cd /opt/trainman && uv sync --locked --no-dev'
sudo tee /etc/trainman.env <<'EOF'
TRAINMAN_HOST=0.0.0.0
TRAINMAN_PORT=80
TRAINMAN_DB_PATH=/var/lib/trainman/trainman.db
EOF
sudo cp /opt/trainman/trainman.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now trainman
Visit the admin page at http://<host>/admin in a browser to manage url mappings.
Set your DNS to resolv go to <host>, then you can point your browser to
go/... to check that everything is working.
uv sync
uv run trainman
To build:
uv build
To launch tests:
uv run pytest
Lint, format and check types:
uv run ruff check src test
uv run ruff format src test
uv run ty check src test
This project is licensed under the MIT License. See LICENSE for details.
Content type
Image
Digest
sha256:da806d5fe…
Size
30.1 MB
Last updated
26 days ago
docker pull ricmaco/trainman