Docker for TShock

Discussion in 'General Discussion' started by ryshe, Jul 9, 2015.

  1. ryshe

    ryshe Level 1

    Joined:
    Jul 9, 2015
    Messages:
    17
    Hey Everyone,

    Not sure if people are familiar with docker, but I created a docker container on dockerhub to help people run tshock/terraria server.

    My Dockerfile is posted on github, but you can also just run the docker container from dockerhub. That way you dont even have to build the container yourself. The container is built from the latest 4.3.1 pre-release build.

    I'm sure there is lots of room for improvement, so feel free to fork and I will do what I can to keep it up to date.

    For the uninitiated, the docker container should make it extremely easy to get your server up and running.

    1. log into your server
    2. install docker. You can install and use boot2docker for mac and windows.
    3. launch the command I posted on dockerhub
    This will download the container and launch the server for you.
     
    • Useful Useful x 2
  2. ryshe

    ryshe Level 1

    Joined:
    Jul 9, 2015
    Messages:
    17
    just noticed that terraria updated to 1.304. When tshock updates ill fix the dockerfile. Poor timing!
     
  3. ryshe

    ryshe Level 1

    Joined:
    Jul 9, 2015
    Messages:
    17
    Can anyone tell me if you can run the vanilla TerrariaServer.exe in mono?
     
  4. nicatronTg

    nicatronTg Shank / hakusaro
    TShock Founder TShock Admin

    Joined:
    Jul 21, 2011
    Messages:
    714
    I can. No.
     
  5. ryshe

    ryshe Level 1

    Joined:
    Jul 9, 2015
    Messages:
    17
    umm... you can or can not?
     
  6. nicatronTg

    nicatronTg Shank / hakusaro
    TShock Founder TShock Admin

    Joined:
    Jul 21, 2011
    Messages:
    714
    It's not possible to, because vanilla depends on the Microsoft XNA Framework, which is native code that does not exist in Mono.
     
  7. ryshe

    ryshe Level 1

    Joined:
    Jul 9, 2015
    Messages:
    17
    For anyone that might care, I updated the docker container with the latest tshock build and pushed it to docker hub.
     
  8. nicatronTg

    nicatronTg Shank / hakusaro
    TShock Founder TShock Admin

    Joined:
    Jul 21, 2011
    Messages:
    714
    We just updated, FYI.
     
  9. ryshe

    ryshe Level 1

    Joined:
    Jul 9, 2015
    Messages:
    17
    updating now, already made the changes on github, and will have container posted to dockerhub within the hour
     
    • Winner Winner x 1
  10. ryshe

    ryshe Level 1

    Joined:
    Jul 9, 2015
    Messages:
    17
    What would you think about setting up a webhook to automatically rebuild the docker container when you post to github?
     
  11. ryshe

    ryshe Level 1

    Joined:
    Jul 9, 2015
    Messages:
    17
    for those interested im looking into how to support volumes for plugins
     
  12. ryshe

    ryshe Level 1

    Joined:
    Jul 9, 2015
    Messages:
    17
    added volume support for plugins, but it comes with a caveat. The default plugins get blown out when the volume is attached to the container. So your plugins directory should contain those default plugins if you want them loaded. To load plugins add an additional volume flag

    Code:
    -v <absolute_path_to_plugins>:/tshock/ServerPlugins
     
  13. Krirken

    Krirken Level 0

    Joined:
    Jul 10, 2015
    Messages:
    2
    Great docker image, thanks for your work ryshe, and thank you nicatronTg for all your work on TShock.
     
    #13 Krirken, Jul 10, 2015
    Last edited: Jul 10, 2015
  14. ryshe

    ryshe Level 1

    Joined:
    Jul 9, 2015
    Messages:
    17
    Glad to hear it is working for you. I saw an email about the docker image quitting out on you. Did that get resolved?
     
  15. Krirken

    Krirken Level 0

    Joined:
    Jul 10, 2015
    Messages:
    2
    I realized it was a memory issue, I only have 390mb of free memory on the server I was running so it was making it to 3% in the world loading then crashing. I continued reading and it seems 390mb is definitely not enough to run TShock with a large world, but besides the memory issue the container setup for the worlds folder and plugins folders looks very nice! Hopefully I'll be renting a system with more memory soon.
     
    • Agree Agree x 1
  16. ryshe

    ryshe Level 1

    Joined:
    Jul 9, 2015
    Messages:
    17
    Updated to 1.305 last night
     
  17. Loderunner

    Loderunner Level 0

    Joined:
    Jul 15, 2015
    Messages:
    1
    maybe wil make some tags at repo..? 4.2.10 for example..)
     
  18. ryshe

    ryshe Level 1

    Joined:
    Jul 9, 2015
    Messages:
    17
    I haven't had a chance yet, but what i would like to do is fork the tshock repo, add, and rework the docker file to build the source code. Then we could setup a docker hub that triggers a build when the repo updates. Another potential option is to convince nicatronTg to have a consistent file name for the latest zip, and setup a webhook when a new release publishes. It could follow the same tagging conventions of tshock. Not sure how to automate the tagging process.

    This was my first real docker project, and my first time linking with some of the build automation features of github. Thankfully docker has automated the integration with github. To make matters worse I am a relative linux newb; but projects like this help me learn a lot!
     
  19. monettagu

    monettagu Level 1

    Joined:
    May 27, 2016
    Messages:
    13
    Easy Dockerizer tShock

    Hello everyone, I see this thread is a bit old, but I wanna to invite to test my latest release of tShock with docker. HERE

    I've added some commands to make it easier to configurate and manage.

    Remember to have installed docker (guide) and simply run like this:

    Code:
    docker run -d \
        -p 7777:7777 -p 7878:7878 \
        --name tshock \
        --network bridge \
        --volume $HOME/tschok/Terraria/Words:/opt/tshock/Terraria/Worlds \
        amonetta/tshock:latest
    Also can get further information at my post or at docker hub

    Hope you get fun and share!