Multiple heroku applications for the same local application - heroku

I have one application at my local machine and it's deployed to heroku. Or I must say, I was deployed - only a landing page. I have its own domain (example.com). However, it's in a test phase now and I want to deploy it to demo.example.com. I've already created another application for this at heroku (demo-example-com).
I could create a new local copy specially for demo-example-com but I don't think it's sensible. Instead I want to push the same local application to the different heroku applicaions (not accounts): example.com and demo-example-com.
How do I do this if this is possible?

Heroku has good documentation on how to deploy to multiple environments from your local machine. In other words, how to push to different applications in the same account from one local repository. See https://devcenter.heroku.com/articles/multiple-environments.

Related

work remotely on heroku with vscode and commit changes

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

Server Client Communcation between heroku apps

I have a server application built on nodejs and socket.io and a client application built with typescript and socket.io.
The two apps are separate git repos.
Can I host them as separate apps on heroku and allow communication between them or do they need to share repo/heroku app?
As heroku allow to open single port per application. You have to use separate heroku apps for:
Nodejs backend which includes socket.io
Front client application which built on Typescript.
You can share share Repo if you're not connected Git with Heroku Repo.
But in case you connected Github repo with Heroku app you need a separate Repo for both.

Run two apps on one heroku domain

I have two apps, one is a react app being served on a node server (front end). Another one is a Spring boot app (backend that provides bunch of REST API endpoints). They live on two different github repos.
Is there a way to configure heroku to serve both of them (they run on different ports) on one domain?
Right now, I have the java spring boot app being served on one heroku domain, I want the second react project to build and run on the same domain. Any idea ?

Can a Heroku app access remote database?

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.

How to discover the *external* hostname from within a heroku cedar application

I am deploying a RubyOnRails 3.1 app to heroku cedar stack. From within the app I would like to auto discover the host name (i.e. appname.herokuapp.com). I have multiple deployments of the same app on heroku - some for development, some for staging and some for production. It would be nice to be able to check an environment variable or make some call to find out my app host name from within the app.
does
request.host
give you want you want?

Resources