Deploy traccar-template
Traccar GPS tracking: web UI, TCP device ingest, MySQL — one-click deploy.
MySQL
Just deployed
/var/lib/mysql
Just deployed
/opt/traccar/data
Traccar — Self-Hosted GPS Tracking on Railway
One-click Traccar, the open-source GPS tracking platform that speaks 150+ device protocols. This template provisions the production pattern: the Traccar web UI and API on your Railway domain, device ingest (OsmAnd protocol, TCP 5055) published through a Railway TCP proxy, and a MySQL database for persistence. All secrets are generated per deploy and the whole stack needs zero deploy-form inputs — click deploy, log in, add your devices.
What you get
traccar— official imagetraccar/traccar:6.15.3-alpinewith a small boot wrapper that waits for MySQL, creates the database, seeds the default admin, and persists logs. Web UI/API on port 8082, mapped to your Railway domain. Device ingest runs through a Railway TCP proxy (host:port shown in the service Variables tab as RAILWAY_TCP_PROXY_DOMAIN / RAILWAY_TCP_PROXY_PORT) speaking the OsmAnd HTTP protocol at the /client-proxy/ path.MySQL— Railway's MySQL 8 plugin with a persistent volume; Traccar connects over Railway's private network in env-var mode (CONFIG_USE_ENVIRONMENT_VARIABLES=true with a referenced JDBC URL), the recommended production setup. The traccar database is created automatically on first boot.
First steps after deploying
- Open your Railway domain and log in with
admin/admin. - Change the admin password immediately (Account screen). Do not skip this — the default is public knowledge.
- In the UI, add a device and give it a unique ID (for example
123456). - Send a test position from any device or even a browser — the OsmAnd protocol accepts a plain HTTP GET through your domain:
https://your-railway-domain/client-proxy/?id=123456&lat=48.137&lon=11.575. The position appears on the map instantly. - For real devices, configure them with the ingest URL from step 4 (devices that append their own query parameters should use the TCP proxy host:port with the /client-proxy/ path). For phone tracking, install the OsmAnd app and enable its online tracking plugin against the same URL.
Costs: about 5–10 USD/month at hobby scale (Traccar roughly 1 GB RAM, MySQL roughly 1 GB RAM, plus two small volumes).
Deploy and Host
About Hosting
Hosting Traccar on Railway gives you a managed GPS tracking server without maintaining a VPS: two services are provisioned for you — traccar (pinned official image, web UI on 8082 via your Railway domain, device ingest on TCP 5055 via a Railway TCP proxy, persistent volume for logs and uploads) and MySQL (persistent volume at /var/lib/mysql, private networking only). Traccar runs in env-var mode against MySQL — the configuration upstream recommends for production — with the JDBC URL, database password, and DB host wired as variable expressions, so credentials rotate per deploy and nothing sensitive is baked in. The boot wrapper waits for MySQL to be reachable, creates the traccar database, and symlinks the log directory into the persistent volume, so a cold deploy never races its own database.
Why Deploy
- Production data model out of the box. The default Traccar image falls back to an embedded H2 file database, which upstream explicitly does not recommend for production. This template gives you MySQL over Railway private networking with a JDBC URL tuned for it (character encoding, timezone, reconnect, multi-query settings included).
- Device ingest that actually works in the cloud. GPS trackers speak TCP, not just HTTP. The template publishes TCP 5055 (OsmAnd protocol) through a Railway TCP proxy and documents where to find the assigned host:port. The OsmAnd HTTP GET fallback on the web domain gives you a no-configuration test path from any browser.
- Zero-prompt, zero-secret deploy. No deploy-form inputs; the root password and all wiring are generated per deployment from template expressions.
- 24/7 sticky workload. GPS tracking is a continuous telemetry workload — Railway restart policies and a real healthcheck route (GET /api/health) keep the tracker online.
Common Use Cases
- Track vehicles, fleets, bikes, boats, or pets with cheap GPS trackers that support the OsmAnd protocol or HTTP GET reporting.
- Phone-based tracking with the free OsmAnd app (Android/iOS) reporting locations to your own server.
- Personal location history with full data ownership: positions, trips, and reports stored in your own MySQL database.
- Geofences, alerts, and maintenance reminders for a small fleet, managed through the Traccar web UI.
Dependencies for
Traccar depends on one service provisioned by this template:
Deployment Dependencies
- MySQL 8 (Railway database plugin): primary datastore for users, devices, and positions. Persistent volume at /var/lib/mysql. Traccar reaches it over Railway private networking via RAILWAY_PRIVATE_DOMAIN; the root password is generated per deploy and referenced by Traccar as DATABASE_PASSWORD. The traccar service depends on MySQL being initialized before boot — the entrypoint waits up to 5 minutes and creates the database automatically, so no manual setup steps are required.
Template Content
MySQL
mysql:9.4