Kaiede/Bedrockifier

Set up

Closed this issue · 7 comments

Hello Friends

I am trying to set up this up.

Docker Compose
`version: '3.7'

services:
backup:
image: kaiede/minecraft-bedrock-backup
restart: always
# Make sure the minecraft images start before the backup
depends_on:
- "public"

environment:
    # Useful for making sure your logs have a proper timestamp
    TZ: "America/New_York"
volumes:
  # Docker needs to be made accessible to the backup container in this case
  - /var/run/docker.sock:/var/run/docker.sock
  # Map your backups folder info /backups
  - /home/matt/Documents/Container_Data/minecraft/Backups:/backups
  # Map the data folders for the server
  - /home/matt/Documents/Container_Data/minecraft/data:/bedrock_public
networks:
  Lan_MacVlan:
    ipv4_address: 192.168.5.212

public:
image: itzg/minecraft-bedrock-server
restart: always
container_name: bedrock_public
# Expose the mc-server-runner's SSH port to just the backup container
expose:
- 2222
# Make the minecraft server port public
ports:
- 19132:19132/udp
environment:
# Server settings
EULA: "TRUE"
GAMEMODE: survival
DIFFICULTY: easy
TZ: America/New_York
ENABLE_SSH: TRUE
volumes:
- /home/matt/Documents/Container_Data/minecraft/data:/data
stdin_open: true
tty: true
networks:
Lan_MacVlan:
ipv4_address: 192.168.5.211
networks:
Lan_MacVlan:
external: true`

and here is my config file

`containers:
bedrock:

  • name: bedrock_public

    The hostname here is the name of the service in the compose YML.

    ssh: bedrock_public:2222

    itzg writes out the password as yaml to the root of /data

    passwordFile: /bedrock_public/.remote-console.yaml
    worlds:
    • /bedrock_public/worlds/Petopia
      schedule:

This will perform a backup every 3 hours.

At most this will generate 8 backups a day.

interval: 3h
trim:

Keep all backups for the last two days (today and yesterday)

Keep at least one backup for the last 14 days

Keep at least two backups per world

trimDays: 2
keepDays: 14
minKeep: 2

`

here is the error i am getting from the backup service

`useradd: warning: the home directory /home/bedrockifier already exists.

useradd: Not copying any file from skel directory into it.

time="2024-01-11T11:52:45-05:00" level=debug msg="Using /backups to match uid and gid"

time="2024-01-11T11:52:45-05:00" level=debug msg="Resolved UID=1000 from match path"

time="2024-01-11T11:52:45-05:00" level=debug msg="Resolved GID=1000 from match path"

[11:52:45.230][info ] Initializing Bedrockifier Daemon

[11:52:45.233][info ] Configuring Bedrockifier Daemon

[11:52:45.233][info ] Loading Configuration From: /backups/config.yml

[11:52:45.236][error ] dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid YAML.", underlyingError: Optional(5:7: error: parser: while parsing a block mapping in line 3, column 6

did not find expected key:

  ssh: bedrock_public:2222 

  ^)))

[11:52:45.236][error ] Unable to read configuration file, fix the above errors and try again`

any help would be appreciated

thank you

The formatting of the snippets makes it difficult to really understand what’s going on. For multi-line code blocks like this you need to use three backticks not just one.

But it looks like you mashed a couple different examples together in this case, rather than starting from the ssh example. You don’t need to map in docker.sock when using SSH. The hostname for SSH is the service name per the comment, not the container name. So “public:2222” in this case.

Finally, when looking at the error, it seems like you have an older version of the image somehow. Can you use docker to pull the latest image? 1.3 was pushed just a couple days ago and is what includes SSH support, so it looks like you got the previous release.

thank you,
I will work on that and report back!

Still having issues

Compose

version: '3.7'

services:
  backup:
    image: kaiede/minecraft-bedrock-backup
    restart: always
    # Make sure the minecraft images start before the backup
    depends_on:
      - "public"
    environment:
        # Useful for making sure your logs have a proper timestamp
        TZ: "America/New_York"
    volumes:
      # Map your backups folder info /backups
      - /home/matt/Documents/Container_Data/minecraft/Backups:/backups
      # Map the data folders for both servers
      - /home/matt/Documents/Container_Data/minecraft/data:/bedrock_public

  public:
    image: itzg/minecraft-bedrock-server
    restart: always
    container_name: bedrock_public
    # Expose the mc-server-runner's SSH port to just the backup container
    expose:
      - 2222
    # Make the minecraft server port public
    ports:
      - 19132:19132/udp
    environment:
      # Enable SSH
      ENABLE_SSH: "TRUE"
      # Server settings
      EULA: "TRUE"
    volumes:
      - /home/matt/Documents/Container_Data/minecraft/data:/data
    stdin_open: true
    tty: true
    networks:
      Lan_MacVlan:
        ipv4_address: 192.168.5.211
networks:
  Lan_MacVlan:
    external: true

Config File

containers:
  bedrock:
    # Backup the world "PublicSMP" on the "bedrock_public" docker container
    - name: bedrock_public
      # Tells the backup service that this container is accessible
      # using the mc-server-runner SSH functionality.
      # passwordFile should point to the .remote-console.yaml file in the container
      ssh: public:2222
      passwordFile: /bedrock_public/.remote-console.yaml
      worlds:
        - /bedrock_public/worlds/Petopia
schedule:
  # This will perform a backup every 3 hours.
  # At most this will generate 8 backups a day.
  interval: 1h
  onLastLogout: True
  startupDelay: 5m

trim:
  # Keep all backups for the last two days (today and yesterday)
  # Keep at least one backup for the last 14 days
  # Keep at least two backups per world
  trimDays: 2
  keepDays: 14
  minKeep: 2

Errors

useradd: warning: the home directory /home/bedrockifier already exists.

useradd: Not copying any file from skel directory into it.

time="2024-01-11T12:49:24-05:00" level=debug msg="Using /backups to match uid and gid"

time="2024-01-11T12:49:24-05:00" level=debug msg="Resolved UID=1000 from match path"

time="2024-01-11T12:49:24-05:00" level=debug msg="Resolved GID=1000 from match path"

[12:49:24.794][info    ] Initializing Bedrockifier Daemon

[12:49:24.798][info    ] Configuring Bedrockifier Daemon

[12:49:24.798][info    ] Loading Configuration From: /backups/config.yml

[12:49:24.801][info    ] Configuration Loaded, Running Service...

[12:49:24.802][info    ] Delaying startup by: 300.0 seconds

[12:54:24.808][info    ] Host PTY Handle Opened: /dev/pts/0  (bedrock_public - 6)

[12:54:24.808][info    ] Child PTY Handle Opened: /dev/pts/0 (bedrock_public - 7)

[12:55:24.812][error   ] SSH connection doesn't seem to have been made properly.

[12:55:24.812][info    ] Checking for servers that might not be cleaned up

[12:55:24.812][info    ] Backup Interval: 3600.0 seconds

[12:55:24.812][info    ] Starting Listeners for Containers

[12:55:24.813][info    ] Service Started Successfully.

[12:55:24.813][info    ] Starting Full Backup

[12:55:24.814][error   ] Docker process didn't start successfully, or has died

[12:55:24.814][error   ] Container bedrock_public failed to backup properly

[12:55:24.814][info    ] Performing Trim Jobs

[12:55:24.817][info    ] Full Backup Completed

The error with trace level logging

useradd: warning: the home directory /home/bedrockifier already exists.

useradd: Not copying any file from skel directory into it.

time="2024-01-11T13:27:09-05:00" level=debug msg="Using /backups to match uid and gid"

time="2024-01-11T13:27:09-05:00" level=debug msg="Resolved UID=1000 from match path"

time="2024-01-11T13:27:09-05:00" level=debug msg="Resolved GID=1000 from match path"

[13:27:09.853][info    ] Initializing Bedrockifier Daemon

[13:27:09.857][info    ] Configuring Bedrockifier Daemon

[13:27:09.858][info    ] Loading Configuration From: /backups/config.yml

[13:27:09.861][info    ] Configuration Loaded, Running Service... (main.swift:117)

[13:27:09.863][info    ] Delaying startup by: 60.0 seconds (Service.swift:75)

[13:28:09.867][debug   ] Creating Bedrock Container Connection. (container: bedrock_public) (ContainerConnection.swift:387)

[13:28:09.868][info    ] Host PTY Handle Opened: /dev/pts/0  (bedrock_public - 6) (Terminal.swift:150)

[13:28:09.868][info    ] Child PTY Handle Opened: /dev/pts/0 (bedrock_public - 7) (Terminal.swift:171)

[13:28:09.868][debug   ] Process attached (Terminal.swift:90)

[13:28:09.868][debug   ] Starting Terminal Process. (container: bedrock_public, kind: ssh) (ContainerConnection.swift:97)

[13:28:09.870][debug   ] Expecting: ["SSHPASS: detected prompt. Sending password.", "SSHPASS: read:"] (bedrock_public) (Terminal.swift:277)

[13:28:09.870][trace   ] Adding Expectation 6AE17C2C-6BEE-453E-B18F-2DE4A064578C (bedrock_public) (Terminal.swift:315)

[13:28:09.870][debug   ] Timeout for Expectation is 60.0 s (bedrock_public) (Terminal.swift:321)

[13:28:09.902][trace   ] Data Received on file descriptor (bedrock_public - 6) (Terminal.swift:346)

[13:28:09.902][trace   ] Processing 1 Expects (bedrock_public) (Terminal.swift:361)

[13:28:09.902][debug   ] Content Read: ssh: Could not resolve hostname public: Temporary failure in name resolution

 (bedrock_public) (Terminal.swift:286)

[13:28:09.902][trace   ] Process terminated (executable: file:///usr/bin/sshpass (Process.swift:41)

[13:28:09.902][debug   ] Calling process detach handlers (bedrock_public) (Terminal.swift:103)

[13:28:09.902][trace   ] Content Has No Matches (bedrock_public) (Terminal.swift:291)

[13:28:09.902][debug   ] Process detached (bedrock_public) (Terminal.swift:108)

[13:29:09.871][debug   ] Timeout Reached for 6AE17C2C-6BEE-453E-B18F-2DE4A064578C (Terminal.swift:326)

[13:29:09.871][trace   ] Removing Expectation 6AE17C2C-6BEE-453E-B18F-2DE4A064578C (bedrock_public) (Terminal.swift:302)

[13:29:09.871][debug   ] No Matches Found, Timed Out (bedrock_public) (Terminal.swift:295)

[13:29:09.872][error   ] SSH connection doesn't seem to have been made properly. (ContainerConnection.swift:109)

[13:29:09.877][debug   ] Docker Process Window Size Fetched. (cols = 65000, rows = 24 (ContainerConnection.swift:376)

[13:29:09.877][info    ] Checking for servers that might not be cleaned up (BackupActor.swift:91)

[13:29:09.877][info    ] Backup Interval: 3600.0 seconds (Service.swift:158)

[13:29:09.878][debug   ] [interval] Registered (ServiceTimer.swift:102)

[13:29:09.878][debug   ] [interval] Event Fired. Valid Handler: false (ServiceTimer.swift:110)

[13:29:09.879][debug   ] [interval] Scheduled For Jan 11, 2024, 1:29:09 PM, Repeating 3600.0 s (ServiceTimer.swift:81)

[13:29:09.879][info    ] Starting Listeners for Containers (Service.swift:201)

[13:29:09.880][info    ] Service Started Successfully. (Service.swift:108)

As the trace points out:

[13:28:09.902][debug   ] Content Read: ssh: Could not resolve hostname public: Temporary failure in name resolution (bedrock_public) (Terminal.swift:286)

Two questions:

  • Do you need the vlan? That could be messing with name resolution across services like this if they are on different vlans. My examples don't use vlans.
  • What other details can you provide from the environment you are hosting with, as docker compose should be making the hostname available to different containers when the networking is left to docker compose to work out.

If you need the vlan, you'll need to work out how to configure things such that the backup container can see the minecraft container. It may be as simple as adding the backup container to the vlan and using the IP address you specified instead of docker compose's hostname.

Thank you for the guidance again. I am certainly not an expert on docker

Thank you for your help i was able to get it working.
Putting my files here so it may help others

Docker Compose

version: '3.7'

services:
  backup:
    image: kaiede/minecraft-bedrock-backup
    restart: always
    # Make sure the minecraft images start before the backup
    depends_on:
      - "public"
    environment:
        # Useful for making sure your logs have a proper timestamp
        TZ: "America/New_York"
    volumes:
      # Map your backups folder info /backups
      - /home/matt/Documents/Container_Data/minecraft/Backups:/backups
      # Map the data folders for both servers
      - /home/matt/Documents/Container_Data/minecraft/data:/bedrock_public
    networks:
      Lan_MacVlan:
        ipv4_address: 192.168.5.212

  public:
    image: itzg/minecraft-bedrock-server
    restart: always
    container_name: bedrock_public
    # Expose the mc-server-runner's SSH port to just the backup container
    expose:
      - 2222
    # Make the minecraft server port public
    ports:
      - 19132:19132/udp
    environment:
      # Enable SSH
      ENABLE_SSH: "TRUE"
      # Server settings
      EULA: "TRUE"
    volumes:
      - /home/matt/Documents/Container_Data/minecraft/data:/data
    stdin_open: true
    tty: true
    networks:
      Lan_MacVlan:
        ipv4_address: 192.168.5.211
networks:
  Lan_MacVlan:
    external: true

Config file

containers:
  bedrock:
    # Backup the world "PublicSMP" on the "bedrock_public" docker container
    - name: bedrock_public
      # Tells the backup service that this container is accessible
      # using the mc-server-runner SSH functionality.
      # passwordFile should point to the .remote-console.yaml file in the container
      ssh: public:2222
      passwordFile: /bedrock_public/.remote-console.yaml
      worlds:
        - /bedrock_public/worlds/Petopia
schedule:
  # This will perform a backup every 3 hours.
  # At most this will generate 8 backups a day.
  interval: 1h
  onLastLogout: True
  startupDelay: 1m
trim:
  # Keep all backups for the last two days (today and yesterday)
  # Keep at least one backup for the last 14 days
  # Keep at least two backups per world
  trimDays: 2
  keepDays: 14
  minKeep: 2
##loggingLevel: trace