]> git.lizzy.rs Git - elidragon_v2.git/commitdiff
Minor adjustments to the scripts and added documentation
authorElias Fleckenstein <eliasfleckenstein@web.de>
Fri, 19 Feb 2021 14:22:39 +0000 (15:22 +0100)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Fri, 19 Feb 2021 14:22:39 +0000 (15:22 +0100)
README [new file with mode: 0644]
scripts/internal.sh
scripts/setup.sh
scripts/update.sh

diff --git a/README b/README
new file mode 100644 (file)
index 0000000..cd1447b
--- /dev/null
+++ b/README
@@ -0,0 +1,73 @@
+Elidragon v2 Server software documentation
+------------------------------------------
+
+This repositiory contains everything required to run the Elidragon v2  Minetest server. Elidragon v2 is the sequel to Elidragon Skyblock and is reusing Skycraft code to a large degree.
+
+This documentation is meant for people who have to deal with the Elidragon v2 server in the future. I don't plan to quit the admin/developer team, but who knows what happens in the future. Maybe I change my mind or are temporary unreachable. I don't want to leave burned soil behind, like I did with the Elidragon Skyblock server. Fortunately today's admins of this server are mostly my IRL friends and therefore easily able to reach me. This documentation was not written to give people the possibility to create a Elidragon v2 ripoff. You can do that, but it is discouraged. The server software is Open Source because I believe that users should have the possibility to read and contribute to the software they are using, even if it is backend software. If you reuse parts of the code in this reop or fork it and build your own server on top of it, I am perfectly fine with that, but I ask you to not just install my software on your own server and possibly take away users from my server using my own software. It will not have any legal consequences if you do, but I politely ask you to not do it.
+
+The goal of Elidragon v2 is to provide a server similar to popular Minecraft servers: When joining a network, you are moved to a lobby, and from there players can select which gamemode they want to play (e.g. Creative, Survival, Skyblock or Minigames) and are automatically connected to the proper server, whithout having to rejoin the server by any means. Players can get anything they want within one network and can easily switch between gamemodes and make progress in different worlds.
+
+Minetest does not support "server-hopping" natively; therefore the multiserver proxy written in Go by HimbeerserverDE is used. multiserver depends on mt rudp by anon55555.
+
+Elidragon v2 runs on top of the latest git version of MineClone2, and the lastest stable release of minetest.
+
+Quick guide for installation and running
+----------------------------------------
+ElidragonV2 requires a GNU/Linux system to run. The setup and update scripts rely on apt and sudo. Go 1.15 or higher is required.
+
+1. Create a new user using adduser and switch to it. The user should be able to use sudo.
+2. git clone this repository into that user's home directory and rename it to .minetest
+3. cd into .minetest
+4. run scripts/setup.sh - this will automatically install minetest and screen. Also, it initialized the submodules - all external mods and MineClone2 are installed automatically. It will also install multiserver and mt rudp.
+5. run scripts/start.sh - this will automatically start all worlds. If one world crashes / shuts down it will automatically restart.
+
+To update, run scripts/update.sh, to restart all worlds run scripts/restart.sh and to stop all worlds run scripts/stop.sh
+
+Organisation structure
+-------------------
+
+The idea is that once the repository is clones onto the server, it contains all code and configuration files needed to run. Even the worlds are part of the repo, but the only files that get tracked by git are the world.mt and minetest.conf (every world has its own minetest.conf and debug.txt). All other files in each world directory will simply be ignored (.gitignore), so none of the databases etc. can be found in the git repository. You are not meant to change ANYTHING in the repo directly (except of course e.g. databases, if it is needed - basically you should only change files that are not tracked by git). If you want to change anything, including configuations, change it in your local installation of Elidragon v2, test and commit it, then push it to the github repository. Afterwards run git pull --recurse-submodules on the server and restart all worlds. (The latter two tasks are automated; See the Scripts section). It is recommended to just use the repository as the .minetest directory. If not used as .minetest directory it will run fine as well, but you'll have to install MineClone2 seperately. However, you are not meant to manually start any worlds; if you have to, you HAVE to, make sure you hand the minetestserver worldpath (worlds/<world>), logfile (worlds/<world>/debug.txt) and configuration file (worlds/<world>/minetest.conf). Usually the start script should be used to start one or all worlds.
+
+Scripts
+-------
+
+For many tasks it is recommended to use the scripts from the scripts/ directory. All scripts need to be run from the root path of this repository.
+
+scripts/setup.sh: This will install minetest and screen using sudo apt. For minetest a apt repository is added that is up to date (the official repos are often one or two versions behind). It will use go to install multiserver, also it will init and update the submodules, which is very important because all external mods are added as submodules.
+
+scripts/update.sh: This will pull the repository including all submodules. Also, it will update minetest, screen and multiserver.
+
+scripts/start.sh: You can use this to start one or all worlds from the worlds folder. If you pass an argument to it, it will start the specified world, else it will start everything. You can use this script even if some worlds are already running. The worlds will be started in a hidden screen and restarted when killed, shut down using /shutdown or crash. Any started world will have a lock file in the /tmp directory that contains the PID of the current minetest process. When the world is stopped, the lock file is deleted.
+
+scripts/stop.sh: You can use this to stop one or all worlds from the worlds folder started using the start script. If you pass an argument to it, it will stop the specified world, else it will stop everything. You can use this script even if some worlds are not running.
+
+scripts/restart.sh: You can use this to restart one or all running worlds. You can use this script even if some worlds are not running. It will only restart the running worlds.
+
+scripts/console.sh: You can used this to access the console of the world specified in the argument. (minetest --terminal running in a screen)
+
+scripts/common.sh: This script should not be started, it contains common functions imported by other scripts. You can modify it to e.g. change the paths of lock files or screen names.
+
+Creating new mods
+-----------------
+
+If you create a new mod, create a folder mods/elidragon_<name>. It should have a mod.conf containing its name, a small description and your name. It should depend on the elidragon mod and all other mods it needs. Any dependenency (that is not already in the repo or in MineClone2) needs to be added as submodule. It should add a <name> table to the elidragon namespace e.g.
+local testing = {}
+
+function testing.test()
+    print("test")
+end
+
+elidragon.testing = testing
+
+When using more than one function from the same other elidragon_ mod, you should import it by doing local othermod = elidragon.othermod at the beginning of the file. All code should be inside init.lua, and don't be scared of creating multiple mods at once - the system is meant to be as modular as possible. After you created the mod, you have to complete the steps for Adding existing mods (except adding the submodule ofc).
+
+Adding existing mods
+--------------------
+
+If you want to add an external mod, cd to the mods directory and type git submodule add <git repo of external mod>.
+For any new mod an entry needs to be added to all world.mt files, saying load_mod_xy = true / false. This is important because if you do not specify load_mod_xy, Minetest will automatically add it, and we do not want minetest to mess with files added to git.
+
+Adding new worlds
+-----------------
+
+If you want to add a new world, add a folder to the worlds/directory. Then, create .gitignore, world.mt and minetest.conf in that directory. .gitignore needs to contain * to ignore everything, and !minetest.conf and !world.mt to include these two. minetest.conf and world.mt need to be created and filled, world.mt needs to contain load_mod_xy = true / false for every added mod, see the Adding existing mods section for that. Also, world.mt needs to contain database settings for map, players and auth data and settings to enable / disable creative mode and damage. Each world also has it's own configuration file. The concept for worlds and mods is that some mods are for one world only e.g. the skyblock mod for the skyblock world, and some are shared. Make sure that each world has the mods enabled that the enabled mods depend on. Every world needs to have a port specified in the config file and needs to be added to the multiserver configuration. Only the lobby server is supposed to announce to the server list.
index 8bfd1fc1038b88143e749ce53f6aabd49342ecb1..6792af11ce1b05c37acef65838be82391eb04937 100644 (file)
@@ -25,48 +25,62 @@ function loop_worlds {
 
 function assert_running {
        if ! is_running $1; then
-               echo "Error: World $1 is not running"
-               exit 1
+               echo "\e[31mWorld $1 is not running\e[0m"
+               if [ -z "$2" ]; then
+                       exit 1
+               else
+                       return 1
+               fi
        fi
 }
 
 function assert_not_running {
        if is_running $1; then
-               echo "Error: World $1 is already running"
-               exit 1
+               echo -e "\e[31mWorld $1 is already running\e[0m"
+               if [ -z "$2" ]; then
+                       exit 1
+               else
+                       return 1
+               fi
        fi
 }
 
 function start_world {
-       echo "Starting $1..."
-       assert_not_running $1
+       echo -n "Starting $1... "
+       if assert_not_running $1 "true"; then
+               LOCK=`world_lock $1`
 
-       LOCK=`world_lock $1`
+               screen -dmS `world_screenname $1` bash -c "
+                       while is_running $1; do
+                               bash -c \"
+                                       echo \\$\\$ > $LOCK
+                                       exec minetest --server --terminal --world worlds/$1 --config worlds/$1/minetest.conf --logfile worlds/$1/debug.txt 
+                               \"
+                       done
+                       rm $LOCK
+               "
 
-       screen -dmS `world_screenname $1` bash -c "
-               while is_running $1; do
-                       bash -c \"
-                               echo \\$\\$ > $LOCK
-                               exec minetest --server --terminal --world worlds/$1 --config worlds/$1/minetest.conf --logfile worlds/$1/debug.txt 
-                       \"
-               done
-               rm $LOCK
-       "
+               echo "\e[32mDone\e[0m"
+       fi
 }
 
 function stop_world {
-       echo "Stopping $1..."
-       assert_running $1
+       echo -n "Stopping $1..."
+       if assert_running $1 "true"; then
+               kill_world $1
+               rm `world_lock $1`
 
-       kill_world $1
-       rm `world_lock $1`
+               echo "\e[32mDone\e[0m"
+       fi
 }
 
 function restart_world {
-       echo "Restarting $1..."
-       assert_running $1
+       echo -n "Restarting $1..."
+       if assert_running $1 "true"; then
+               kill_world $1
 
-       kill_world $1
+               echo "\e[32mDone\e[0m"
+       fi
 }
 
 function run_one_or_all {
index 33e7eb8d6af2fee9b04a4713f8c12964490611be..c51fb68434cd87f215a576fc36e863674a4e548e 100755 (executable)
@@ -6,11 +6,12 @@
 git submodule update --recursive --remote
 
 # Add apt repo to always get the lastest MT release
-add-apt-repository ppa:minetestdevs/stable
-apt-get update -y
+sudo add-apt-repository ppa:minetestdevs/stable
+sudo apt-get update -y
 
 # Install minetest and screen
 apt install minetest screen -y
 
-# Install multiserver
+# Install multiserver & rudp
+go get github.com/anon/multiserver
 go get github.com/HimbeerserverDE/multiserver
index 78abf522cdf0e06f1a0aaec67b9171db907e0140..0c2bdacea94e9c198c58aee3344321226546e9a2 100755 (executable)
@@ -6,8 +6,8 @@
 git pull --recurse-submodules
 
 # Update minetest and screen
-apt-get update -y
-apt-get upgrade minetest screen -y
+sudo apt-get update -y
+sudo apt-get upgrade minetest screen -y
 
 # Update multiserver
 go get -u github.com/HimbeerserverDE/multiserver