m-chandler / factorio-spot-pricing

Factorio Deployment to AWS
MIT License
98 stars 25 forks source link

Trouble getting the server to load a save #11

Closed Jim-Bar closed 4 years ago

Jim-Bar commented 4 years ago

On a new instance of the server I'm trying to load an existing save.

  1. I pushed the save file to the server in /opt/factorio/saves
  2. I restarted the docker container

Each time the save is ignored. I tried cheating by giving my save the name of an autosave (something like _autosave1.zip), but then everytime it got replaced (looking at its size) and the server starts a new world.

The doc at factoriotool states that I should just have to leave a single save in there for the server to load it. Maybe it's something related to EFS or the way the container is started? I'm familiar with Linux and Docker but not AWS.

m-chandler commented 4 years ago

What verion of Factorio are you running? Might be important.

Jim-Bar commented 4 years ago

The save comes from a 0.17.74 and the server is in 0.17.74 too.

m-chandler commented 4 years ago

I think I've found the problem and I'm surprised this hasn't come up earlier. When the Factorio container stops, it autosaves. So basically by doing Step 2 in your description - a save of the current server is created and thus gets priority when the container is restarted. Note: I also found restarting the container by this method is a terrible idea, as ECS loses track of the container. I've updated the readme to reflect this (and have documented the right way to restart the container).

Can you please try the following and I'll update the doco to suit:

  1. Go to ECS in the AWS Console
  2. Click the factorio cluster
  3. Tick the factorio service, and select update
  4. Set Number of tasks to 0
  5. Click Next 3 times, and finally Update service

This will ensure the container doesn't keep trying to restart itself.

Now, please place your save in the /opt/factorio/saves (delete anything else in that folder).

Finally, repeat the steps above, setting Number of tasks to 1.

Report back so I can update doco - hopefully it works now.

Jim-Bar commented 4 years ago

This worked although I had some trouble finding where the right ECS AWS console was.

So, just to be sure, now what's the right way to pause the server when not using it? Still by updating the CloudFormation stack (changing the server state parameter from "Running" to "Stopped") or by setting the number of tasks for the cluster?

A big thanks!

Jim-Bar commented 4 years ago

There is still a misleading instruction for restarting the container in the documentation under "How can I change map settings, server settings etc."

m-chandler commented 4 years ago

Thanks I'll update the doco and fix that misleading instruction.

Setting number of tasks in the cluster will only stop the container from running - NOT the underlying EC2 instance (so you'll still be paying for the VM, you just won't be using it).

The way to turn it off when not in use is still via the CloudFormation parameter.

Jim-Bar commented 4 years ago

All right, thank you for the explanations.

m-chandler commented 4 years ago

Have updated readme. Thank you for reporting this.