Jump to content
TrinityCore

Running 3.3.5 world and auth servers as a service


Dewm
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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 `screen` 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:

screen -AdmS authserver /the/full/path/to/authserver <- loads the authserver program into a session called authserver
screen -AdmS worldserver /the/full/path/to/worldserver <- loads the worldserver program into a session called authserver
screen -ls <- list the available screen sessions
screen -r worldserver <- reconnects to the worldserver session so that you can issue commands

Next I found `tmux` which virtually does the same thing as `screen` except that it appeared to not close the sessions after disconnecting from SSH.

Tmux Examples:

tmux <- creates new terminal session
/home/<user>/server/bin/authserver <- start authserver as normal
Detach from the session by pressing CTRL+B then D.
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.

Link to comment
Share on other sites

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.

Edited by Minyat
Link to comment
Share on other sites

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

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

apt install supervisor
cd /etc/supervisor/
nano supervisord.conf

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.

[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)

[supervisord]
logfile=/var/log/supervisor/supervisord.log ; main log file
pidfile=/var/run/supervisord.pid            ; supervisord pidfile
childlogdir=/var/log/supervisor             ; 'AUTO' child log dir

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

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


[include]
files = /etc/supervisor/conf.d/*.conf

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

cd conf.d
nano authserver.conf

Paste this into nano or your text editor

[program:authserver]
directory=/home/trinitycore/server/bin/
command=/home/trinitycore/server/bin/authserver
autostart=true
autorestart=true
startretries=3
stopasgroup=true

Save the file as authserver.conf

cp authserver.conf worldserver.conf

nano worldserver.conf

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

systemctl restart supervisor
supervisorctl status all

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.

supervisor.thumb.PNG.03743fb55f99091bb81560d894da27ce.PNG

Link to comment
Share on other sites

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 compile.sh script in this repository includes service scripts. They should still work.

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...