Skip to content

Commit

Permalink
feat(README): add Host on Heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKozAllB committed Aug 8, 2024
1 parent 86eff54 commit 32ae630
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Provides an easy integration with the Allbridge Core ChainBridgeService for DApp
- [How to get](#how-to-get)
- [1. Use existing docker image](#1-use-existing-docker-image)
- [2. Build and run the docker image](#2-build-and-run-the-docker-image)
- [Host on Heroku](#host-on-heroku)
- [How to use](#how-to-use)
- [Swagger](#swagger)
- [Raw transactions](#raw-transactions)
Expand Down Expand Up @@ -160,6 +161,62 @@ docker run -p 3000:3000 \
-d allbridge-core-rest-api
```

### Host on Heroku

If you cannot host Docker, you can use a separate hosting service like Heroku to deploy the REST API.

For detailed instructions on using Heroku's container registry and runtime, see [the official guide](https://devcenter.heroku.com/articles/container-registry-and-runtime).

Below is a step-by-step guide on how to do this.

#### Step-by-Step Guide

1. Sign up for Heroku
* [Heroku Sing Up](https://id.heroku.com/login)
2. Install Heroku CLI
* Follow the instructions [here](https://devcenter.heroku.com/articles/heroku-cli#install-the-heroku-cli)
3. Login to Heroku CLI
* Run the command: `heroku login`
* If you encounter an 'IP address mismatch' error, disabling iCloud Private Relay may help. More details [here](https://help.heroku.com/CBF0T4AJ/can-t-login-to-heroku-using-cli-getting-ip-address-mismatch).
4. Ensure Docker is Installed
* Verify Docker is working by running `docker ps`.
* Ensure you are logged in to Heroku with `heroku login`.
5. Create a New Heroku App
* [Create a new app](https://dashboard.heroku.com/new-app) on the Heroku dashboard.
6. Set Heroku Stack to Container
* Run the command: `heroku stack:set container --app <app-name>`

##### Deploy and release REST-API container

Repeat steps 7-11 to upgrade to a newer REST-API version.

7. Login to Heroku Container Registry
* Run `heroku container:login` or log in via Docker following [these instructions](https://devcenter.heroku.com/articles/container-registry-and-runtime#logging-in-to-the-registry).
8. Pull the REST-API Locally
* Run the command: `docker pull --platform linux/amd64 allbridge/io.allbridge.rest-api:<version>`
9. Tag the Docker Image
* Run the command: `docker tag allbridge/io.allbridge.rest-api:<version> registry.heroku.com/<app-name>/web`
10. Push the Tagged Image to Heroku
* Run the command: `docker push registry.heroku.com/<app-name>/web`
11. Release the Container on Heroku
* Run the command: `heroku container:release web --app <app-name>`

##### One-Time Setup (Optional for Updates)

12. Set Configuration Variables
* Run the commands, like: `heroku config:set ETH_NODE_URL=https://ethereum-rpc.publicnode.com --app <app-name>`
* Alternatively, you can set it via the Heroku Dashboard under the app's settings. [See](https://devcenter.heroku.com/articles/config-vars#using-the-heroku-dashboard).

#### Final Steps

13. Retrieve the Base URL
* Find the base URL in the domains section of your app's settings (`https://dashboard.heroku.com/apps/<app-name>/settings`) on the Heroku Dashboard.
* Or click the button `Open App`
14. Check API Availability
* Append `/api` to the base URL to check the availability of the Swagger.

You are now ready to use your rest-api app.

## How to use

### Swagger
Expand Down

0 comments on commit 32ae630

Please sign in to comment.