This service is based on Heroku, Websockets using Sockets.io, and Redis. It provides presence information, chat and other realtime communication services for Midspace.
cd services/realtime
cp .env.example .env
- Replace the placeholder values in
.env
for the environment variables listed in the table at the bottom of this page. - You should have already configured and started the Docker services. Open http://localhost:15672 in a web browser and log in with the default username and password, both
admin
. - Now, create the user that the realtime service will use to access RabbitMQ. Go to the Admin tab and add a new user with username
services/realtime
and password1234
. Click the username of the newly-created user, and then click the Set Permission button. This gives the user unrestricted read/write access.- You can choose a different username and password, but you will need to update the
RABBITMQ_USERNAME
andRABBITMQ_PASSWORD
in.env
to match.
- You can choose a different username and password, but you will need to update the
- We need "sticky sessions" to make websockets work:
heroku features:enable http-session-affinity --app APP_NAME
- We need Heroku Redis for maintaining state:
heroku addons:create heroku-redis:premium-0 --app APP_NAME
- We need Heroku Multiprocfile to handle our monorepo:
heroku buildpacks:add -a APP_NAME heroku-community/multi-procfile
heroku config:set -a APP_NAME PROCFILE=services/realtime/PROCFILE
Name | Purpose | Example |
---|---|---|
REDIS_URL | The URI to your redis server. Heroku sets this automatically. | redis://localhost:6379 |
AUTH0_API_DOMAIN | As per other parts of Midspace. | |
SECRET_FOR_SUMMARY | same as PRESENCE_SUMMARY_SECRET in hasura/.env | |
SECRET_FOR_FLUSHING | same as PRESENCE_FLUSH_SECRET in hasura/.env |