Coder Social home page Coder Social logo

egladman / minutemen Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 96 KB

Build/Provision dedicated minecraft servers with forge mod support in seconds

License: MIT License

Shell 100.00%
minecraft-server minecraft linux bash minecraft-java minecraft-forge

minutemen's Introduction

Build/Provision dedicated minecraft servers with forge mod support in seconds.

How this project came to be

I began work on minutemen when I offered to host a small modded minecraft server for some friends and I. I was unimpressed with the current opensource offerings I found online so I decided to build my own. Most of the scripts/tutorials I found on forums/blogs either went against Linux best practices or went as far as suggesting screen in lieu of a named pipe and proper init system. I found these solutions to be unacceptable.

Features

  • Written 100% in Bash ๐Ÿ’ช Depends only on common Linux utilities; no additional languages required
  • Designed to be rerunnable with no repercussions
  • Built with security in mind
  • Supports Fedora and Ubuntu. If your distro of choice isn't compatible make an issue.
  • Utilizes Systemd
  • Does NOT depend on screen; instead named pipes are used
  • Supports multiple concurrent minecraft servers on a single host
  • Supports multiple versions of ForgeMod. Each instance can run a different version.

Installaton

Quick and Dirty

curl | bash is indefensible. Just because the transport is over HTTPS doesn't guarantee the content hasn't been maliciously modified on the server. It also doesn't guarantee that you won't receive a partial download that happens to stop at some inopportune time.

curl https://raw.githubusercontent.com/egladman/minutemen/master/bootstrap.sh | bash

The Proper Way

git clone [email protected]:egladman/minutemen.git
cd minutemen
./bootstrap.sh -v -e 28.1.0

Note: Checkout manifest.json to see all supported forgemod versions. Other versions can be added with minimum effort.

Tips and Tricks

  1. Run the help utility for more info
./bootstrap.sh -h
  1. Override jvm max heap size in megabytes
./bootstrap.sh -m 4096M
  1. Have you created a monster and don't know what to do?

Delete the main installation folder and rerun bootstrap.sh

rm -rf /opt/minecraft
  1. Kill instance

Warning: You run the risk of data loss. Can you use systemctl stop minutemen@<uuid>?

systemctl kill -s SIGKILL minutemen@<uuid>
  1. If you're running multiple builds place the forge installer jar in /opt/minecraft/.cache to reduce network activity. The .jar is cached after the first install.

Configuration

Mods

  1. If you add mods (i.e. .jar) to /opt/minecraft/instances/<uuid>/mods or /opt/minecraft/.forgemods be sure to set permissions
chown -R mminecraft:mminecraft /opt/minecraft/.forgemods
# or
chown -R mminecraft:mminecraft /opt/minecraft/instances/<uuid>/mods/
  1. Mods placed in /opt/minecraft/.forgemods will be automatically be installed

Password

  1. Generate a password with the following command:
#Tested againt mkpasswd 5.5.3 on Fedora31
mkpasswd --method=sha512crypt mySuperSecretPassword

Tip: Run mkpasswd --method=help to print all the available encryption algorthims. SHA-512 is by far the strongest provided by mkpasswd.

  1. For example if you'd like user: mminecraft to have password: HelloWorld you'd run:
mkpasswd --method=sha512crypt HelloWorld

mkpasswd will return the following:

$6$RN.HLGL5BosPQ2ZS$kVfGYi709anfOLAn7Hc18zwTfhRhwEcLfSMvhKl2yVU1wIJV4P4sJTheebx8BMpzr0HWl/cIsp3GK8FO670v9.

Note: By default mkpasswd salts the string. So each time you run mkpasswd you'll get a different hash by design.

  1. Pass the hash into bootstrap.sh as an environment variable
MC_USER_PASSWORD_HASH='$6$RN.HLGL5BosPQ2ZS$kVfGYi709anfOLAn7Hc18zwTfhRhwEcLfSMvhKl2yVU1wIJV4P4sJTheebx8BMpzr0HWl/cIsp3GK8FO670v9.' ./bootstrap.sh

Logging

  1. The forge installer stdout is saved to /opt/minecraft/log/<uuid>

  2. View process details

systemctl status minutemen@<uuid>
  1. View logs that would typically be printed to stdout
journalctl -u minutemen@<uuid>.service -f

Console Commands

To run the following commands you'll need to authenticate as mminecraft

su - mminecraft
/opt/minecraft/bin
โ”œโ”€โ”€ backup
โ”œโ”€โ”€ backup-restore
โ”œโ”€โ”€ cmd
โ”œโ”€โ”€ save
โ”œโ”€โ”€ start
โ””โ”€โ”€ stop
  1. backup
  • Summary: Copies /opt/minecraft/instances/<uuid> directory and saves it to /opt/minecraft/backups/<uuid> as <epoch-time>.tar.gz
  • Example: /opt/minecraft/bin/backup <uuid>
  1. backup-restore
  • Summary: Recover from backup.
  • Example: /opt/minecraft/bin/backup-restore <uuid> <epoch-time>
  1. cmd
  • Summary: Execute any console command. See full list here
  • Example: /opt/minecraft/bin/cmd <uuid> say HELLO
  1. save
  • Summary: Executes console command save-all flush.
  • Example: /opt/minecraft/bin/save <uuid>
  1. start
  • Summary: Skip systemd and run the server manually
  • Example: /opt/minecraft/bin/start <uuid>
  1. stop
  • Summary: Executes console command stop
  • Example: /opt/minecraft/bin/stop <uuid>

minutemen's People

Contributors

egladman avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

minutemen's Issues

Add SFTP support?

I'm hesitant of adding SFTP support to the scope of this project. The original goal of this project was to keep things as simple as possible. This would be the easiest way to manage mods.

I've began work on this: https://github.com/egladman/minutemen/tree/sftp

Expected Behavior

  • when logging into the host via sftp. the user: mminecraft should be jailed to /opt/minecraft/instances
  • mminecraft should only beable to authenticate with an ssh key.

Forge multi-version support for concurrent instances

Right now v1.14.3 is hardcoded in bootstrap.sh. I'll need to reference both the URL and checksum. The main script is getting too large (600+ lines), might make since to save the version data else where. Since it's static.

Error: "cannot set terminal process group" when ran on Fedora with X11

bootstrap.sh: SUCCESS: forge-1.14.3-27.0.25-installer.jar returned code 0. Proceeding...
bootstrap.sh: DEBUG: Updating files in /opt/minecraft/bin
bash: cannot set terminal process group (25106): Inappropriate ioctl for device
bash: no job control in this shell
[minecraft@samus 54262948-898c-489b-b019-476db31595bd]$

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.