Comments (3)
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 bedatabase.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 containb4fe966
(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.
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.
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)
- 403 Forbidden {message: "unauthorized"} HOT 3
- Install with Docker Compose : problem to connect/use database.sqlite HOT 5
- Add outgoing email testing from the UI HOT 1
- 2fauth + NGINX reverse proxy = 502 error HOT 1
- Mail Password Format HOT 1
- Secret Type Format
- Blank screen after update from 5.0.3 to 5.0.4 HOT 10
- "Check now" button is untranslatable HOT 1
- Add a route to clear cache from browser
- Add a "keep SSO registration enabled" setting HOT 1
- app/Policies/OwnershipTrait contains a bug, i think HOT 9
- Add support for FreeOPT+ json exports HOT 1
- Can't decipher codes after updating to 5.1.0 HOT 17
- 5.1 SSO: Authentication via SSO rejected HOT 8
- Admin panel not working when using security device
- "Keep SSO registration enabled" is not saved
- Add pagination to /accounts page HOT 4
- Last admin can demote to user, leaving the instance administratorless
- Accounts visibility HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 2fauth.