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

Persist state (and Station ID) across Docker upgrades #444

Open
3 tasks
Tracked by #131
bajtos opened this issue May 2, 2024 · 5 comments
Open
3 tasks
Tracked by #131

Persist state (and Station ID) across Docker upgrades #444

bajtos opened this issue May 2, 2024 · 5 comments

Comments

@bajtos
Copy link
Member

bajtos commented May 2, 2024

A follow-up for our Slack discussion in https://space-meridian.slack.com/archives/C06RPCL6QGL/p1714047593651149.

I realised that our instructions for running Station Core don’t configure any persisted volume. All state files are kept inside the container. I think that means these state files can be lost, although I am not sure when exactly that would happen. When that happens, we lose the job count and Station ID keypair, everything will look like a fresh install of a new instance.

We have verified this is happening in our Station Core deployment running on Fly.io.

I'm just worried that we can't force them to implement a persistent volume
or can we? Otherwise we need to accept that there will be this noise in our data

We would have to detect whether we are running in Docker and whether STATE_ROOT is mounted as a persisted volume.

I don’t know how reliable this is, but if the STATE_DIR is a mounted volume, then it is listed in the list of all mounts inside the container.

❯ docker run -it --rm --network none -e STATE_ROOT=/state -v /tmp/state:/state debian /bin/bash
root@db797b6fc5a7:/# mount | grep $STATE_ROOT
/run/host_mark/private on /state type fakeowner (rw,nosuid,nodev,relatime,fakeowner)
root@db797b6fc5a7:/#station-public-dashboard 

For comparison:

❯ docker run -it --rm --network none -e STATE_ROOT=/tmp debian /bin/bash
root@171b4e474f30:/# mount | grep $STATE_ROOT
root@171b4e474f30:/#

Tasks:

  • How to detect a mounted volume
  • Update docker documentation
  • Notify network, and set a deadline for migration
@bajtos
Copy link
Member Author

bajtos commented May 3, 2024

Since we can't be 100% sure that the state is persisted outside of the running Docker container, I am not sure if Station Core can enforce this in a meaningful way. But! Maybe we can incentivise station instances that are old enough at the Meridian protocol level, e.g. by doubling the reward for instances older than 1 month. That way Station operators will have at least some motivation to comply.

@csmasterpath2023
Copy link

Has this feature already been implemented in the current version? I used the following command to create a container, but it failed. Can you help me?

docker run --name station --detach --env STATE_ROOT=/state --env FIL_WALLET_ADDRESS=0x000000000000000000000000000000000000dEaD ghcr.io/filecoin-station/core:20.4.1 -v /tmp/state1:/state

@juliangruber
Copy link
Member

This hasn't been implemented yet. Can you please open a new issue, with this message and the error you received?

@bajtos
Copy link
Member Author

bajtos commented May 15, 2024

Update docker documentation

We should explain to operators how to fix Error: EACCES: permission denied, mkdir errors they may encounter if the Docker daemon does not have permission to write to the state directory on the host.

See #456 (comment)

@bajtos bajtos mentioned this issue Jul 31, 2024
36 tasks
@juliangruber juliangruber changed the title Persist state (and Station ID) accross Docker upgrades Persist state (and Station ID) across Docker upgrades Aug 2, 2024
@bajtos
Copy link
Member Author

bajtos commented Sep 3, 2024

Loosely related: space-meridian/roadmap#122

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

3 participants