OpenFactorioServerManager / factorio-server-manager

A tool to help manage Factorio multiplayer servers including mods and save games.
MIT License
541 stars 129 forks source link

Server autostart #362

Open Parabux opened 8 months ago

Parabux commented 8 months ago

Hi i have a server running on docker. the docker does a backup every night. this stops all containers. when factorio server manager starts up, i dosnt start the game server. would it be possible to get an button to make the server autostart on container start?

mroote commented 8 months ago

You should be able to set the FSM_AUTOSTART environment variable in the docker container to start the server automatically.

Parabux commented 8 months ago

do i set FSM_AUTOSTART to true or 1 ? im no pro with docker :P

Mattie112 commented 8 months ago

It looks to be true/false: https://github.com/OpenFactorioServerManager/factorio-server-manager/blob/a5cde420c7400a26e937e77512ec86c5e43af2fb/src/bootstrap/config.go#L31

(And this is not a Docker thing btw, if you would to run this app without docker you can still use environment variables to configure it.

Parabux commented 8 months ago

Tanks for the help so far. Still haven't gotten this to work. tried two different env variables. im betting its me doing something silly.

FSM_AUTOSTART autostart

i'm running this on unraid with an official image found on the community application store. the images is from portainer. I use portainer for a bit more granular access to the containers.

knoxfighter commented 8 months ago

Have a look into #315 to see how to setup envs in unraid, do the same for FSM_AUTOSTART=true and it should work.

mwLabs-eu commented 3 months ago

Hi, tried it on my server but still no autostart. Is anyone here who got it working?

armandkd commented 3 months ago

I can confirm that setting the env variable in Docker does NOT work for me.

armandkd commented 3 months ago

The FACTORIO_VERSION environment variable is working though. So it's probably not a problem with how I set the environment variables in Docker, but rather an issue with ofsm itself. I have also checked the conf.json file and the flags (as the documentation states that they will take precedence over the environment variables) and autostart is not present. I have also noticed that autostart is not mentioned in the conf.json documentation. This leads me to believe that this functionality may not be fully implemented yet.

mwLabs-eu commented 3 months ago

Due to the missing auto-restart, I excluded the container from my backups (I thought, Autosave would be fine). Yesterday a friend of mine started a train, crashed the server, and all saves were wiped. I don't know if this was already before the crash, wasn´t able to find any helpful in the logs. So just a reminder - create backups... (sorry for being off-topic)