How to run your own Moonlapse server [Arch/Manjaro]

12 Oct 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 Arch Linux official repositories. In this example, we will be using pacman which is standard in most Arch-based distributions.

Prerequisites

  1. Firstly you will need Python 3.6 which should be installed by default on most Arch-based systems.
  2. Update the package list using the following command:

    sudo pacman -Syyu
    
  3. Install PIP, the Package Installer for Python, which is what we will use to obtain the rest of our prerequisite Python libraries\

    sudo pacman -S python-pip
    
  4. Install PostgreSQL the database server the game will need to read from and write to.

    sudo pacman -S postgresql
    
  5. Next, the drivers required to let Python and PostgreSQL talk to each other.

    sudo pacman -S python-psycopg2
    sudo pip install psycopg2
    
  6. Install git and clone the MoonlapseMUD source from the current repository

    sudo pacman -S git
    git clone https://github.com/trithagoras/MoonlapseMUD
    sudo cp MoonlapseMUD/Moonlapse.sql /var/lib/postgres
    
  7. Initialise the database cluster.
     sudo -iu postgres
     initdb -D /var/lib/postgres/data
     exit
    
  8. Enable and start the PostgreSQL service.
    sudo systemctl enable postgresql
    sudo systemctl start postgresql
    
  9. 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.\

    sudo -u postgres psql postgres
    \password postgres
    \q
    

    You’ll see:

    Enter new password:
    Enter it again:
    
  10. From your terminal, create a new user to run the Moonlapse database and create the new database itself.\
   sudo -iu postgres
   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
  1. When you’re running psql as the postgres user, create the database required for the game. Then run the script you moved earlier to create the structure for the game database.
   psql Moonlapse
   \i Moonlapse.sql
   \q
   exit
  1. 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"
}
  1. python MoonlapseMUD/server