6

I need to connect to an API with my Heroku/Rails app where I need to have a static IP.

I know about the add-on proximo - https://devcenter.heroku.com/articles/proximo - but it is insanely priced, so that's out of the question.

Most people in my situation ends up deploying to EC2 instead and using a an Elastic IP as their static IP. I've also tried this and it works, but I find the whole flow of playing around with EC2 really cumbersome.

I've read in some answers that it is possible to set up an EC2 server and use it as a proxy for your Heroku/Rails app - Heroku Static IP for SFTP - but it sounds very cryptic for a person who is not very server-savvy.

Can someone give a step-to-step tutorial on how to set up your Heroku/Rails app to use your EC2 instance as a proxy?

Community
  • 1
  • 1
Holger Sindbaek
  • 2,278
  • 6
  • 41
  • 68
  • You're right that proximo is pretty expensive, but that's because they're shouldering the burden of a complex configuration and providing a simple implementation to you. You're asking for both cheap and simple, which unfortunately doesn't always exist. The complexity involved with provisioning an EC2 instance and correctly configuring/securing a proxy is a job for a competent employee, or maybe a contractor or consultant, not Stack Overflow. – Fitzsimmons Apr 10 '13 at 16:03
  • 1
    So you are saying that it is so complex to set up an EC2 server and use it as a proxy for my heroku app that it is near impossible? It's not so much that proximo is pricey, it's that it's so pricey, that it's unpayable. – Holger Sindbaek Apr 10 '13 at 16:24
  • No, it's not impossible. It's just not something that someone can answer off the cuff. It's a *project*. It's a complex process that's outside the scope of a Q&A on Stack Overflow. – Fitzsimmons Apr 15 '13 at 21:06
  • Ok.. thanks for the clear answer. If you put it up as an answer, I'll accept it and credit the bounty to you. – Holger Sindbaek Apr 15 '13 at 21:12

4 Answers4

2

In short: I would just switch to AWS. There is a little bit of a learning curve but it's not too difficult. Here is a presentation I gave on it geared toward front-end devs: https://speakerdeck.com/krunkosaurus/intro-to-scaling-your-web-app-on-the-cloud-with-aws-for-frontend-developers-part-1

Amazon has 9 regions each with 3-5 "Availability Zones". I know that Heroku uses AWS but am not sure if you get to decide (or know) which AWS region and AZ your actual server is hosted.

Whatever it is, you should host your proxy server in the same Region (better yet, even the same Availability Zone). Setting up an EC2 there is easy just use the web console and be sure to give it an Elastic IP so the adress doesn't ever change. Then point your DNS away from your Heroku instance (dyno?) to this EC2 instance. From there you can either install Nginx or HAProxy.

Mauvis Ledford
  • 40,827
  • 17
  • 81
  • 86
  • Thanks for the advice. I've managed to set up an EC2 server and attach an elastic IP, but the whole process of pointing DNS's from Heroku and working with Nginx and HAProxy is unknown to me. Can you explain more detailed how to do that or lead me in the direction of someone explaining it more in detail? Thanks again. – Holger Sindbaek Apr 09 '13 at 18:01
  • Different people manage your DNS. If you bought the domain name at GoDaddy, then your DNS manager is probably at godaddy.com. I like to move all of that to Amazon Route53. If you PM me your domain name I can tell you more about where it's hosted. One problem this may not solve is that id your dyno keeps changing ip or dns then your static EC2 instance may no longer be pointing to it. – Mauvis Ledford Apr 09 '13 at 19:05
  • K... I'm hosting my domain at iwantmyname.com. Problem is not so much getting that domain to point to my heroku app, but to get the heroku app go through my ec2 instance, when querying to the API. If you know what I mean? – Holger Sindbaek Apr 09 '13 at 20:03
  • What the guy in the post you linked is probably more relevant than what I'm talking about: http://stackoverflow.com/questions/13350188/heroku-static-ip-for-sftp You need to set up a SOCKS proxy on your micro instance. To test it out you can do it from your local machine to your ec2: http://www.mikeash.com/ssh_socks.html – Mauvis Ledford Apr 09 '13 at 21:56
  • Seems complex. You don't of anybody who has done this before an written a tutorial? – Holger Sindbaek Apr 09 '13 at 22:18
0

I've just setup QuotaGuard Static as a more robust, better value static IP service that can be used by Heroku apps.

It's hosted on EC2 so you get the low latency benefits without having to start managing servers.

Tim Williams
  • 318
  • 2
  • 6
0

Hello you can use this answer to see how to use NGINX as a reverse proxy.

https://stackoverflow.com/a/27874505/1345865

http://blog.talenox.com/post/107675614745/how-to-setup-static-ip-on-heroku

Community
  • 1
  • 1
amdstorm
  • 66
  • 6
0

Fixie is very affordable option for getting static IP address on Heroku. The documentation section has a lot of examples for different languages and frameworks, including Ruby.

user527662
  • 363
  • 5
  • 14