How to run your own Moonlapse server [Debian/Ubuntu]
17 Aug 2020 - saltytaro
Interested in playing by your own rules? You can download the code to run your very own MoonlapseMUD server.
To follow along with this tutorial, you will need a machine running an operating system with access to Advanced Package Tool (or APT).
- Note for Mac users, you can vaguely follow these instructions with Homebrew.
Prerequisites
- Firstly you will need Python 3.6 which should be installed by default on most Debian-based systems.
-
Update the package list using the following command:
sudo apt update
-
Install PIP, the Package Installer for Python, which is what we will use to obtain the rest of our prerequisite Python libraries
sudo apt install python3-pip
-
Install the PostgreSQL, the database server the game will need to read from and write to.
sudo apt install postgresql
-
Next, the drivers required to let Python and PostgreSQL talk to each other.
sudo apt install python3-psycopg2 sudo apt install libpq-dev sudo pip3 install psycopg2
-
Note for Mac users, you can instead run the following command (assuming you have homebrew installed):
brew install postgresql sudo pip3 install psycopg2
If you get a C compilation error such as
library not found for -lssl
then run this command and try the pip3 install again.export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
-
-
Install
git
and clone the MoonlapseMUD source from the current repositorysudo apt install git git clone https://github.com/trithagoras/MoonlapseMUD
-
Enter a new shell environment logged in as the
postgres
user:sudo -iu postgres
-
Set a password for the operating system user
postgres
, which is created when you install postgresql by default. This will be used to create your database.psql \password postgres
You’ll see the following prompts at which you enter the desired password:
Enter new password: Enter it again:
-
Now exit from the
psql
environment:\q
-
While still logged in as the
postgres
user, create a new user to run the Moonlapse database and create the new database itself.createuser --interactive --pwprompt Enter name of role to add: MoonlapseAdmin Enter password for new role: Enter it again: Shall the new role be a superuser? (y/n) y createdb Moonlapse
-
Now logout of the shell environment controlled by the
postgres
user to return to your own shell:exit
-
While logged in as your own user, install Twisted, the networking library for the server.
sudo pip install twisted
-
Install Django, the library used for the ORM.
sudo pip install django
-
Create the database connection string and place it in the
MoonlapseMUD/server
directory.MoonlapseMUD/server/connectionstrings.json
{ "user": "MoonlapseAdmin", "password": "myPassword", "host": "localhost", "port": "5432", "database": "Moonlapse" }
-
Initialise the database.
python MoonlapseMUD/server/manage.py makemigrations server python MoonlapseMUD/server/manage.py migrate python MoonlapseMUD/server/manage.py flush python MoonlapseMUD/server/loaddata.py
-
Run the server!
python MoonlapseMUD/server