Code from Debugging my Terraria Server's Startup.
terraria.nchlswhttkr.com:7777
for my server (if up).
This runs in a detached screen, managed by systemd.
You can download the server itself off the official Terraria website, place the contents of the Linux
directory on a local terraria
user in your droplet, with the accompanying server.config
and terraria.service
.
Set up as a user unit (~/.config/systemd/user/terraria.service
) to run the server, which can be taken up/down with systemctl --user start/stop terraria
.
To make sure this unit is not stopped when the owning user logs out, run sudo loginctl enable-linger <username>
to allow the service to linger. Otherwise, the server will be stopped when you log out of your SSH session.
Runs off port 7777
(make sure its excepted from your firewall).
Attach to the screen (screen -r terraria
) if you want to run admin commands.
Useful Links
Hey! Seems like port 7000 was a typo on my part, it should be 7777. Cheers for catching that, I've updated it.
I should probably clarify that this code mostly exists because I had certain constraints to meet, largely in relation to how the "Run script over SSH" command works in iOS Shortcuts.
systemctl --user start/stop terraria
was very nice.If I wanted the Terraria server to always be running while my droplet was up, I'd make it a system unit rather than a user unit and
enable
it so it runs on boot (IIRC user units on run on login). Like you pointed out, you could make it Restart then as well.Hope this clears things up!