Installation from scratch
The following instructions assume you have a clean Linux machine at your disposal, with absolutely nothing (else) running on it as yet.
Of course, this might not be the case. You might already have a Linux machine running Docker containers of other applications. We then assume you have a web server running (such as Nginx) that listens to http(s) web requests for particular domains, and redirects to particular ports running particular Docker containers accordingly. You can also accomplish this by using the Nginx reverse-proxy Docker container. We at BUas are still experimenting with this, so this guide does not offer support or instructions for this kind of a setup just yet.
So back to the initial assumption: you have a clean Linux machine with absolutely nothing (else) running on it yet. In this case, to get the MSP Challenge server up and running on Linux, in the form of Docker containers, please do the following:
- Get your hands on a (sub-)domain name and make sure it refers to the IP address of your Linux machine. This means defining an A record in the domain's DNS settings, through some DNS-setting tool that your domain or hosting provider should provide.
- Log on to your Linux machine using SSH. You could use Putty for this, a free SSH client for Windows. Be sure the account you use to log onto the machine has full superuser privileges. If needed, it's easiest if you switch to the root user by running:
sudo -i
- Make sure the Linux package index and then the actual Linux packages are all up-to-date. Type and enter the following command:
apt-get update -y && apt-get upgrade -y
- If still needed*, follow these instructions to install the Docker Engine on your Linux machine: https://docs.docker.com/engine/install/ubuntu/ There are multiple ways of doing it, we always like to use the apt repository. It should be pretty straightforward - a matter of pasting and running a handful of commands (~5 minutes). (* this won't be needed if you're using e.g. MS Azure's Docker on Linux operating system image)
- Next, install PHP. Type and enter the following command:
apt-get install php8.1-fpm -y
- Make sure your Linux machine has Git installed by running, for example:
git --version
- If it turns out you don't have Git yet, then install it by running:
apt-get install git
- Now obtain the MSP Challenge Server code. If you run the command below, it'll download the code into a newly created subfolder MSPChallenge-Server of your current working directory. If you don't want it there, then change directory to a proper parent folder before your run the command:
git clone --branch REL4_0 https://github.com/BredaUniversityResearch/MSPChallenge-Server.git
- Get into the MSPChallenge-Server subfolder:
cd MSPChallenge-Server
- In it, create a new file called .env.local (indeed, this file has a name that starts with a dot, that is correct), and edit it using VI or NANO:
vi .env.local
nano .env.local
- Assuming you're familiar enough with these kinds of text file editors, paste the following text into the file and replace the 'your.domainname.here' part with your chosen (sub-)domain name for the server (see the very first bullet at the top of this page). Of course, be sure to save and close the file when you're done. Note that from release 4.0.2 the line WEB_SERVER_HOST has been removed.
SERVER_NAME=your.domainname.here URL_WEB_SERVER_PORT=443 URL_WS_SERVER_PORT="${URL_WEB_SERVER_PORT}" URL_WEB_SERVER_SCHEME=https:// URL_WS_SERVER_SCHEME=wss:// URL_WS_SERVER_URI=/ws/ APP_ENV=prod URL_WEB_SERVER_HOST="${SERVER_NAME}" URL_WS_SERVER_HOST="${SERVER_NAME}"
- Advanced Docker users will surely recognise the opportunities for customising the Docker container setup here. Indeed, through all sorts of environment variables you can define the schemes, port numbers and host names of the different containers that make up the entire MSP Challenge Server solution. If you're interested in this (perhaps because you want to use a Linux machine that has other Docker containers running as well - see the top of this page), then have a look in the docker-aliases.sh file (specifically the 'dcu' alias definition) for more information.
- You're ready to get the Docker containers built, up and running. We've created a bunch of short commands to help you with that. To enable these commands, run the following:
source docker-aliases.sh
- The above will enable you to run the following alias for a much longer Docker Compose Up Production command, which is nice. Just type and enter:
dcup
- It typically takes a couple of minutes for all the Docker containers to get built, up and running. By the end you should see something like this:
You might need to give the container another minute or two, but after that you should be able to open up the Server Manager application in your browser under your Linux machine's domain name, something like:
https://your.domainname.here/ServerManager
You might first get redirected to the MSP Challenge Authoriser application prompting you to log in with your MSP Challenge account. This might not happen if you already did that in your current browser session (as we have a Single Sign-On functionality).
Either way, you should end up seeing the New Server Installation message of the Server Manager application. You can now go ahead and set up your first new game session. If you're not familiar with this, then follow the instructions on this page.
That should be it!
Uninstallation
You might want or need to uninstall and remove the Docker containers at some point, if only to reinstall everything again afterwards (with or without an alteration in the Docker configuration). Here's how we do this at BUas:
- First you need to stop the Docker containers. For that you need to know the container IDs:
docker ps
- You should see something like this:
- You can now stop the containers with the following command, replacing <ID> with the actual container IDs (paste them in, separated by a space):
docker stop <ID> <ID> <ID>
- Then you can completely remove the containers in a similar way:
docker rm <ID> <ID> <ID>
- Finally, you can remove the image in a similar way, only this time you should use the image name (e.g. mspserver-caddy):
docker rmi <IMAGE> <IMAGE> <IMAGE>
Of course you could now also delete the entire MSPChallenge-Server subfolder you originally retrieved through Git as well.
Alternatively, if you did this to just upgrade your MSP Challenge Server, then you now can pull in the latest code changes by running the following within the MSPChallenge-Server subfolder:
git pull
...and then you can rebuild the containers again with the aforementioned 'dcup' command (see above).