Docker

Started by UncleSam, October 17, 2023, 08:59:23 PM

Previous topic - Next topic

UncleSam

Hi,


I have no real experience in running jts3servermod using docker, but I found a ways for me which seems to work fine. Feel free to try it. Of course this is NOT official - so use at your own risk.


Regarding the license system I have no clue at the moment if this is working as expected or not. Basically it has the same ip address but could have different hardware specs every time you delete the container and respawn it again.

I am not using a special docker container which contains the hosting files. Instead I am using the official openjdk image and just mount the bot-files inside. The benefit is also that this is not exposing any hosted files.


Requirements:


       
  • knowledge about docker and docker compose
  • working bot
  • reachable database (in my case I also host the database inside docker)
  • installed "docker compose" (or the old "docker-compose")
How To:

       
  • Create a new folder
  • Inside create the "docker-compose.yaml" files (see below)
  • Stop your bot and copy your bot folder in the subfolder "botfiles"
  • Add the "entrypoint.sh" inside this folder
Also make sure to update the binding and telnet whitelist.


After performin this steps start the container using "docker compose" and check if it fails for something.


docker-compose.yaml
version: '3.5'
services:
        jts3servermod:
                container_name: jts3servermod
                image: openjdk:22
                volumes:
                        - ./botfiles:/botfiles
                restart: unless-stopped
                environment:
                        TZ: Europe/Berlin
                entrypoint: ["/botfiles/entrypoint.sh"]



entrypoint.sh
#!/bin/sh
cd /botfiles


# delete pid and lock file which could lead into the bot not starting
rm -f /botfiles/config/jts3servermod.pid
rm -f /botfiles/config/JTS3ServerMod_InstanceManager.cfg.lock


# run the bot
/usr/bin/java -Xms1G -Xmx2G -jar JTS3ServerMod.jar