Updating ngrok-generated URL in add-on descriptor automatically

302 views
Skip to first unread message

gabor...@midori-global.com

unread,
Aug 18, 2016, 12:26:28 PM8/18/16
to Atlassian Connect Dev
Hi,

I followed the "Developing locally" guide here: https://developer.atlassian.com/static/connect/docs/latest/developing/developing-locally.html
However, updating the baseUrl in add-on descriptor every time I restart ngrok is a but tedious. I am wondering how you deal with this problem.

I know paid ngrok has a feature called "Custom subdomains" but does anyone know a free tool or any kind of workaround?

Thank you,
Gabor

Fernando Boucquez

unread,
Aug 18, 2016, 12:36:08 PM8/18/16
to atlassian-...@googlegroups.com
I ended up paying ngrok 60 bucks for the year license and it's worth it. Save the time of running ngork, copying the url to the descriptor and reinstalling all host instances.

I used to have a script that installs the addon using some rest calls when developing with atlas-sdk but for some reason didn't worth in the cloud (I didn't try to hard). 

--
You received this message because you are subscribed to the Google Groups "Atlassian Connect Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connect-dev+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James Hazelwood

unread,
Aug 18, 2016, 10:21:13 PM8/18/16
to Atlassian Connect Dev
Hi Gabor,

This doesn't completely solve your problem, but are you aware of the AC_LOCAL_BASE_URL environment variable you can set when running your add-on (I'm assuming you're using atlassian-connect-express)? This will at least save you the hassle of editing your atlassian-connect.json

You can set it when starting the add-on like so:

$ AC_LOCAL_BASE_URL=https://...ngrok.io node app.js

alternatively, the locally-running ngrok service provides a REST api that you could query in a script if you wanted something more automated.

Cheers,
James

Tobias Binna

unread,
Aug 19, 2016, 1:34:10 AM8/19/16
to Atlassian Connect Dev
Hi Gabor,

I know exactly what you are talking about. This bugged me for a while as well. Ngrok is really reliable and fast but paying $5/month for a custom domain is quite expensive. I ended up using https://localtunnel.github.io/www/ (source is here: https://github.com/localtunnel/localtunnel)
It's free and allows you to use your own custom subdomain. Unfortunately there is a problem that causes the connection to go down every here and there, but I think it's still worth a try. I don't mind reconnecting here and there instead of paying $60 a year.

gabor...@midori-global.com

unread,
Aug 19, 2016, 10:01:54 AM8/19/16
to Atlassian Connect Dev
Hi All,

Thank you for your responses, they are all useful.

I am using atlassian-connect-spring-boot but James' hint about using ngrok's REST API is a great idea, this will be the first approach I will try.
localtunnel is also interesting, but if neither of these work, as a last resort I will possibly end up buying an ngrok license as Fernando suggested.

Thank you; cheers,
Gabor

Gregory Joseph

unread,
Aug 24, 2016, 4:36:49 AM8/24/16
to atlassian-...@googlegroups.com, gabor...@midori-global.com
Here’s how I do it: https://bitbucket.org/snippets/hpesojg/L64GK
The last line would need to be adapted to your use case, our you could integrate that differently with your workflow, but you get the idea.
(relies on curl and jq (https://stedolan.github.io/jq/), could probably be rewritten to use httpie instead)

HTH,

-g
> --
> You received this message because you are subscribed to the Google Groups "Atlassian Connect Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connec...@googlegroups.com.

gabor...@midori-global.com

unread,
Aug 24, 2016, 5:57:01 PM8/24/16
to Atlassian Connect Dev, gabor...@midori-global.com
Hi,

Thanks for the sample code! I ended up with something similar.
I am using Spring Boot, using two different profiles while running my app: "development" and "production". I put "server.url=https://my-production-url.com" in application-production.properties and put a small code in my main Application class that checks if this property is set or not. If not, a small Java method is invoked that obtains the ngrok URL from its locally running REST API and sets this URL as the value of "server.url" property. As Atlassian Connect Spring Boot supports the usage of property references in atlassian-plugin.json, I can simply use this property as a placeholder.

This way I can forget manual messing with URLs: the whole thing works out of the box in local development or production mode without any code changes. In development mode, I only have to be sure ngrok is running. Maybe a shell script could ensure this as in Gregory's solution.
I hope this gives some inspiration to users of Spring Boot.

Cheers,
Gabor
> To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connect-dev+unsub...@googlegroups.com.

William Henrique

unread,
Jan 27, 2017, 4:47:13 AM1/27/17
to Atlassian Connect Dev
Urgh. Every here and there? It's totally unstable. From 5 requests, it will probably fail 2. I really wish they could fix this (maybe it's on their servers and not actually the GitHub code...?)
Reply all
Reply to author
Forward
0 new messages