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

Bug: Catch-22 when migrating to Kubernetes cluster #143

Open
kajes opened this issue Mar 10, 2021 · 2 comments
Open

Bug: Catch-22 when migrating to Kubernetes cluster #143

kajes opened this issue Mar 10, 2021 · 2 comments
Assignees

Comments

@kajes
Copy link

kajes commented Mar 10, 2021

There's an issue with restoring a Snipe-IT instance in a Kubernetes cluster using the snipeit helm chart. According to the documentation, moving a Snipe-IT instance from one server to another is a matter of copying files from the backup to the new server instance, setting the environment variable BACKUP_ENV to true before you start migrating.

The BACKUP_ENV variable prevents the installer running when accessing the site before migrating, resulting instead in the page erroring out until you've migrated all the files.

This, however, also causes the /health endpoint to also throw PHP exceptions, which means the kubernetes controller will judge it to be unhealthy and kill the pod before you have the chance to migrate everything, leaving the pod in an endless CrashLoopBackOff state. Unfortunately, the only way to prevent the endless restart state is to actually copy the files, mainly the .env file to the proper location in the pod container.

Currently, there's no way to prevent this without building your own custom container image which copies the .env file into the pod when building, and then make the chart pull that image instead.

There are probably multiple ways of solving this, but one way is to allow the user to specify their own .env file in values.yaml to prevent this from happening.

@mschmidt291
Copy link
Contributor

So setting the BACKUP_ENV variable through .Values.config.snipeit.envConfig and then disabling liveness and readiness probe is not enough? Currently there is no way to disable the liveness and readiness probes, but this wouldn't be a problem.

@mschmidt291 mschmidt291 self-assigned this Mar 10, 2021
@kajes
Copy link
Author

kajes commented Mar 11, 2021

@mschmidt291

That would be one solution, but probably pretty bad practice. Would make more sense to try to populate the .env config with values that the user should provide for the database already. It seem to mainly be SQL Connection errors that are thrown. Alternatively you should be able to load a .env from a configmap you create yourself.

Edit:
In fact, it would make a lot of sense if you could specify a .env to be mounted in the already existing config.snipeit.envConfig object. Something like this:

config:
  snipeit:
    envConfig:
      .env: |
        DB_HOST: <hostname>
        [...]

This could be mounted as the .env file if the key exist in the object.

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

2 participants