demo chat service with websocket and graphQL endpoints
Find a file
2025-01-06 10:02:48 +03:30
common init 2024-12-05 03:41:14 +03:30
graphql add support chat 2025-01-06 10:02:48 +03:30
images init 2024-12-05 03:41:14 +03:30
models init 2024-12-05 03:41:14 +03:30
websocket init 2024-12-05 03:41:14 +03:30
.gitignore init 2024-12-05 03:41:14 +03:30
deploy.sh init 2024-12-05 03:41:14 +03:30
docker-compose-develop.yml init 2024-12-05 03:41:14 +03:30
docker-compose-production.yml init 2024-12-05 03:41:14 +03:30
go.mod init 2024-12-05 03:41:14 +03:30
go.sum init 2024-12-05 03:41:14 +03:30
README.md first commit 2024-12-05 03:40:54 +03:30

chat-service

about services

service port databases what it does
graphQL 4000 postgres creates rooms and handles memberships
websocket 8066 postgres, redis handles connections to rooms and sending and receiving messages

set up dependency containers

create network

docker network create gol_golang_network

development

docker-compose -f docker-compose-develop.yml up -d  --build
docker-compose -f docker-compose-production.yml up -d  --build

This will download and launch these containers:

  • postgres
  • redis

create postgres Database

development

docker exec -it chat_postgres_dev  psql -U postgres -c 'create database "Dev_Messages"'

For environment variables listed below, fill in the appropriate values based on your environment.

REDISCONNECTIONHOST=chat_redis_dev
REDISCONNECTIONPORT=6379
REDISCONNECTIONPASSWORD=
REDISCONNECTIONDB=0

POSTGRESQLROOMSHOST=chat_postgres_dev
POSTGRESQLROOMSPORT=5432
POSTGRESQLROOMSUSER=postgres
POSTGRESQLROOMSPASSWORD=
POSTGRESQLROOMSSSLMODE=disable
POSTGRESQLROOMSDBNAME=Dev_Messages
POSTGRESQLROOMSTABLE=rooms

POSTGRESQLMEMBERSHIPTABLE=membership

POSTGRESQLMESSAGESHOST=chat_postgres_dev
POSTGRESQLMESSAGESPORT=5432
POSTGRESQLMESSAGESUSER=postgres
POSTGRESQLMESSAGESPASSWORD=
POSTGRESQLMESSAGESSSLMODE=disable
POSTGRESQLMESSAGESDBNAME=Dev_Messages
POSTGRESQLMESSAGESTABLE=messages

JWTSECRET=

WSPORT=4000

GRAPHQLPORT=8066
```# chat-golang-ws-graphql