Skip to content

SQLJames/factorio-server-charts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 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 github https://github.com/SQLJames/factorio-server-charts
$ helm repo update
$ helm install  github/factorio-server-charts -n  --version=1.0.2

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  github/factorio-server-charts -n  --version=1.0.2

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 1
image.repository "factoriotools/factorio"
image.pullPolicy Always
image.tag "latest"
securityContext.runAsUser 1000
securityContext.fsGroup 2000
service.type LoadBalancer
service.port 30000
resources.requests.memory 512Mi
resources.requests.cpu 500m
nodeSelector {}
tolerations []
affinity {}
livenessProbe.initialDelaySeconds 30
livenessProbe.periodSeconds 5
livenessProbe.failureThreshold 10
livenessProbe.successThreshold 1
livenessProbe.timeoutSeconds 1
readinessProbe.initialDelaySeconds 30
readinessProbe.periodSeconds 5
readinessProbe.failureThreshold 10
readinessProbe.successThreshold 1
readinessProbe.timeoutSeconds 1
persistence.dataDir.Size "1Gi"
persistence.dataDir.existingClaim ``
persistence.storageClass longhorn
factorioServer.instance_name `"Factorio"
#Your Instance's Description`
factorioServer.instance_description "Factorio running on Kubernetes"
factorioServer.save_name "replaceMe"
factorioServer.generate_new_save true
factorioServer.load_latest_save update_mods_on_start: false As of 0.17 a new environment variable was added UPDATE_MODS_ON_START which if set to true will cause the mods get to updated on server start. If set a valid Factorio Username and Token must be supplied or else the server will not start. They can either be set as docker secrets, environment variables, or pulled from the server-settings.json file. lets the game know if you want to load the latest save true
factorioServer.config_path /srv
serverSettingsJson.name Name of the game as it will appear in the game listing
serverSettingsJson.description Description of the game that will appear in the listing
serverSettingsJson.max_players 0
serverSettingsJson.visibility.public true
serverSettingsJson.visibility.lan true
serverSettingsJson.username ''
serverSettingsJson.password ''
serverSettingsJson.token ''
serverSettingsJson.game_password ''
serverSettingsJson.require_user_verification true
serverSettingsJson.max_upload_in_kilobytes_per_second 0
serverSettingsJson.max_upload_slots 5
serverSettingsJson.minimum_latency_in_ticks 0
serverSettingsJson.ignore_player_limit_for_returning_players false
serverSettingsJson.allow_commands admins-only
serverSettingsJson.autosave_interval 10
serverSettingsJson.autosave_slots 5
serverSettingsJson.afk_autokick_interval 0
serverSettingsJson.auto_pause true
serverSettingsJson.only_admins_can_pause_the_game true
serverSettingsJson.autosave_only_on_server true
serverSettingsJson.non_blocking_saving 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
serverSettingsJson.minimum_segment_size 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
serverSettingsJson.minimum_segment_size_peer_count 20
serverSettingsJson.maximum_segment_size 100
serverSettingsJson.maximum_segment_size_peer_count 10
rcon.password "01234567890123456"
rcon.port 27015
map_gen_settings.terrain_segmentation `1
#_water_comment:`
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 0
map_gen_settings.height 0
map_gen_settings.starting_area 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 `cliff
#_cliff_elevation_0_comment: Elevation of first row of cliffs`
map_gen_settings.cliff_settings.cliff_elevation_0 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 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 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 _comment_min_to_diffuse_2: 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  github/factorio-server-charts -n  --version=1.0.2 --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  github/factorio-server-charts -n  --version=1.0.2 --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