Docker Server Setup
Local Development
Section titled “Local Development”-
Make sure you have latest
Node 18
installed. -
Copy
.env.example
to.env
. -
run dependant services (MongoDB, Minio, Redis) via
Terminal window docker-compose -f docker-compose.yml -f docker-compose.development.yml up -
Terminal window npm install -
Terminal window npm run migrate-mongo-up -
Terminal window npm run startIn a case of running under Windows - see https://github.com/SAMA-Communications/sama-server/issues/128
-
Now the server will be listening for incoming connections at
ws://localhost:9001
Compete Deployment
Section titled “Compete Deployment”Deploying the SAMA application can be done easily with Docker, whether you want a complete setup with all dependencies or a local environment with the main applications. Below are the steps to follow:
Docker one-command deployment
Section titled “Docker one-command deployment”This approach builds and runs the entire SAMA application, including all dependencies, in a single command. It is ideal for setting up the full environment quickly.
To deploy using this method, run:
docker-compose -f docker-compose-full.yml up --build
Docker local deployment
Section titled “Docker local deployment”To run the dependency services along with the main SAMA
applications (sama-client
, sama-server
, and sama-push-daemon
), use:
docker-compose up --build
If you are using MacOS or Windows, and want run SAMA
apps, add these two
variables before the launch command:
$env:MINIO*ENDPOINT = (Get-NetIPAddress | Where-Object { $*.AddressFamily -eq 'IPv4' -and $\_.IPAddress -match '^192\.168\.|^10\.|^172\.(1[6-9]|2[0-9]|3[0-1])\.' } | Select-Object -ExpandProperty IPAddress)[1]; $env:MINIO_PORT = 9010;
MINIO_ENDPOINT=$(ipconfig getifaddr en0) MINIO_PORT=9010
If you are encountering issues with attachments in the web client, it suggests that an error occurred in the first variable. To resolve this, you can simply update the code segment with the private IP address of your machine.
Avaible Links
Section titled “Avaible Links”Now you can access apps at the following addresses:
Docker e2e tests & migrations
Section titled “Docker e2e tests & migrations”Run migrations:
docker-compose exec sama-server sh -c "MONGODB_URL=mongodb://172.25.0.4/samatests npm run migrate-mongo-up"
Run e2e tests:
docker-compose exec sama-server sh -c "MONGODB_URL=mongodb://172.25.0.4/samatests npm run test"