Giter Site home page Giter Site logo

Comments (3)

Bubka avatar Bubka commented on June 12, 2024 2

Hi,
this is not really a bug as this use case is not really covered (migrating from a selfhosted server to Docker). But anyway, let discuss it here.

Using Docker, the /2fauth directory on the host side should contain:

  • The database.sqlite file
  • The storage folder
  • An installed file which contain a commit hash.

During the update process, this hash is compared to the commit hash used to build the image. If the hashes are different then db is updated by executing missing migrations. But if the installed file is missing then the whole db is reset and all migrations executed. I guess this is what happened in your case.

So try this:

  • Copy your legacy db file to /2fauth. Its name must be database.sqlite
  • Copy your storage folder to /2fauth
  • Do not copy the legacy database folder to /2fauth. (this folder exists in the image)
  • Create a file named installed which contain b4fe966 (this is the v3.4.1 hash) alongside these files.
  • Start the container

You should see this line in Docker output:

Installed commit b4fe966 is different from program commit 342448b we are migrating...

(not sure about the 342448b ref, what is important is that you see the line)
After this line, I think you will see only one migration line (for 2023_12_06_131842_add_oauth_columns_to_user), not 10-15 as previously. You should then be able to sign in.

One more thing. Do not forget to pass your APP_KEY via docker-compose env vars if your db is encrypted

from 2fauth.

homeusepb avatar homeusepb commented on June 12, 2024

Adding some extra information, I have just browsed the NEW database constructed by 2fauth docker-compose, it seems some tables are empty. The users table is fully empty, the twofaccounts table is empty and groups table is empty and maybe few others. So I am sure that the migrations are not happening properly.

I have manually modified the sqlite table myself and fixed the users table, which allowed me to login but I also need to copy over the "twofaccounts" table but that seems to not be working maybe it is encrypted? How can I copy over twofaccounts? I would assume copying the encrypted "account", "legacy_uri" and "secret" column off the table would still work but it doesn't.

from 2fauth.

homeusepb avatar homeusepb commented on June 12, 2024

Hi!

I see, thanks for your help and it is now clearer.
However, I got impatient on Sunday ha-ha and I sort of used my own hacks. I just ended up opeing the sqlite database in a database reader and copied over the missing data and new user_id columns and it now seems to work all okay.

However the instructions above should help someone if they come this route!

Thank you for your help and wonderful app, wish you all the best!

from 2fauth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.