Skip to content

ccl-consulting/factorio-server-charts

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 

Repository files navigation

Artifact HUB

factorio-server-charts

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

TL;DR;

$ helm repo add sqljamesfactorio https://sqljames.github.io/factorio-server-charts/
$ helm repo update
$ helm install sqljamesfactorio/factorio-server-charts -n  

Introduction

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

Prerequisites

Installing the Chart

To install the chart with the release name ``:

$ helm install  sqljamesfactorio/factorio-server-charts -n  

The command deploys Factorio on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall/delete the ``:

$ helm delete  -n 

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters of the factorio-server-charts chart and their default values.

Parameter Description Default
replicaCount Number of replicas to create (only 1 is supported) 1
image.repository "factoriotools/factorio"
image.pullPolicy Container image pull policy Always
image.tag Overrides the image tag whose default is the chart appVersion. "latest"
securityContext.runAsUser 1000
securityContext.fsGroup 2000
service.type LoadBalancer
service.port 30000
resources Compute Resources required by the operator container {"requests":{"cpu":"500m","memory":"512Mi"}}
nodeSelector Node labels for pod assignment
Example:
nodeSelector:
beta.kubernetes.io/os: linux
beta.kubernetes.io/arch: amd64
{} # +doc-gen:break
tolerations Tolerations for pod assignment []
affinity Affinity rules for pod assignment {}
persistence.dataDir.Size "1Gi"
persistence.dataDir.existingClaim ``
persistence.storageClass longhorn
factorioServer.save_name specify a save name "replaceMe"
factorioServer.generate_new_save Generate a New Save true
factorioServer.update_mods_on_start Update mods on start false
factorioServer.load_latest_save lets the game know if you want to load the latest save true
factorioServer.config_path Location of the configuration files that are generated /srv
serverSettings.name Your Instance Name Factorio
serverSettings.description Your Instance Description "Factorio running on Kubernetes"
serverSettings.max_players Maximum number of players allowed, admins can join even a full server. 0 means unlimited. 0
serverSettings.visibility.public Game will be published on the official Factorio matching server true
serverSettings.visibility.lan Game will be broadcast on LAN true
serverSettings.username Your factorio.com login credentials. Required for games with visibility public ''
serverSettings.password ''
serverSettings.token Authentication token. May be used instead of password above. ''
serverSettings.game_password password required to log into the factorio server ''
serverSettings.require_user_verification When set to true, the server will only allow clients that have a valid Factorio.com account true
serverSettings.max_upload_in_kilobytes_per_second optional, default value is 0. 0 means unlimited. 0
serverSettings.max_upload_slots optional, default value is 5. 0 means unlimited. 5
serverSettings.minimum_latency_in_ticks optional one tick is 16ms in default speed, default value is 0. 0 means no minimum. 0
serverSettings.ignore_player_limit_for_returning_players Players that played on this map already can join even when the max player limit was reached. false
serverSettings.allow_commands possible values are, true, false and admins-only admins-only
serverSettings.autosave_interval Autosave interval in minutes 10
serverSettings.autosave_slots server autosave slots, it is cycled through when the server autosaves. 5
serverSettings.afk_autokick_interval How many minutes until someone is kicked when doing nothing, 0 for never. 0
serverSettings.auto_pause Whether should the server be paused when no players are present. true
serverSettings.only_admins_can_pause_the_game specifies if anyone can pause or only admins true
serverSettings.autosave_only_on_server Whether autosaves should be saved only on server or also on all connected clients. Default is true. true
serverSettings.non_blocking_saving Highly experimental feature, enable only at your own risk of losing your saves. On UNIX systems, server will fork itself to create an autosave. Autosaving on connected Windows clients will be disabled regardless of autosave_only_on_server option. false
serverSettings.minimum_segment_size Long network messages are split into segments that are sent over multiple ticks. Their size depends on the number of peers currently connected. Increasing the segment size will increase upload bandwidth requirement for the server and download bandwidth requirement for clients. This setting only affects server outbound messages. Changing these settings can have a negative impact on connection stability for some clients. 25
serverSettings.minimum_segment_size_peer_count 20
serverSettings.maximum_segment_size 100
serverSettings.maximum_segment_size_peer_count 10
rcon.password "01234567890123456"
rcon.port 27015
map_gen_settings.terrain_segmentation The inverse of water scale in the map generator GUI. 1
map_gen_settings.water The equivalent to water coverage in the map generator GUI. Higher coverage means more water in larger oceans. Water level = 10 * log2(this value) 1
map_gen_settings.width Width and height of map, in tiles; 0 means infinite 0
map_gen_settings.height Width and height of map, in tiles; 0 means infinite 0
map_gen_settings.starting_area Multiplier for biter free zone radius 1
map_gen_settings.peaceful_mode false
map_gen_settings.autoplace_controls.coal.frequency 1
map_gen_settings.autoplace_controls.coal.size 1
map_gen_settings.autoplace_controls.coal.richness 1
map_gen_settings.autoplace_controls.stone.frequency 1
map_gen_settings.autoplace_controls.stone.size 1
map_gen_settings.autoplace_controls.stone.richness 1
map_gen_settings.autoplace_controls.copper-ore.frequency 1
map_gen_settings.autoplace_controls.copper-ore.size 1
map_gen_settings.autoplace_controls.copper-ore.richness 1
map_gen_settings.autoplace_controls.iron-ore.frequency 1
map_gen_settings.autoplace_controls.iron-ore.size 1
map_gen_settings.autoplace_controls.iron-ore.richness 1
map_gen_settings.autoplace_controls.uranium-ore.frequency 1
map_gen_settings.autoplace_controls.uranium-ore.size 1
map_gen_settings.autoplace_controls.uranium-ore.richness 1
map_gen_settings.autoplace_controls.crude-oil.frequency 1
map_gen_settings.autoplace_controls.crude-oil.size 1
map_gen_settings.autoplace_controls.crude-oil.richness 1
map_gen_settings.autoplace_controls.trees.frequency 1
map_gen_settings.autoplace_controls.trees.size 1
map_gen_settings.autoplace_controls.trees.richness 1
map_gen_settings.autoplace_controls.enemy-base.frequency 1
map_gen_settings.autoplace_controls.enemy-base.size 1
map_gen_settings.autoplace_controls.enemy-base.richness 1
map_gen_settings.cliff_settings.name Name of the cliff prototype cliff
map_gen_settings.cliff_settings.cliff_elevation_0 Elevation of first row of cliffs 10
map_gen_settings.cliff_settings.cliff_elevation_interval Elevation difference between successive rows of cliffs. This is inversely proportional to frequency in the map generation GUI. Specifically, when set from the GUI the value is 40 / frequency. 40
map_gen_settings.cliff_settings.richness Called cliff continuity in the map generator GUI. 0 will result in no cliffs, 10 will make all cliff rows completely solid 1
map_gen_settings.property_expression_names.control-setting:moisture:frequency:multiplier '1'
map_gen_settings.property_expression_names.control-setting:moisture:bias '0'
map_gen_settings.property_expression_names.control-setting:aux:frequency:multiplier '1'
map_gen_settings.property_expression_names.control-setting:aux:bias '0'
map_gen_settings.seed Use null for a random seed, number for a specific seed. null
map_settings.difficulty_settings.recipe_difficulty 0
map_settings.difficulty_settings.technology_difficulty 0
map_settings.difficulty_settings.technology_price_multiplier 1
map_settings.difficulty_settings.research_queue_setting after-victory
map_settings.pollution.enabled true
map_settings.pollution.diffusion_ratio these are values for 60 ticks (1 simulated second) amount that is diffused to neighboring chunk 0.02
map_settings.pollution.min_to_diffuse 15
map_settings.pollution.ageing 1
map_settings.pollution.expected_max_per_chunk 150
map_settings.pollution.min_to_show_per_chunk 50
map_settings.pollution.min_pollution_to_damage_trees 60
map_settings.pollution.pollution_with_max_forest_damage 150
map_settings.pollution.pollution_per_tree_damage 50
map_settings.pollution.pollution_restored_per_tree_damage 10
map_settings.pollution.max_pollution_to_restore_trees 20
map_settings.pollution.enemy_attack_pollution_consumption_modifier 1
map_settings.enemy_evolution.enabled true
map_settings.enemy_evolution.time_factor 4.0e-06
map_settings.enemy_evolution.destroy_factor 0.002
map_settings.enemy_evolution.pollution_factor 9.0e-07
map_settings.enemy_expansion.enabled true
map_settings.enemy_expansion.min_base_spacing 3
map_settings.enemy_expansion.max_expansion_distance 7
map_settings.enemy_expansion.friendly_base_influence_radius 2
map_settings.enemy_expansion.enemy_building_influence_radius 2
map_settings.enemy_expansion.building_coefficient 0.1
map_settings.enemy_expansion.other_base_coefficient 2
map_settings.enemy_expansion.neighbouring_chunk_coefficient 0.5
map_settings.enemy_expansion.neighbouring_base_chunk_coefficient 0.4
map_settings.enemy_expansion.max_colliding_tiles_coefficient 0.9
map_settings.enemy_expansion.settler_group_min_size 5
map_settings.enemy_expansion.settler_group_max_size 20
map_settings.enemy_expansion.min_expansion_cooldown 14400
map_settings.enemy_expansion.max_expansion_cooldown 216000
map_settings.unit_group.min_group_gathering_time 3600
map_settings.unit_group.max_group_gathering_time 36000
map_settings.unit_group.max_wait_time_for_late_members 7200
map_settings.unit_group.max_group_radius 30
map_settings.unit_group.min_group_radius 5
map_settings.unit_group.max_member_speedup_when_behind 1.4
map_settings.unit_group.max_member_slowdown_when_ahead 0.6
map_settings.unit_group.max_group_slowdown_factor 0.3
map_settings.unit_group.max_group_member_fallback_factor 3
map_settings.unit_group.member_disown_distance 10
map_settings.unit_group.tick_tolerance_when_member_arrives 60
map_settings.unit_group.max_gathering_unit_groups 30
map_settings.unit_group.max_unit_group_size 200
map_settings.steering.default.radius 1.2
map_settings.steering.default.separation_force 0.005
map_settings.steering.default.separation_factor 1.2
map_settings.steering.default.force_unit_fuzzy_goto_behavior false
map_settings.steering.moving.radius 3
map_settings.steering.moving.separation_force 0.01
map_settings.steering.moving.separation_factor 3
map_settings.steering.moving.force_unit_fuzzy_goto_behavior false
map_settings.path_finder.fwd2bwd_ratio 5
map_settings.path_finder.goal_pressure_ratio 2
map_settings.path_finder.max_steps_worked_per_tick 100
map_settings.path_finder.max_work_done_per_tick 8000
map_settings.path_finder.use_path_cache true
map_settings.path_finder.short_cache_size 5
map_settings.path_finder.long_cache_size 25
map_settings.path_finder.short_cache_min_cacheable_distance 10
map_settings.path_finder.short_cache_min_algo_steps_to_cache 50
map_settings.path_finder.long_cache_min_cacheable_distance 30
map_settings.path_finder.cache_max_connect_to_cache_steps_multiplier 100
map_settings.path_finder.cache_accept_path_start_distance_ratio 0.2
map_settings.path_finder.cache_accept_path_end_distance_ratio 0.15
map_settings.path_finder.negative_cache_accept_path_start_distance_ratio 0.3
map_settings.path_finder.negative_cache_accept_path_end_distance_ratio 0.3
map_settings.path_finder.cache_path_start_distance_rating_multiplier 10
map_settings.path_finder.cache_path_end_distance_rating_multiplier 20
map_settings.path_finder.stale_enemy_with_same_destination_collision_penalty 30
map_settings.path_finder.ignore_moving_enemy_collision_distance 5
map_settings.path_finder.enemy_with_different_destination_collision_penalty 30
map_settings.path_finder.general_entity_collision_penalty 10
map_settings.path_finder.general_entity_subsequent_collision_penalty 3
map_settings.path_finder.extended_collision_penalty 3
map_settings.path_finder.max_clients_to_accept_any_new_request 10
map_settings.path_finder.max_clients_to_accept_short_new_request 100
map_settings.path_finder.direct_distance_to_consider_short_request 100
map_settings.path_finder.short_request_max_steps 1000
map_settings.path_finder.short_request_ratio 0.5
map_settings.path_finder.min_steps_to_check_path_find_termination 2000
map_settings.path_finder.start_to_goal_cost_multiplier_to_terminate_path_find 500
map_settings.max_failed_behavior_count 3

Specify each parameter using the --set key=value[,key=value] argument to helm install. For example:

$ helm install  sqljamesfactorio/factorio-server-charts -n   --set replicaCount=1

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example:

$ helm install  sqljamesfactorio/factorio-server-charts -n   --values values.yaml

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.0.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.

I did run into one issue on my setup, and I feel like it will likely come up again if people follow along. The factorio server is defaulting to run on port 30000 instead of 34197 because the default nginx port range for ingress does not have 34197 within the normal port range. This shows the line of code that specifically is causing the issue inside kubernetes :) https://github.com/kubernetes/kubernetes/blob/59876df736c41093363f4c198aeec05e29c9c902/cmd/kube-apiserver/app/server.go#L197

Releases

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

Readme

Readme was generated from the chart-doc-gen tool.