---
title: "Deploy Terraria server"
description: "Self-host a persistent terraria TShock server using Docker Image"
category: "Other"
url: https://railway.com/deploy/terraria-dedicated-server
---

# Deploy Terraria server

Self-host a persistent terraria TShock server using Docker Image

**[Deploy Terraria server on Railway](https://railway.com/template/terraria-dedicated-server)**

- **Creator:** Xav's Projects
- **Category:** Other
- **Total deploys:** 29

## Template content

### Terraria-Selfhost https://terraria.wiki.gg/images/App_icon_1.3_Update.png

- **Source:** https://github.com/XavTo/Terraria-Selfhost

## Documentation

# Deploy and Host Terraria Dedicated Server on Railway

**Terraria Dedicated Server** is the official multiplayer server for the Terraria sandbox game. It allows players to host a persistent world, invite others to join online, and customize gameplay using server configuration and plugins such as TShock.

## How to Join the Server

This server is exposed using **Railway TCP Proxy**.  
Players must connect using the **public proxy domain and port**, not the default Terraria port.

### Steps (Terraria PC / Steam)

1. Launch **Terraria**.
2. Click **Multiplayer**.
3. Select your character.
4. Choose **Join via IP**.
5. When prompted for the server address, enter:

   ```
   YOUR_RAILWAY_TCP_DOMAIN
   ```

   Example:
   ```
   shortline.proxy.rlwy.net
   ```

6. Confirm, then enter the **port provided by Railway TCP Proxy**:

   ```
   YOUR_RAILWAY_TCP_PORT
   ```

   Example:
   ```
   48187
   ```

7. If the server is password-protected, enter the password when asked.
8. Join the world.

### Important Notes

- **Do not use port 7777** when connecting.
  - `7777` is the internal server port.
  - Railway maps it to a different **external TCP port**.
- The correct connection format is:

  ```
  domain:port
  ```

  Example:
  ```
  shortline.proxy.rlwy.net:48187
  ```

- You can find the correct domain and port in:
  **Railway → Service → Networking → TCP Proxy**

---

## About Hosting Terraria Dedicated Server

This Railway template deploys a fully functional Terraria Dedicated Server using Docker, with support for persistent storage, configuration files, logs, and plugins. The server runs in headless mode and exposes a TCP endpoint via Railway’s TCP Proxy, allowing players to connect securely from anywhere.

The template is designed to work with a single persistent volume, ensuring that worlds, TShock configuration, plugins, and logs are preserved across restarts and redeployments. No manual server setup is required: worlds can be auto-generated, and common server settings are configurable through environment variables.

## Common Use Cases

- Host a private Terraria multiplayer server for friends or small communities.
- Run a persistent world with TShock for permissions, commands, and moderation.
- Test plugins or server configurations in an isolated environment.
- Deploy an always-on Terraria server without managing your own VPS.

## Dependencies for Terraria Dedicated Server Hosting

- **Docker container** running Terraria Server with TShock.
- **Persistent volume** for worlds, configuration, plugins, and logs.
- **TCP networking** for player connections.

### Deployment Dependencies

- Railway TCP Proxy  
  https://docs.railway.app/deploy/exposing-your-app#tcp-proxy
- Terraria Dedicated Server  
  https://terraria.wiki.gg/wiki/Server
- TShock (server management and plugins)  
  https://github.com/Pryaxis/TShock

### Implementation Details (Optional)

The server runs inside a Docker container based on a prebuilt Terraria/TShock image. A custom startup script prepares a single persistent volume and maps it to the directories used by Terraria and TShock. Environment variables are used to control world generation, player limits, passwords, and startup behavior, avoiding manual command-line configuration.

## Why Deploy Terraria Dedicated Server on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you do not have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Terraria Dedicated Server on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — [Jul'26] Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/terraria-dedicated-server
