This works for local redis-server
BullModule.forRoot({
redis: {
host: "localhost",
port: 6379,
db: 0,
password: ""
}
})
But if I use the DataStore Credentials on Heroku Redis, the bull board does not load and Heroku Logs gives an H12 error.
How can I get the BullModule to properly connect to Heroku Data for Redis?
Thanks!
You must specify the location of where redis is accessible. localhost:6379 is the default for running redis locally, but to deploy an application that uses Redis to Heroku, you will need to add the Connecting to Heroku Data for Redis add-on. Then, you'll need to pass the location of your Redis service via process.env.REDIS_URL to the BullModule.forRoot() constructor.
Be aware that encountering TLS issues in connecting to Redis like this are common. When I tried connecting using the format from PedroPovedaQ's answer, I ran into one.
There's a discusson on that here.
I suggest trying
BullModule.forRoot({
redis: "<redisurl given by heroku in env variable>"
})
This fixed the issue for me.
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 have two microservice (using nest.js) deployed on heroku. When I try to connect I get this error:
Error: getaddrinfo ENOTFOUND https://URL.herokuapp.com
This is the my way for connect to microsrevice.
{
imports: [ConfigModule],
inject: [ConfigService],
name: 'CURRENCY_SERVICE',
useFactory: (configService: ConfigService) => {
return {
transport: Transport.TCP,
options: {
host: configService.services.currency.host,
port: configService.services.currency.port,
},
}
},
}
I couldn't find the port number heroku assign. So I just log the port number after app is up and copied to .env file.
This is my .env file
CURRENCY_SERVICE_HOST=https://URL.herokuapp.com
CURRENCY_SERVICE_PORT=53294 # I copied this port number from view logs section on heroku
Also I tried access without port but still can't connect. I can connect on localhost by he way. I just need to find correct connection credentials please help me
This is the first and the most basic test. Try accessing those URLs in the browser and see if the apps are running as expected and if they resolve.
If your API URI is
https://URL.herokuapp.com/api/v0/endpoint
Open the app API URI in a browser to ensure that it is working.
Next, presuming both services are back-end nodejs apps that need to talk to each other via server-to-server API calls, you want to ensure that communication between them is working on Heroku.
It seems like you're on the right track with troubleshooting and logging this step, but you definitely don't want to use the internal port number. You do want to use the public URL https://URL.herokuapp.com. When using HTTPS, it's always going to be on port 443.
Please take a look at this answer for additional help with configuring, deploying, and running microservices on Heroku. How to deploy microservices on Heroku
Hopefully, this helps. Good luck!
Can we use redis on heroku for background jobs with python without using RedisToGo add-on. Any pointer please.
I've this error while following this https://devcenter.heroku.com/articles/python-rq post without using RedisToGo add-on
app[worker.1]: Error 111 connecting to localhost:6379. Connection refused.
Heroku does not include a redis server by default. You will have to use a Heroku add-on or connect to another instance you control.
I've successfully set up a password-protected redis cluster using the guide here:
http://kubernetes.io/v1.1/examples/redis/
I can connect to the sentinel just fine using redis-cli, but I cannot connect to the redis master/slave even though I have exposed the sentinels.
I'm using ruby and the following connection string.. Am I doing this wrong?
SENTINELS = [{host: "104.122.24.897", port: 26379}]
redis = Redis.new(url: "redis://mymaster", sentinels: SENTINELS, :role => :master, password: "longasspassword", timeout: 16)
The error I get is:
Error connecting to Redis on 10.64.7.33:6379 (Redis::TimeoutError) (Redis::CannotConnectError)`
I eventually settled on using helm (https://helm.sh/) and installed redis-cluster using helm install redis-cluster.
I can connect to the redis cluster using the cluster_ip (not external ip) in kubernetes and this satisfies my security requirement. redis sentinel works out of the box with this approach.
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.