factorio-server-manager icon indicating copy to clipboard operation
factorio-server-manager copied to clipboard

Docker: pass on parameters such as --autostart true to the fsm process

Open Leridon opened this issue 1 year ago • 2 comments

What's wrong?

While investigating #409 I found an issue with the docker packaging of fsm:

As it stands currently, all command line parameters meant for the fsm process passed when starting a container (with docker run or any other method) are ignored because entrypoint.sh does not actually pass them to the process. This is noticeable when trying to use --autostart true for example.

The fix

The change to fix this is tiny: The parameters are forwarded to fsm by appending "$@" to the command that starts factorio-server-manager.

When supplying parameters that are already included in the command (--conf, --dir and --port), the manually supplied parameters override the included ones, which seems like reasonable behaviour to me. If this is not desired, the "$@" can be moved to the left so the default arguments take precedence.

Impact

This change does not affect the fsm code itself, but can help to mitigate various issues regarding autostart (see #409, #362, #301). The Dockerfile pulls the current release for packaging directly from the GitHub releases, so even if the current state of the development branch is not release-ready, this fix can quickly be distributed by updating the image on Docker Hub. Please consider doing so as soon as it's convenient. Thank you!

Leridon avatar Oct 23 '24 08:10 Leridon

@knoxfighter I can confirm that this works (even though you might prefer the "normal" autostart to work this does give a quick/easy way to add arguments to factorio.

edit: to confirm, this DOES work on master

Mattie112 avatar Oct 26 '24 17:10 Mattie112

The current image osfm/osfm:latest has both broken flags AND broken environment variables as detailed in a couple of issues.

The current ofsm/ofsm:develop image has working environment variables but broken flags.

I injected my own entrypoint.sh with the fix suggested above and now both flags AND variables are working.

Can we maybe get a new release with working variables and a docker image with working entrypoint.sh?

jesta030 avatar Jan 28 '25 06:01 jesta030