I'm trying to get a new/blank volt (0.9.5) app into production on Heroku following the instructions on the Volt docs page.
The application deploys successfully until I try and add the Mongo database.
The below creates a new MongoLab database and sets a connection URI to the MONGOLAB_URI variable.
$ heroku addons:create mongolab
I thought all I had to do was copy the below into my config/app.rb file and replace the 'MONGOHQ_URL' with 'MONGOLAB_URI'.
config.db_driver = 'mongo'
config.db_name = (config.app_name + '_' + Volt.env.to_s)
if ENV['MONGOHQ_URL'].present?
config.db_uri = ENV['MONGOHQ_URL'] # you will have to set this on heroku
else
config.db_host = 'localhost'
config.db_port = 27017
end
But this is resulting in an application error and the log is showing the below...
[ERROR] Error adding listener: #<Mongo::AuthenticationError: Failed to authenticate user
Can anyone point me in the right direction?
Some other users suggested that the issue was to do with an outdated version of the volt-mongo gem which was, "using an old version of the Mongo Ruby driver." I have since upgraded to the latest version (currently 0.1.4) and everything seems to be working ok with the database.
This isn't an answer, but you should be able to run heroku config to see what ENV's are set for the dyno. Does that show the ENV?
Related
I just install Strapi but with PostgreQL DB (not using -- quickstart which means SQLite)
1. yarn create strap'-app name-of-my-project,
2. submit all QA=default step-by-step (database=strapi, port=default, login/password nothing fancy, and last without SSL connection)
And the finall result is not so descriptive. Only server error with connecting, which I don't know
Connection test failed: connect ECONNREFUSED 127.0.0.1:5433
Problem solved! (after 2 hours of trying instalation)
The answer is => You have to install PostgreSQL DB too on your computer
Once its done, next, you can run Strapi by yarn develop
So the problem is solved. Other problem in meantime solved
`Server wasn't able to start properly. Error: The server does not support SSL connections. Try to install without SSL connection (last question in Strapi install process)
I know you resolved the issue but just posting this in case anybody needs specific instructions.
I followed this tutorial and it's working for me now.
Sidenote: Once I installed Postgres and ran the command psql postgres it prompted me to enter my password. Despite putting in the correct password it still gave me an error that it is the wrong password, so I ran psql postgres postgres and then entering my password resolved the issue for me.
Instead of downloading postgres you can apply docker and it works the same
Link: https://blog.dehlin.dev/docker-with-strapi-v4
I had the same problem and as Kris says above, you need to install postgresql, pgAdmin and create the database first to then can create your Strapi project linked to you database.
I followed this youtube tutorial (in spanish) to solve it very easy.
Also need to avoid enable SSL for your local project. If you need to change this option in the future you can make it in the strapi config/database.js file.
Good luck!
I developed a FastAPI app in a Virtual Environment using an SQLite database but deployed it on Heroku with a PostgresSQL database on Heroku as suggested in the tutorial. Although it worked on my PC, adding PostegresSQL as an addon & replacing the value of SQLALCHEMY_DATABASE_URL in the database.py broke everything. Note that I've properly frozen the dependencies on the requirements.txt file. Yet I can't figure out what went wrong.
For further clarification, I've pushed my code to GitHub & it can be accessed at this repository - Self_calculation.
If you are using Postgres Addon on Heroku, probably your solution is simple.
Use os.environ to get the connection parameters , don't try to connect directly, it's Heroku's recommended solution from Heroku Postgres
import os
DATABASE_URL = os.environ.get('DATABASE_URL')
I just need to run this:
1)heroku git:remote -a my_heroku_app_name
2)heroku logs --tail
after that I could see my problem.
In my case I forgot to change postgres url in alembic.ini file
I have created database in heroku hobby-dev and uploaded table from postgresql and used app.db.create_all() to trigger database model but its showing psycopg2 wheel package will be renamed from release 2.8 and suggesting us to install psycopg2-binary and we installed that too and still app.db.create_all() not working.
The error doesn't relate to database Integration. There should be some error in Backend that's why It's giving 500.
For checking the error in heroku logs using heroku cli, use this :
heroku logs -t
Alternatively, you can view the logs on the App dashboard.
I hope this helps.
I successfully deployed my app to Heroku, Added mLab as my add-on
I also set
heroku config:set MONGOLAB_URI=mongodb://[myusername]:[mypassword]#ds119508.mlab.com:19508/heroku_l1q51vhd
but still I get:
I got the answer. The problem was with authentication. I made new user/pass and it works. You can use Mongochef to check if your connection and authentication with db is correct.
i have been following the Flask book by Miguel Ginberg and I am thinking about how to deploy my app and use the PostgresDB.
In my local production config I have to manually go in and run Role.insert_roles() before any roles can be assigned.
How do I do this in Heroku with postgres? In fact, how do you connect to the postgres db? It is not really clear where in the code postgres takes over using the environment variable:
https://github.com/miguelgrinberg/flasky/blob/master/config.py
I have a feeling my app is just running sqlite and the book isn't really clear on how to switch over.
SOLUTION:
if you have deployed to heroku and you have not changed the environment variables:
DATABASE_URI to SQLALCHEMY_DATABASE_URI
FLASK_CONFIG = heroku
FLASKY_ADMIN = your email
then ran in your shell:
heroku run python manage.py shell
db.create_all()
db.commit()
Role.insert_roles()
then you are probably running the development config from the SQLite database!
If you want to connect manually, you could use the http://initd.org/psycopg/ libarary directly. Flask-SQLAlchemy provides uses psycopg underneath the hood itself, see here - in your example it may be easier to continue using SQLAlchemy. More information here.
I had the same problem and solved like the follow:
1. provisioning a db
$:heroku addons:create heroku-postgresql bobby-dev
......
add database_url:
$:hero config -s |grep HEROKU-PSOTGRESQL
( then show HEROKU_POSTGRESQL_RED_URL=..... )
$:heroku pg:promote HEROKU-POSTGRESQL-RED
install this extention:psycopg2
3.change the config.py:
config = {
.....
'default' : ProductionConfig
}