Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server Autostart on Unraid #409

Open
Tronnic opened this issue Oct 21, 2024 · 9 comments
Open

Server Autostart on Unraid #409

Tronnic opened this issue Oct 21, 2024 · 9 comments

Comments

@Tronnic
Copy link

Tronnic commented Oct 21, 2024

Hello everyone, I am unable to setup Server Autostart within my unraid docker.

image

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.

@matmat07
Copy link

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

@Mattie112
Copy link
Contributor

see: #301 for more

@Tronnic
Copy link
Author

Tronnic commented Oct 22, 2024

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.

@Mattie112
Copy link
Contributor

@Tronnic see #301 (comment) for a possible work-around

@Tronnic
Copy link
Author

Tronnic commented Oct 22, 2024

@Mattie112 I have looked into the possible fix with the entrypoint.sh, unfortunately this doesn't work for me as well.

@Leridon
Copy link

Leridon commented Oct 22, 2024

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?

@Mattie112
Copy link
Contributor

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.

@Leridon
Copy link

Leridon commented Oct 22, 2024

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

@OnlyPlean
Copy link

@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
  3. 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
  4. Open the entrypoint.sh with your text editor
    nano entrypoint.sh
  5. 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants