nalc-server/README.md

170 lines
6.1 KiB
Markdown
Raw Permalink Normal View History

2018-03-15 21:57:46 +01:00
2022-05-27 14:36:02 +02:00
# Description
2018-03-15 23:49:09 +01:00
2022-05-27 14:36:02 +02:00
The files to install the Minetest NALC server.
2018-03-15 23:49:09 +01:00
2019-04-28 22:43:57 +02:00
2022-05-27 14:36:02 +02:00
# Installation
2022-05-27 16:25:43 +02:00
Start the `install.sh` script and follow instructions.
2022-05-27 14:36:02 +02:00
2022-05-27 16:25:43 +02:00
Help: `./install.sh --help`
2022-05-27 14:36:02 +02:00
# Requirements
- Official Minetest server must already be installed on your GNU/Linux system. If it is not the case, please refers to the <https://minetest.net> website for the installation instructions.
2022-05-27 16:25:43 +02:00
- You'll also need 'git', and optionaly 'cmake' and 'make' programs installed.
2022-05-27 14:36:02 +02:00
# Examples of installation
## For a production server intended to be publicly available
We suppose that you have already installed Minetest server from your package manager.
2022-05-27 16:25:43 +02:00
The home of the 'minetest' user is located to `/var/lib/minetest` and you have the write access to it.
2022-05-27 14:36:02 +02:00
2022-05-27 16:25:43 +02:00
1. Create the dir `/var/lib/minetest/.minetest` if not exist.
2. `cd /var/lib/minetest`
3. `git clone --depth 1 https://sys4.fr/gitea/nalc/nalc-server.git`
4. `cd nalc-server`
5. `./install.sh -d /var/lib/minetest/.minetest`
2022-05-27 14:36:02 +02:00
6. Follow the instructions
## For a test server
2022-05-27 16:25:43 +02:00
We suppose you have already installed a production server that is actually in use and stable. But now you want to install another server in parallel on the same system in order to test the development version of NALC.
2022-05-27 14:36:02 +02:00
For the next steps we will be logged in as a normal user:
2022-05-27 16:25:43 +02:00
1. `cd`
2. Create the dir `~/.minetest` if it not exist.
3. No need to download the server files again because they are already downloaded in the dir `/var/lib/minetest/nalc-server`. So you can just do a `mkdir ~/nalc-dev`. But you can always do a `git clone https://sys4.fr/gitea/nalc/nalc-server.git ~/nalc-dev` if you prefer. Whatever your choice and for the next steps we will refer to the install dir as `$SCRIPT_DIR`.
4. `$SCRIPT_DIR/install.sh -d ~/.minetest -w test -P 30001 --branch dev ~/nalc-dev`
2022-05-27 14:36:02 +02:00
5. Follow the instructions
## Case of a custom Minetest installation
2022-05-27 16:25:43 +02:00
We suppose you have compiled Minetest from sources with the CMAKE option `RUN_IN_PLACE=TRUE`. The location of your installation is `~/games/minetest`.
2022-05-27 14:36:02 +02:00
2022-05-27 16:25:43 +02:00
1. `cd ~/games`
2. `git clone https://sys4.fr/gitea/nalc/nalc-server.git`
3. `cd nalc-server`
4. `./install.sh -b ~/games/minetest/bin/minetestserver -d ~/games/minetest`
2022-05-27 14:36:02 +02:00
5. Follow the instructions
## Other cases
2022-05-27 16:25:43 +02:00
Other combinations are possible and I cannot describe all of them. Don't hesitate to read the help of the script with `--help` option and do your own tests :)
2022-05-27 14:36:02 +02:00
# Add or disable mods
2022-05-27 16:25:43 +02:00
- If you want to add mods you can do it easily.
2022-05-27 14:36:02 +02:00
2022-05-27 16:25:43 +02:00
For that you can create the dir `$DESTINATION/custom/mods` where `$DESTINATION` is the dir where you have installed the server (the one containing the `nalc.conf` file).
Then copy your mods and modpacks in `$DESTINATION/custom/mods` and you need to execute `$INSTALL/upgrade.sh -s $DESTINATION -w <world> -b <version> -f worldmt` for regenerating the `world.mt` file of your world.
Replace `<world>` by your world name.
Replace `<version>` by the branch name specified during the installation, either 'stable', 'dev' or 'exp'.
2022-05-27 14:36:02 +02:00
2022-05-27 16:25:43 +02:00
- If you want to disable mods you need to edit the file `$DESTINATION/mods_disabled.txt` and add one mod name per line.
Then execute again `$INSTALL/upgrade.sh -s $DESTINATION -w <world> -b <version> -f worldmt`.
Note: Depending on how you have installed NALC server, but `$INSTALL` and `$DESTINATION` can point to the same directory. If it's the case you can ommit the `-s` option.
2022-05-27 14:36:02 +02:00
# Start/Stop the server
## Use provided scripts
2022-05-27 16:25:43 +02:00
You can rename the `$SCRIPT_DIR/start.sh.example` file to `start.sh` and give it exe permissions.
Then launch the server with the command `$SCRIPT_DIR/start.sh -s $DESTINATION`.
2022-05-27 14:36:02 +02:00
2022-05-27 16:25:43 +02:00
Note: `-s` option can be ommited if you launch the script from the dir `$DESTINATION`.
2022-05-27 14:36:02 +02:00
2022-05-27 16:25:43 +02:00
For shutting down the server press `CTRL-C`.
2022-05-27 14:36:02 +02:00
2022-05-27 16:25:43 +02:00
You can edit the `start.sh` script for your needs.
2022-05-27 14:36:02 +02:00
## Use openrc to start/stop NALC as a daemon
2022-05-27 16:25:43 +02:00
We suppose minetest is installed from portage with the `+server` USE flag and NALC server is installed in the home of the minetest user `/var/lib/minetest/nalc-server`. If you would use your Gentoo/Calculate Linux system run init to start/stop NALC server as a service then you can follow theses steps:
2022-05-27 14:36:02 +02:00
1. Edit your `/etc/conf.d/minetest-server` file like that:
# /etc/conf.d/minetest-server: config file for /etc/init.d/minetest-server
# user
USER="minetest"
# group
GROUP="minetest"
# pidfile
PIDFILE="/run/minetest-server.pid"
# executable
MINETESTBIN="/usr/bin/minetestserver"
# additional arguments for the server
ARGS="--logfile /var/log/minetest/minetest-server.log"
2. Edit or create the file `/etc/init.d/minetest-server`:
#!/sbin/openrc-run
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
supervisor="supervise-daemon"
description="Minetest dedicated server"
depend() {
need net postgresql-13 # Remove postgresql-13 if you don't use it as a Minetest backend.
}
start() {
ebegin "starting Minetest server"
${supervisor} ${RC_SVCNAME} \
--pidfile "${PIDFILE}" \
--user ${USER} \
--group ${GROUP} \
--start "${MINETESTBIN}" -- ${ARGS}
eend $?
}
stop() {
ebegin "stopping Minetest server"
${supervisor} ${RC_SVCNAME} \
--stop \
--signal 15 \
--pidfile "${PIDFILE}" \
--user ${USER} \
--group ${GROUP}
eend $?
}
2022-05-27 16:25:43 +02:00
3. Add the service to your default init run level: `rc-update add minetest-server default`.
2022-05-27 14:36:02 +02:00
4. Start the service: `rc-service minetest-server start`.
5. Stop the service: `rc-service minetest-server stop`.
## TODO Use systemd to start/stop NALC as a daemon
# Update the server
2022-05-27 16:25:43 +02:00
You can execute the `install.sh` script again. If a `nalc.conf` file is detected in the specified destination, all the settings specified during the previous installation will be loaded.
2022-05-27 14:36:02 +02:00
Then you have to follow the instructions of the script and you will be able to update your server.
2019-04-28 22:43:57 +02:00