remotes
This commit is contained in:
1 parent
4f0886b6cd
commit
02017d470f
16 files changed
+2665
-84
No files matched your search
+226
-40
@@ -16,14 +16,15 @@ Run any number of vanilla Terraria and tModLoader dedicated servers on one Linux
|
||||
10. [Configuration](#configuration)
|
||||
11. [Mods (tModLoader)](#mods-tmodloader)
|
||||
12. [Versions and upgrades](#versions-and-upgrades)
|
||||
13. [Deleting and restoring](#deleting-and-restoring)
|
||||
13. [Deleting, renaming and restoring](#deleting-renaming-and-restoring)
|
||||
14. [Exporting and importing](#exporting-and-importing)
|
||||
15. [Backups](#backups)
|
||||
16. [Permissions](#permissions)
|
||||
17. [Running by hand for debugging](#running-by-hand-for-debugging)
|
||||
18. [Troubleshooting](#troubleshooting)
|
||||
19. [Tab completion](#tab-completion)
|
||||
20. [Command reference](#command-reference)
|
||||
15. [Managing other hosts](#managing-other-hosts)
|
||||
16. [Backups](#backups)
|
||||
17. [Permissions](#permissions)
|
||||
18. [Running by hand for debugging](#running-by-hand-for-debugging)
|
||||
19. [Troubleshooting](#troubleshooting)
|
||||
20. [Tab completion](#tab-completion)
|
||||
21. [Command reference](#command-reference)
|
||||
|
||||
---
|
||||
|
||||
@@ -49,10 +50,13 @@ Everything is installed by the `terraria-server-manager` package:
|
||||
| `/usr/lib/systemd/system/terraria@.service` | Template service. One copy runs per instance. |
|
||||
| `/usr/lib/systemd/system/terraria@.socket` | Creates the console pipe the server reads commands from. |
|
||||
| `/usr/bin/terractl` | Helper script. The service calls it to set up, run and stop servers; you use it for everyday management. |
|
||||
| `/etc/default/terractl` | Optional overrides (locations, stop timeout). |
|
||||
| `/usr/lib/terraria-server-manager/terractl-remote` | The part of `terractl` that manages other hosts (`--host`, `remote`, `daemon`, `copy`, `move`), in Python. |
|
||||
| `/usr/lib/systemd/system/terractld.service` | The daemon that lets other hosts manage this one. Off until you turn it on (see [Managing other hosts](#managing-other-hosts)). |
|
||||
| `/etc/default/terractl` | Optional overrides (locations, stop timeout, the daemon's address). |
|
||||
| `/etc/systemd/journald@terraria.conf` | Size and retention of the servers' own journal (see [Logs](#logs)). |
|
||||
| `/usr/lib/sysusers.d/terractl.conf` | Defines the `terraria` system user. |
|
||||
| `/usr/lib/tmpfiles.d/terractl.conf` | Creates `/var/lib/terraria` and its subdirectories. |
|
||||
| `/usr/share/polkit-1/rules.d/50-terractl.rules` | Lets members of the `terraria` group start, stop and restart servers without `sudo`. |
|
||||
| `/usr/share/terraria-server-manager/export-tmod-mods.ps1` | Optional. Copy to your Windows PC to collect your enabled tModLoader mods. |
|
||||
|
||||
What happens when an instance starts:
|
||||
@@ -61,7 +65,7 @@ What happens when an instance starts:
|
||||
2. `terractl prepare <name>` creates the instance directory and default configs if they're missing, and unpacks the server zip if it hasn't been unpacked yet.
|
||||
3. `terractl run <name>` starts the vanilla or tModLoader server, reading commands from the pipe and logging to the servers' own journal (see [Logs](#logs)).
|
||||
|
||||
On stop, `terractl stop` sends `exit` through the pipe so the world is saved before the server shuts down.
|
||||
On stop, `terractl service-stop` sends `exit` through the pipe so the world is saved before the server shuts down.
|
||||
|
||||
---
|
||||
|
||||
@@ -86,6 +90,8 @@ On stop, `terractl stop` sends `exit` through the pipe so the world is saved bef
|
||||
└── .deleted/ Backups made by 'terractl delete'
|
||||
|
||||
/run/terraria/<name>.stdin Console pipe (exists only while running)
|
||||
|
||||
/var/lib/terractl/ The daemon's certificate and trusted computers (root only)
|
||||
```
|
||||
|
||||
The server can write only inside `instances/`. It reads `dist/` but can never change it.
|
||||
@@ -100,15 +106,15 @@ The package works on Debian 12 or newer and Ubuntu 22.04 or newer.
|
||||
sudo apt install ./terraria-server-manager_0.0.9_all.deb
|
||||
```
|
||||
|
||||
Using `apt install ./file.deb` (rather than `dpkg -i`) installs the dependencies automatically. `unzip` is required. `curl` and the ICU library are "recommended", which apt installs by default; they're only needed for tModLoader instances, which crash with `Aborted` without ICU.
|
||||
Using `apt install ./file.deb` (rather than `dpkg -i`) installs the dependencies automatically. `unzip` is required. `curl` and the ICU library are "recommended", which apt installs by default; they're only needed for tModLoader instances, which crash with `Aborted` without ICU. `polkitd` is also recommended: it lets members of the `terraria` group start and stop servers without `sudo` (see [Permissions](#permissions)).
|
||||
|
||||
Installing the package:
|
||||
|
||||
- creates the `terraria` system user and group;
|
||||
- creates `/var/lib/terraria/`, `/var/lib/terraria/instances/` and `/var/lib/terraria/dist/`;
|
||||
- installs the units and helper script.
|
||||
- installs the units, the helper script and the polkit rule.
|
||||
|
||||
It doesn't start or enable anything.
|
||||
It doesn't start or enable anything, including the daemon for managing the host from elsewhere.
|
||||
|
||||
If you use a firewall, open each instance's port for **TCP**. Terraria uses TCP only.
|
||||
|
||||
@@ -173,6 +179,8 @@ sudo make install # or install directly without a package (PREFIX=/usr/
|
||||
sudo make uninstall # removes a 'make install' (keeps settings and data)
|
||||
```
|
||||
|
||||
`make install` with a prefix other than `/usr` puts the polkit rule in `/etc/polkit-1/rules.d/`, because polkit doesn't read `/usr/local`.
|
||||
|
||||
The version comes from the `VERSION` file. Set `Maintainer:` in `packaging/deb/control` to yourself before publishing packages.
|
||||
|
||||
### Changing locations
|
||||
@@ -281,7 +289,7 @@ Instance names may contain letters, digits, `_`, `-` and `.`, and must not start
|
||||
sudo terractl new calamity tmodloader
|
||||
sudo terractl mods calamity add ~/tmod-export # your mods, before the first start
|
||||
sudo nano /var/lib/terraria/instances/calamity/serverconfig.txt # optional: world size, difficulty
|
||||
sudo systemctl enable --now terraria@calamity
|
||||
sudo terractl enable calamity --now
|
||||
sudo terractl attach calamity # watch it load and generate the world
|
||||
```
|
||||
|
||||
@@ -291,24 +299,41 @@ You can also skip `new` and just run `sudo systemctl start terraria@<name>`. Tha
|
||||
|
||||
## Starting, stopping and boot
|
||||
|
||||
Instances are ordinary systemd services:
|
||||
Instances are ordinary systemd services, which `terractl` starts and stops for you:
|
||||
|
||||
```bash
|
||||
sudo systemctl start terraria@calamity
|
||||
sudo systemctl stop terraria@calamity # saves the world, then exits
|
||||
sudo systemctl restart terraria@calamity
|
||||
sudo systemctl enable terraria@calamity # start at boot
|
||||
sudo systemctl disable terraria@calamity # don't start at boot
|
||||
sudo systemctl enable --now terraria@calamity # both at once
|
||||
systemctl status terraria@calamity
|
||||
sudo terractl start calamity
|
||||
sudo terractl stop calamity # saves the world, then exits
|
||||
sudo terractl restart calamity
|
||||
```
|
||||
|
||||
To see all instances with their type, port and state:
|
||||
These are the same as `systemctl start|stop|restart terraria@<name>`, which work too; `systemctl status terraria@<name>` shows the details. `terractl start` refuses names that have no instance, whereas `systemctl start` creates one.
|
||||
|
||||
Whether a server starts at boot is set with `terractl`:
|
||||
|
||||
```bash
|
||||
sudo terractl enable calamity # start at boot
|
||||
sudo terractl enable calamity --now # start at boot, and start it now
|
||||
sudo terractl disable calamity # don't start at boot (a running server keeps running)
|
||||
sudo terractl disable calamity --now # don't start at boot, and stop it now (saves the world)
|
||||
```
|
||||
|
||||
These do the same as `systemctl enable`/`disable terraria@<name>`, which also still work. `terractl enable` refuses names that have no instance, so a typo can't create a new instance at the next boot.
|
||||
|
||||
Members of the `terraria` group can `start`, `stop` and `restart` servers without `sudo` (see [Permissions](#permissions)). `enable` and `disable` always need `sudo`.
|
||||
|
||||
To see all instances with their type, port, whether they start at boot, and state:
|
||||
|
||||
```bash
|
||||
sudo terractl list
|
||||
```
|
||||
|
||||
```
|
||||
INSTANCE TYPE PORT BOOT STATE
|
||||
calamity tmodloader 7778 enabled active
|
||||
survival vanilla 7777 disabled inactive
|
||||
```
|
||||
|
||||
Behaviour to be aware of:
|
||||
|
||||
- **Crashes restart automatically** after 10 seconds.
|
||||
@@ -330,10 +355,20 @@ sudo terractl attach calamity
|
||||
|
||||
This shows the last 30 lines of output and then follows it live. Anything you type is sent to the server, with arrow-key editing and history. **Ctrl-D** or **Ctrl-C** detaches, and the server keeps running.
|
||||
|
||||
`attach` will not send `exit`, since that would stop the server. Use `systemctl stop` to stop it.
|
||||
`attach` will not send `exit`, since that would stop the server. Use `terractl stop` to stop it.
|
||||
|
||||
The one visible difference from a real terminal: the server's `:` prompt only appears once a newline follows it.
|
||||
|
||||
### Read-only: `watch`
|
||||
|
||||
```bash
|
||||
terractl watch calamity # last 30 lines, then follow
|
||||
terractl watch calamity -n 200 # start with the last 200 lines
|
||||
terractl watch calamity -q # without the lines about what it's doing
|
||||
```
|
||||
|
||||
`watch` shows the server's output like `attach` does, but never sends anything to the server. That makes it safe to leave open, for instance on a second screen, with no risk of typing into the console. **Ctrl-C** quits and the server keeps running. It also works while the server is stopped: it shows the last output and picks up again when the server starts.
|
||||
|
||||
### One-off commands: `cmd`
|
||||
|
||||
```bash
|
||||
@@ -343,7 +378,7 @@ sudo terractl cmd calamity say Restarting in 5 minutes
|
||||
|
||||
`cmd` prints the server's reply, then returns once the server has been quiet for a second (at most 5 seconds). For example, `terractl cmd calamity playing` lists who's online. That makes it handy in scripts and cron jobs too. If the server doesn't answer within 5 seconds (for instance while it's still loading), `cmd` says so; the command has still been sent.
|
||||
|
||||
Members of the `terraria` group can use `attach` and `cmd` fully, output included, without `sudo`. See [Logs](#logs) for how that's arranged.
|
||||
Members of the `terraria` group can use `attach`, `watch` and `cmd` fully, output included, without `sudo`. See [Logs](#logs) for how that's arranged.
|
||||
|
||||
### Logs
|
||||
|
||||
@@ -543,7 +578,7 @@ sudo systemctl restart terraria@calamity
|
||||
|
||||
---
|
||||
|
||||
## Deleting and restoring
|
||||
## Deleting, renaming and restoring
|
||||
|
||||
```bash
|
||||
sudo terractl delete calamity # asks you to type the name
|
||||
@@ -557,11 +592,17 @@ To restore an instance, import its backup. You can give it back its old name, or
|
||||
|
||||
```bash
|
||||
sudo terractl import calamity /var/lib/terraria/instances/.deleted/calamity-20260928-134422.tar.gz
|
||||
sudo systemctl enable --now terraria@calamity # server/ is unpacked again on start
|
||||
sudo terractl enable calamity --now # server/ is unpacked again on start
|
||||
```
|
||||
|
||||
`.deleted/` is never cleaned up automatically. Remove old archives yourself.
|
||||
|
||||
To give an instance another name, use `rename`. It stops the server if it's running, renames the folder, updates the paths in `serverconfig.txt`, and starts it again under the new name. The port, world, mods and unpacked server stay as they are, and if it started at boot, it still does:
|
||||
|
||||
```bash
|
||||
sudo terractl rename calamity calamity-old
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Exporting and importing
|
||||
@@ -599,11 +640,13 @@ After extracting, it adjusts the instance for its new home:
|
||||
|
||||
`import` also accepts:
|
||||
|
||||
- the backups that `delete` makes (see [Deleting and restoring](#deleting-and-restoring));
|
||||
- the backups that `delete` makes (see [Deleting, renaming and restoring](#deleting-renaming-and-restoring));
|
||||
- a plain archive of an instance folder, including one from the old `/opt/terraria` manual setup, e.g. `tar -czf old.tar.gz -C /opt/terraria calamity`.
|
||||
|
||||
### Moving a server to another machine
|
||||
|
||||
If the new machine runs the daemon, `sudo terractl move calamity newhost:` does all of this in one step; see [Managing other hosts](#managing-other-hosts). By hand:
|
||||
|
||||
```bash
|
||||
# old machine
|
||||
sudo terractl export calamity /tmp/calamity.tar.gz
|
||||
@@ -611,11 +654,116 @@ scp /tmp/calamity.tar.gz newhost:/tmp/
|
||||
|
||||
# new machine (with terraria-server-manager installed, and the same zip in dist/)
|
||||
sudo terractl import calamity /tmp/calamity.tar.gz
|
||||
sudo systemctl enable --now terraria@calamity
|
||||
sudo terractl enable calamity --now
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Managing other hosts
|
||||
|
||||
One computer can manage the Terraria servers of several hosts. A host that should be managed runs **the daemon**, `terractld`. The computers that manage it add it as a **remote**, as with LXD or Incus remotes. Then any command can be run there with `--host`, and instances can be copied and moved between hosts:
|
||||
|
||||
```bash
|
||||
terractl --host nas list
|
||||
terractl --host nas attach calamity
|
||||
sudo terractl move calamity nas: # this host → nas
|
||||
terractl copy nas:calamity pi:test # nas → pi, as 'test'
|
||||
```
|
||||
|
||||
### Turning on the daemon
|
||||
|
||||
On the host to be managed:
|
||||
|
||||
```bash
|
||||
sudo terractl daemon enable
|
||||
```
|
||||
|
||||
This starts `terractld.service` and makes it start at boot. It listens on **TCP port 7776**, on all addresses. If a firewall is active, allow that port (for example `sudo ufw allow 7776/tcp`), ideally only from the computers that will manage the host. To listen on one address or on another port, set `TERRACTL_LISTEN` in `/etc/default/terractl` (e.g. `TERRACTL_LISTEN=10.0.10.77:7776`) and run `sudo systemctl restart terractld`.
|
||||
|
||||
`sudo terractl daemon disable` turns it off again. `terractl daemon status` shows whether it's running, where it listens and its certificate's fingerprint, and with `sudo`, which computers it trusts.
|
||||
|
||||
The daemon is an ordinary systemd service: systemd starts it at boot, restarts it if it crashes, and keeps its log. `journalctl -u terractld` lists every command it ran and for which computer.
|
||||
|
||||
### Adding a remote
|
||||
|
||||
Each computer that should manage the host needs a one-time token. On the host with the daemon:
|
||||
|
||||
```bash
|
||||
sudo terractl daemon trust add laptop
|
||||
```
|
||||
|
||||
`laptop` is a name for the computer, used in the host's log and to revoke it later. The command prints what to run on that computer:
|
||||
|
||||
```bash
|
||||
terractl remote add nas tctl1_eyJ2IjoxLCJmcCI6...
|
||||
```
|
||||
|
||||
`nas` is the name you'll use for the host there; choose any. The token contains the host's addresses, so usually nothing else is needed. If none of them works from the computer (behind NAT, for example), add the address: `terractl remote add nas 203.0.113.5 tctl1_...`, or `nas.example.com:7800` for another port.
|
||||
|
||||
A token works **once**, **within 24 hours**. Remotes are kept per user in `~/.config/terractl/remotes.json`, readable only by you. Under `sudo`, the remotes of the person who ran sudo are used.
|
||||
|
||||
```bash
|
||||
terractl remote list # your remotes
|
||||
terractl remote remove nas # forget one
|
||||
```
|
||||
|
||||
### Running commands on a remote: `--host`
|
||||
|
||||
Put `--host <remote>` in front of any command:
|
||||
|
||||
```bash
|
||||
terractl --host nas list
|
||||
terractl --host nas new calamity tmodloader
|
||||
terractl --host nas mods calamity add ~/tmod-export # sends the files
|
||||
terractl --host nas enable calamity --now
|
||||
terractl --host nas attach calamity
|
||||
terractl --host nas export calamity # fetches ./calamity-<date>-<time>.tar.gz
|
||||
terractl --host nas import calamity2 calamity.tar.gz # sends the archive
|
||||
```
|
||||
|
||||
`<remote>` is a remote's name, or the address it was added with (`--host 10.0.10.77`). No `sudo` is needed on either side: the daemon runs each command as root on its host, as if it had been typed there with `sudo`. File arguments (`mods add`, `import`, `export`) are files on *your* computer; they're sent to the host or fetched from it. Messages that suggest a command show it as `terractl --host nas ...`.
|
||||
|
||||
Not available with `--host`:
|
||||
|
||||
- `remote`, `daemon`, `copy` and `move` run on your computer (copy and move take `<remote>:<name>` instead).
|
||||
- The service's own commands (`prepare`, `run`, `service-stop`, `journal-access`).
|
||||
- Editing `serverconfig.txt` still needs a shell on that host.
|
||||
|
||||
### Copying and moving instances
|
||||
|
||||
```bash
|
||||
terractl copy calamity nas: # to nas, same name
|
||||
sudo terractl copy nas:calamity cal-test # from nas to this host, as cal-test
|
||||
terractl copy nas:calamity pi: # between two remotes
|
||||
sudo terractl move calamity nas: # to nas; removed here
|
||||
terractl move nas:calamity pi: # between two remotes
|
||||
sudo terractl move calamity survival2 # rename, on this host (same as rename)
|
||||
```
|
||||
|
||||
Each side is `[<remote>:]<name>`, and without a remote it's this host. Leave out the destination name (`nas:`) to keep the name.
|
||||
|
||||
A copy is an [export](#exporting-and-importing) on the source, a transfer, and an import on the destination, so everything import does applies. Paths are set to the **destination's** folders, whatever its `TERRARIA_BASE` is: they're asked from the destination, never assumed. A port that's taken there is replaced with a free one, and the server version is pinned.
|
||||
|
||||
- **The server zip comes along if needed.** If the destination's `dist/` doesn't have the zip the instance runs, it's copied from the source's `dist/`. If the source doesn't have it either, nothing is changed and you're told so; put the zip on the destination first, or use `--with-server` to take the unpacked server along.
|
||||
- **Copy leaves the source running.** A running server is asked to save first, so the copy has the world as of that save. Anything that happens in the game after it isn't included. The copy isn't started.
|
||||
- **Move within one host is a rename** (`sudo terractl move calamity calamity-old`, or `nas:a nas:b`): nothing is copied, and the port and unpacked server stay the same. See [Deleting, renaming and restoring](#deleting-renaming-and-restoring).
|
||||
- **Move stops the source first**, which saves the world, and removes it from the source only after the import worked. `delete`'s usual backup is kept in the source's `.deleted/`. If the source was running, the moved instance is started on the destination, and if it started at boot, it does there too. If something fails before the import has worked, the source is started again and nothing else changes.
|
||||
- **Transfers go through the computer you run the command on.** Between two remotes, the archive streams from one to the other through your computer without being stored on it.
|
||||
|
||||
On this host, copying *from* it works for members of the `terraria` group. Copying *to* it, and moving away from it, needs `sudo`, like `import` and `delete` do.
|
||||
|
||||
### Security
|
||||
|
||||
- **Encrypted and pinned.** Traffic is HTTPS (TLS 1.2 or newer). The daemon's certificate is self-signed, the token carries its fingerprint, and every connection checks it, so nothing in between can pose as the daemon. If the fingerprint ever changes, `terractl` refuses to connect and says so.
|
||||
- **Keys, not passwords.** Joining trades the token for a random key for that computer. The daemon keeps only hashes of keys and tokens, in `/var/lib/terractl/trust.json` (root only).
|
||||
- **A trusted computer is an admin of the host's servers.** It can do what `sudo terractl` can: create, delete, import, start and stop instances, and install mods or server files, which run as the `terraria` user. It can't change the daemon or run anything other than `terractl`. Give tokens only to computers you'd trust with `sudo terractl`.
|
||||
- **Revoking.** `sudo terractl daemon trust list` shows the trusted computers, and `sudo terractl daemon trust remove laptop` takes one's access away immediately.
|
||||
- **Firewall.** The daemon doesn't need to be reachable from the internet. Limit port 7776 to your LAN or VPN, or set `TERRACTL_LISTEN` to a LAN or VPN address.
|
||||
|
||||
The daemon runs as root, because it creates and removes instances and starts services, but with systemd's protections it can't write to `/usr`, `/boot`, `/etc` or home folders. Its certificate, key and trust list are in `/var/lib/terractl/`. Files in transit are kept in `/var/lib/terractl/transfers/`, and removed once used, after 6 hours unused, or when the daemon restarts.
|
||||
|
||||
---
|
||||
|
||||
## Backups
|
||||
|
||||
Everything worth keeping is in `data/`, `instance.conf` and `serverconfig.txt`, which is exactly what `export` saves. A nightly backup kept for 14 days, as a root cron job (`sudo crontab -e`):
|
||||
@@ -635,19 +783,27 @@ The servers always run as the `terraria` user. Administration is simplest with `
|
||||
| Command | Who can run it | Notes |
|
||||
|---|---|---|
|
||||
| `new` | root (or `terraria`) | Run as root, it sets ownership of the new instance to `terraria` itself. |
|
||||
| `list` | root, or members of the `terraria` group | `/var/lib/terraria` is not readable by other users. |
|
||||
| `list`, `info` | root, or members of the `terraria` group | `/var/lib/terraria` is not readable by other users. |
|
||||
| `start`, `stop`, `restart` | root, or members of the `terraria` group | Through systemd, where the polkit rule allows the group (see `systemctl start/stop/restart` below). |
|
||||
| `enable`, `disable` | root only | Checked by the script. systemd can't restrict these to Terraria servers, so the group can't be allowed them. |
|
||||
| Adding zips to `dist/` | root, or members of the `terraria` group | |
|
||||
| `attach` | root, or members of the `terraria` group | Writes to the console pipe and reads the servers' journal. |
|
||||
| `cmd` | root, or members of the `terraria` group | Same as `attach`. |
|
||||
| `watch` | root, or members of the `terraria` group | Reads the servers' journal only. |
|
||||
| `reinstall` | root (or `terraria`) | |
|
||||
| `mods <name>` (list) | root, or members of the `terraria` group | |
|
||||
| `mods add/enable/disable/remove` | root (or `terraria`) | Run as root, it sets ownership of the files it installs to `terraria`. |
|
||||
| `delete` | root only | Checked by the script. |
|
||||
| `delete`, `rename` | root only | Checked by the script. |
|
||||
| `export` | root, or members of the `terraria` group | Reads the instance, and asks a running server to save. |
|
||||
| `import` | root (or `terraria`) | Run as root, it gives the new instance to `terraria`. |
|
||||
| `prepare`, `run` | Normally only the service | Run as root, they automatically switch to the `terraria` user, so no files end up owned by root. Any other user is refused. |
|
||||
| `stop` | Only the service | Needs the server's process ID from systemd. |
|
||||
| `systemctl start/stop/enable` | root | |
|
||||
| `service-stop` | Only the service | Needs the server's process ID from systemd. |
|
||||
| `daemon enable`, `daemon disable`, `daemon trust ...` | root only | |
|
||||
| `daemon status` | anyone | Shows the trusted computers only with `sudo`. |
|
||||
| `remote ...`, `--host ...` | anyone | Uses your own remotes. On the remote, the daemon runs the command as root. |
|
||||
| `copy`, `move` | depends on this host's part | Copying from this host: the group is enough. Copying to it, or moving away from it: root. |
|
||||
| `systemctl start/stop/restart terraria@...` | root, or members of the `terraria` group | Allowed by the polkit rule `50-terractl.rules`. Needs `polkitd` 0.106 or newer, so not on Ubuntu 22.04, where it needs `sudo`. Starting a name that has no instance creates a vanilla one with default settings. |
|
||||
| `systemctl enable/disable terraria@...` | root | Same as `terractl enable`/`disable`. |
|
||||
| `journalctl --namespace=terraria ...` | root, or members of the `terraria` group | The servers' output only; see [Logs](#logs). |
|
||||
| `journalctl -u terraria@...` (system journal) | root, or members of `systemd-journal` or `adm` | systemd's start/stop messages. |
|
||||
|
||||
@@ -682,14 +838,14 @@ Editing an existing file with `sudo nano` keeps its owner, so it's fine.
|
||||
Stop the service first. `terractl` won't let two copies of the same server run at once: if the service is running, `run` refuses and tells you to stop it.
|
||||
|
||||
```bash
|
||||
sudo systemctl stop terraria@calamity
|
||||
sudo terractl stop calamity
|
||||
sudo terractl run calamity # automatically runs as 'terraria'
|
||||
```
|
||||
|
||||
The server runs in your terminal and you can type commands into it directly. Type `exit` to stop it, then start the service again:
|
||||
|
||||
```bash
|
||||
sudo systemctl start terraria@calamity
|
||||
sudo terractl start calamity
|
||||
```
|
||||
|
||||
### How running servers are protected
|
||||
@@ -702,7 +858,7 @@ While a server runs, whether systemd started it or you did, it holds a lock on t
|
||||
- **`delete` stops the service**, but refuses to go on if a copy started by hand is still running.
|
||||
- **`list` shows a copy started by hand** as `running (outside systemd)`.
|
||||
|
||||
`terractl stop` is only for the service's own use. Typed by hand, it tells you to use `systemctl stop terraria@<name>` instead.
|
||||
`terractl stop` only stops the service. A copy started by hand is stopped by typing `exit` in its terminal.
|
||||
|
||||
---
|
||||
|
||||
@@ -741,7 +897,7 @@ Run `terractl mods <name>` to check for mods that are enabled but missing. Then
|
||||
Two instances share a port. Check the ports with `sudo terractl list`. A second copy of the *same* instance can't be the cause, because `terractl` prevents it.
|
||||
|
||||
**"already running outside systemd" or "is active; stop it first".**
|
||||
The instance's server is already running, so the command was refused to protect it. Stop the server first. If it was started with `terractl run` in another terminal, type `exit` there; otherwise use `sudo systemctl stop terraria@<name>`.
|
||||
The instance's server is already running, so the command was refused to protect it. Stop the server first. If it was started with `terractl run` in another terminal, type `exit` there; otherwise use `terractl stop <name>`.
|
||||
|
||||
**The service starts but you can't connect.**
|
||||
Check the port in `serverconfig.txt`, your firewall (TCP), and router port forwarding.
|
||||
@@ -750,11 +906,20 @@ Check the port in `serverconfig.txt`, your firewall (TCP), and router port forwa
|
||||
Both commands print a note explaining why. If you were just added to the `terraria` group, log out and back in. If you're already in it, the servers' journal hasn't been set up for the group yet; that happens automatically when a server starts, or run `sudo terractl journal-access`. Servers that were running before upgrading to 0.0.11 keep logging to the system journal until they're restarted.
|
||||
|
||||
**The server isn't restarting after it stopped.**
|
||||
It exited cleanly, probably via `exit` in the console, so systemd leaves it stopped. Start it again with `systemctl start`.
|
||||
It exited cleanly, probably via `exit` in the console, so systemd leaves it stopped. Start it again with `terractl start`.
|
||||
|
||||
**The world was created without mod content.**
|
||||
It was generated before the mods were added. Delete the world files in `data/Worlds/` (or point `world=` at a new name) and restart to generate a new one.
|
||||
|
||||
**`can't reach nas at 10.0.10.77:7776`.**
|
||||
The daemon isn't running on that host (check with `terractl daemon status` there), a firewall blocks the port, or the host's address changed. After an address change, remove the remote and add it again with a new token.
|
||||
|
||||
**`isn't the one 'nas' was added with: its certificate changed`.**
|
||||
The daemon has a different certificate than when you added it. That's expected if `/var/lib/terractl` was deleted there, or the package was purged and installed again; remove the remote and add it again. If nothing like that happened, don't work around it: something may be intercepting the connection.
|
||||
|
||||
**`doesn't trust this computer (any more)`.**
|
||||
Its access was revoked with `daemon trust remove`, or that computer was added again under the same name elsewhere. Get a new token.
|
||||
|
||||
---
|
||||
|
||||
## Tab completion
|
||||
@@ -765,7 +930,8 @@ It was generated before the mods were added. Delete the world files in `data/Wor
|
||||
- instance names;
|
||||
- `vanilla`/`tmodloader` for `new`;
|
||||
- common server console commands for `cmd` (`save`, `say`, `playing`, `kick`...);
|
||||
- the options of `reinstall`, `delete` and `export`;
|
||||
- the options of `enable`, `disable`, `watch`, `reinstall`, `delete`, `export`, `copy` and `move`;
|
||||
- remote names after `--host`, and `<remote>:<name>` for `copy` and `move`. Instance names on a remote are asked from its daemon, so they can take a moment;
|
||||
- `.tar.gz` files for `export` and `import`;
|
||||
- `mods` actions. For `mods add` it completes `.tmod` files and folders; for `mods enable` and `mods remove`, the installed mods; for `mods disable`, the enabled ones.
|
||||
|
||||
@@ -779,8 +945,13 @@ Completion runs as *you*, even when you type `sudo`. Instance and mod names ther
|
||||
|
||||
```
|
||||
terractl new <name> [vanilla|tmodloader] [port] Create an instance (not started)
|
||||
terractl list Show instances, type, port, state
|
||||
terractl list Show instances, type, port, boot, state
|
||||
terractl info [<name>] This host's paths and zips, or an instance's details
|
||||
terractl start|stop|restart <name> Start, stop (saves the world) or restart
|
||||
terractl enable <name> [--now] Start at boot (--now: and start now)
|
||||
terractl disable <name> [--now] Don't start at boot (--now: and stop now)
|
||||
terractl attach <name> Interactive console (Ctrl-D detaches)
|
||||
terractl watch <name> [-n <lines>] [-q] Follow the output, read-only (Ctrl-C quits)
|
||||
terractl cmd <name> <command...> Send one console command
|
||||
terractl reinstall <name> [--clean] Re-unpack server/ on next start
|
||||
(--clean also re-downloads .NET)
|
||||
@@ -789,15 +960,30 @@ terractl mods <name> add <folder|file.tmod>... Install and enable mods (and M
|
||||
terractl mods <name> enable|disable <Mod>... Change which mods load
|
||||
terractl mods <name> remove <Mod>... Uninstall mods
|
||||
terractl delete <name> [-y] [--no-backup] Stop, disable, back up and remove
|
||||
terractl rename <name> <new name> Rename (restarted if it was running)
|
||||
terractl export <name> [file.tar.gz] [--with-server]
|
||||
Archive an instance (configs, worlds, mods)
|
||||
terractl import <name> <file.tar.gz> Create an instance from an archive
|
||||
terractl --version Show the installed version
|
||||
|
||||
Other hosts:
|
||||
terractl --host <remote> <command> [args] Run a command on a remote
|
||||
terractl copy [<remote>:]<name> [<remote>:][<new name>] [--with-server]
|
||||
Copy an instance, here or between hosts
|
||||
terractl move [<remote>:]<name> [<remote>:][<new name>] [--with-server]
|
||||
Move or rename an instance
|
||||
terractl remote add <name> <token> Add a remote (token from 'daemon trust add')
|
||||
terractl remote add <name> <address> [<token>] ... at an address the token doesn't list
|
||||
terractl remote list | remove <name> Show or forget remotes
|
||||
terractl daemon enable|disable|status Let other hosts manage this one
|
||||
terractl daemon trust add|remove <name> Create a token for a computer, or revoke one
|
||||
terractl daemon trust list Show trusted computers and unused tokens
|
||||
|
||||
Used by the service:
|
||||
terractl prepare <name> Create dirs/configs, unpack zip if needed
|
||||
terractl run <name> Run the server
|
||||
terractl stop <name> <pid> Save and shut down via the console (service only)
|
||||
terractl service-stop <name> <pid> Save and shut down via the console (service only)
|
||||
terractl daemon serve Run the daemon (terractld.service)
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user