Deploying SAMA chat server stack: a comprehensive guide

Igor Khomenko
SAMA communications
3 min readOct 11, 2023

--

In the world of modern communication, real-time messaging has become an integral part of our daily lives. Whether it’s for personal use or business, the need for efficient chat applications has grown exponentially. The SAMA Chat Server Stack offers a powerful solution for those looking to deploy a robust and scalable chat server.

In this article, we’ll explore the steps to deploy the SAMA Chat Server stack, providing you with a comprehensive guide to get started.

Before you start — we highly recommend to check SAMA: chat server tech stack article to get an overview about different components which SAMA stack consists of.

In this article we will cover the 4 main services and explain how to run it locally:

  • sama-server - core API service
  • sama-client - frontend Web application
  • sama-push-daemon - push notifications service
  • sama-push-queue-board - web dashboard to monitor push notifications service queue

sama-server

~ repository: https://github.com/SAMA-Communications/sama-server

  • make sure you have Node 18 installed.
  • clone the repo
git clone git@github.com:SAMA-Communications/sama-server.git 
cd sama-server
  • create env file from the template
cp .env.example .env
  • run docker-compose up to run dependant services (MongoDB, Minio, Redis)
  • Open http://localhost:9011/access-keys and login using MINIO_ROOT_USER and MINIO_ROOT_PASSWORD from docker-compose.yml file. Create Access Keys and set MINIO_ACCESS_KEY and MINIO_SECRET_KEY in .env file.
  • do npm install to install dependencies
  • do npm run migrate-mongo-up to run DB migrations
  • do npm run start to run server

sama-client

~ repository: https://github.com/SAMA-Communications/sama-client

  • clone the repo
git clone git@github.com:SAMA-Communications/sama-client.git 
cd sama-client
  • create env file from the template
cp .env.example .env
  • generate VAPID keys via npx web-push generate-vapid-keys and set Public Key to REACT_APP_PUBLIC_VAPID_KEY in .env file
  • do npm install to install dependencies
  • do npm run start to run server
  • access http://localhost:3000 in your browser

sama-push-deamon

~ repository: https://github.com/SAMA-Communications/sama-push-daemon

  • clone the repo
git clone git@github.com:SAMA-Communications/sama-push-deamon.git 
cd sama-push-deamon
  • create env file from the template
cp .env.example .env
  • from the previous step when you generated VAPID keys, set Public Key to PUBLIC_VAPID_KEY and Private Key to PRIVATE_VAPID_KEY in .env file
  • do npm install to install dependencies
  • do npm run start to run server

sama-push-queue-board

~ repository: https://github.com/SAMA-Communications/sama-push-queue-board

  • clone the repo
git clone git@github.com:SAMA-Communications/sama-push-queue-board.git 
cd sama-push-queue-board
  • create env file from the template
cp .env.example .env

Try SAMA 👇🏼

To run SAMA server locally — follow the above instructions to run the complete SAMA stack.

Also Check out more posts on our page for fantastic improvements to your app!

Discover, enjoy, and all feedback is welcome. We will be thankful a lot for every GitHub star, issue, or comment!

--

--

Igor Khomenko
SAMA communications

Software craftsman, RTC pro, love programming and clouds, XMPP, WebRTC, secure messaging, chat bots