From ff9fac842e6bbe99c9ba2081a64789457dfcd8f7 Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Fri, 31 Mar 2017 22:34:39 +0200 Subject: [PATCH 1/4] Added docker for running master server --- Dockerfile | 11 +++++++++++ README.md | 16 ++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..175f3142 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM node:latest +RUN apt-get update && apt install git -y && git clone https://github.com/Danielv123/factorioClusterio.git && cd factorioClusterio && npm install && curl -o factorio.tar.gz -L https://www.factorio.com/get-download/latest/headless/linux64 && tar -xvzf factorio.tar.gz + +LABEL maintainer "danielv@live.no" + +EXPOSE 8080 34167 + +VOLUME factorioClusterio/instances + +WORKDIR factorioClusterio +CMD node $MODE\.js start $INSTANCE \ No newline at end of file diff --git a/README.md b/README.md index f78d3a4c..645d9e2b 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,18 @@ To launch an instance with pm2 use `nano config.json` to change settings. +**Ubuntu with Docker** + +Clusterio has limited support for using docker. + + sudo docker build -t clusterio --no-cache --force-rm factorioClusterio + + sudo docker run --name master -e MODE=master -p 1234:8080 -d -it --restart=unless-stopped danielvestol/clusterio + + sudo docker run --name slave -e MODE=client -e INSTANCE=world1 -v /srv/clusterio/instances:/factorioClusterio/instances -p 1235:34167 -it --restart=unless-stopped danielvestol/clusterio + +The -v flag is used to specify the instance directory. Your instances (save files etc) will be stored there. + #Windows setup Clusterio is built up of multiple parts. Here is a quick guide: @@ -86,7 +98,7 @@ reboot when you are done, then proceed to the next steps. *reboots matter* 3. Type `node client.js start [instancename]` to create a new instance. -To connect to a master server running on a remote machine, open config.json with your favourite text editor (notepad++). You can also set it up to use the official server browser server. +To connect to a master server running on a remote machine, open config.json with your favourite text editor (notepad++). You can also set it up to use the official server browser. Change masterIP to something like 31.152.123.14 (provided by master server owner) @@ -96,7 +108,7 @@ Repeat step 3 for more servers on one machine. You should be able to find its po **GameClient** -Alternative experimental client that may be broken: [clusterioClient](https://github.com/Danielv123/factorioClusterioClient) +Fancy game client that does the following steps automatically: [clusterioClient](https://github.com/Danielv123/factorioClusterioClient) 1. Download the same version of the mod as the slave is running from [the mod portal](https://mods.factorio.com/mods/Danielv123/clusterio) or [github](https://github.com/Danielv123/factorioClusterioMod From 06e431c01ab5c2f65257bd40bf9fe342c3254571 Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Fri, 31 Mar 2017 22:36:24 +0200 Subject: [PATCH 2/4] Fixed markdown headers in readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 645d9e2b..1f292842 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -#factorioClusterio +# factorioClusterio If you want to connect to a clusterio cluster, please reffer to the [client](https://github.com/Danielv123/factorioClusterioClient) @@ -18,7 +18,7 @@ Connection diagram: There can be any number of clients connected to each slave, and any sumber of slaves connected to a master but there can only be one master server. -#Ubuntu setup +# Ubuntu setup NodeJS does not support EOL ubuntu releases. Make sure you are on the most recent LTS release or newer. @@ -60,7 +60,7 @@ Clusterio has limited support for using docker. The -v flag is used to specify the instance directory. Your instances (save files etc) will be stored there. -#Windows setup +# Windows setup Clusterio is built up of multiple parts. Here is a quick guide: From 0e10e2ebfaf75348274442c29baf42df8197b0f2 Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Sun, 2 Apr 2017 15:16:54 +0200 Subject: [PATCH 3/4] . --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 175f3142..4f68ff19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ LABEL maintainer "danielv@live.no" EXPOSE 8080 34167 -VOLUME factorioClusterio/instances +VOLUME /factorioClusterio/instances WORKDIR factorioClusterio CMD node $MODE\.js start $INSTANCE \ No newline at end of file From 2278176608ec6e77bc6029980b169008cb34f3ab Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Sun, 2 Apr 2017 15:17:17 +0200 Subject: [PATCH 4/4] Suppressed error --- client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.js b/client.js index 48035ff4..7e4c8dd3 100644 --- a/client.js +++ b/client.js @@ -354,7 +354,7 @@ function instanceManagement() { if(fs.existsSync(instancedirectory + "/script-output/tempfile.txt")) { var data = fs.readFileSync(instancedirectory + "/script-output/tempfile.txt", "utf8").split("\n"); // delete when we are done - fs.unlink(instancedirectory + "/script-output/tempfile.txt"); + fs.unlink(instancedirectory + "/script-output/tempfile.txt", function(){}); } // if we actually got anything from the file, proceed to categorize it if (data && data[0]) {