NoseyNick's Nebula - an Artemis SBS server-in-the-cloud

"Nebula" is my Artemis SBS server in the cloud. Specifically, it's a bunch of scripts that can kick off an AWS server running a fresh untouched Ubuntu Linux, will install WINE and a bunch of other pre-requisites, install and configure Artemis, run it, click "server", and be ready for your players to connect to within 5 minutes. You can then connect using SSH in order to configure Siege/Single Front/Double Front/Deep Strike/etc, Difficulty Level, Terrain/LethalTerrain/FriendlyShips/Monsters/Anomalies, and click "Start Game" - there are some commands installed to "click buttons for you" or you can run VNC to see / click the buttons yourself.

Contents...

Step 1: AWS account (once)

You'll need to get yourself an AWS account ("create a free account"), unless you already have one of course!

You'll want an SSH keypair in the right region (see below). If you're on Linux you probably already know what SSH is. If you're on Windows you'll probably want PuTTY Secure SHell - this is how you'll connect securely across the internet to your Nebula server

You'll want a Network Security Group in the right region. Call it "2010", add inbound rule, protocol TCP, port 22, source "Anywhere" (unless you want to be really specific about where you will be connecting from for administration?), add inbound rule, protocol TCP, port 2010, source "Anywhere" (unless you know all the IPs of all your players?!?), Done. This will allow players to connect to the Artemis server (which runs on TCP port 2010)

There's no cost for any of the above SO FAR

Step 2: Pick your region and VM size

Unfortunately an Artemis server requires a VM with a spec that's too big for the AWS "free tier". Your VM is going to cost you some money to run, however I've found a spec that seems to run Artemis OK[*] and supports a reasonable number of clients/players for 17c/hr. I think 50c for 3hrs of Artemis is OK, isn't it? Remember how far 50c used to go at the arcade? When you're done with it you can completely nuke it, there's no disks to keep around so no cost when NOT using the server.

Your "region" should probably be chosen according to where most of your players are located, with a bit of an eye on price. Start at AWS's "on demand" pricing page, 4 vCPUs, usually the "compute optimised" are cheapest. You should obviously check for yourself, I am not going to pay your bill for you, but last time I checked some appropriate prices were:

0.17 USD/hr: vCPU=4 ECU=16 memoryGiB=8 storageGB=ebsonly region=ap-south-1 type=computeCurrentGen size=c5.xlarge
0.17 USD/hr: vCPU=4 ECU=16 memoryGiB=8 storageGB=ebsonly region=us-east-1 type=computeCurrentGen size=c5.xlarge
0.17 USD/hr: vCPU=4 ECU=16 memoryGiB=8 storageGB=ebsonly region=us-east-2 type=computeCurrentGen size=c5.xlarge
0.17 USD/hr: vCPU=4 ECU=16 memoryGiB=8 storageGB=ebsonly region=us-west-2 type=computeCurrentGen size=c5.xlarge
0.186 USD/hr: vCPU=4 ECU=16 memoryGiB=8 storageGB=ebsonly region=ca-central-1 type=computeCurrentGen size=c5.xlarge
0.192 USD/hr: vCPU=4 ECU=16 memoryGiB=8 storageGB=ebsonly region=eu-west-1 type=computeCurrentGen size=c5.xlarge
0.194 USD/hr: vCPU=4 ECU=16 memoryGiB=8 storageGB=ebsonly region=eu-central-1 type=computeCurrentGen size=c5.xlarge
0.196 USD/hr: vCPU=4 ECU=16 memoryGiB=8 storageGB=ebsonly region=ap-southeast-1 type=computeCurrentGen size=c5.xlarge
0.202 USD/hr: vCPU=4 ECU=16 memoryGiB=8 storageGB=ebsonly region=eu-west-2 type=computeCurrentGen size=c5.xlarge
0.202 USD/hr: vCPU=4 ECU=16 memoryGiB=8 storageGB=ebsonly region=eu-west-3 type=computeCurrentGen size=c5.xlarge
0.212 USD/hr: vCPU=4 ECU=16 memoryGiB=8 storageGB=ebsonly region=us-west-1 type=computeCurrentGen size=c5.xlarge
0.222 USD/hr: vCPU=4 ECU=16 memoryGiB=8 storageGB=ebsonly region=ap-southeast-2 type=computeCurrentGen size=c5.xlarge
0.227 USD/hr: vCPU=4 ECU=16 memoryGiB=7.5 storageGB=ebsonly region=ap-northeast-2 type=computeCurrentGen size=c4.xlarge
0.2432 USD/hr: vCPU=4 ECU=variable memoryGiB=16 storageGB=ebsonly region=ap-northeast-1 type=generalCurrentGen size=t2.xlarge OR
0.252 USD/hr: vCPU=4 ECU=16 memoryGiB=7.5 storageGB=ebsonly region=ap-northeast-1 type=computeCurrentGen size=c4.xlarge
0.262 USD/hr: vCPU=4 ECU=16 memoryGiB=8 storageGB=ebsonly region=sa-east-1 type=computeCurrentGen size=c5.xlarge

Step 3: Start your VM

If you are using Linux and/or can run BASH scripts and have the AWS CLI installed and configured...

Download start.sh. Check the variables at the top. You probably want to change SSHKEY=name-of-your-ssh-key, you may want to change REGION=us-east-1 and a corresponding IMAGE_ID=ami-927185ef, and maybe INSTANCE_TYPE=c5.xlarge - see the notes in the top of the script. All except INSTANCE_TYPE can be set in a creds.sh script if you wish. Some stuff is also driven off of NAME which can be set when you run the script (see below).

Then just run it:

SSHKEY=my-ssh-key ./start.sh 271ben

Make a note of the Public IP it tells you.

If you prefer the AWS web console...

  • Fire up the "Launch Instance Wizard"
  • Make sure you're in the right region (dropdown in the top-right)
  • Select Ubuntu Server
  • Choose an Instance Type: c5.xlarge (or whatever you chose above)
  • "Configure Instance Details" (NOT review+launch)
  • "Shutdown behavior: Terminate". You do not need to keep the VM around, you can nuke it when done, and start again "from scratch" next time
  • Advanced Details... paste this into "User data":
    #!/bin/bash
    wget -T3 -O- http://noseynick.org/artemis/aws/init.sh | NAME=271ben bash
  • Skip to step 6: "Configure Security Group"
  • "Select an existing security group" and choose the "2010" one you made above (or you could make it for the first time - leave SSH/TCP/22 and add Custom/TCP/2010/Anywhere
  • Review and Launch, Launch
  • Choose the SSH keypair you created/uploaded above (or you could make a new one at this point)
  • Launch Instance
  • Return to the list of instances, make a note of the "Public IP" of your shiny new server!

Step 4: Wait for it to start

You should be able to connect to it (using SSH or PuTTY) within about a minute, for example if your Public IP was 192.0.2.3:

ssh -L5900:127.1:5900 ubuntu@192.0.2.3   # <-- use the real IP address here
tail -1000f /var/log/cloud-init.log      # to watch boot progress

If using PuTTY, you'll want to connect to the supplied IP, user "ubuntu", and arrange for a "local port forward" of port 5900 to 127.0.0.1 5900

If it works, you'll see a lot of headers like:

######################################################################
#### YYYY-MM-DD HH:MM:SS : SSH config...
######################################################################
... and a lot of other debugging output in between. It will probably pause for quite a while on some https://dl.winehq.org/wine-builds/ubuntu stuff (I'll be looking for a faster WINE mirror soon). When done, you should see something like...
#### YYYY-MM-DD HH:MM:SS : Waiting 50 secs for server...
#### YYYY-MM-DD HH:MM:SS : Waiting 49 secs for server...
#### YYYY-MM-DD HH:MM:SS : Waiting 48 secs for server...
tcp        0      0 0.0.0.0:2010            0.0.0.0:*               LISTEN
######################################################################
#### YYYY-MM-DD HH:MM:SS : DONE - stop the clock!
######################################################################
If it DOESN'T work, in particular if you don't see the "tcp ... 0.0.0.0:2010" line, you may want to hit control-C and re-start the entire process:
wget -T3 -O- http://noseynick.org/artemis/aws/init.sh | sudo NAME=271ben bash
If it still doesn't work... Sorry, get hold of me (probably on the United Stellar Navy Discord server) and tell me what went wrong. I'll probably appreciate a copy of your /var/log/cloud-init.log file from Step 4 above, and/or I might want to log into your server to nose around - I'll discuss how to do that once you get hold of me.

Step 5: Play!

Once you see "tcp... 0.0.0.0:2010" you know that you, and your other players, can point your Artemis clients at the Public IP address.

You're going to need to choose game type, skill level, Terrain/LethalTerrain/FriendlyShips/Monsters/Anomalies etc though, and you're going to need to start the game. There are 2 ways to do this:

  1. Point a VNC client at 127.0.0.1, EG vncviewer 127.0.0.1
  2. Run a series of commands to click buttons for you, and (without being able to see them) HOPE it has done what you expected

Some of the special commands available to you are:

Some regular Linux commands that may be useful:

Step 6: Shutdown

From inside the VM: sudo /sbin/poweroff

From the AWS CLI: aws ec2 terminate-instances --region $REGION --instance-ids $ID

From the AWS web console, make sure you're in the right region (if you forgot, then yes, sorry, you're going to have to check every single region). Click on the VM in the list. Click "Actions", "Instance State", "Terminate".

How It Works

Optional Extras

aws-pricing.pl produces the price list above. It is not guaranteed to be up-to-date or correct or anything, I'm not responsible for any errors on your AWS bill or anything.

A number of environment variables can be set in "Step 3 Start your VM" or if you are re-running manually in step 4. The examples show NAME=271ben or SSHKEY=my-ssh-key. If you're using start.sh from your own machine, you can set them in the environment, or in a creds.sh which will be read by start.sh. If you're using the AWS web console, you'll add them in your "User data" between the | and bash

Performance

"Load average" stats during typical USN games show the machine using about 2.5 - 3.5 of the 4 CPUs allocated to it, with no "steal time", so Artemis seems to not be bottlenecked. AWS still uses "powers of 2" CPUs, so 2 would be too few, 8 would be too many, 4 seems to be the Goldilocks "just right".

After many / most games, I also get my Artemis-Puppy bot to post a quick survey (see puppy-poll.sh), which looks a bit like...

cute puppy     Artemis-Puppy BOT
Thanks Crew! Please rate the performance of this server - it's a bit of an experiment and I'd appreciate feedback:
AMarvellous
BPretty good
CFair
DNot goot
EBad
FAwful
Total votes so far (2018-04-21, fakes The bot itself votes for A-F to make the options appear, making
it LOOK like every letter has at least 1 vote per survey
removed
):
A 3   B 9   C 1   D 1   E 0   F 0  

... so it looks like USUALLY the players agree these servers are "Pretty good" :-)

Coming Soon? Maybe?


(See also my other Artemis tools)