From f4d7112808832e9820132deb56cbb06890817a44 Mon Sep 17 00:00:00 2001 From: William Lindholm Date: Tue, 13 Oct 2026 16:22:59 +0200 Subject: [PATCH 01/10] Added templates --- ct/factorio.sh | 39 +++++++++++++++++++++++++++++++++++++ install/factorio-install.sh | 21 ++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 ct/factorio.sh create mode 100644 install/factorio-install.sh diff --git a/ct/factorio.sh b/ct/factorio.sh new file mode 100644 index 0000000000..5cc887621f --- /dev/null +++ b/ct/factorio.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main" +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") +# Copyright (c) 2021-2026 community-scripts ORG +# Author: William Lindholm (LindholmLabs) +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://www.factorio.com/ + +APP="App Name" +var_tags="${var_tags:-appname}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-8}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_unprivileged="${var_unprivileged:-1}" +var_arm64="${var_arm64:-yes}" + +# Export only app-specific values read by install/appname-install.sh. +# export var_admin_user="${var_admin_user:-}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + # Application update logic. + exit +} + +start +build_container +description +msg_ok "Completed successfully!\n" \ No newline at end of file diff --git a/install/factorio-install.sh b/install/factorio-install.sh new file mode 100644 index 0000000000..1622e63b0c --- /dev/null +++ b/install/factorio-install.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: William Lindholm (LindholmLabs) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://www.factorio.com/ + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing App Name" +# App-specific dependencies, deployment, configuration, and service setup. +msg_ok "Installed App Name" + +motd_ssh +customize +cleanup_lxc \ No newline at end of file From 57a5b652ad9479f55fe55039f940d1719edf7f8a Mon Sep 17 00:00:00 2001 From: William Lindholm Date: Tue, 13 Oct 2026 17:10:09 +0200 Subject: [PATCH 02/10] Created installation script --- install/factorio-install.sh | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/install/factorio-install.sh b/install/factorio-install.sh index 1622e63b0c..4f028e4caf 100644 --- a/install/factorio-install.sh +++ b/install/factorio-install.sh @@ -12,9 +12,39 @@ setting_up_container network_check update_os -msg_info "Installing App Name" -# App-specific dependencies, deployment, configuration, and service setup. -msg_ok "Installed App Name" +msg_info "Installing factorio server" + +# download factorio headless server and extract to /opt/factorio +curl -sSL "https://factorio.com/get-download/stable/headless/linux64" -o /tmp/factorio.tar.xz +tar -xJf /tmp/factorio.tar.xz -C /opt + +# create new user for factorio +useradd -r -d /opt/factorio -s /bin/false factorio +chown -R factorio:factorio /opt/factorio + +msg_info "Creating Factorio Service" +cat </etc/systemd/system/factorio.service +[Unit] +Description=Factorio Headless Server +Wants=network-online.target +After=network-online.target + +[Service] +Type=simple +User=factorio +WorkingDirectory=/opt/factorio_data +ExecStart=/opt/factorio/bin/x64/factorio --config /opt/factorio_data/config.ini --start-server-load-latest --server-settings /opt/factorio_data/server-settings.json --port 34197 +KillSignal=SIGINT +TimeoutStopSec=120 +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now factorio + +msg_ok "Installed factorio server" motd_ssh customize From 4fab7b202d4f40fc07934a98d08ab339b56a5262 Mon Sep 17 00:00:00 2001 From: William Lindholm Date: Tue, 13 Oct 2026 17:27:03 +0200 Subject: [PATCH 03/10] Add app name --- ct/factorio.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ct/factorio.sh b/ct/factorio.sh index 5cc887621f..07342ea7e4 100644 --- a/ct/factorio.sh +++ b/ct/factorio.sh @@ -7,7 +7,7 @@ source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_ # License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE # Source: https://www.factorio.com/ -APP="App Name" +APP="factorio" var_tags="${var_tags:-appname}" var_cpu="${var_cpu:-1}" var_ram="${var_ram:-2048}" @@ -30,6 +30,7 @@ function update_script() { check_container_storage check_container_resources # Application update logic. + exit } From 9e34f85a21e15ce689b7a9777a482e0a16183b16 Mon Sep 17 00:00:00 2001 From: William Lindholm Date: Tue, 13 Oct 2026 17:36:23 +0200 Subject: [PATCH 04/10] Simplified installation sctrip --- install/factorio-install.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/install/factorio-install.sh b/install/factorio-install.sh index 4f028e4caf..09775b5e19 100644 --- a/install/factorio-install.sh +++ b/install/factorio-install.sh @@ -18,9 +18,9 @@ msg_info "Installing factorio server" curl -sSL "https://factorio.com/get-download/stable/headless/linux64" -o /tmp/factorio.tar.xz tar -xJf /tmp/factorio.tar.xz -C /opt -# create new user for factorio -useradd -r -d /opt/factorio -s /bin/false factorio -chown -R factorio:factorio /opt/factorio +msg_info "Creating initial save file" +mkdir -p /opt/factorio_data/saves +/opt/factorio/bin/x64/factorio --create /opt/factorio_data/saves/save.zip msg_info "Creating Factorio Service" cat </etc/systemd/system/factorio.service @@ -31,9 +31,9 @@ After=network-online.target [Service] Type=simple -User=factorio +User=root WorkingDirectory=/opt/factorio_data -ExecStart=/opt/factorio/bin/x64/factorio --config /opt/factorio_data/config.ini --start-server-load-latest --server-settings /opt/factorio_data/server-settings.json --port 34197 +ExecStart=/opt/factorio/bin/x64/factorio --start-server-load-latest KillSignal=SIGINT TimeoutStopSec=120 Restart=on-failure @@ -42,7 +42,7 @@ RestartSec=5 [Install] WantedBy=multi-user.target EOF -systemctl enable -q --now factorio +systemctl enable --now factorio msg_ok "Installed factorio server" From 8ef4740c281bac5622cf4c54fdc886b2de1812b7 Mon Sep 17 00:00:00 2001 From: William Lindholm Date: Tue, 13 Oct 2026 17:44:15 +0200 Subject: [PATCH 05/10] Fix paths --- install/factorio-install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install/factorio-install.sh b/install/factorio-install.sh index 09775b5e19..72348ec39d 100644 --- a/install/factorio-install.sh +++ b/install/factorio-install.sh @@ -19,8 +19,8 @@ curl -sSL "https://factorio.com/get-download/stable/headless/linux64" -o /tmp/fa tar -xJf /tmp/factorio.tar.xz -C /opt msg_info "Creating initial save file" -mkdir -p /opt/factorio_data/saves -/opt/factorio/bin/x64/factorio --create /opt/factorio_data/saves/save.zip +mkdir -p /opt/factorio/saves +/opt/factorio/bin/x64/factorio --create /opt/factorio/saves/save.zip msg_info "Creating Factorio Service" cat </etc/systemd/system/factorio.service @@ -32,7 +32,7 @@ After=network-online.target [Service] Type=simple User=root -WorkingDirectory=/opt/factorio_data +WorkingDirectory=/opt/factorio ExecStart=/opt/factorio/bin/x64/factorio --start-server-load-latest KillSignal=SIGINT TimeoutStopSec=120 From cb06613be67b3b2a653c49dc3541b47dfcab21ec Mon Sep 17 00:00:00 2001 From: William Lindholm Date: Tue, 13 Oct 2026 18:58:04 +0200 Subject: [PATCH 06/10] Add factorio settings file from example --- ct/factorio.sh | 4 ++-- install/factorio-install.sh | 7 ++++--- json/factorio.json | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 json/factorio.json diff --git a/ct/factorio.sh b/ct/factorio.sh index 07342ea7e4..7caec57bcc 100644 --- a/ct/factorio.sh +++ b/ct/factorio.sh @@ -15,7 +15,7 @@ var_disk="${var_disk:-8}" var_os="${var_os:-debian}" var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" -var_arm64="${var_arm64:-yes}" +var_arm64="${var_arm64:-no}" # Factorio headless is only published for Linux x64. # Export only app-specific values read by install/appname-install.sh. # export var_admin_user="${var_admin_user:-}" @@ -37,4 +37,4 @@ function update_script() { start build_container description -msg_ok "Completed successfully!\n" \ No newline at end of file +msg_ok "Completed successfully!\n" diff --git a/install/factorio-install.sh b/install/factorio-install.sh index 72348ec39d..c5bb251b65 100644 --- a/install/factorio-install.sh +++ b/install/factorio-install.sh @@ -17,6 +17,7 @@ msg_info "Installing factorio server" # download factorio headless server and extract to /opt/factorio curl -sSL "https://factorio.com/get-download/stable/headless/linux64" -o /tmp/factorio.tar.xz tar -xJf /tmp/factorio.tar.xz -C /opt +sed 's/"public":[[:space:]]*true/"public": false/' /opt/factorio/data/server-settings.example.json >/opt/factorio/server-settings.json msg_info "Creating initial save file" mkdir -p /opt/factorio/saves @@ -33,7 +34,7 @@ After=network-online.target Type=simple User=root WorkingDirectory=/opt/factorio -ExecStart=/opt/factorio/bin/x64/factorio --start-server-load-latest +ExecStart=/opt/factorio/bin/x64/factorio --start-server-load-latest --server-settings /opt/factorio/server-settings.json KillSignal=SIGINT TimeoutStopSec=120 Restart=on-failure @@ -42,10 +43,10 @@ RestartSec=5 [Install] WantedBy=multi-user.target EOF -systemctl enable --now factorio +systemctl enable -q --now factorio msg_ok "Installed factorio server" motd_ssh customize -cleanup_lxc \ No newline at end of file +cleanup_lxc diff --git a/json/factorio.json b/json/factorio.json new file mode 100644 index 0000000000..3937fc8de4 --- /dev/null +++ b/json/factorio.json @@ -0,0 +1,36 @@ +{ + "name": "Factorio", + "slug": "factorio", + "categories": [24], + "date_created": "2026-10-13", + "type": "ct", + "updateable": false, + "privileged": false, + "interface_port": null, + "documentation": "https://wiki.factorio.com/Multiplayer", + "website": "https://factorio.com/", + "repository": "", + "architectures": ["amd64"], + "platforms": ["pve"], + "logo": "", + "description": "Factorio headless multiplayer server using the current stable Linux x64 release.", + "install_methods": [ + { + "type": "default", + "script": "ct/factorio.sh", + "config_path": "/opt/factorio/server-settings.json", + "resources": { + "cpu": 1, + "ram": 2048, + "hdd": 8, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": {"username": null, "password": null}, + "notes": [ + {"text": "Connect using the Factorio client to :34197 over UDP. There is no web interface. Clients need the same Factorio version and mods as the server.", "type": "info"}, + {"text": "Saves are stored in /opt/factorio/saves. The service loads the most recent save on restart. Automatic updates are not implemented.", "type": "info"} + ] +} From 733ca23c216d8d849fcdd20fc84859ca76ccbed9 Mon Sep 17 00:00:00 2001 From: William Lindholm Date: Tue, 13 Oct 2026 19:53:22 +0200 Subject: [PATCH 07/10] Added update script --- ct/factorio.sh | 27 ++++++++++++++++++++++++++- json/factorio.json | 4 ++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/ct/factorio.sh b/ct/factorio.sh index 7caec57bcc..f9e4b75d4f 100644 --- a/ct/factorio.sh +++ b/ct/factorio.sh @@ -29,7 +29,32 @@ function update_script() { header_info check_container_storage check_container_resources - # Application update logic. + if [[ ! -x /opt/factorio/bin/x64/factorio ]]; then + msg_error "No Factorio Installation Found!" + exit 1 + fi + + msg_info "Stopping Factorio" + systemctl stop factorio + msg_ok "Stopped Factorio" + + create_backup /opt/factorio/config /opt/factorio/config-path.cfg \ + /opt/factorio/server-settings.json /opt/factorio/saves /opt/factorio/mods \ + /opt/factorio/player-data.json /opt/factorio/server-adminlist.json \ + /opt/factorio/server-banlist.json /opt/factorio/server-whitelist.json + + # Overlay the release without deleting user files; restore any shipped defaults. + if ! fetch_and_deploy_from_url "https://factorio.com/get-download/stable/headless/linux64" "/opt/factorio"; then + restore_backup + msg_error "Factorio update failed. User data was restored; Factorio remains stopped." + exit 1 + fi + restore_backup + + msg_info "Starting Factorio" + systemctl start factorio + msg_ok "Started Factorio" + msg_ok "Updated Factorio successfully!" exit } diff --git a/json/factorio.json b/json/factorio.json index 3937fc8de4..b847f4e755 100644 --- a/json/factorio.json +++ b/json/factorio.json @@ -4,7 +4,7 @@ "categories": [24], "date_created": "2026-10-13", "type": "ct", - "updateable": false, + "updateable": true, "privileged": false, "interface_port": null, "documentation": "https://wiki.factorio.com/Multiplayer", @@ -31,6 +31,6 @@ "default_credentials": {"username": null, "password": null}, "notes": [ {"text": "Connect using the Factorio client to :34197 over UDP. There is no web interface. Clients need the same Factorio version and mods as the server.", "type": "info"}, - {"text": "Saves are stored in /opt/factorio/saves. The service loads the most recent save on restart. Automatic updates are not implemented.", "type": "info"} + {"text": "Saves are stored in /opt/factorio/saves. The service loads the most recent save on restart. Run update inside the container to install the current stable release while preserving settings and saves.", "type": "info"} ] } From 294c9743851b592da7ba959178ae89674e363eef Mon Sep 17 00:00:00 2001 From: William Lindholm Date: Tue, 13 Oct 2026 19:56:17 +0200 Subject: [PATCH 08/10] Update to use fetch_and_deploy_from_url --- install/factorio-install.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/install/factorio-install.sh b/install/factorio-install.sh index c5bb251b65..962e32c9d0 100644 --- a/install/factorio-install.sh +++ b/install/factorio-install.sh @@ -12,16 +12,17 @@ setting_up_container network_check update_os -msg_info "Installing factorio server" +ensure_dependencies file xz-utils +fetch_and_deploy_from_url "https://factorio.com/get-download/stable/headless/linux64" "/opt/factorio" -# download factorio headless server and extract to /opt/factorio -curl -sSL "https://factorio.com/get-download/stable/headless/linux64" -o /tmp/factorio.tar.xz -tar -xJf /tmp/factorio.tar.xz -C /opt +msg_info "Configuring Factorio" sed 's/"public":[[:space:]]*true/"public": false/' /opt/factorio/data/server-settings.example.json >/opt/factorio/server-settings.json +msg_ok "Configured Factorio" -msg_info "Creating initial save file" +msg_info "Creating Factorio Save" mkdir -p /opt/factorio/saves -/opt/factorio/bin/x64/factorio --create /opt/factorio/saves/save.zip +$STD /opt/factorio/bin/x64/factorio --create /opt/factorio/saves/save.zip +msg_ok "Created Factorio Save" msg_info "Creating Factorio Service" cat </etc/systemd/system/factorio.service @@ -45,7 +46,7 @@ WantedBy=multi-user.target EOF systemctl enable -q --now factorio -msg_ok "Installed factorio server" +msg_ok "Created Factorio Service" motd_ssh customize From 4b7e4aecba90e24c67a5c94b05ad2d2f36aa494a Mon Sep 17 00:00:00 2001 From: William Lindholm Date: Tue, 13 Oct 2026 20:27:16 +0200 Subject: [PATCH 09/10] Change scripts to follow established conventions --- ct/factorio.sh | 15 +++++++++------ install/factorio-install.sh | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ct/factorio.sh b/ct/factorio.sh index f9e4b75d4f..45696aaa38 100644 --- a/ct/factorio.sh +++ b/ct/factorio.sh @@ -7,8 +7,8 @@ source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_ # License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE # Source: https://www.factorio.com/ -APP="factorio" -var_tags="${var_tags:-appname}" +APP="Factorio" +var_tags="${var_tags:-gaming}" var_cpu="${var_cpu:-1}" var_ram="${var_ram:-2048}" var_disk="${var_disk:-8}" @@ -17,9 +17,6 @@ var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" var_arm64="${var_arm64:-no}" # Factorio headless is only published for Linux x64. -# Export only app-specific values read by install/appname-install.sh. -# export var_admin_user="${var_admin_user:-}" - header_info "$APP" variables color @@ -29,11 +26,14 @@ function update_script() { header_info check_container_storage check_container_resources + if [[ ! -x /opt/factorio/bin/x64/factorio ]]; then msg_error "No Factorio Installation Found!" exit 1 fi + ensure_dependencies file xz-utils + msg_info "Stopping Factorio" systemctl stop factorio msg_ok "Stopped Factorio" @@ -62,4 +62,7 @@ function update_script() { start build_container description -msg_ok "Completed successfully!\n" + +msg_ok "Completed Factorio setup successfully!\n" +echo -e "${INFO}${YW}Connect in Factorio using the following address (UDP):${CL}" +echo -e "${GATEWAY}${BGN}${IP}:34197${CL}" diff --git a/install/factorio-install.sh b/install/factorio-install.sh index 962e32c9d0..624a274e96 100644 --- a/install/factorio-install.sh +++ b/install/factorio-install.sh @@ -2,11 +2,12 @@ # Copyright (c) 2021-2026 community-scripts ORG # Author: William Lindholm (LindholmLabs) -# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE # Source: https://www.factorio.com/ source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" color +verb_ip6 catch_errors setting_up_container network_check From 37fb801abd958939bf591078b084bf9ad793ad11 Mon Sep 17 00:00:00 2001 From: William Lindholm Date: Tue, 13 Oct 2026 21:13:26 +0200 Subject: [PATCH 10/10] Add creation of admin list --- install/factorio-install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/install/factorio-install.sh b/install/factorio-install.sh index 624a274e96..85f79928d3 100644 --- a/install/factorio-install.sh +++ b/install/factorio-install.sh @@ -18,6 +18,9 @@ fetch_and_deploy_from_url "https://factorio.com/get-download/stable/headless/lin msg_info "Configuring Factorio" sed 's/"public":[[:space:]]*true/"public": false/' /opt/factorio/data/server-settings.example.json >/opt/factorio/server-settings.json +cat </opt/factorio/server-adminlist.json +[] +EOF msg_ok "Configured Factorio" msg_info "Creating Factorio Save" @@ -36,7 +39,7 @@ After=network-online.target Type=simple User=root WorkingDirectory=/opt/factorio -ExecStart=/opt/factorio/bin/x64/factorio --start-server-load-latest --server-settings /opt/factorio/server-settings.json +ExecStart=/opt/factorio/bin/x64/factorio --start-server-load-latest --server-settings /opt/factorio/server-settings.json --server-adminlist /opt/factorio/server-adminlist.json KillSignal=SIGINT TimeoutStopSec=120 Restart=on-failure