Persistent database to retain state

I have an app that pulls records from a workflow system using their API. The data is used to create an email to inform a user that invoices can be created for records with a certain status. I’d like to pull the data into a database because I need a flag to indicate that a qualifying record has already been sent so it’s not included in subsequent emails.

Trouble is that containers are shut down by after a while which destroys the database as I understand. So the next time the app is started a new db gets created and I lose the state.

Is there a way to keep the container alive or at least retain the database?

Hi @camodue,

This is certainly possible. The easiest way would be to use a volume; basically a persistent “disk” that is mounted on your machine and survives reboots (which as you mentioned, reset the root filesystem to the deployed image).

Depending on your needs you can use something like LiteFS (“Distributed SQLite”) if you need to replicate data among many machines, or even go full RDBMS and use Postgres, in either Unmanaged or Managed flavors, to store your persistent data.

Hope this helps!

  • Daniel

Thanks @roadmr, I’ll try that

Thanks again. Have been able to create a volume and place my database into the volume and it’s no longer created on startup…

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.