Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions .env.docker
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
NODE_ENV=testing

LOG_LEVEL=trace
LOG_SINGLE_LINE=false

APP_PORT=9001

MONGODB_URL=mongodb://172.25.0.4/samadb

REDIS_URL=redis://172.25.0.5:6379

STORAGE_DRIVER=minio
STORAGE_DRIVER=s3

MINIO_ROOT_USER=e7walulcatDu7waekVSk
MINIO_ROOT_PASSWORD=PYiRFiqUljLFRdKvwnVQ
MINIO_ACCESS_KEY=hJZWjTyRnxkvcu2gQS5m
MINIO_SECRET_KEY=k4QiBO1i8GZSP69U8CnImqhHhAQJGHWl8PKDJRXJ
MINIO_BUCKET_NAME=samabucket
MINIO_USE_SSL=false
# Garage (S3-compatible), see prefs/garage
GARAGE_RPC_SECRET=6faa4ec263e89f1f5707a1c45a886d74658f5a3e5b4dde056bc6be20f959c2cf
GARAGE_ADMIN_TOKEN=R+zcAoZ6LuQ+ylu+J6H3fNBKd3sZOMjCq8sOlpg4NFc=
S3_ACCESS_KEY=GK420ff84841bcd9d58d606e2e
S3_SECRET_KEY=451ca1503caa256a9491875800bb2fdf1eec356a5bc079c298b95f0fb13f1776
S3_BUCKET_NAME=samabucket
S3_REGION=garage
S3_FORCE_PATH_STYLE=true

CONVERSATION_MAX_PARTICIPANTS=50
CONVERSATION_PRELOAD_COUNT=30
Expand Down
25 changes: 9 additions & 16 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,19 @@ APP_REPL_SOCKET_HANDLER=/tmp/net-repl.socket
APP_REPL_FILE_IN=/tmp/pipe-repl.in
APP_REPL_FILE_OUT=/tmp/pipe-repl.out

STORAGE_DRIVER=minio
STORAGE_DRIVER=s3

# If you set STORAGE_DRIVER=s3, then fill the below envs
#
S3_ACCESS_KEY=key
S3_SECRET_KEY=secret
S3_ENDPOINT=
# Defaults below point to the local Garage from docker-compose (prefs/garage).
# For AWS S3: leave S3_ENDPOINT empty, set S3_FORCE_PATH_STYLE=false
#
S3_ACCESS_KEY=GK420ff84841bcd9d58d606e2e
S3_SECRET_KEY=451ca1503caa256a9491875800bb2fdf1eec356a5bc079c298b95f0fb13f1776
S3_ENDPOINT=http://127.0.0.1:9010
S3_BUCKET_NAME=samabucket
S3_REGION=us-east-1
S3_REGION=garage
S3_FORCE_PATH_STYLE=true

# If you set STORAGE_DRIVER=spaces, then fill the below envs
#
Expand All @@ -40,17 +44,6 @@ SPACES_ENDPOINT=127.0.0.1
SPACES_BUCKET_NAME=samabucket
SPACES_REGION=us-east-1

# If you set STORAGE_DRIVER=minio, then fill the below envs
#
MINIO_ROOT_USER=e7walulcatDu7waekVSk
MINIO_ROOT_PASSWORD=PYiRFiqUljLFRdKvwnVQ
MINIO_ACCESS_KEY=hJZWjTyRnxkvcu2gQS5m
MINIO_SECRET_KEY=k4QiBO1i8GZSP69U8CnImqhHhAQJGHWl8PKDJRXJ
MINIO_ENDPOINT=127.0.0.1
MINIO_BUCKET_NAME=samabucket
MINIO_PORT=9010
MINIO_USE_SSL=false

CONVERSATION_MAX_PARTICIPANTS=50
CONVERSATION_PRELOAD_COUNT=30
MESSAGE_PRELOAD_COUNT=30
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
- name: Run tests single node
run: docker compose exec sama-server sh -c "MONGODB_URL=mongodb://172.25.0.4/samatests npm run test"

- name: Run tests cluster
run: docker compose exec sama-server sh -c "MONGODB_URL=mongodb://172.25.0.4/samatests npm run test:cluster"

- name: Stop the SAMA resources
if: always()
run: docker compose -f docker-compose-full.yml down -v --rmi all
2 changes: 1 addition & 1 deletion APIs/XMPP
Submodule XMPP updated from 37cb4a to cb894f
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.37.3

### Updated

- use `garage` instead of `minio` for file storage

## 0.37.2

### Features
Expand Down
9 changes: 1 addition & 8 deletions app/config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,13 @@ const CONFIG = {
driver: process.env.STORAGE_DRIVER ?? "s3",
uploadUrlExpiresIn: process.env.FILE_UPLOAD_URL_EXPIRES_IN,
downloadUrlExpiresIn: process.env.FILE_DOWNLOAD_URL_EXPIRES_IN,
minio: {
key: process.env.MINIO_ACCESS_KEY,
secret: process.env.MINIO_SECRET_KEY,
endpoint: process.env.MINIO_ENDPOINT || null,
bucket: process.env.MINIO_BUCKET_NAME,
port: process.env.MINIO_PORT ?? 9010,
useSSL: process.env.MINIO_USE_SSL === CONSTANTS.ENV_TRUE,
},
s3: {
key: process.env.S3_ACCESS_KEY,
secret: process.env.S3_SECRET_KEY,
endpoint: process.env.S3_ENDPOINT || null,
bucket: process.env.S3_BUCKET_NAME,
region: process.env.S3_REGION ?? "us-east-1",
forcePathStyle: process.env.S3_FORCE_PATH_STYLE === CONSTANTS.ENV_TRUE,
},
spaces: {
key: process.env.SPACES_ACCESS_KEY,
Expand Down
4 changes: 1 addition & 3 deletions app/providers/services/storage/clients/Provider.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import config from "../../../../config/index.js"

import MinioStorageClient from "./minio.js"
import S3StorageClient from "./s3.js"
import SpacerStorageClient from "./spaces.js"

Expand All @@ -9,8 +8,7 @@ import RegisterProvider from "../../../../common/RegisterProvider.js"
const name = "StorageDriverClient"
const storageDriverName = config.get("storage.driver")

const StorageDriverClient =
storageDriverName === "minio" ? MinioStorageClient : storageDriverName === "spaces" ? SpacerStorageClient : S3StorageClient
const StorageDriverClient = storageDriverName === "spaces" ? SpacerStorageClient : S3StorageClient

class StorageDriverClientRegisterProvider extends RegisterProvider {
register(slc) {
Expand Down
35 changes: 0 additions & 35 deletions app/providers/services/storage/clients/minio.js

This file was deleted.

1 change: 1 addition & 0 deletions app/providers/services/storage/clients/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class S3StorageClient extends BaseStorageClient {
},
endpoint: this.config.get("storage.s3.endpoint"),
region: this.config.get("storage.s3.region"),
forcePathStyle: this.config.get("storage.s3.forcePathStyle"),
})

this.bucketName = this.config.get("storage.s3.bucket")
Expand Down
25 changes: 10 additions & 15 deletions docker-compose-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ services:
volumes:
- ./.env.docker:/app/.env
environment:
- MINIO_ENDPOINT=${MINIO_ENDPOINT:-172.25.0.2}
- MINIO_PORT=${MINIO_PORT:-9000}
- S3_ENDPOINT=${S3_ENDPOINT:-http://172.25.0.2:9000}

sama-push-daemon:
build:
Expand Down Expand Up @@ -96,26 +95,26 @@ services:
- ./prefs/server-dashboard/.env.server-dashboard:/app/.env

s3:
image: minio/minio
image: dxflrs/garage:v2.4.1
networks:
sama_network:
ipv4_address: 172.25.0.2
ports:
- "9011:9001"
- "9011:3903"
- "9010:9000"
volumes:
- data:/data
- data:/var/lib/garage
- ./prefs/garage/garage.toml:/etc/garage.toml:ro
env_file:
- ./.env.docker
command: server --address 0.0.0.0:9000 --console-address :9001 /data
healthcheck:
test: ["CMD", "mc", "ready", "local"]
test: ["CMD", "/garage", "status"]
interval: 30s
timeout: 20s
retries: 3

s3-service:
image: minio/mc
image: curlimages/curl
networks:
sama_network:
ipv4_address: 172.25.0.3
Expand All @@ -124,13 +123,9 @@ services:
condition: service_healthy
env_file:
- ./.env.docker
entrypoint: >
/bin/sh -c "
/usr/bin/mc alias set sama http://s3:9000 $${MINIO_ROOT_USER} $${MINIO_ROOT_PASSWORD};
/usr/bin/mc mb sama/samabucket;
/usr/bin/mc policy set public sama/samabucket;
/usr/bin/mc admin user svcacct add --access-key $${MINIO_ACCESS_KEY} --secret-key $${MINIO_SECRET_KEY} sama $${MINIO_ROOT_USER}
"
volumes:
- ./prefs/garage/init.sh:/init.sh:ro
entrypoint: ["/bin/sh", "/init.sh"]

mongo:
image: mongo:6.0.11
Expand Down
Loading
Loading