We want to serve different versions of the API under different paths e.g. /v2, /v3 but not necessarily reflect that convention in the code.
To achieve that an NGINX proxy has been created and set up as an entrypoint to the entire API. It provides path level routing e.g. /v2 will be routed to a different heroku APP then /.
build the image: docker build --pull --rm -f "backend/proxy/Dockerfile" -t bloom:latest "backend/proxy"
- PORT: 80
- BACKEND_HOSTNAME: [Your local IP]:3100 (e.g. 192.168.86.231:3100)
- PROTOCOL: http
- ALLOW_LIST: localhost:3000|localhost:3001
Run and you should be able to access listings at http://localhost:9000/listings
Based on this tutorial. All values are for bloom-reference-backend-proxy and each environment requires it's own proxy.
Download and install the Heroku CLI.
If you haven't already, log in to your Heroku account and follow the prompts to create a new SSH public key.
$ heroku login
You must have Docker set up locally to continue. You should see output when you run this command.
$ docker ps
Now you can sign into Container Registry.
$ heroku container:login
Note if you are using an Apple M1 device the following steps will not work. You will have to do the following: https://stackoverflow.com/a/67001433
Push your Docker-based app Build the Dockerfile in the current directory and push the Docker image.
# workdir: backend/proxy
$ heroku container:push --app bloom-reference-backend-proxy web
Deploy the changes Release the newly pushed images to deploy your app.
$ heroku container:release --app bloom-reference-backend-proxy web
Heroku Proxy app requires four environment variables to work:
PORT: 443 BACKEND_HOSTNAME: bloom-backend-orm.herokuapp.com PROTOCOL: https ALLOW_LIST: partners.bloom.exygy.dev|bloom.exygy.dev