-
-
Notifications
You must be signed in to change notification settings - Fork 999
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
docs: How to backup and restore Authentik #8411
Comments
The same question I migrate my authentik docker installation to standalone linux installation and I want to export/import de configuration authentik from docker to standalone thank's |
Hi, i have the same question. I want to setup a Test System out of the Prod system :D |
Just rsync your mapped docker volumes to your new server/new location and start a new docker container... |
Same question. Dumping PostgreSQL and restoring it on another instance would be enough? |
Should be. I moved the Authentik postgres to a central Postgres instance and dumped the old DB and re-imported the DB to the new instance and everything still worked. |
We've wanted to make a documentation section about this for some time now. I'll just dump some ideas here until we write one: Things that absolutely need to be backed up:
Optional but very much recommended because of potential inconveniences:
Optional:
|
I plan to move my Authentik instance to a new server recently, will keep an eye on the doc, and probably give it a try first if I cannot wait that long... |
How relevant is the |
Yeah that's basically what will happen, some stuff in the UI will look ugly, and you'll have to re-upload the icons, but that's basically it. However, if you are storing extra data in there (such as with the prompt stage and a file field type), that will be lost also, but I doubt a lot of people are doing this. |
Hi folks, attempting to restore Authentik to a new docker LXC. I was able to create an sql dump file, but can someone explain how to restore it for a novice/lay person? When I tried using:
but it gave me multiple errors that each item 'already exists'. update: I was able to fix by dropping the existing database first, using:
If anyone else is reading, you'll have to replace ${DOCKERDIR} with your own, e.g., /home/user/... |
I understand the sentiment of not wanting to invest in backups, but I think the thing that was overlooked here is that even with a backup you need a way to restore and while there's various ways to do it, a built in way straight from the web interface would be the cleanest solution and provide a framework to ensure that backups and restores are done properly. |
As someone who is not in the Authentik team: Oh hell no. Authentik itself is basically stateless. It should not have to concern itself with the backup/restore of systems (SQL DB, filesystem) for which backups and restores have been a solved problem for decades. This is just unnecessarily complicated and brings many problems with it. This goes also against any established practices in large teams/companies. Restoring a SQL db and a simple directory is so much easier and more convenient than a web based solution likely will be. You would need some kind of container format (e.g. .tar.gz) which contains all the files plus the SQL database. Then you have to unpack it and put it in the correct location. For the DB backup it might be that Authentik itself does not have enough privileges to restore everything directly. And you would have to generate this file somehow - which is another useless step in making this more complicated. This is not even touching the problems of uploading large backup files. This means that the whole database with confidential user data would need to be on some developers machine. Uploading a large file would also require Authentik or the reverse proxy in front of it to accept huge body payloads which makes it way easier to DoS it. |
I am, however, all in favor of more/proper documentation of the process! |
Not disagreeing with you, but having a built in method in no way inhibits you from doing it manually. It’s does make it easier for smaller home lab users to migrate things between boxes without being concerned about whether they need to move just the db, directories, etc. |
I fully agree with this comment, thank you. An in-built or even guided backup/restore process does not eliminate the option for advanced or commercial users to do so manually according to their own best-practices, but it does add an option for users who may have never backed up or restored a database manually in their own home (or even knew they would have to do so). |
That is certainly true (and sorry if I sounded rude, I just have strong opinions about some stuff which I likely voice louder than necessary). My argument is mostly that sich a feature be needlessly complex and would take an unjustified amount of development time. |
I agree that we definitely need to document what needs to be backed-up (as I listed in #8411 (comment)), with pointers to the documentation of our dependencies on how they recommend the data should be backed up. However, we won't be including a backup/restore feature in authentik directly. I know many software that are aimed at homelab users do so, but many also do not. The first thing you should do when using new software, especially one that uses a database, is figure out how to backup things. For a database system like postgres or mysql (and variants), those are transferable skills that will come in handy for all things that you run. On top of that, this is definitely feature creep, and something we don't want. By "we" I mean the authentik team, and the user, because then we cannot concentrate on other features, improvements and bug fixes. Now, backing up postgresql isn't that hard. On my homelab, I run |
I mean, for docker it could just output the backup to a I always like it when the apps I am using are able to create the backup file(s) as those files are more likely to work and include all the little 'gotchas' each specific app has in what does/does not need to be backed up. It just increases confidence in the setup. To that end, though, wouldn't backing up the existing mountpoints be sufficient for backing up Authentik? Why would you need to concern yourself with backing up postgres separately? |
Well, you're using postgresql with authentik, and postgres is able to output those backup files and restore from them, and does it very well. Better than we could ever do.
I'll again link to https://www.postgresql.org/docs/current/backup.html and quoting from https://www.postgresql.org/docs/current/backup-file.html (which essentially is what you are describing, aka backing up the postgres docker mount):
This is obviously not something we want to recommend. As stated before, authentik itself is basically stateless. The mount directories are all optional:
As such, you only need to backup postgresql, redis (see #8411 (comment) for details) and your media mount if you have one. The rest is data that the operator is providing optionally, and thus is their responsibility to decide how to back it up. @tanberry we need to have documentation for this. |
Here are a couple of thoughts on this. Primarily from a UX perspective. When I originally setup authentik the compose db was Postgres 12, it's now 16. You can't just change a PG container from 12 to 16. So if you are moving from one location with 12 to another with 16, you need to make at least a couple of edits to things like the Secondly, if Authentik development wants to use the feature set of a new PG they should at a minimum, explain the specific instructions it expects users to take in documentation. Even if it's a dump command. If it is a dump command, in an effort to standardize it, the command should be issued to authentik who should perform that command as a dump command's flags, and params change between versions. The ideal mechanism would be an export feature for users, databases, configs, files (images, etc), any anything else needed. And an import feature that would put those items where then need to be in the current infrastructure. |
I have just moved my entire docker-authentik installation from one VPS to another.
That's all I did, took me around 10 minutes to migrate the entire installation and up until now it's working flawlessly. Be sure to adjust the above to your needs. |
If I want to just make second Authentik in another server, I can copy all bind mounted data to another server? |
Describe your question/
How to create a back up of all the configuration of the Authentik, including username/authorization method, etc...?
How to restore this back up in the new setup Authentik?
I've read about blueprint but not sure where I can run the command ak export_blueprint.
I can see the export for the Flow but there is no export features for Stages or other areas...
Version and Deployment (please complete the following information):
The text was updated successfully, but these errors were encountered: