Server Autostart on Unraid
Hello everyone, I am unable to setup Server Autostart within my unraid docker.
I set the FSM_AUTOSTART variable to true but the server remains offline.
My unraid server does a backup of all containers at night, which results in the factorio server being offline. Is there any possible fix for this?
Is there any other way to fix the autostart? Where would the conf.json be?
Any help would be greatly appreciated!
Best regards, Frank.
I can confirm the same behaviour. To add to that and confirm the value was passed correctly, here's the output of a command for the container:
printenv
HOSTNAME=6ca9cbef4a20 HOME=/root HOST_OS=Unraid FSM_AUTOSTART=true TERM=xterm PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin FACTORIO_VERSION=latest HOST_HOSTNAME=Tower HOST_CONTAINERNAME=FactorioServerManager PWD=/opt RCON_PASS= TZ=America/New_York
see: https://github.com/OpenFactorioServerManager/factorio-server-manager/issues/301 for more
Is it in any way possible to start the factorio server within the container trough command line? Maybe a workaround would be to create a userscript that runs after the backup is complete to start the server "manually".
Using the Evn.Variables seems to be bugged in fsm/unraid.
@Tronnic see https://github.com/OpenFactorioServerManager/factorio-server-manager/issues/301#issuecomment-2416052379 for a possible work-around
@Mattie112 I have looked into the possible fix with the entrypoint.sh, unfortunately this doesn't work for me as well.
What confuses me about the docker installation is that entrypoint.sh does not appear to pass any of its CLI arguments to the actual fsm process. So when starting the container using docker run ofsm --autostart true (or any other parameter), all parameters are dropped. Am I missing something or is this an oversight and the last command of entrypoint.sh should include an "$@" at the end?
That could very well be the case but I won't have time to dive into it before the weekend. If you can test it out and report back (or create a PR) that would be great! If not I will try it in the weekend.
@Mattie112 I tested exactly that (after taking some time to get the docker build going locally) and it appears to work fine. With the argument passing added it now reacts to --autostart true as expected when running it, as well as all other cli parameters.
Here's the command I tested this with: docker run -p 80:80 -v ./factorio-data/saves:/opt/factorio/saves -v ./factorio-data/mods:/opt/factorio/mods -v ./factorio-data/config:/opt/factorio/config -p 34197:34197/udp localofsm:latest --autostart true
Want me to create a PR for this miniscule change? I know this does not fix the original problem with Environment variables, but still seems relevant because as it stands right now, CLI parameters to fsm are ignored in docker.
@Tronnic I've gotten the autostart feature to work on Factorio Server Manger.
I am deploying the container via Unraid and followed these steps:
- Turn on the container
- Open the console for the container
- Install nano (or whatever text editor you like) as one is not installed by default in the container
apt-get update && apt-get install nano - Open the
entrypoint.shwith your text editornano entrypoint.sh - Edit the final line to the following:
cd /opt/fsm && ./factorio-server-manager --conf /opt/fsm-data/conf.json --dir /opt/factorio --port 80 --autostart true "$@"
After adding the --autostart true with the "$@" to the end of the line I saved and quit the editor. Restarting the container showed the server start automatically!
Thank you to @Leridon for figuring this out!
Hope this helps!
@Tronnic I've gotten the autostart feature to work on Factorio Server Manger.
I am deploying the container via Unraid and followed these steps:
1. Turn on the container 2. Open the console for the container
correct me if im wrong but doesnt this get lost when you actually restart the unraid server or update the docker container?
@Tronnic I've gotten the autostart feature to work on Factorio Server Manger. I am deploying the container via Unraid and followed these steps:
1. Turn on the container 2. Open the console for the containercorrect me if im wrong but doesnt this get lost when you actually restart the unraid server or update the docker container?
Just came here to say that this worked for me and seems to persist through restarts. I'm too smooth brain to understand why, but it does.
@Tronnic I've gotten the autostart feature to work on Factorio Server Manger. I am deploying the container via Unraid and followed these steps:
1. Turn on the container 2. Open the console for the containercorrect me if im wrong but doesnt this get lost when you actually restart the unraid server or update the docker container?
Just came here to say that this worked for me and seems to persist through restarts. I'm too smooth brain to understand why, but it does.
It does not survive an image update... :( back to square one for me
Okay, switching to the develop branch allows the environmental variable to work
Set FSM_AUTOSTART to true