Giter Site home page Giter Site logo

sqljames / factorio-server-charts Goto Github PK

View Code? Open in Web Editor NEW
20.0 4.0 22.0 144 KB

Helm deployment for Factorio

Home Page: https://artifacthub.io/packages/helm/factorio-server-charts/factorio-server-charts

License: The Unlicense

Mustache 100.00%
factorio-server chart kubernetes helm

factorio-server-charts's Introduction

Artifact HUB Factorio Chart Version Image Version

factorio-server-charts

factorio-server-charts - A Helm chart for running factorio in kubernetes

Introduction

This chart deploys Factorio on a Kubernetes cluster using the Helm package manager.

Background

This is something of a passion project for both learning kubernetes and because kubernetes is awesome. Because of this, I have only confirm this working on version 1.1.0 of factorio but I am sure it will work just fine on old versions as long as the schema doesn't change to much on the Secrets settings.

However, with the way this is implemented if you want to make it backwards compatible, you can update the appropriate sections in the values.yaml file to have the items added or removed to the json files that are required by factorio. Server-settings, map-gen-settings, etc.

Releases

Releases are published using the official helm release action in github. https://github.com/helm/chart-releaser-action

Full Documentation

To read the full documentation check the chart's README.md

Examples Of Large mods

Values.yaml configuration of large mods:

Changelog

V1.1.0

Breaking Changes

  • Moved account data from server_settings. to account. in values.yaml
  • Moved server password from server_settings. to serverPassword. in values.yaml

Non-Breaking Changes

  • Added account.accountSecret field to values.yaml
  • Added rcon.passwordSecret field to values.yaml
  • Added serverPassword.passwordSecret field to values.yaml
  • Changed default rcon.password to CHANGEMECHANGEME, which should be changed anyway
  • Changed default map_gen_settings.autoplace_controls from the standard values to {}, since by default map generation follows standard parameters if not overriden
  • Changed default admin_list, white_list and ban_list to [] instead of nil

factorio-server-charts's People

Contributors

avanier avatar bongoeadgc6 avatar haloghen avatar hyperbolic2346 avatar mozgiii avatar nippold avatar rlex avatar vanderscycle avatar zcube avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

factorio-server-charts's Issues

Ability to Specify mod version

Great chart, thank you for your efforts and for providing this to the community!

With the recent "breaking changes" to SpaceExploration + Krastorio2 for mid game players, there should be an easy way to pin mods at certain versions. I had to restart my pod due to a failed blueprint import, and it pulled the latest plugin on boot that I didn't want, and now I'm seemingly needing the unofficial mods section for rolling back.

Ideally, mods can have pinned versions and have those be downloaded from the mod portal.

I should also note that the update_mods_on_start property seems to have failed. I have mine set to false and my mods were still updated on reboot.

negative_path_cache_delay_interval missing from map-settings

As of Factorio 1.1.0, negative_path_cache_delay_interval must be set in the map-settings.json (configMap). You can specify this in your values.yaml file, but since it's a required field in the JSON, a default value should probably be specified in the chart. More details in the Factorio forum.

License

I am interested in the license you plan for this project.
I have used this chart for a little while but the design was not quite right for my needs (mainly around my loadbalancer/setup) and i ended up using a seperate service.yaml for it.

I am part of the k8s @ home community and we have a large library of helm charts based off a excelent common library. I have setup a chart but would like to use part of your config-mapping, as it makes it so much easier to setup than expectiing users to edit config manually!

Space exploration mod configuration

Hey not to add an edge case to the solid work you did, but what about mods with lots of dependencies that are normally downloaded with the main package like space ex mod?

I am asking because I can't seem to be able to download the space exploration mod.

mods:
  enabled: true
  # in order to use the mods portal you will need to specify the username and token in the server_settings.
  # name is determined by the url, it will be the last part of the url, not the title of the mod.
  portal:
    - space-exploration
    - [...] more to be added later

BTW, your helm chart allowed me to bridge the huge knowledge gap needed to have argocd/kustomize/helm in a declarative gitops pattern to work.

Thank you,

Originally posted by @Vanderscycle in #12 (comment)

unable to start with Krastorio2 mod

Hey all,

I am unable to run a server using the latest Krastorio2 (v1.3.23) using the helm chart.
I am using a minimal values file:

image:
  tag: stable
service:
  type: ClusterIP
  port: 34197
persistence:
  enabled: true
  dataDir:
    Size: "10Gi"
  storageClassName: "ssd"
account:
  username: "secret"
  token: "secret"
mods:
  enabled: true
  portal:
    - Krastorio2
    - Krastorio2Assets
    - flib

But the pod keeps crashing with the following log output:

+ FACTORIO_VOL=/factorio
+ LOAD_LATEST_SAVE=true
+ GENERATE_NEW_SAVE=true
+ SAVE_NAME=replaceMe
+ BIND=
+ CONSOLE_LOG_LOCATION=
+ mkdir -p /factorio
+ mkdir -p /factorio/saves
+ mkdir -p /factorio/configs
+ mkdir -p /factorio/mods
+ mkdir -p /factorio/scenarios
+ mkdir -p /factorio/script-output
+ [[ ! -f /factorio/configs/rconpw ]]
+ [[ ! -f /factorio/configs/server-settings.json ]]
+ [[ ! -f /factorio/configs/map-gen-settings.json ]]
+ [[ ! -f /factorio/configs/map-settings.json ]]
++ find -L /factorio/saves -iname ++ '*.tmp.zip' wc -l
-mindepth 1
+ NRTMPSAVES=0
+ [[ 0 -gt 0 ]]
+ [[ false == \t\r\u\e ]]
++ id -u
+ [[ 0 = 0 ]]
+ usermod -o -u 845 factorio
usermod: no changes
+ groupmod -o -g 845 factorio
+ chown -R factorio:factorio /factorio
+ SU_EXEC='su-exec factorio'
+ sed -i '/write-data=/c\write-data=\/factorio/' /opt/factorio/config/config.ini
++ find -L /factorio/saves -iname ++ '*.zip' wc -l
-mindepth 1
+ NRSAVES=0
+ [[ true != true ]]
+ [[ true == true ]]
+ [[ -z replaceMe ]]
+ [[ -f /factorio/saves/replaceMe.zip ]]
+ su-exec factorio /opt/factorio/bin/x64/factorio --create /factorio/saves/replaceMe.zip --map-gen-settings /factorio/configs/map-gen-settings.json --map-settings /factorio/configs/map-settings.json
   0.000 2024-01-08 10:33:13; Factorio 1.1.100 (build 61920, linux64, headless)
   0.000 Operating system: Linux
   0.000 Program arguments: "/opt/factorio/bin/x64/factorio" "--create" "/factorio/saves/replaceMe.zip" "--map-gen-settings" "/factorio/configs/map-gen-settings.json" "--map-settings" "/factorio/configs/map-settings.json" 
   0.000 Config path: /opt/factorio/config/config.ini
   0.000 Read data path: /opt/factorio/data
   0.000 Write data path: /factorio [9725/9979MB]
   0.000 Binaries path: /opt/factorio/bin
   0.005 System info: [CPU: AMD EPYC 7232P 8-Core Processor, 2 cores, RAM: 3331 MB]
   0.005 Environment: DISPLAY=<unset> WAYLAND_DISPLAY=<unset> DESKTOP_SESSION=<unset> XDG_SESSION_DESKTOP=<unset> XDG_CURRENT_DESKTOP=<unset> __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset> __GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
   0.005 Running in headless mode
   0.022 Loading mod settings Krastorio2 1.3.23 (settings.lua)
   0.023 Loading mod settings Krastorio2 1.3.23 (settings-updates.lua)
   0.024 Loading mod core 0.0.0 (data.lua)
   0.045 Loading mod base 1.1.100 (data.lua)
   0.218 Loading mod flib 0.13.0 (data.lua)
   0.239 Loading mod Krastorio2 1.3.23 (data.lua)
   0.327 Loading mod base 1.1.100 (data-updates.lua)
   0.351 Loading mod Krastorio2 1.3.23 (data-updates.lua)
   0.428 Loading mod Krastorio2 1.3.23 (data-final-fixes.lua)
   0.555 Checksum for core: 2152183905
   0.555 Checksum of base: 1215362964
   0.555 Checksum of flib: 574468295
   0.555 Checksum of Krastorio2Assets: 0
   0.555 Checksum of Krastorio2: 3880386261
   0.790 Prototype list checksum: 2900857415
   0.856 Info PlayerData.cpp:76: Local player-data.json available, timestamp 1704709973
   0.856 Info PlayerData.cpp:83: Cloud player-data.json unavailable
   0.857 Factorio initialised
   0.857 Info Main.cpp:777: Creating new map /factorio/saves/replaceMe.zip
   2.076 Loading level.dat: 1608873 bytes.
   2.076 Info Scenario.cpp:204: Map version 1.1.100-0
   2.112 Checksum for script /factorio/temp/currently-playing/control.lua: 3702463597
   2.120 Checksum for script __Krastorio2__/control.lua: 2424813832
Error: The mod Krastorio 2 (1.3.23) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event Krastorio2::on_init()
__Krastorio2__/scripts/freeplay.lua:52: attempt to index field 'autoplace_controls' (a nil value)
stack traceback:
	__Krastorio2__/scripts/freeplay.lua:52: in function 'add_to_crash_site'
	__Krastorio2__/scripts/migrations.lua:23: in function 'generic'
	__Krastorio2__/control.lua:54: in function <__Krastorio2__/control.lua:37>
   2.172 Goodbye

When I run the container in docker using factoriotools/factorio:stable as an image and adding the same mods manually everything runs fine.

Does this helm chart needs some special settings to run Krastorio2?
Anyone experienced similar issues and may give me an hint where the issue may be?

FYI: using no mods or other mods everything works just fine.

Thanks!

Public browser listing shows the server but we arent able to connect.

The server now shows in public browser, however, when attempting to connect through the public browser you will get an error, the server is available on the web and allows inbound connections when connecting to the ip directly. This is due to the fact the outbound ports are randomized and because the server needs to reach out to update the browser with connection details and keepalive state on port 34197.

This is better explained by this writeup on serverfault;

If anyone has any ideas on how we can look to resolve this I would be happy to implement them.

Permission Change Error while Using NFS as storage class

Description

When deploying the Factorio Server using the Helm chart provided in this repository with NFS as the storage class, the chown command fails with a non-zero exit code during both the initialization and server startup scripts, preventing the server from starting.

Environment

Issue Details

The failure occurs when the scripts attempt to change ownership of directories to the factorio user and group. Since NFS typically restricts ownership changes, the chown command exits with an error, halting the initialization and server startup processes.

Workaround Implemented

As a temporary solution, I manually adjusted the deployment configuration by setting the PUID and PGID to align with the NFS-mounted volume’s permitted UID and GID. This workaround prevents the chown command from trying to change permissions, thus allowing the server startup process to proceed without encountering errors.

Suggested Changes

  1. Configurability of PUID and PGID: Integrate the ability to configure PUID and PGID through environment variables directly in the Helm chart. This addition would provide flexibility in handling permissions with NFS storage and could prevent similar issues for other users.

  2. Reevaluate Ownership Changes in Initialization Container: Consider removing the ownership change commands in the initialization container. The subsequent command in the script sets directory permissions to 777, which suggests that altering ownership might be unnecessary and could be safely omitted to streamline the deployment process.

Conclusion

I am not fully familiar with Kubernetes and may have misconfigured some aspects. Therefore, I am open to feedback on whether this issue stems from a misconfiguration on my part or if it is a broader problem that needs addressing. I am willing to contribute a pull request to implement the suggested changes once we have consensus on the appropriate solution.

This permissions issue might be a recurring scenario for users deploying with NFS, and making these environment variables configurable via the Helm chart could provide a robust solution.

Thank you for your attention to this matter.

Specifying Existing claim does nothing

Specifying persistence.dataDir.existingClaim does not use the existing claim. A search of the templates shows that this value is not used. If specified by a user, the chart should:

  1. not create a new PVC
  2. use the given pvc for the deployment

server_settings values do not appear in Config Map

I've been struggling to get this server working in my HA Kubernetes cluster for about a week now. I just realized today that the values configuration for the server_settings file does not seem to be applied with the --values values.yaml flag. The default values from the values.yaml file in this repo do not even appear to be sent to the config map in Kubernetes.

I've tried the following helm commands to apply my own values.yaml file which is just a modified copy of the one in this repo:
helm install factorio sqljamesfactorio/factorio-server-charts -n factorio --values factorio/factorio-helm-values.yaml
helm install factorio sqljamesfactorio/factorio-server-charts -n factorio -f factorio/factorio-helm-values.yaml
and, because neither of those worked as expected, helm install factorio sqljamesfactorio/factorio-server-charts -n factorio -f factorio/factorio-helm-values.yaml --values factorio/factorio-helm-values.yaml.

Each way I tried did end up creating the Service as laid out in my custom values file, and set the resource requests properly, but still the factorio-factorio-server-charts-serversettingsconfig config map still has outdated default values in the compiled server-settings.json field with the following content:

{"afk_autokick_interval":0,"allow_commands":"admins-only","auto_pause":true,"autosave_interval":10,"autosave_only_on_server":true,"autosave_slots":5,"description":"Factorio running on Kubernetes","game_password":"","ignore_player_limit_for_returning_players":false,"max_players":0,"max_upload_in_kilobytes_per_second":0,"max_upload_slots":5,"maximum_segment_size":100,"maximum_segment_size_peer_count":10,"minimum_latency_in_ticks":0,"minimum_segment_size":25,"minimum_segment_size_peer_count":20,"name":"Factorio","non_blocking_saving":false,"only_admins_can_pause_the_game":true,"password":"","require_user_verification":true,"tags":["game","tags"],"token":"","username":"","visibility":{"lan":true,"public":true}}

I've set a valid token, username, and the new default visibility includes public: false, which I kept in my values file, but none of those settings seem to carry over to the pod configuration. This is particularly evident due to the fact that I get the following error: 1.406 Error ServerMultiplayerManager.cpp:717: Matching server connection failed: Error when creating server game: Missing token.

mod list needs to be url encoded

Mod list needs to be URL encoded when there's a space in the mod name.

without encoding:
image

with encoding:
image

The only relevant difference between the two deployments is the modlist:

without encoding:
image

with encoding:
image

a urlencode binary is available in a gridsite package(man page), or it can be done through curl dataencode arguements

No server-id.json file created in the config directory

I am trying to deploy this chart but am getting the following error
Unhandled exception: Error when opening /factorio/config/server-id.json for writing: No such file or directory

This seems to be an autogenerated file, but since all the config files are mounted in read only as a ConfigMap, it cannot create it.

Mods?

Hello, i see UPDATE_MODS_ON_START env variable on pod, but no way to install mods from helm chart. Am i missing something?

Unable to add a password to the game

The image works really well, but I can't seem to lock down the server with a password despite specifying it in the values.yaml file. I suppose that I am making an obvious mistake, and would like a bit of help as to why its not working.

The relevant section of my values.yaml:

server_settings:
  autosave_only_on_server: false
  name: '[BETA] helm-kubernetes-argocd-vanilla'
  description: 'unstable and experimental deployment method by me. Use at own risk and expect loss of data'
  tags:
    - vanilla
    - helm
    - experimental
  visibility:
    public: true
  require_user_verification: true

account:
  # Existing secret containing a valid factorio.com username and either a password or a token
  # Example:
  #
  # apiVersion: v1
  # kind: Secret
  # metadata:
  #   name: account-secret
  # data:
  #   username: <username in base64>
  #   password: <password in base64>
  #
  # accountSecret: account-secret
  [...]

serverPassword:
  # password required to log into the factorio server
  game_password: 'broski'
  # Existing Secret containing a `game_password` data entry
  passwordSecret: ''

This results in the following /factorio/configs/server-settings.json which has no password.

{
"afk_autokick_interval": 0,
"allow_commands": "admins-only",
"auto_pause": true,
"autosave_interval": 10,
"autosave_only_on_server": false,
"autosave_slots": 5,
"description": "unstable and experimental deployment method by me. Use at own risk and expect loss of data",
"ignore_player_limit_for_returning_players": false,
"max_players": 0,
"max_upload_in_kilobytes_per_second": 0,
"max_upload_slots": 5,
"maximum_segment_size": 100,
"maximum_segment_size_peer_count": 10,
"minimum_latency_in_ticks": 0,
"minimum_segment_size": 25,
"minimum_segment_size_peer_count": 20,
"name": "[BETA] helm-kubernetes-argocd-vanilla",
"non_blocking_saving": false,
"only_admins_can_pause_the_game": true,
"require_user_verification": true,
"game_password": "test",
"tags": [
  "vanilla",
  "helm",
  "experimental"
],
"visibility": {
  "lan": true,
  "public": true
},
"username": "...",
"token": "..."
}

As far as I understand, I only need to fill the game_password value to add a password

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.