Example docker setup


#1

Hey guys,

I have been away from minecraft for a while but I decided to swing by and see what my favorite minecraft management software has been up too. It looks like the community is doing well. I am excited that MineOS has a docker setup. I like tinkering with docker somewhat so here is a gist that show an example of how to use docker-compose to setup up MineOS with nginx-proxy, and letsencrypt. The url for your site must be publicly reachable for lets encrypt to work and the mineos-proxy handles taking the standard web request on port 80 and proxy passing it to your mineos instance on port 8443. Maybe someone will find it helpful.

Sam


#2

This is excellent–my exposure to docker-compose is very limited and it’s been a huge hurdle to treating mineos-docker like it’s a production-ready deployment platform.

I was able to get this up and running in no time, with a single, minor adjustment:

https://gist.github.com/valeryan/c74c70004b2a8c50826f08a0fd37e896#file-mineos-proxy-dockerfile-L8

ADD ./etc/nginx/sites/mineos.conf /etc/nginx/conf.d/ -> ADD mineos.conf /etc/nginx/conf.d/

Simply because the docker host doesn’t likely have /etc/nginx, but it is present in the current working directory when docker compose is run. Able to make this change to the gist? I’d be more than happy to use yours as the authoritative gist and give you the credit you deserve!

I’ll tool around with this more and explore all the use cases I might get help requests about but I’d definitely like to make this an official deployment method.


#3

I made that change for you. I have many other projects that I tie into docker so I don’t like to clutter up the root space on my own system. If this is all you are setting up its easier to have the mineos.conf in the root. Feel free to use this example however you want. I have been using mineos for a few years now to run servers for my kids so Its good that I can give something back. Thanks for all your work.

Sam


An idea for a future MineOS?
#4

I did a bit of research and you can actually specify a port range to bind to the host machine. so the minecraft ports that are exposed can all be mapped in aa single port config like - "25565-25570:25565-25570". I haven’t tried it out yet but it should work according to the docker-compose docs. Also I left port 8443 bound but it does not need to be because of the proxy layer handling the translation of 80 to 8443 behind the scene. After I test that out tomorrow on my own server I will make that change if you are interested.

Sam


#5

apologies, for resurrecting an old thread but this looks like the best place to solve my problem.

I’m running the official mineos docker and the Linuxserver Letsencrypt docker. I’ve got other dockers working with LE like Plex, Ombin and calibre-web and I want to get mineos. I’ve tried:

	location /mineos {
		proxy_set_header X-Real-IP  $remote_addr;
		proxy_set_header X-Forwarded-For $remote_addr;
		proxy_set_header Host $host;
		proxy_pass https://172.35.12.82:8443;
	}
}

which doesn’t work. Any ideas please? My full config file with working sites below:

# listening on port 80 disabled by default, remove the "#" signs to enable
# redirect all traffic to https
#server {
#	listen 80;
#	server_name _;
#	return 301 https://$host$request_uri;
#}

# main server block
server {
	listen 443 ssl default_server;

	root /config/www;
	index index.html index.htm index.php;

	server_name _;

	ssl_certificate /config/keys/letsencrypt/fullchain.pem;
	ssl_certificate_key /config/keys/letsencrypt/privkey.pem;
	ssl_dhparam /config/nginx/dhparams.pem;
	ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
	ssl_prefer_server_ciphers on;

	client_max_body_size 0;

	location / {
		try_files $uri $uri/ /index.html /index.php?$args =404;
	}

	location ~ \.php$ {
		fastcgi_split_path_info ^(.+\.php)(/.+)$;
		# With php7-cgi alone:
		fastcgi_pass 127.0.0.1:9000;
		# With php7-fpm:
		#fastcgi_pass unix:/var/run/php7-fpm.sock;
		fastcgi_index index.php;
		include /etc/nginx/fastcgi_params;
	}


# calibre-web

	location /books {
		proxy_bind              $server_addr;
		proxy_pass              http://172.35.12.72:8083;
		proxy_set_header        Host            $http_host;
		proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header        X-Scheme        $scheme;
		proxy_set_header        X-Script-Name   /books;
	}

# PLEX

	location /web {
		# serve the CSS code
		proxy_pass http://172.35.12.90:32400;
	}

	location /plex {
		# proxy request to plex server
		proxy_pass http://172.35.12.90:32400/web;
	}

# Ombi

	location /plexrequest {
		include /config/nginx/proxy.conf;
		proxy_pass http://172.35.12.87:3579/plexrequest;
	}

# MineOS not working
	location /mineos {
		proxy_set_header X-Real-IP  $remote_addr;
		proxy_set_header X-Forwarded-For $remote_addr;
		proxy_set_header Host $host;
		proxy_pass https://172.35.12.82:8443;
	}
}

#6

Try looking through this https://github.com/valeryan/home-server.

I run mineos with let’s encrypt on my home server and this is my setup.


#7

Thanks for trying to help, but I’ve clicked through all the files int he link and I can’t find any entries to put in my nginx config file?


#8

I recently took the time to simplify my setup so I updated the the gist in the first post and my home-server setup. The gist is a very lightweight solution using docker-compose.

The simple Mineos Gist is a very fast way to have a public instance of minoes with a reverse proxy secured by lets encrypt.
The Home Server setup is a more complete example with other integrated services such as a plex server and nextcloud.