I want to use mysql database which is hosted on my own server.
I've changed DATABASE_URL and SHARED_DATABASE_URL config vars to point to my server, but it's still trying to connect to heroku's amazonaws servers. How do I fix that?
According to the Heroku documentation, changing DATABASE_URL is the correct way to go.
If you would like to have your rails application connect to a non-Heroku provided database, you can take advantage of this same mechanism. Simply set your DATABASE_URL config var to point to any cloud-accessible database, and Heroku will automatically create your database.yml file to point to your chosen server. The Amazon RDS Add-on does this for you automatically, though you can also use this same method to connect to non-RDS databases as well.
Here's an example that should work:
heroku config:add DATABASE_URL=mysql://user:password#host/db
You may need to redeploy by making a change and running git push heroku master
By the way, the host is XXXX.amazonaws.com, where XXX is a long host hame that probably changes. If you can add a wildcard, that's the easiest %.amazonaws.com
I had this exact same problem with my Dreamhost MySQL database. Turns out the solution was to tell Dreamhost is was Ok to accept connections from this foreign host. Otherwise, Dreamhost blocks all requests to MySQL that don't originate from their systems.
It seems that if Heroku is falling back to Amazon AWS despite your DATABASE_URL, it's because it's being denied access to your MySQL database.
Related
I want to host a database in Heroku server and also a django application. The problem is: To transfer data to my Heroku database i would need be connected to a VPN. Does Heroku provides a way to connect to a VPN in order to access another database, like AWS client VPN?
My infra would be like this:
Airflow running DAGs to pull data from a AWS database that requires VPN connection to source from it. I would transfer the data from this AWS database to my heroku database.
Is it possible?
Thank you
Another thing that i'm wondering is if it is possible to connect Heroku to AWS client VPN, in case Heroku does not have something similar or a way to do this step.
Yes Heroku does provides a VPN labelled as Heroku Private Spaces and Shield Spaces.
Here is the link
https://devcenter.heroku.com/articles/private-space-vpn-connection
I want to code directly on production with VSCode, make some changes, and commit them (for fast prototyping, not a live server). I'm testing responses from external services, so I need a publicly-accessible URL.
Is that possible with heroku?
When I SSH intro Heroku from a terminal, I can't git commit cause I get fatal: not a git repository
Also, running heroku ps:exec on VSCode remote extension pack doesn't work.
No, this is not possible on Heroku without some very awkward hoop-jumping. Heroku is a platform-as-a-service provider, not a remote workstation.
I'm testing responses from external services, so I need a publicly-accessible URL
Your best bet may be to use something like ngrok or localtunnel.
These tools let you temporarily route traffic from a publicly-accessible address to your local development environment. At a high level, it looks something like this:
Start your development server locally
Start ngrok or localtunnel locally
Take the publicly-accessible URL the tool gives you and tell the external service to use it
I'm learning redis and have it working from a java app. I'm trying to use the heroku redis:cli -a myAppName command to connect with it directly but it says "No Redis instances found".
When I do heroku apps it lists myAppName so I know it's valid.
heroku redis:info -a myAppName doesn't return anything.
The heroku docs don't seem to be accurate as they all leave out the -a flag which the cli tells me is required. Outside of that I don't know what I've missed.
You are looking at documentation for Heroku Redis, a hosted Redis service that Heroku itself provides. If you wish to use Heroku Redis, you can provision it for your app using like so:
heroku addons:create heroku-redis:hobby-dev -a your-app-name
Pricing for Heroku Redis can be found here. The Hobby Dev plan used in the previous command is free.
There are also other Redis providers that can be provisioned this way, including Redis Enterprise Cloud. Or you can use existing hosted Redis server. But with these options you won't be able to interact with the service using heroku redis commands. Use whatever tooling those providers offer.
Good day everyone, I have a Laravel application that is supposed to connect to a remote MYSQL database in production, and to ease deployment I am using docker. I have setup a GitHub actions workflow that is triggered when I push to master branch, the workflow essentially runs a couple of tests and then builds my app into an image and then pushes to docker hub.
To avoid database connection issues when composer dump-autoload is run during the build process, I allowed connection from any host (changed bind-address to 0.0.0.0 in mysql config) and also setup the mysql user to connect from any host. This seems to do the trick but my concern is obviously exposing my database service to the entire world. Fortunately its possible to setup my own dedicated server for Github actions, which means I can easily restrict my db service to that host. Would that be the Ideal solution or there is way to run the workflow without needing to connect to a database?.
Try to connect to remote database using an SSH Tunnel
ssh -N -L 3336:127.0.0.1:3306 [USER]#[REMOTE_SERVER_IP]
With this you do not need to publish MySQL to the world and could bind it to 127.0.0.1 on Remote host.
I want to host an application in Heroku bu don't want to use a Heroku database. Can I connect to an existing remote database from my Heroku app?
You can use whatever database you like from Heroku as long as it is accessible from Heroku's platform.
Just set and use the proper env var in your app with your db's address and credentials and it should just work.
Where is your current database hosted? In short, the answer is likely yes. Heroku makes it really easy to connect to an Amazon RDS instance through a plugin. This is the same way many other database hosts provide connectivity, such as ClearDB or MongoLab. If you share where your current remote database is, it will be easier to give you more information.