diff --git a/config/minecraft-chat.service b/config/minecraft-chat.service deleted file mode 120000 index 4f2225e..0000000 --- a/config/minecraft-chat.service +++ /dev/null @@ -1 +0,0 @@ -/etc/systemd/system/minecraft-chat.service \ No newline at end of file diff --git a/config/minecraft-chat.service b/config/minecraft-chat.service new file mode 100644 index 0000000..294890e --- /dev/null +++ b/config/minecraft-chat.service @@ -0,0 +1,13 @@ +[Unit] +Description=Gunicorn instance to serve minecraft-chat wsgi service +After=network.target + +[Service] +User=thallada +Group=www-data +WorkingDirectory=/var/www/panic-shack/chat +Environment="PATH=/home/thallada/.virtualenvs/minecraft-chat/bin" +ExecStart=/home/thallada/.virtualenvs/minecraft-chat/bin/gunicorn --workers 3 --bind unix:minecraft-chat.sock -m 007 server:app --log-file /srv/minecraft-panic-shack/gunicorn.log + +[Install] +WantedBy=multi-user.target diff --git a/config/minecraft@.service b/config/minecraft@.service deleted file mode 120000 index ad9318a..0000000 --- a/config/minecraft@.service +++ /dev/null @@ -1 +0,0 @@ -/etc/systemd/system/minecraft@.service \ No newline at end of file diff --git a/config/minecraft@.service b/config/minecraft@.service new file mode 100644 index 0000000..bcfbbdc --- /dev/null +++ b/config/minecraft@.service @@ -0,0 +1,50 @@ +[Unit] +Description=Minecraft Server %i +After=network.target + +[Service] +WorkingDirectory=/srv/minecraft-%i +User=thallada +Group=thallada +ProtectSystem=full +ProtectHome=true +ProtectKernelTunables=true +ProtectKernelModules=true +ProtectControlGroups=true + + +ExecStart=/bin/sh -c '/usr/bin/screen -DmLS mc-%i /usr/bin/java -server -Xms1G -Xmx2G -XX:+UseG1GC -XX:+CMSIncrementalPacing -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar $(ls -v | grep -i "FTBServer.*jar\|minecraft_server.*jar" | head -n 1) nogui' + +ExecReload=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "reload"\\015' + +ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "say SERVER SHUTTING DOWN IN 15 SECONDS..."\015' +ExecStop=/bin/sleep 5 +ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "say SERVER SHUTTING DOWN IN 10 SECONDS..."\015' +ExecStop=/bin/sleep 5 +ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "say SERVER SHUTTING DOWN IN 5 SECONDS..."\015' +ExecStop=/bin/sleep 5 +ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "say SERVER SHUTTING DOWN. Saving map..."\\015' +ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "save-all"\\015' +ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "stop"\\015' +ExecStop=/bin/sleep 2 + +Restart=on-failure +RestartSec=60s + +[Install] +WantedBy=multi-user.target + +######### +# HowTo +######### +# +# Create directory in /opt/minecraft-XX where XX is a name like 'survival' +# Add minecraft_server.jar into dir with other conf files for minecraft server +# +# Enable/Start systemd service +# systemctl enable minecraft@survival +# systemctl start minecraft@survival +# +# To run multiple servers simply create a new dir structure and enable/start it +# systemctl enable minecraft@creative +# systemctl start minecraft@creative diff --git a/config/nginx-panic-shack b/config/nginx-panic-shack deleted file mode 120000 index 3bda015..0000000 --- a/config/nginx-panic-shack +++ /dev/null @@ -1 +0,0 @@ -/etc/nginx/sites-available/panic-shack \ No newline at end of file diff --git a/config/nginx-panic-shack b/config/nginx-panic-shack new file mode 100644 index 0000000..5436c2c --- /dev/null +++ b/config/nginx-panic-shack @@ -0,0 +1,12 @@ +server { + listen 80; + listen [::]:80; + + root /var/www/panic-shack; + + server_name panic-shack.hallada.net; + + location / { + return 301 https://panic-shack.hallada.net$request_uri; + } +} diff --git a/config/nginx-panic-shack-https b/config/nginx-panic-shack-https deleted file mode 120000 index a8352f2..0000000 --- a/config/nginx-panic-shack-https +++ /dev/null @@ -1 +0,0 @@ -/etc/nginx/sites-available/panic-shack-https \ No newline at end of file diff --git a/config/nginx-panic-shack-https b/config/nginx-panic-shack-https new file mode 100644 index 0000000..fd74d75 --- /dev/null +++ b/config/nginx-panic-shack-https @@ -0,0 +1,31 @@ +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + server_name panic-shack.hallada.net; + root /var/www/panic-shack; + + ssl_certificate /etc/letsencrypt/live/panic-shack.hallada.net/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/panic-shack.hallada.net/privkey.pem; + ssl_trusted_certificate /etc/letsencrypt/live/panic-shack.hallada.net/fullchain.pem; + + location /notify { + deny all; + return 404; + } + + location /config { + deny all; + return 404; + } + + location / { + try_files $uri $uri/ $uri.php?$args =404; + } + + location /chat { + include uwsgi_params; + proxy_set_header X-Forwarded-Host $host:$server_port; proxy_set_header X-Forwarded-Server $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://unix:/var/www/panic-shack/chat/minecraft-chat.sock; + } +} diff --git a/config/overviewerConfig.py b/config/overviewerConfig.py deleted file mode 120000 index cadd496..0000000 --- a/config/overviewerConfig.py +++ /dev/null @@ -1 +0,0 @@ -/srv/minecraft-panic-shack/overviewerConfig.py \ No newline at end of file diff --git a/config/overviewerConfig.py b/config/overviewerConfig.py new file mode 100644 index 0000000..4aabb1c --- /dev/null +++ b/config/overviewerConfig.py @@ -0,0 +1,130 @@ +worlds["Panic Shack"] = "/srv/minecraft-panic-shack/world" + +renders["normalrender"] = { + "world": "Panic Shack", + "title": "North", + "rendermode": smooth_lighting, + "dimension": "overworld", + "northdirection": "upper-left", +} + +renders["normalrendersouth"] = { + "world": "Panic Shack", + "title": "South", + "rendermode": smooth_lighting, + "dimension": "overworld", + "northdirection": "lower-right", +} + +renders["normalrenderwest"] = { + "world": "Panic Shack", + "title": "West", + "rendermode": smooth_lighting, + "dimension": "overworld", + "northdirection": "upper-right", +} + +renders["normalrendereast"] = { + "world": "Panic Shack", + "title": "East", + "rendermode": smooth_lighting, + "dimension": "overworld", + "northdirection": "lower-left", +} + +renders["nightrender"] = { + "world": "Panic Shack", + "title": "Night North", + "rendermode": smooth_night, + "dimension": "overworld", + "northdirection": "upper-left", +} + +renders["nightrendersouth"] = { + "world": "Panic Shack", + "title": "Night South", + "rendermode": smooth_night, + "dimension": "overworld", + "northdirection": "lower-right", +} + +renders["nightrenderwest"] = { + "world": "Panic Shack", + "title": "Night West", + "rendermode": smooth_night, + "dimension": "overworld", + "northdirection": "upper-right", +} + +renders["nightrendereast"] = { + "world": "Panic Shack", + "title": "Night East", + "rendermode": smooth_night, + "dimension": "overworld", + "northdirection": "lower-left", +} + +renders["caverender"] = { + "world": "Panic Shack", + "title": "Cave North", + "rendermode": cave, + "dimension": "overworld", + "northdirection": "upper-left", +} + +renders["caverendersouth"] = { + "world": "Panic Shack", + "title": "Cave South", + "rendermode": cave, + "dimension": "overworld", + "northdirection": "lower-right", +} + +renders["caverenderwest"] = { + "world": "Panic Shack", + "title": "Cave West", + "rendermode": cave, + "dimension": "overworld", + "northdirection": "upper-right", +} + +renders["caverendereast"] = { + "world": "Panic Shack", + "title": "Cave East", + "rendermode": cave, + "dimension": "overworld", + "northdirection": "lower-left", +} + +renders["netherrender"] = { + "world": "Panic Shack", + "title": "Nether North", + "rendermode": nether, + "dimension": "nether", + "northdirection": "upper-left", +} + +renders["netherrendersouth"] = { + "world": "Panic Shack", + "title": "Nether South", + "rendermode": nether, + "dimension": "nether", + "northdirection": "lower-right", +} + +renders["netherrenderwest"] = { + "world": "Panic Shack", + "title": "Nether West", + "rendermode": nether, + "dimension": "nether", + "northdirection": "upper-right", +} +renders["netherrendereast"] = { + "world": "Panic Shack", + "title": "Nether East", + "rendermode": nether, + "dimension": "nether", + "northdirection": "lower-left", +} + +outputdir = "/var/www/panic-shack/map/"