From e8b70142f97d79f6e56f11e57af23d68f24fb76c Mon Sep 17 00:00:00 2001 From: Maik Laschober Date: Fri, 12 May 2023 17:16:39 +0200 Subject: [PATCH] refactor: made using this repo/image more simple --- Dockerfile | 4 +- NOTE.md | 19 - README.md | 65 +--- build-custom-example/Dockerfile | 15 - .../Mods/ExtendedDurability.zip | Bin 2468 -> 0 bytes build-custom-example/docker-compose.yml | 21 -- build-custom-example/serverconfig.json | 349 ------------------ .../Playerdata/playerdata.json | 0 .../Playerdata/playergroups.json | 0 .../Playerdata/playersbanned.json | 0 .../Playerdata/playerswhitelisted.json | 0 .../serverconfig.json | 109 +++--- compose-default/servermagicnumbers.json | 25 ++ docker-compose.yml | 47 +++ 14 files changed, 138 insertions(+), 516 deletions(-) delete mode 100644 NOTE.md delete mode 100644 build-custom-example/Dockerfile delete mode 100644 build-custom-example/Mods/ExtendedDurability.zip delete mode 100644 build-custom-example/docker-compose.yml delete mode 100644 build-custom-example/serverconfig.json rename {build-custom-example => compose-default}/Playerdata/playerdata.json (100%) rename {build-custom-example => compose-default}/Playerdata/playergroups.json (100%) rename {build-custom-example => compose-default}/Playerdata/playersbanned.json (100%) rename {build-custom-example => compose-default}/Playerdata/playerswhitelisted.json (100%) rename serverconfig.json => compose-default/serverconfig.json (93%) create mode 100644 compose-default/servermagicnumbers.json create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index 7c20bfa..ebd0a7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,9 +16,7 @@ FROM mono:latest as runtime COPY --from=downloader "./download/" "/game" # Defaults -ARG vs_data_path=/gamedata/vs - -COPY "./serverconfig.json" "${vs_data_path}/serverconfig.json" +ENV vs_data_path=/gamedata/vs # Expose ports EXPOSE 42420/tcp diff --git a/NOTE.md b/NOTE.md deleted file mode 100644 index 953c3cb..0000000 --- a/NOTE.md +++ /dev/null @@ -1,19 +0,0 @@ -# Contribution note -just some notes for myself in case i forgot how to upgrade the image - -```sh -#build -docker build -t devidian/vintagestory . -#push -docker push devidian/vintagestory -#run -docker run -pd 42420:42420 --name VintageStoryServer devidian/vintagestory -# -------------------------------------- -# --------- using composer ------------- -#start -docker-compose up -d -#rebuild -docker-compose up -d --build -#stop -docker-compose down -``` \ No newline at end of file diff --git a/README.md b/README.md index 36d0f36..5742c3c 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ services: vsserver: image: devidian/vintagestory:latest container_name: vsserver - restart: always + restart: unless-stopped volumes: # • your world will be in /appdata/vintagestory/vs by default (/gamedata/vs on the container) # • if you run multiple servers just change the left part @@ -27,74 +27,17 @@ services: - 42420:42420 ``` -## Custom build - -You can either copy files from `https://github.com/Devidian/docker-vintagestory/tree/master/build-custom-example` or follow these steps: - -- create a `serverconfig.json` with your settings -- create a `Dockerfile` file with contents found below -- create a `docker-compose.yml` file with contents found below (adjust port/path if you need) -- run `docker-compose up -d` to start -- run `docker-compose up -d --build` to rebuild and restart -- run `docker-compose down` to stop - -We use `vs_data_path` as ARG because ENV did not get overridden in build phase and we use `VS_DATA_PATH` as ENV because ARG in CMD is empty. - -## Dockerfile for custom-build - -```docker -# ============== runtime stage ================== -FROM devidian/vintagestory:latest as runtime - -ARG vs_data_path=/gamedata/vs - -# update with your own serverconfig -COPY serverconfig.json ${vs_data_path}/serverconfig.json -# copy mods -#COPY Mods ${vs_data_path}/Mods/ -# copy default player data -#COPY Playerdata ${vs_data_path}/Playerdata/ - -WORKDIR /game - -CMD mono VintagestoryServer.exe --dataPath ${VS_DATA_PATH} - -``` - -### docker-compose.yml - -```yml -version: '3.8' - -services: - vsserver: - build: - context: . - args: - vs_data_path: /gamedata/vs-custom/ - container_name: vsserver - restart: always - volumes: - - gamedata:/gamedata - ports: - - 42420:42420 - environment: - VS_DATA_PATH: /gamedata/vs-custom -volumes: - gamedata: -``` - ### Using unstable versions -To use unstable versions just replace tag `latest` with `unstable` in `Dockerfile` +To use unstable versions just replace tag `latest` with `unstable`. See [docker-compose.yml]( docker-compose.yml ) for all versions. ### Updating container -To update to the latest version call `docker pull devidian/vintagestory` first, this will download the newest latest base image. Then execute `docker-compose up -d --build` if you have not changed any other files it should not override them (did not for me) +To update to the latest version call `docker compose pull` first, this will download the newest latest base image. Then execute `docker compose up -d`. ### Copy/Override files -To copy and override files use `docker exec vsserver cp [local path] [docker-path]` where `docker-path` is starting with `/gamedata/vs-custom/..` for the example composer file. This is useful to update white/blacklists manually or update `serversettings.json` +If you use a host volume, you can just edit files there. First stop the container, then make your changes and start the container again. ## Troubleshooting / Help / Issues diff --git a/build-custom-example/Dockerfile b/build-custom-example/Dockerfile deleted file mode 100644 index 7210622..0000000 --- a/build-custom-example/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -# ============== runtime stage ================== -FROM devidian/vintagestory:latest as runtime - -ARG vs_data_path=/gamedata/vs-custom - -# update with your own serverconfig -COPY serverconfig.json ${vs_data_path}/serverconfig.json -# copy mods -COPY Mods ${vs_data_path}/Mods/ -# copy default player data -COPY Playerdata ${vs_data_path}/Playerdata/ - -WORKDIR /game - -CMD mono VintagestoryServer.exe --dataPath ${VS_DATA_PATH} diff --git a/build-custom-example/Mods/ExtendedDurability.zip b/build-custom-example/Mods/ExtendedDurability.zip deleted file mode 100644 index be597cfb22f100c1a98c3957197a45214e1579d5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2468 zcmWIWW@Zs#0D%ZAvtTd-N(cjK*NT$Vyp+@wm(rrdq|BVml1lvmxQ0M94N}-OBo-H^ zmK5XBr;Jx$acNOmW?5nmk^!x@s4mqe&VYi%lH`n3giAOWc0mDsxfEs^w*zoBZ0pwA~hZWF{%NSMOBV^54mNdT$ACd`ftBPSDNe2|$w);Hk_(Pp%?1Lj7ite$cVu^WMXe3jjCGm& z>OzK-5!bda??Sb<=qa0Q=4`P)`8a+~v-SC6yK5iwP8`&ZS)V8?;&I`kiX*!U3xA1e zAoslg!qaHqu7 zC-yJ!X{}6~7{RI8+vzD4r7~^v<2bF0_6IIh@~yQBEN9-jd&$hJZk)ekPffmRSEwe% zwD?9=zpMa9>s7hTysh5840k3-sK+lV-m#An5k`S_X2I6?9T|QD!^o41^f1cEFT+SS zXRn;iI&8qh@Su9(`+%Z%9@qYE+;{4RW8YO5pN&0hSvGAfk3Ynf+s}99hpWn%-L2+w3g%|%vrRcU zXWoLlU3^_fuCSz>6v({pHevVlPwbMbTo3&I{Ez8Z&l%fU#uC#PC5RM9Jk+cF#CqH_ zvHu?b%{a{oXLhUH$}8NL&$Z*vE*drGKP9ZtJSq!KFbz+dfZlm&(0HLsz*<1_?U`a*>2?mkdIYEW%uQS4E zwLKd>L40IOFiUo1OALW#VW}9P{4bxwks2_UGTaA+0siP5KCb+ z%yMK)F>4THOIHzRDXcz0wtS)b>pLaD(1g)2M<6W6R_nklR{&c4nKa9>)Zzfe8b}a793cs0Av@nySSeQg^`|D_8AbZU41kX zL?gQhvxr4@krp#)F2YveBD=_K*TRFPKo=N(SPrIPE<<(^X4!=7qGlGXE