Skip to content

joanroig/admincraft-websocket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Admincraft WebSocket logo

Admincraft WebSocket

WebSocket server to control Minecraft Bedrock Dockerized servers with Admincraft.

Admincraft badge Node.js badge Open issues Docker Pulls

What is Admincraft WebSocket?

Admincraft WebSocket allows remote control of Minecraft Bedrock servers hosted in Docker. It uses WebSocket technology to provide secure, real-time communication with the Minecraft server, executing commands and monitoring server activity from anywhere.

Current Project Status

Getting Started

Prerequisites

To run Admincraft WebSocket, ensure you have the Docker installed.

Installation

You can set up your server following the server setup guide from Admincraft, in summary you need to:

  1. Set up your environment:

    Get the docker-compose.yml file and edit it with your secret key:

    SECRET_KEY=your_secret_key_here

  2. Build and run the Docker container:

    sudo docker-compose up --build

    The WebSocket server will be available on port 8080.

Development

Running Locally

  1. Run a demo container

    sudo docker run -p 8080:8080 --name admincraft-websocket -e SECRET_KEY=your_secret_key_here admincraft-websocket

  2. The server will start on port 8080 by default.

Running together with docker compose

Change the websocket service in the docker-compose.yml file to remove the image configuration and add the build configuration to point to the local folder with the project code:

version: "3"
services:

  [...]

  websocket:
    container_name: websocket
    build:
      context: ./admincraft-websocket
      dockerfile: Dockerfileadmincraft-websocket:latest
    restart: always
    depends_on:
      # Make sure the minecraft service starts before the websockets service
      minecraft:
        condition: service_healthy
    ports:
      - 8080:8080
    volumes:
      # Mount Docker socket
      - /var/run/docker.sock:/var/run/docker.sock
      # Needed if environment.USE_SSL is "true"
      - ./certs:/usr/src/app/certs:ro
    environment:
      # Login password to use in admincraft (use alphanumeric characters only)
      SECRET_KEY: YOUR_SECRET_KEY_HERE
      # Enable or disable SSL
      USE_SSL: "false"

You can also run a separate docker compose file by providing it: sudo docker compose -f docker-compose_ssl.yml up -d

Troubleshoot

You can stop the servers, remove all containers and all images with:

sudo docker compose down
sudo docker rm -vf $(sudo docker ps -aq)
sudo docker rmi -f $(sudo docker images -aq)

Docker Build & Push

To build and push the Docker image to a repository:

  1. Build the Docker image:

    sudo docker build -t your-docker-username/admincraft-websocket .

  2. Tag the image:

    sudo docker tag your-docker-username/admincraft-websocket your-docker-username/admincraft-websocket:latest

  3. Push the image to Docker Hub:

    sudo docker push your-docker-username/admincraft-websocket:latest

Architecture

The Admincraft WebSocket Server operates alongside a Minecraft Bedrock server hosted in Docker. All arechitecture details can be found here.

License

Licensed under the GPLv3 License.