This instruction shows how to deploy the main Messaging microservice in Heroku and get that service connected with a YugabyteDB Managed cluster.
Note, if you'd like to deploy the complete solution with the Attachments microservice, Kong Gateway, MinIO then follow the local deployment instruction.
- Heroku account
- YugabyteDB Managed instance
- Java 17+
- Maven 3.8.4+
The main Messaging microservice implements basic messaging capabilities letting exchange messages and content across messenger's channels. The microservice is deployed in Heroku and stores application data (workspaces, users, channels, messages, etc.) in a YugabyteDB Managed instance.
-
Create a production build:
mvn clean package -Pprod
-
Log in to your Heroku account:
heroku login
-
Install the Heroku Java Plugin:
heroku plugins:install java
-
Create a new application in Heroku:
heroku create geo-distributed-messenger
-
Provide application and database-specific configuration settings to Heroku:
heroku config:set PORT=<YOUR_SPRING_SERVER_PORT> -a geo-distributed-messenger heroku config:set DB_URL="<YOUR_DB_URL>" -a geo-distributed-messenger heroku config:set DB_USER=<YOUR_DB_USER> -a geo-distributed-messenger heroku config:set DB_PWD=<YOUR_DB_PWD> -a geo-distributed-messenger heroku config:set DB_SCHEMA_FILE="classpath:messenger_schema.sql" -a geo-distributed-messenger heroku config:set DB_MODE="standard" -a geo-distributed-messenger
Note, the
DB_URL
should be in the following formatjdbc:postgresql://us-east1.9b01e695-51d1-4666-adae-a1e7e13ccfb9.gcp.ybdb.io:5433/yugabyte?ssl=true&sslmode=require
YugabyteDB Managed needs to whitelist your Heroku app on the database end:
-
Install the Fixie Socks Add-On:
heroku addons:create fixie-socks:handlebar -a geo-distributed-messenger
Replace
handlebar
with your fixie socks package. -
Find your static IP addresses on the Fixie Socks Dashboard:
heroku addons:open fixie-socks
-
Add the IPs to YugabyteDB Managed IP Allow list.
-
Request the app to route all TCP/IP requests through the proxy:
heroku config:set USE_FIXIE_SOCKS=true -a geo-distributed-messenger
Check the How To Connect a Heroku Java App to a Cloud-Native Database article for alternate options.
-
Deploy the production build to Heroku:
heroku deploy:jar target/geo-distributed-messenger-1.0-SNAPSHOT.jar -a geo-distributed-messenger
-
Check the applicatin logs to confirm the flight is normal:
heroku logs --tail -a geo-distributed-messenger
-
Open the app:
heroku open -a geo-distributed-messenger
-
Log in under a test user:
username: [email protected] pwd: password
Enjoy and have fun!
Next, try out the cloud-native geo-distributed deployment option of the messenger that spans accross countries and continents.