heroku postgres db not saving data in cloud - spring

I created a heroku Spring-MVC project in Eclipse. By default a sample application was created with url /people and /people/add.
Eveyrthing works fine when I run the app on Tomcat7. When I try adding a person and fetch it from DB works fine.
But when I stop the app and restart the app on Tomcat, the /get request doesn't fetch any details. I have to add the user details again.
I feel heroku is saving the data in some local DB which is getting refreshed everytime I run the app.
I want to use the free heroku Postgres DB, where the data is saved in heroku cloud. Could anyone please let me know if this is expected.
Please let me know the changes I need to make if any
Thanks

Related

Strapi : why data got deleted every time i update strapi-app and deploy it on heroku

i've made strapi app for my backend and deployed it on Heroku
and it works fine
But when i update strapi app on local and then push it on heroku ,
previous data is deleted , and event admin username and pass is deleted
whay this happen ?
i though this data are on Postgres data base that i have made on heroku and should not be deleted
i found answer
i used postgres SQL and its work fine

Why do I lose contents of my database after a heroku dyno restart?

Anytime my app goes to sleep and comes back on, I lose data in my database
And I'm not storing any media, it's just form data (texts)... I built the app on strapi and I've followed all their guidelines but it keeps happening. I'd be happy if anyone can help
Local data (files, db) is cleared after a Dyno restart because the Heroku File System is ephemeral. A Dyno is restarted (at least) every 24hrs.
In your case Strapi uses SQLite where data is saved in a local file.
Strapi suggests to configure Postgres on Heroku, alternatively you can use an external DB storage service.
First of all:
As you create content types with strapi it generates the code (= new files) for the according controllers/routes/services
Heroku does not persist data after a restart
After a restart strapi checks which content types exist in the code and deletes the tables of nonexisting types from the database.
Therefore, on Heroku you have to set up all your content types locally and connect to an external db (e.g. Heroku Postgres) but never strapi's default textfile based db.
Then push the generated files and finally deploy.
Thus, on Heroku you should always run in production mode. This way the option to alter content types is completely blocked and you will not run into the issue of data loss after a restart.

Is it possible to force a database credential update on Heroku?

Heroku sent an email regarding scheduled maintenance for a hobby-dev hosted Postgres database I have. I received confirmation that the scheduled maintenance had been successfully completed and that my updated database credentials would reflect this.
After updating the environment variables in my app to reflect this change, I can no longer connect to the database. Scheduled maintenance changes have completed before with no issues, this is the first time I'm receiving this error.
Authentication failed against database server at `ec2-176-34-114-78.eu-west-1.compute.amazonaws.com`, the provided database credentials for `mydb` are not valid.
However, when I log into Heroku to view the database instance, the health checks are showing that it's available.
I've now tried using the new and old database credentials, but both are unable to connect to the DB. It also appears that I am unable to directly contact support on the hobby dev plan.
Do I have any other options to try troubleshoot this? Is it possible to force a new database credential update on Heroku?
Yes, you can use heroku pg:credentials:rotate to generate new credentials. But you shouldn't have to do this.
After updating the environment variables in my app to reflect this change
As the email told you, your credentials would automatically have been updated. There was nothing for you to do. As long as you are connecting via the DATABASE_URL environment variable, which is always recommended with Heroku Postgres¹, you should be good to go.
heroku pg:credentials:rotate behaves the same way, so running that command without understanding this isn't likely to help much.
¹Heroku may update these credentials at any time. Connecting via that environment variable is the best way to ensure you can always connect.

Data does not persist when dyno is restarted in Heroku?

I have deployed Strapi headless CMS on Heroku free tier and tried to use it both with MongoDB and Postgres databases, whenever I restart the dyno e.g. during deployment - all the data created thus far is not persisted?
I tried rebuilding Strapi locally and I cannot reproduce the behaviour.
I am using free tier for hosting of Strapi as well as free tier of Heroku Postgres.
Most likely you created your project with --quickstart which is not Postgres, it is SQLite. Can you please check your config/environments/*/database.json files and ensure you have PostgreSQL setup?
All model configs are stored in files meaning you will not be able to create, edit, or delete new models, fields, components while using Heroku. All data (content) is saved to the database.
https://strapi.io/documentation/3.0.0-beta.x/guides/deployment.html#heroku

Migrating changes in table structure with Sinatra/Ruby/Heroku

I have made my app with Sinatra/Ruby and deployed with Heroku. I made some extra columns to my database and manually dropped the table and put the new one up with Postgres so it works with my local version but not the Heroku one. I have already deployed my app with Heroku before this change and struggle finding a way to update the new table structure to the deployed version with terminal and heroku commands. Could someone help me with this?

Resources