Data loss after restart/reboot

Hi all,

I know what I’m missing after all, some functions that are disabled during local build but enabled when pushed. This topic can be deleted, my apologies.

1 Like

Hi @vedicium
Don’t worry, it is still useful in case people run in the same issue and might not figure out the solution by themselves, so feel free to restore the original message along with the solution

Hi @thundron,

I doubt that anyone runs in the same issue as I did, but I can definitely share my solution and explain why it happened.

I use a NodeJS container and a MariaDB container. The NodeJS container connects to the MariaDB container to use the database. The MariaDB container has a start script that starts MariaDB, but also changes the root password, database user and database password everytime at startup. This is to enhance the security of the system, that contains user information. The node knows the new details after the MariaDB container is healthy.

The node container has a startup script, before the real system starts, that connects to the MariaDB container and checks the new credentials and starts a migration script. This migration script has tests to test if every migration step is executed correct. When this is not the case, it executed the ‘down’ script of that migration, so for example delete the tables that were supposed to be created. When the tests failed and the down script is executed, the migration starts again.

My problem was that the tests failed. The new MariaDB user didn’t have the permission to access the ‘views’ made by the previous MariaDB user. So the ‘down’ SQL was executed and the database was emptied.

But feel free to ask questions about this method and I’m welcome to suggestions!

1 Like