pborreli / slack-hubot

A SlackHQ - Hubot ready to deploy
MIT License
5 stars 4 forks source link

finding a way to set the HEROKU_URL automatically #1

Open pborreli opened 9 years ago

pborreli commented 9 years ago

In order to keep the dyno running we have to set the HEROKU_URL env with the actual URL of your heroku :dizzy_face: http://XXXX.herokuapp.com which is not yet created when you click on Deploy on Heroku button.

That's what i'm trying to do in b87a56c3b9755b0e0c2340c4085ce4fba78b3a2e but it doesn't work because heroku cli is not available from inside a dyno (makes sense)

Right now I can't find a way to config the app.json in order to set it automatically after the overall one click creation process.

maybe @dzuelke has an idea ?

scottrobertson commented 9 years ago

http://stackoverflow.com/a/14280500 might help?

pborreli commented 9 years ago

@scottrobertson I don't get it, do you recommend to access or export HEROKU_URL = URL at startup ?

dzuelke commented 9 years ago

Why do you need the URL?

pborreli commented 9 years ago

@dzuelke it's explained here

In addition, there is one special environment variable for Heroku. The default hubot Procfile marks the process as a 'web' process type, in order to support serving http requests (more on that in the scripting docs). The downside of this is that dynos will idle after an hour of inactivity. That means your hubot would leave after an hour of idle web traffic, and only rejoin when it does get traffic. This is extremely inconvenient since most interaction is done through chat, and hubot has to be online and in the room to respond to messages. To get around this, there's a special environment variable to make hubot regularly ping itself over http. If the app is deployed to http://rosemary-britches-123.herokuapp.com/, you'd configure:

heroku config:set HEROKU_URL=http://rosemary-britches-123.herokuapp.com

dzuelke commented 9 years ago

Ah. Yeah, there's not really a way right now. You could put it into the env vars section as a required var with no value, and make the description so that it tells users to pick their own app name when creating the app through the button and then set the URL accordingly.

pborreli commented 9 years ago

@dzuelke that should be really great if there was a way, that would remove one annoying step, I will try to see if it's possible to modify hubot source code to find by itself the url, not sure if it's possible but can worth the effort, thanks for your feedback !

hkedia321 commented 6 years ago

Hi @pborreli @dzuelke @scottrobertson I am facing exact same problem for another bot I am developing. If anyone got any solution can you please share? Thanks!