Code Monkey home page Code Monkey logo

minecraft_jupyterhub's Introduction

Minecraft with Python

This repo shows how to setup a Minecraft Server that gives users the ability to change the world through Python. Docker all the things. This will be running a Spigot Minecraft 1.13.1 server with the RaspberryJuice Plugin that allows Python API calls. Interaction with the Minecraft server will be done through the mcpi library with API instructions available here.

Jupyterhub Minecraft

This project was created for the purposes of teaching introductory Python concepts.

Setup

This will run a Minecraft server and JupyterHub behind and NGINX proxy. SSL is done via Let's Encrypt for secure access to JupyterHub. Users auth to the JupyterHub via GitHub OAuth.

Create a GitHub OAuth application that we will link to JupyterHub https://github.com/settings/applications/new with https://subd.domain.com/hub/oauth_callback as the callback URL.

Note the client_id and client_secret that GitHub provides after creation. We will need them below.

Environment Variables

You will configure these services through environment variables. Below is a list of the variables you need to change before launching the stack. The sections below are the services in the docker-compose.yml file.

jupyterhub

  • OAUTH_CALLBACK_URL: This will be the callback URL you provided to GitHub when creating the application eg. https://subd.domain.com/hub/oauth_callback
  • GITHUB_CLIENT_ID: The client_id GitHub provided after creationg the application.
  • GITHUB_CLIENT_SECRET: The client_secret GitHub provided after creating the application
  • VIRTUAL_HOST: The domain that jupyterhub will be accessed at. eg sub.domain.com
  • LETSENCRYPT_HOST: The domain that jupyterhub will be accessed at. eg sub.domain.com
  • LETSENCRYPT_EMAIL: The contact email for Let's Encrypt eg. [email protected]
  • JUPYTERHUB_ADMIN: The GitHub username for the first Admin account; supply multieple names separated by commas. Subsequent users can be added through the JupyterHub GUI after launch.

Launch

docker-compose up -d

To give your minecraft user Operator privleage, open up RCON cli.

docker-compose exec minecraft rcon-cli
> op MINECRAFTNAME

Open your Minecraft Java client and connect to your Multiplayer Server, once you're in game, open up a Jupyter notebook at your domain, and try the following.

from mcpi import minecraft
mc = minecraft.Minecraft.create('minecraft')
mc.postToChat("Hello Minecraft World")

If you see your message in the chat, all is working!

Additional Resources

I found the following very helpful in setting this up:

minecraft_jupyterhub's People

Contributors

mcrowson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.