nalc-server/doc/README.org

141 lines
5.9 KiB
Org Mode

* Description
The files to install the Minetest NALC server.
* Installation
Start the install.sh script and follow instructions.
Help: ./install.sh --help
* 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.
- You'll also need 'git', 'cmake' and 'make' programs installed.
* 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.
The home of the 'minetest' user is located to /var/lib/minetest and you have the write access to it.
1. Create the dir '\/var/lib/minetest/.minetest' if not exist.
2. cd /var/lib/minetest
3. git clone --depth 1 -b master https://sys4.fr/gitea/nalc/nalc-server.git
4. cd nalc-server
5. ./install.sh -d \/var/lib/minetest/.minetest
6. Follow the instructions
** For a test server
We suppose you have already installed a production server that is actually in use and stable. But you want to install another one in palallel on the same system in order to test the development version of NALC.
For the next steps we will be logged in as a normal user:
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 '$INSTALL'.
4. $INSTALL/install.sh -d ~/.minetest -w test -P 30001 --branch dev ~/nalc-dev
5. Follow the instructions
** Case of a custom Minetest installation
We suppose you have compiled Minetest from sources with the CMAKE option RUN_IN_PLACE=TRUE. The location of your installation is ~/games/minetest.
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
5. Follow the instructions
** Other cases
Other combinaisons are possibles 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 :)
* Add or disable mods
If you want to add mods you can do it easily. 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'.
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.
* Start/Stop the server
** Use provided scripts
You can rename the $INSTALL/start.sh.example file to start.sh and give it executable permissions.
Then launch the server with the command $INSTALL/start.sh -s $DESTINATION.
Note: -s option can be ommited if you launch the script from the dir $DESTINATION.
For shutting down the server press CTRL-C.
You can edit the start.sh script for your needs.
** Use openrc to start/stop NALC as a daemon
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 init to start/stop NALC server as a service then you can follow theses steps:
1. Edit your ~/etc/conf.d/minetest-server~ file like that:
#+begin_src conf
# /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"
#+end_src
2. Edit or create the file ~/etc/init.d/minetest-server~:
#+begin_src openrc-run
#!/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 $?
}
#+end_src
3. Add the service to your default init level: ~rc-update add minetest-server default~.
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
You can execute the install.sh script again. If a nalc.conf file is detected in the specified destination, it will load all the settings specified during the previous installation.
Then you have to follow the instructions of the script and you will be able to update your server.