[Guide] Setting up a server on DigitalOcean

Fixious

Test Lead
While Xzanth already made a guide back in 2013, the following method is considerably easier and more straight-forward.

Step 1. Create an account on DigitalOcean and setup your payment methods. This is pretty straightforward if you've ever setup an account before. This link will give you $100 to play with for 60 days, which is more than enough to get you started and test things out.

Step 2. Create a Project. Call it Legions or whatever you want. You can click Skip Now on the next screen.

1638144544957.png

Step 3. Create a Droplet (i.e. server) by clicking Create at the top and selecting Droplets.

1638144743686.png

Step 4. Select your server settings. If you just want a basic server that'll probably support a decent number of people, you can probably get by with the $6/month plan. It's the most affordable. The below image shows the key areas to select and modify to your liking. You are of course free to select a more expensive plan for better performance. You can also select any region you want, I just selected NY in this example.

1638145114634.jpeg
Step 5. Paste the following text into the User Data text box. You are free to change $Host::Name = "A Dedicated Server"; and the user role passwords (change_me, change_me2, etc) to your liking.


Code:
#cloud-config

users:
  - default
  - name: legions
    system: true
    homedir: /opt/legions
    shell: /usr/sbin/nologin

write_files:
  - path: /etc/systemd/system/legions.service
    content: |
      [Unit]
      Description=Legions Server

      [Service]
      ExecStart=/opt/legions/live/Legions.linux --mod-list=modList_Server.txt --server-config=cloud.cs
      User=legions
      WorkingDirectory=/opt/legions/live
      Restart=always

      [Install]
      WantedBy=multi-user.target
  - path: /etc/legions_config.cs
    content: |
      /**
       * Admin Levels: Every superior admin level can do everything
       * the level below can do.
       *
       * Level 1: Pug Admin
       *  - Can set the server password so people can join pugs
       *  - Can force players to switch teams
       *  - Can change maps
       * Level 2: Moderator
       *  - Can kick and ban people
       * Level 3: Admin
       *  - Slash commands
       * Level 4: Super Admin
       *  - Has Eval access
       * Level 5: Owner
       *  - God
       */

      // This level can't do anything
      $Host::Admins::Name[0] = "Player";
      $Host::Admins::Level[0] = 0;
      $Host::Admins::Password[0] = "";

      $Host::Admins::Name[1] = "PUG";
      $Host::Admins::Level[1] = 1;
      $Host::Admins::Password[1] = "change_me1";

      $Host::Admins::Name[2] = "Moderator";
      $Host::Admins::Level[2] = 2;
      $Host::Admins::Password[2] = "change_me2";

      $Host::Admins::Name[3] = "Admin";
      $Host::Admins::Level[3] = 3;
      $Host::Admins::Password[3] = "change_me3";

      $Host::Admins::Name[4] = "Super Admin";
      $Host::Admins::Level[4] = 4;
      $Host::Admins::Password[4] = "change_me4";

      $Host::Admins::Name[5] = "Owner";
      $Host::Admins::Level[5] = 5;
      $Host::Admins::Password[5] = "change_me5";

      $Host::AutoResetPassword = false;
      $Host::AutoResetPasswordTime = 600000; // Default of 600,000 milliseconds = 10 minutes after all players have left
      $Host::DefaultPassword = "";

      // A lot of these will be overrided by Server::create() in server.cs
      // if the options are selected using the GUI page gameMenu.cs
      $Host::Name = "A Dedicated Server";
      $Host::GameType = "CTF";
      $Host::MaxPlayers = 32;
      $Host::MaxObservers = 10;
      $Host::Type = "Multiplayer Web";
      $Host::MinimumStartPlayers = 1;
      $Host::BroadcastMaster = true;

      new scriptGroup(MapRotationGroup)
      {
      };

      addMapToRotation("Fallout.mis","CTF",14,40);
      addMapToRotation("Frostbyte.mis","CTF",0,22);
      addMapToRotation("WinterMelt.mis","CTF",0,20);
      addMapToRotation("ZenithCauldron.mis","CTF",14,40);
      addMapToRotation("SandBox.mis","TDM",0,30);

bootcmd:
  - "dpkg --add-architecture i386"

packages:
  - libstdc++6:i386

runcmd:
  - "mkdir /opt/legions"
  - "rsync -a --stats --progress --compress --chown=legions:legions rsync.legionsoverdrive.com::live /opt/legions/live"
  - "install --owner=legions --group=legions /etc/legions_config.cs /opt/legions/live/server/preferences/cloud.cs"
  - "systemctl enable legions.service"
  - "service legions start"

Step 5. Click 'Create Droplet' at the bottom, and wait 2-3 minutes. If all goes well, your server will be up and running and available in the server list!


Accessing the game files​


To access the game files to make edits, such as adding maps, changing the server name, passwords, etc., you will need a client that can access the server. I simply use FileZilla as I feel it's the easiest for beginners. But any SFTP client should suffice.

Step 1. Download, install, and start FileZilla.

Step 2. Create a new entry for your Legions server.

1638146098968.png

The 'Host' is the IP of your server. This can be found from the 'Droplets' menu in your DigitalOcean account. It'll be something like 147.122.125.3
You can leave the port empty.
Protocol must be SFTP.
Set Logon Type to Normal
Username is root
The password will be whatever you used in the previous step.
Click the Advanced tab at the top, and enter /opt/legions/live for the Default remote directory.
Press OK at the bottom once all of this is entered.

Click the icon under File again, but press the arrow instead. From here, select the profile you just created. If you entered everything correctly, it will connect to your server and show you the game files. This is where you can make server changes, but this guide isn't really going to go into that.

Restarting your server​

If you do happen to make edits to the server or add new maps, you will very likely need to restart the server in order for these changes to go into effect. Go to your DigitalOcean account, click on Droplets, then click on your Droplet.

From here, click Access to the left of the graphs.

Click the blue 'Launch Droplet Console button.

In the window that appears, enter the following command to restart your server:

Code:
sudo shutdown -r now

Your server will restart and re-appear in the game list after 10-20 seconds.
 

Attachments

  • 1638144525835.png
    1638144525835.png
    8.8 KB · Views: 1
  • 1638144694513.png
    1638144694513.png
    126.7 KB · Views: 0
  • 1638145799617.png
    1638145799617.png
    15 KB · Views: 0
Last edited:

Fixious

Test Lead
As a short follow-up to the above method, if an update is pushed from the patcher and you want to make sure your server is up to date, run the following command on your server (in this case you can do it from your Droplet console):

Code:
rsync -a --stats --progress --compress --chown=legions:legions rsync.legionsoverdrive.com::live /opt/legions/live

Once that has been entered it will download the latest version of the game to your server/droplet. It'll probably take 2-3 minutes to complete. Once it does, stay in the Console and run this command to restart the server:

Code:
sudo shutdown -r now

After about 2-3 minutes, your server should re-appear in the server list.
 
Top