Running 3.3.5 world and auth servers as a service

I just recently decided to rent a remote Ubuntu server for a variety of reasons, one of which was to migrate my 3.3.5 server from an at home Windows machine. I thought it would be nice to not have to maintain a computer at my house anymore. So I’m looking around for ways to control the server remotely, either through a CMS portal, or running the world and auth servers as a service that is started automatically with the system, something that can be controlled either through SSH or RA or other remote methods.

I found this post which details how to install pre-compiled versions of the core, db, and tools but since I’m already building it myself I wondered if there was a way to apply the automation tools available to a manually compiled build.

I messed around for a while with finding some commands that allow you to detach from processes that are running in terminal.

The first I found was [FONT='Courier New']screen[/FONT] which lets you run the auth server and the world server inside containers that you can detach from and continue working with other commands. The problem with this is that if you’re connecting with SSH or a remote desktop connection to your linux machine, as soon as you disconnect it will close your screen sessions.

Screen Examples:

[FONT=‘Courier New’]screen -AdmS authserver /the/full/path/to/authserver [/FONT]<- loads the authserver program into a session called authserver
[FONT=‘Courier New’]screen -AdmS worldserver /the/full/path/to/worldserver[/FONT] ← loads the worldserver program into a session called authserver
[FONT=‘Courier New’]screen -ls [/FONT]<- list the available screen sessions
[FONT=‘Courier New’]screen -r worldserver [/FONT]<- reconnects to the worldserver session so that you can issue commands

Next I found [FONT='Courier New']tmux[/FONT] which virtually does the same thing as [FONT='Courier New']screen[/FONT] except that it appeared to not close the sessions after disconnecting from SSH.

Tmux Examples:

[FONT=‘Courier New’]tmux[/FONT] ← creates new terminal session
[FONT=‘Courier New’]/home//server/bin/authserver[/FONT] ← start authserver as normal
Detach from the session by pressing [FONT=‘Courier New’]CTRL+B[/FONT] then [FONT=‘Courier New’]D[/FONT].
Repeat this process for worldserver.
tmux list-sessions ← list the available tmux sessions
tmux attach-session -t 0 ← reconnects to the session that you specify with the session ID

If anybody has a better answer or another tool they use to automate the status of their servers, I’d be happy to hear them.

Have a look at supervisord. You can add both auth and world processes here and then easily start and stop them from the command line. You can even set them up in dependent order, so that when world starts, it’ll then go ahead and start auth.

Wow that was WAY easy. Thank you for the recommendation!

Here is essentially what I did to install it and configure it.

[FONT=‘Courier New’]apt install supervisor[/FONT]
[FONT=‘Courier New’]cd /etc/supervisor/
nano supervisord.conf[/FONT]

Below are the default contents of supervisord.conf. Minimal changes were necessary. I opted to try out the web interface and it was a breeze to configure by just removing the comment marks and changing the username and password to what I wanted.

[FONT=‘Courier New’][[/FONT]unix_http_server]
file=/tmp/supervisor.sock ; the path to the socket file
chmod=0700 ; socket file mode (default 0700)

[inet_http_server] ; inet (TCP) server disabled by default
port=ipaddress:9001 ; ip_address:port specifier, *:port for all iface
username=user ; default is no username (open server)
password=123 ; default is no password (open server)

logfile=/var/log/supervisor/supervisord.log ; main log file
pidfile=/var/run/ ; supervisord pidfile
childlogdir=/var/log/supervisor ; ‘AUTO’ child log dir

supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

serverurl=unix:///var/run/supervisor.sock   ; user a unix:// URL for a unix socket

[FONT=‘Courier New’][include]
files = /etc/supervisor/conf.d/*.conf[/FONT]

Next I had to create two custom configuration files inside the conf.d folder, one for authserver and the other for worldserver as outlined in the supervisord.conf include instructions

[FONT=‘Courier New’]cd conf.d
nano authserver.conf[/FONT]

Paste this into nano or your text editor

[FONT=‘Courier New’][[/FONT]program:authserver]

Save the file as authserver.conf

[FONT=‘Courier New’]cp authserver.conf worldserver.conf[/FONT]

[FONT=‘Courier New’]nano worldserver.conf[/FONT]

Simply change the two instances of “authserver” to “worldserver” and save the file

[FONT=‘Courier New’]systemctl restart supervisor
supervisorctl status all[/FONT]

Your servers should be starting as immediately as you restarted supervisor.

Now all you have to do is open your browser and go to http://yourip:9001 and you can check the status of, and start, stop, and restart your servers with the click of a button.


I see you’ve already got this where you need it, but I wanted to offer just direct management through systemctl as an option too for other folks that may visit here in the future. I did some stuff with CI for a server a couple years ago and the [FONT=‘Courier New’][/FONT] script in this repository includes service scripts. They should still work.

I decided to scrap the remote Ubuntu server, at least for the purposes of running TrinityCore - performance became an issue and was laggy.

I really enjoyed ubuntu on the remote server so I decided to wipe Windows OS from my home server and use ubuntu instead. I love it!

However, @Minyat i tried to get Supervisor running and it simply wouldn’t work which was a big disappointment. I troubleshooted the issue for hours. So I am back to using tmux in the mean time.

@velinath I took a look at the scripts you mentioned but I already have my server built on my new setup and didn’t want to risk even more troubleshooting than I already went through.

I’ve seen people claiming they create services using systemd/systemctl to add services but I can’t find any instructions about how to do it or where to configure them.