From c692f4ca552bd68ef79bc71e8c27b3f056914b35 Mon Sep 17 00:00:00 2001 From: Sergey Morozov Date: Sun, 20 Sep 2020 21:41:13 +0300 Subject: [PATCH 1/7] New docker bundle --- docker/.dockerignore | 2 + docker/.env | 7 +++ docker/.gitignore | 2 + docker/Dockerfile | 37 ++++++++-------- docker/README.md | 74 +++++++++++++++++-------------- docker/docker-compose.simple.yaml | 20 +++++++++ docker/docker-compose.yaml | 65 +++++++++++++++++++++++++++ docker/docker-compose.yml | 17 ------- docker/entrypoint.sh | 51 +++++++++++++++++++++ docker/init.sh | 18 -------- docker/nginx.conf | 74 ------------------------------- 11 files changed, 205 insertions(+), 162 deletions(-) create mode 100644 docker/.dockerignore create mode 100644 docker/.env create mode 100644 docker/.gitignore create mode 100644 docker/docker-compose.simple.yaml create mode 100644 docker/docker-compose.yaml delete mode 100644 docker/docker-compose.yml create mode 100755 docker/entrypoint.sh delete mode 100755 docker/init.sh delete mode 100644 docker/nginx.conf diff --git a/docker/.dockerignore b/docker/.dockerignore new file mode 100644 index 0000000..594b011 --- /dev/null +++ b/docker/.dockerignore @@ -0,0 +1,2 @@ +/fsm-data +/factorio-data diff --git a/docker/.env b/docker/.env new file mode 100644 index 0000000..1b3bfee --- /dev/null +++ b/docker/.env @@ -0,0 +1,7 @@ +FACTORIO_VERSION=latest +ADMIN_USER=admin +ADMIN_PASS=factorio +RCON_PASS= +COOKIE_ENCRYPTION_KEY= +DOMAIN_NAME= +EMAIL_ADDRESS= diff --git a/docker/.gitignore b/docker/.gitignore new file mode 100644 index 0000000..594b011 --- /dev/null +++ b/docker/.gitignore @@ -0,0 +1,2 @@ +/fsm-data +/factorio-data diff --git a/docker/Dockerfile b/docker/Dockerfile index 3919a45..87c8501 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,29 +1,28 @@ -# glibc is required for Factorio Server binaries to run -FROM frolvlad/alpine-glibc +# Glibc is required for Factorio Server binaries to run +FROM frolvlad/alpine-glibc:alpine-3.12 ENV FACTORIO_VERSION=latest \ MANAGER_VERSION=0.8.2 \ - ADMIN_PASSWORD=factorio + ADMIN_USER=admin \ + ADMIN_PASS=factorio \ + RCON_PASS="" \ + COOKIE_ENCRYPTION_KEY="" -VOLUME /opt/factorio/saves /opt/factorio/mods /opt/factorio/config /security +VOLUME /opt/fsm-data /opt/factorio/saves /opt/factorio/mods /opt/factorio/config -RUN apk add --no-cache curl tar unzip nginx openssl xz +EXPOSE 80/tcp 34197/udp -WORKDIR /opt/ +RUN apk add --no-cache curl tar xz unzip jq -RUN curl -s -L -S -k https://www.factorio.com/get-download/$FACTORIO_VERSION/headless/linux64 -o /tmp/factorio_$FACTORIO_VERSION.tar.xz && \ - tar Jxf /tmp/factorio_$FACTORIO_VERSION.tar.xz && \ - rm /tmp/factorio_$FACTORIO_VERSION.tar.xz && \ - curl -sLSk https://github.com/mroote/factorio-server-manager/releases/download/$MANAGER_VERSION/factorio-server-manager-linux-${MANAGER_VERSION}.zip \ - --cacert /opt/github.pem -o /tmp/factorio-server-manager-linux_$MANAGER_VERSION.zip && \ - unzip -qq /tmp/factorio-server-manager-linux_$MANAGER_VERSION.zip && \ - rm /tmp/factorio-server-manager-linux_$MANAGER_VERSION.zip && \ - mkdir -p /run/nginx && \ - chown nginx:root /var/lib/nginx +WORKDIR /opt -COPY "init.sh" "/opt/init.sh" -COPY "nginx.conf" "/etc/nginx/nginx.conf" +# Install FSM +RUN curl --location "https://github.com/mroote/factorio-server-manager/releases/download/${MANAGER_VERSION}/factorio-server-manager-linux-${MANAGER_VERSION}.zip" \ + --output /tmp/factorio-server-manager-linux_${MANAGER_VERSION}.zip \ + && unzip /tmp/factorio-server-manager-linux_${MANAGER_VERSION}.zip \ + && rm /tmp/factorio-server-manager-linux_${MANAGER_VERSION}.zip \ + && mv factorio-server-manager fsm -EXPOSE 80/tcp 443/tcp 34190-34200/udp +COPY entrypoint.sh /opt -ENTRYPOINT ["/opt/init.sh"] +ENTRYPOINT ["/opt/entrypoint.sh"] diff --git a/docker/README.md b/docker/README.md index ee1be71..d34fa2b 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,40 +1,56 @@ # Factorio Server Manager Docker Image +## Prerequisites +You need to have [Docker](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04) +and [Docker Compose](https://docs.docker.com/compose/install/) installed. + ## Getting started? -Pull the Docker container from Docker Hub using the pull command +Copy `docker-compose.yaml` and `.env` files from this repository to somewhere on your server. + +Edit values in the `.env` file: +* `FACTORIO_VERSION` (default `latest`): Factorio version that will be downloaded and used in FSM. +* `ADMIN_USER` (default `admin`): Name of the default user created for FSM UI. +* `ADMIN_PASS` (default `factorio`): Default user password. \ + __Important:__ _For security reasons, please change the default user name and password. Never use the defaults._ +* `RCON_PASS` (default empty string): Password for Factorio RCON (FSM uses it to communicate with the Factorio server). \ + If left empty, a random password will be generated and saved on the first start of the server. You can see the password in `fsm-data/conf.json` file. +* `COOKIE_ENCRYPTION_KEY` (default empty string): The key used to encrypt auth cookie for FSM UI. \ + If left empty, a random key will be generated and saved on the first start of the server. You can see the key in `fsm-data/conf.json` file. +* `DOMAIN_NAME` (must be set manually): The domain name where your FSM UI will be available. Must be set, + so [Let's Encrypt](https://letsencrypt.org/) service can issue a valid HTTPS certificate for this domain. +* `EMAIL_ADDRESS` (must be set manually): Your email address. Used only by Let's Encrypt service. -``` -docker pull majormjr/factorio-server-manager -``` Now you can start the container by running: ``` -docker run --name factorio-manager -d \ - -p 80:80 \ - -p 443:443 \ - -p 34197:34197/udp \ - majormjr/factorio-server-manager +docker-compose up -d ``` -If you want persistent data in your container also mount the data volumes when starting: +### Simple configuration without HTTPS +If you don't care about HTTPS and want to run just the Factorio Server Manager, or want to run it on local machine you can use `docker-compose.simple.yaml`. +Ignore `DOMAIN_NAME` and `EMAIL_ADDREESS` variables in `.env` file and run ``` -docker run --name factorio-manager -d \ - -v [yourpath]:/opt/factorio/saves \ - -v [yourpath]:/opt/factorio/mods \ - -v [yourpath]:/opt/factorio/config \ - -v [yourpath]:/security \ - -p 80:80 \ - -p 443:443 \ - -p 34197:34197/udp \ - majormjr/factorio-server-manager +docker-compose -f docker-compose.simple.yaml up -d ``` ## Accessing the application -Go to the port specified in your `docker run` command in your web browser. If running on localhost host access the application at https://localhost +Go to the domain specified in your `.env` file in your web browser. If running on localhost host access the application at http://localhost + +### First start +When container starts it begins to dowload Factorio headless server archive, and only after that Factorio Server Manager server starts. +So when Docker Compose writes +``` +Creating factorio-server-manager ... done +``` +you have to wait several seconds before FSM UI becomes available. + +It may take some time for Let's Encrypt to issue the certificate, so for the first couple of minutes after starting the container you may see +"Your connection is not private" error when you open your Factorio Server Manager address in your browser. This error should disappear within +a couple of minutes, if configuration parameters are set correctly. ## Updating Credentials, adding and deleting users. @@ -48,26 +64,16 @@ For now you can't update/downgrade the Factorio version from the UI. You can however do this using docker images while sustaining your security settings and map/modfiles. -This guide assumes that you mounted the volumes /security, /opt/factorio/saves, /opt/factorio/config and /opt/factorio/mods to your file system. Before doing anything we need to stop the old container using `docker stop factorio-manager`. To update Factorio you should then open the Dockerfile and change the Factorio version to the one desired. After that you need to rebuild the image using `docker build -t factorio-server-manager .`. Once completed you can simply rerun the command that you used to run the image in the first place. It's recommended to change the name to something including the version to keep track of the containers. +If you want to update Factorio to the latest version: +1. Save your game and stop Factorio server in FSM UI. +2. Run `docker-compose restart` (or `docker-compose -f docker-compose.simple.yaml restart` if you are using simple configuration). -Pull the latest container with `docker pull majormjr/factorio-server-manager` and start with the `docker run` command. +After container starts, latest Factorio version will be downloaded and installed. ## Security -A self generated SSL/TLS certificate is created when the container is first created and the webserver is accessible via HTTPS. - Authentication is supported in the application but it is recommended to ensure access to the Factorio manager UI is accessible via VPN or internal network. -### Changing SSL/TLS certificate - -If you have your own SSL/TLS certificate then you can supply it to the Factorio Server Manager container. - -When first running the container you need to mount the security volume to your host machine by adding the security volume parameter `-v [yourpath]:/security` - -The directory will contain a "server.key" file and a "server.crt" file. - -If you replace these with a trusted SSL certificate and key, you should ensure that "server.crt" contains the whole certificate chain from the root of your CA. - ## For everyone who actually read this thing to the end And now go and build some nice factories! diff --git a/docker/docker-compose.simple.yaml b/docker/docker-compose.simple.yaml new file mode 100644 index 0000000..3dacdbf --- /dev/null +++ b/docker/docker-compose.simple.yaml @@ -0,0 +1,20 @@ +version: "3" +services: + factorio-server-manager: + image: "sammann/fsm-docker:latest" + container_name: "factorio-server-manager" + restart: "unless-stopped" + environment: + - "FACTORIO_VERSION" + - "ADMIN_USER" + - "ADMIN_PASS" + - "RCON_PASS" + - "COOKIE_ENCRYPTION_KEY" + ports: + - "80:80" + - "34197:34197/udp" + volumes: + - "./fsm-data:/opt/fsm-data" + - "./factorio-data/saves:/opt/factorio/saves" + - "./factorio-data/mods:/opt/factorio/mods" + - "./factorio-data/config:/opt/factorio/config" diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml new file mode 100644 index 0000000..978d3cb --- /dev/null +++ b/docker/docker-compose.yaml @@ -0,0 +1,65 @@ +version: "3" +services: + factorio-server-manager: + image: "sammann/fsm-docker:latest" + container_name: "factorio-server-manager" + restart: "unless-stopped" + environment: + - "FACTORIO_VERSION" + - "ADMIN_USER" + - "ADMIN_PASS" + - "RCON_PASS" + - "COOKIE_ENCRYPTION_KEY" + volumes: + - "./fsm-data:/opt/fsm-data" + - "./factorio-data/saves:/opt/factorio/saves" + - "./factorio-data/mods:/opt/factorio/mods" + - "./factorio-data/config:/opt/factorio/config" + labels: + - "traefik.enable=true" + + - "traefik.http.routers.fsm.entrypoints=websecure" + - "traefik.http.routers.fsm.rule=Host(`${DOMAIN_NAME}`)" + - "traefik.http.routers.fsm.tls=true" + - "traefik.http.routers.fsm.tls.certResolver=default" + - "traefik.http.routers.fsm.service=fsm" + #- "traefik.http.routers.fsm.middlewares=fsm-auth" + - "traefik.http.services.fsm.loadbalancer.server.port=80" + + - "traefik.udp.routers.fsm.entrypoints=factorio" + - "traefik.udp.routers.fsm.service=fsm" + - "traefik.udp.services.fsm.loadbalancer.server.port=34197" + traefik: + image: "traefik:v2.2" + container_name: "traefik" + restart: "always" + command: + - "--entrypoints.web.address=:80" + - "--entrypoints.websecure.address=:443" + - "--entrypoints.factorio.address=:34197/udp" + + - "--entrypoints.web.http.redirections.entryPoint.to=websecure" + - "--entrypoints.web.http.redirections.entryPoint.scheme=https" + + - "--providers.docker" + - "--providers.docker.exposedByDefault=false" + + - "--certificatesresolvers.default.acme.email=${EMAIL_ADDRESS}" + - "--certificatesresolvers.default.acme.storage=/etc/traefik/acme.json" + - "--certificatesresolvers.default.acme.tlschallenge=true" + ports: + - "80:80" + - "443:443" + - "34197:34197/udp" + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + - "./traefik-data:/etc/traefik" + labels: + - "traefik.enable=true" + + #- "traefik.http.middlewares.fsm-auth.basicauth.usersfile=/etc/traefik/.htpasswd" + #- "traefik.http.middlewares.fsm-auth.basicauth.realm=FSM" +#networks: +# default: +# external: +# name: "traefik" diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml deleted file mode 100644 index 5d00383..0000000 --- a/docker/docker-compose.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: '2' -services: - factorio-manager: - container_name: factorio-manager - image: "majormjr/factorio-server-manager" - restart: always - volumes: - - "/etc/localtime:/etc/localtime:ro" - - "/etc/timezone:/etc/timezone:ro" - - "[yourPath_optional]:/security" - - "[yourPath]:/opt/factorio/saves" - - "[yourPath]:/opt/factorio/mods" - - "[yourPath]:/opt/factorio/config" - ports: - - "80:80" - - "443:443" - - "34197:34197/udp" diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000..fa1f474 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +init_config() { + jq_cmd='.' + + if [ -n $ADMIN_USER ]; then + jq_cmd="${jq_cmd} | .username = \"$ADMIN_USER\"" + echo "Admin username is '$ADMIN_USER'" + fi + if [ -n $ADMIN_PASS ]; then + jq_cmd="${jq_cmd} | .password = \"$ADMIN_PASS\"" + echo "Admin password is '$ADMIN_PASS'" + fi + echo "IMPORTANT! Please create new user and delete default admin user ASAP." + + if [ -z $RCON_PASS ]; then + RCON_PASS="$(random_pass)" + fi + jq_cmd="${jq_cmd} | .rcon_pass = \"$RCON_PASS\"" + echo "Factorio rcon password is '$RCON_PASS'" + + if [ -z $COOKIE_ENCRYPTION_KEY ]; then + COOKIE_ENCRYPTION_KEY="$(random_pass)" + fi + jq_cmd="${jq_cmd} | .cookie_encryption_key = \"$COOKIE_ENCRYPTION_KEY\"" + + jq_cmd="${jq_cmd} | .database_file = \"/opt/fsm-data/auth.leveldb\"" + jq_cmd="${jq_cmd} | .log_file = \"/opt/fsm-data/factorio-server-manager.log\"" + + jq "${jq_cmd}" /opt/fsm/conf.json >/opt/fsm-data/conf.json +} + +random_pass() { + LC_ALL=C tr -dc 'a-zA-Z0-9' Date: Tue, 22 Sep 2020 12:52:17 +0300 Subject: [PATCH 2/7] Move `FACTORIO_VERSION` value to docker-compose.yaml --- docker/.env | 1 - docker/README.md | 8 +++++++- docker/docker-compose.simple.yaml | 2 +- docker/docker-compose.yaml | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docker/.env b/docker/.env index 1b3bfee..547fb13 100644 --- a/docker/.env +++ b/docker/.env @@ -1,4 +1,3 @@ -FACTORIO_VERSION=latest ADMIN_USER=admin ADMIN_PASS=factorio RCON_PASS= diff --git a/docker/README.md b/docker/README.md index d34fa2b..82f4b76 100644 --- a/docker/README.md +++ b/docker/README.md @@ -9,7 +9,6 @@ and [Docker Compose](https://docs.docker.com/compose/install/) installed. Copy `docker-compose.yaml` and `.env` files from this repository to somewhere on your server. Edit values in the `.env` file: -* `FACTORIO_VERSION` (default `latest`): Factorio version that will be downloaded and used in FSM. * `ADMIN_USER` (default `admin`): Name of the default user created for FSM UI. * `ADMIN_PASS` (default `factorio`): Default user password. \ __Important:__ _For security reasons, please change the default user name and password. Never use the defaults._ @@ -29,6 +28,7 @@ docker-compose up -d ``` ### Simple configuration without HTTPS + If you don't care about HTTPS and want to run just the Factorio Server Manager, or want to run it on local machine you can use `docker-compose.simple.yaml`. Ignore `DOMAIN_NAME` and `EMAIL_ADDREESS` variables in `.env` file and run @@ -36,11 +36,17 @@ Ignore `DOMAIN_NAME` and `EMAIL_ADDREESS` variables in `.env` file and run docker-compose -f docker-compose.simple.yaml up -d ``` +### Factorio version + +By default container will download the latest version of factorio. If you want to use specific version, you can change +the value of `FACTORIO_VERSION=latest` variable in the `docker-compose.yaml` file. + ## Accessing the application Go to the domain specified in your `.env` file in your web browser. If running on localhost host access the application at http://localhost ### First start + When container starts it begins to dowload Factorio headless server archive, and only after that Factorio Server Manager server starts. So when Docker Compose writes ``` diff --git a/docker/docker-compose.simple.yaml b/docker/docker-compose.simple.yaml index 3dacdbf..518bb35 100644 --- a/docker/docker-compose.simple.yaml +++ b/docker/docker-compose.simple.yaml @@ -5,7 +5,7 @@ services: container_name: "factorio-server-manager" restart: "unless-stopped" environment: - - "FACTORIO_VERSION" + - "FACTORIO_VERSION=latest" - "ADMIN_USER" - "ADMIN_PASS" - "RCON_PASS" diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 978d3cb..32524b8 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -5,7 +5,7 @@ services: container_name: "factorio-server-manager" restart: "unless-stopped" environment: - - "FACTORIO_VERSION" + - "FACTORIO_VERSION=latest" - "ADMIN_USER" - "ADMIN_PASS" - "RCON_PASS" From 3f53239f2c5dcabba89bf09409d9b3570fc53bb4 Mon Sep 17 00:00:00 2001 From: Sergey Morozov Date: Fri, 9 Oct 2020 21:08:49 +0300 Subject: [PATCH 3/7] Use latest alpine-glibc image version --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 87c8501..a7f7e3b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,5 @@ # Glibc is required for Factorio Server binaries to run -FROM frolvlad/alpine-glibc:alpine-3.12 +FROM frolvlad/alpine-glibc ENV FACTORIO_VERSION=latest \ MANAGER_VERSION=0.8.2 \ From 983234d9bfda723dd5671489f26cb978931970c4 Mon Sep 17 00:00:00 2001 From: Sergey Morozov Date: Fri, 9 Oct 2020 21:24:20 +0300 Subject: [PATCH 4/7] Updated info about environment vars in readme --- docker/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/README.md b/docker/README.md index 82f4b76..32a28b4 100644 --- a/docker/README.md +++ b/docker/README.md @@ -20,6 +20,8 @@ Edit values in the `.env` file: so [Let's Encrypt](https://letsencrypt.org/) service can issue a valid HTTPS certificate for this domain. * `EMAIL_ADDRESS` (must be set manually): Your email address. Used only by Let's Encrypt service. +Alternatively you can ignore `.env` file and edit this values directly in `environment` section of `docker-compose.yaml`. +But remember that if `.env` file is present, values set there take precedence over values set in `docker-compose.yaml`. Now you can start the container by running: From bd04f9c4c0fa3cdbbc7f39e343c3ae02b9faeaf1 Mon Sep 17 00:00:00 2001 From: knoxfighter Date: Fri, 16 Oct 2020 18:13:51 +0200 Subject: [PATCH 5/7] added support for creating a docker image from local sourcecode --- Makefile | 2 +- docker/Dockerfile-build | 20 -------------------- docker/Dockerfile-local | 27 +++++++++++++++++++++++++++ docker/Makefile | 27 --------------------------- docker/README.md | 3 +++ docker/build.sh | 14 ++++++++------ 6 files changed, 39 insertions(+), 54 deletions(-) delete mode 100644 docker/Dockerfile-build create mode 100644 docker/Dockerfile-local delete mode 100644 docker/Makefile mode change 100644 => 100755 docker/build.sh diff --git a/Makefile b/Makefile index 3a366e8..5719ad5 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,6 @@ clean: @-rm app/style.css.map @-rm -r app/fonts/vendor/ @-rm -r app/images/vendor/ - @-rm -r node_modules/ + @-rm -rf node_modules/ @-rm -r pkg/ @-rm -r factorio-server-manager diff --git a/docker/Dockerfile-build b/docker/Dockerfile-build deleted file mode 100644 index 12cc602..0000000 --- a/docker/Dockerfile-build +++ /dev/null @@ -1,20 +0,0 @@ -FROM alpine:latest - -RUN apk add --no-cache git make musl-dev go nodejs npm zip - -ENV FAC_BRANCH=develop -ENV GOROOT /usr/lib/go -ENV GOPATH /go -ENV PATH /go/bin:$PATH -ENV FAC_ROOT /go/src/factorio-server-manager - -COPY build.sh /usr/local/bin/build.sh - -RUN mkdir -p ${GOPATH}/bin -RUN chmod u+x /usr/local/bin/build.sh - -WORKDIR $FAC_ROOT - -VOLUME /build - -CMD ["/usr/local/bin/build.sh"] \ No newline at end of file diff --git a/docker/Dockerfile-local b/docker/Dockerfile-local new file mode 100644 index 0000000..c0f8465 --- /dev/null +++ b/docker/Dockerfile-local @@ -0,0 +1,27 @@ +# Glibc is required for Factorio Server binaries to run +FROM frolvlad/alpine-glibc + +ENV FACTORIO_VERSION=latest \ + MANAGER_VERSION=0.8.2 \ + ADMIN_USER=admin \ + ADMIN_PASS=factorio \ + RCON_PASS="" \ + COOKIE_ENCRYPTION_KEY="" + +VOLUME /opt/fsm-data /opt/factorio/saves /opt/factorio/mods /opt/factorio/config + +EXPOSE 80/tcp 34197/udp + +RUN apk add --no-cache curl tar xz unzip jq + +WORKDIR /opt + +# Install FSM +COPY factorio-server-manager-linux.zip /factorio-server-manager-linux.zip +RUN unzip /factorio-server-manager-linux.zip \ + && rm /factorio-server-manager-linux.zip \ + && mv factorio-server-manager fsm + +COPY entrypoint.sh /opt + +ENTRYPOINT ["/opt/entrypoint.sh"] diff --git a/docker/Makefile b/docker/Makefile deleted file mode 100644 index e3bbad3..0000000 --- a/docker/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -# Variables can be overridden by setting environment variables - -FACTORIO_PATH ?= ~/.factorio -SECURITY_PATH ?= $(FACTORIO_PATH)/security -SAVES_PATH ?= $(FACTORIO_PATH)/saves -MODS_PATH ?= $(FACTORIO_PATH)/mods -PORT_FORWARD ?= -p 80:80 -p 443:443 -p 34197:34197/udp -FACTORIO_BRANCH ?= develop - -build: - docker build --build-arg FAC_BRANCH=$FACTORIO_BRANCH -f Dockerfile-build -t fsm-build . - docker build -t factorio-server-manager . - -logs: - docker logs factorio-server -f - -run: - docker run -d --name factorio-server -v $(SECURITY_PATH):/security -v $(SAVES_PATH):/opt/factorio/saves -v $(MODS_PATH):/opt/factorio/mods $(PORT_FORWARD) factorio-server-manager - -stop: - docker stop factorio-server - docker rm factorio-server - -clean: - docker rmi factorio-server-manager - docker stop fsm-build - docker rmi fsm-build diff --git a/docker/README.md b/docker/README.md index 32a28b4..dc383b5 100644 --- a/docker/README.md +++ b/docker/README.md @@ -82,6 +82,9 @@ After container starts, latest Factorio version will be downloaded and installed Authentication is supported in the application but it is recommended to ensure access to the Factorio manager UI is accessible via VPN or internal network. +## Development +For development purposes it also has the ability to create the docker image from local sourcecode. This is done by running `build.sh` in the `docker` directory. This will delete all old executables and the node_modules directory (runs `make build`). The created docker image will have the tag `factorio-server-manager:dev`. + ## For everyone who actually read this thing to the end And now go and build some nice factories! diff --git a/docker/build.sh b/docker/build.sh old mode 100644 new mode 100755 index b3be17c..a0624e7 --- a/docker/build.sh +++ b/docker/build.sh @@ -1,8 +1,10 @@ #!/bin/sh -echo "Cloning ${FAC_BRANCH}" -git clone -b ${FAC_BRANCH} https://github.com/mroote/factorio-server-manager.git ${FAC_ROOT} -echo "Creating build..." -make gen_release -echo "Copying build artifacts..." -cp -v build/* /build/ \ No newline at end of file +cd .. +make build +cp build/factorio-server-manager-linux.zip docker/factorio-server-manager-linux.zip + +cd docker +docker build -f Dockerfile-local -t factorio-server-manager:dev . + +rm factorio-server-manager-linux.zip From 3b978b5b04b68fbb367d1c1dcdf91f0f43e4d85c Mon Sep 17 00:00:00 2001 From: knoxfighter Date: Sat, 17 Oct 2020 02:02:57 +0200 Subject: [PATCH 6/7] Apply suggestions from code review use subshell & stop if something is not right Co-authored-by: Sandro --- docker/build.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker/build.sh b/docker/build.sh index a0624e7..8d077a1 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -1,10 +1,10 @@ #!/bin/sh - -cd .. -make build -cp build/factorio-server-manager-linux.zip docker/factorio-server-manager-linux.zip - -cd docker +set -eou pipefail +( + cd .. + make build + cp build/factorio-server-manager-linux.zip docker/factorio-server-manager-linux.zip +) docker build -f Dockerfile-local -t factorio-server-manager:dev . rm factorio-server-manager-linux.zip From 421eef3b9503618a0a41dd65e9a1bdc519e13dc3 Mon Sep 17 00:00:00 2001 From: Jan Naahs Date: Fri, 13 Nov 2020 23:07:38 +0100 Subject: [PATCH 7/7] changed screenshots in README.md --- README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 74d8392..f5ac975 100644 --- a/README.md +++ b/README.md @@ -81,16 +81,13 @@ Custom glibc example: ``` ## Manage Factorio Server -![Factorio Server Manager Screenshot](http://i.imgur.com/q7tbzdH.png "Factorio Server Manager") +![Factorio Server Manager Screenshot](screenshots/Screenshot_Controls.png) ## Manage save files -![Factorio Server Manager Screenshot](http://i.imgur.com/M7kBAhI.png "Factorio Server Manager") +![Factorio Server Manager Screenshot](screenshots/Screenshot_Saves.png) ## Manage mods -![Factorio Server Manager Screenshot](https://imgur.com/QIb0Kr4.png "Factorio Server Manager") - -## Manage modpacks -![Factorio Server Manager Screenshot](https://imgur.com/O701fB8.png "Factorio Server Manager") +![Factorio Server Manager Screenshot](screenshots/Screenshot_Mods.png)