Hi. I am new to deploying to DigitalOcean. I recently created a Droplet, into which I will put my Django API to serve my project. I saw that the droplet I rent has 25 GB of memory, and for the actual size of my project, it could be a good fit for the database. I run my entire code with Docker Compose, which handles Django and PostgreSQL. I was wondering if it is a good idea to store all the data in the PostgreSQL created by Docker Image, and stored in the local memory of the droplet, or do I need to set up an external Database in Digital Ocean?
Technically I think that could work, but I don’t know if it is safe to do, if I will be able to scale the droplets once the size scales, or if I will be able to migrate all the data into an external database, on digital ocean, a managed PostgreSQL all my data without too many problems.
And if I save it all locally, what about redundancy? Or can I clone my database on a daily basis in some way?
If someone knows about that and can help me, please I don’t know where to start
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $200 of credit to try our products over 60 days!
There are benefits to both approaches:
If you decide to go with the Docker approach, I would recommend creating a Docker volume where you store your Postgres data, that way if you ever delete your Postgres container at least you would have your data stored in the Docker volume.
You could use
pg_dumpto backup your Postgres database on a daily basis and also enable backups for your Droplet itself:
No matter which option you choose, you could always migrate your database from the Docker container to a managed Postgres instance and vice-versa if you ever decide to!
Hope that this helps!