FusionAuth/fusionauth-containers

Creating snapshot of FusionAuth data?

Opened this issue · 0 comments

Hi!

During development, we are using FusionAuth and Postgres with Docker Compose.
We pre-load the database with data (also FusionAuth data), and when necessary, we dump the data from database to a file, so it can be reused.

However, sometimes when starting FusionAuth from a recent database dump, it will log a whole lot of errors [0]. I believe the backup process is at fault.

To do a backup, we run:

$ # Start the services
$ docker compose up db fusionauth

$ # Save the data to a file
$ pg_dumpall --clean -h localhost -U postgres > db.out

To restore, we run:

$ # Start database and load with data
$ docker compose up db

$ # Load fixtures
$ psql $DATABASE_URL -f ./fixtures/db.out

$ # Start FusionAuth
$ docker compose up fusionauth # Here fusionauth starts complaining!

When FusionAuth is started, it will log a whole lot of errors similar to [0].
What are we doing wrong? Is there a better approach of creating a snapshot image of FusionAuth?

[0]:

platform-fusionauth-1  | 2023-10-31 08:42:02.592 AM ERROR com.inversoft.migration.Migrator - Unable to run migration [io.fusionauth.api.migration.guice.Migration_1_42_0]
platform-fusionauth-1  | com.google.inject.ProvisionException: Unable to provision, see the following errors:                                                  
platform-fusionauth-1  |                                                                                                                                       
platform-fusionauth-1  | 1) [Guice/ErrorInCustomProvider]: TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2  
platform-fusionauth-1  |   at FusionAuthMVCModule.configure(FusionAuthMVCModule.java:31)                                                                       
platform-fusionauth-1  |       \_ installed by: FusionAuthModule -> Modules$OverrideModule -> FusionAuthMVCModule                                              
platform-fusionauth-1  |   at BooleanConverter.<init>(BooleanConverter.java:35)                                                                                
platform-fusionauth-1  |       \_ for 1st parameter                                                                                                            
platform-fusionauth-1  |   while locating BooleanConverter                                                                                                     
platform-fusionauth-1  |   while locating GlobalConverter annotated with @Element(setName=,uniqueId=202, type=MAPBINDER, keyType=Class<?>)                     
platform-fusionauth-1  |   at DefaultConverterProvider.<init>(DefaultConverterProvider.java:47)                                                                
platform-fusionauth-1  |       \_ for 2nd parameter                                                                                                            
platform-fusionauth-1  |   while locating DefaultConverterProvider                                                                                             
platform-fusionauth-1  |   at ParameterModule.bindConverterProvider(ParameterModule.java:42)                                                                   
platform-fusionauth-1  |       \_ installed by: FusionAuthModule -> Modules$OverrideModule -> MVCModule -> ParameterModule                                     
platform-fusionauth-1  |   at DefaultExpressionEvaluator.<init>(DefaultExpressionEvaluator.java:47)                                                            
platform-fusionauth-1  |       \_ for 1st parameter                                                                                                            
platform-fusionauth-1  |   while locating DefaultExpressionEvaluator                                                                                           
platform-fusionauth-1  |   at ParameterModule.bindExpressionEvaluator(ParameterModule.java:46)                                                                 
platform-fusionauth-1  |       \_ installed by: FusionAuthModule -> Modules$OverrideModule -> MVCModule -> ParameterModule                                     
platform-fusionauth-1  |   at InUseValidator.<init>(InUseValidator.java:21)                                                                                    
platform-fusionauth-1  |       \_ for 1st parameter                                                                                                            
platform-fusionauth-1  |   at DefaultEmailTemplateService.<init>(DefaultEmailTemplateService.java:59)                                                          
platform-fusionauth-1  |       \_ for 5th parameter                                                                                                            
platform-fusionauth-1  |   while locating DefaultEmailTemplateService                                                                                          
platform-fusionauth-1  |   at SystemDefaultsSingleton.<init>(SystemDefaultsSingleton.java:185)                                                                 
platform-fusionauth-1  |       \_ for 1st parameter                                                                                                            
platform-fusionauth-1  |   at SystemDefaultsSingleton.class(SystemDefaultsSingleton.java:28)                                                                   
platform-fusionauth-1  |   at Migration_1_42_0.<init>(Migration_1_42_0.java:20)                                                                                
platform-fusionauth-1  |       \_ for 1st parameter                                                                                                            
platform-fusionauth-1  |   while locating Migration_1_42_0                                                                                                     
platform-fusionauth-1  |                                                                                                                                       
platform-fusionauth-1  | Learn more:                                                                                                                           
platform-fusionauth-1  |   https://github.com/google/guice/wiki/ERROR_IN_CUSTOM_PROVIDER                                                                       
platform-fusionauth-1  |                                                                                                                                       
platform-fusionauth-1  | 1 error                                                                                                                               
platform-fusionauth-1  |