This is a project to remotely host a Mindustry server on a remote server without a GUI, such as AWS EC2 or Digital Ocean Droplets. It provides a simple web interface, where users can log in to issue simple commands.
- Lightweight Remote Management: Remotely manage your Mindustry server from a lightweight web GUI
- Access Control: Different accounts have different permissions, limiting the commands they can run and the save slots that they can use. If you don't trust your invitee, give them less access.
- GUI: Easier to use for people who have never touched the command line. Click on forms and buttons instead of typing commands.
Mindustry servers have the ability to execute javascript code. This includes code that can hack your server. As a result, arbitrary commands execution (for commands outside of the whitelisted commands in the project) and user text input is disabled by default. However, if you really trust your password and my code, or care little about your server being coopted into the next big botnet, you can always re-enable that feature.
The following tutorial for setup assumed you have a Ubuntu server with Nginx and python3 installed. If your situation differs, your mileage may vary. Feel free to open an issue to ask for help. A tutorial for installing Nginx can be found here.
ssh
into your remote server.mkdir Mindustry && cd Mindustry
to make a folder for the code and server jar.wget https://github.com/LivelyCarpet87/Mindustry-HTTP-Wrapper/releases/download/v2.1/Mindustry-HTTP-Wrapper_v2.1.zip
to download the latest release to the current folder. Also usewget
to download the latest mindustry server release from hereunzip -x Mindustry-HTTP-Wrapper_v2.1.zip
to extract the filespython3 -m venv mindustryServer
to create a virtual environment for the server's python dependencysource mindustryServer/bin/activate
to activate the virtual environment. (You will need to do this step every time you start a new shell)pip3 install -r requirements.txt
to install the required librariespip3 install gunicorn
to installgunicorn
to host the servernano server.py
to open up the server file and edit the configuration section. Once complete, pressCTRL
+O
, thenENTER
to save the changes. Once complete, pressCTRL
+X
to exit the editor.sudo nano /etc/systemd/system/mindustry.service
to create a service file. This will launch the mindustry server everytime the virtual server starts.- Paste in and edit the following:
Once complete, press
[Unit] Description=Gunicorn instance to serve Mindustry After=network.target [Service] User=ubuntu Group=www-data WorkingDirectory=/home/ubuntu/Mindustry Environment="PATH=/home/ubuntu/Mindustry/mindustryServer/bin" ExecStart=/home/ubuntu/Mindustry/mindustryServer/bin/gunicorn --workers 1 --threads 1 --bind unix:mindustry.sock -m 007 server:app [Install] WantedBy=multi-user.target
CTRL
+O
, thenENTER
to save the changes. Once complete, pressCTRL
+X
to exit the editor. sudo systemctl start mindustry
to start the serversudo systemctl enable mindustry
to start the server on bootsudo systemctl status mindustry
to make sure everything is working fine. If errors occurred, check previous setps or open an issue to ask for help.sudo nano /etc/nginx/sites-available/mindustry
to create the Nginx server entry. Paste and edit the following as necessary.Once complete, pressserver { listen 80; server_name your_domain_or_ip; location / { include proxy_params; proxy_pass http://unix:/home/ubuntu/Mindustry/mindustry.sock; } }
CTRL
+O
, thenENTER
to save the changes. Once complete, pressCTRL
+X
to exit the editor.sudo ln -s /etc/nginx/sites-available/mindustry /etc/nginx/sites-enabled
to link your site configuration to Nginx's enabled sites.sudo nginx -t
to check that everything is without issue with Nginxsudo systemctl restart nginx
to restart Nginx
Because this project does not need a beautiful interface to function, it is a collection of links and forms that trigger different server responses.
I believe that it is a horrible security practice to expose a web app that has priveleged access to a shell that can run arbitrary code, then hoping that it never gets abused. Instead of investing in a lot of security filtering, I instead elected to whitelist inputs. However, if you are understand the risks (hopefully), you can change the settings under the server configuration.
Feel free to extend the code in any way to add more features, or just open a pull request asking me to.