diff --git a/.gitignore b/.gitignore index 01d90e8..e20f53b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ -letsencrypt/ \ No newline at end of file +letsencrypt/ +nginx/docker-compose.yaml +traefik/docker-compose.yaml +compose.yaml +nginx.conf \ No newline at end of file diff --git a/nginx/setup.sh b/nginx/setup.sh index 39f1cf0..12f5fe6 100755 --- a/nginx/setup.sh +++ b/nginx/setup.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash read -p "Enter the domain name: " DOMAIN_NAME if [ -z "$DOMAIN_NAME" ]; then @@ -30,16 +30,17 @@ case "$NGINX_BEHIND_SSL" in esac -export HULY_VERSION="v0.6.245" -export SERVER_ADDRESS=$DOMAIN_NAME +export HULY_VERSION="v0.6.295" export NGINX_SERVICE_PORT=$NGINX_SERVICE_PORT export NGINX_HTTP_SCHEME=$NGINX_HTTP_SCHEME export NGINX_WS_SCHEME=$NGINX_WS_SCHEME +export SERVER_ADDRESS="${DOMAIN_NAME}:${NGINX_SERVICE_PORT}" + # $(openssl rand -hex 32) -export HULY_SECRET="c37fef1f157efe09785844215225ee3d1ab8086eb822055d5aa1bdedc72921bd" +export HULY_SECRET="secret" # replace the domain name and email address in the docker-compose file -envsubst < template-compose.yml > docker-compose.yml +envsubst < template-compose.yaml > docker-compose.yaml echo -e "\033[1;32mSetup is complete!\033[0m" diff --git a/nginx/docker-compose.yml b/nginx/template-compose.yaml similarity index 62% rename from nginx/docker-compose.yml rename to nginx/template-compose.yaml index 7d5c98d..7be25ce 100644 --- a/nginx/docker-compose.yml +++ b/nginx/template-compose.yaml @@ -2,7 +2,7 @@ services: nginx: image: "nginx:1.21.3" ports: - - "8080:80" + - "${NGINX_SERVICE_PORT}:80" volumes: - ./huly.nginx:/etc/nginx/conf.d/default.conf restart: unless-stopped @@ -54,9 +54,9 @@ services: - internal-services rekoni: - image: hardcoreeng/rekoni-service:v0.6.245 + image: hardcoreeng/rekoni-service:${HULY_VERSION} environment: - - SECRET=c37fef1f157efe09785844215225ee3d1ab8086eb822055d5aa1bdedc72921bd + - SECRET=${HULY_SECRET} deploy: resources: limits: @@ -67,25 +67,22 @@ services: - nginx-public transactor: - image: hardcoreeng/transactor:v0.6.245 + image: hardcoreeng/transactor:${HULY_VERSION} environment: - SERVER_PORT=3333 - - SERVER_SECRET=c37fef1f157efe09785844215225ee3d1ab8086eb822055d5aa1bdedc72921bd + - SERVER_SECRET=${HULY_SECRET} - SERVER_CURSOR_MAXTIMEMS=30000 - ELASTIC_URL=http://elastic:9200 - ELASTIC_INDEX_NAME=huly_storage_index - MONGO_URL=mongodb://mongodb:27017 - METRICS_CONSOLE=false - METRICS_FILE=metrics.txt - - MINIO_ENDPOINT=minio - - MINIO_ACCESS_KEY=minioadmin - - MINIO_SECRET_KEY=minioadmin + - STORAGE_CONFIG=minio|minio?accessKey=minioadmin&secretKey=minioadmin - REKONI_URL=http://rekoni:4004 - FRONT_URL=http://localhost:8087 - - SERVER_PROVIDER=wss - ACCOUNTS_URL=http://account:3000 - LAST_NAME_FIRST=true - - UPLOAD_URL=https://example.com/files + - UPLOAD_URL=${NGINX_HTTP_SCHEME}://${SERVER_ADDRESS}/files restart: unless-stopped networks: - internal-services @@ -93,35 +90,27 @@ services: collaborator: - image: hardcoreeng/collaborator:v0.6.245 + image: hardcoreeng/collaborator:${HULY_VERSION} environment: - COLLABORATOR_PORT=3078 - - SECRET=c37fef1f157efe09785844215225ee3d1ab8086eb822055d5aa1bdedc72921bd + - SECRET=${HULY_SECRET} - ACCOUNTS_URL=http://account:3000 - - TRANSACTOR_URL=ws://transactor:3333 - - UPLOAD_URL=/files - MONGO_URL=mongodb://mongodb:27017 - - MINIO_ENDPOINT=minio - - MINIO_ACCESS_KEY=minioadmin - - MINIO_SECRET_KEY=minioadmin + - STORAGE_CONFIG=minio|minio?accessKey=minioadmin&secretKey=minioadmin restart: unless-stopped networks: - internal-services - nginx-public account: - image: hardcoreeng/account:v0.6.245 + image: hardcoreeng/account:${HULY_VERSION} environment: - SERVER_PORT=3000 - - SERVER_SECRET=c37fef1f157efe09785844215225ee3d1ab8086eb822055d5aa1bdedc72921bd + - SERVER_SECRET=${HULY_SECRET} - MONGO_URL=mongodb://mongodb:27017 - - TRANSACTOR_URL=ws://transactor:3333 - - ENDPOINT_URL=${wss}://example.com/_transactor # this is the transactor endpoint - - MINIO_ENDPOINT=minio - - MINIO_ACCESS_KEY=minioadmin - - MINIO_SECRET_KEY=minioadmin + - TRANSACTOR_URL=ws://transactor:3333;${NGINX_WS_SCHEME}://${SERVER_ADDRESS}/_transactor + - STORAGE_CONFIG=minio|minio?accessKey=minioadmin&secretKey=minioadmin - FRONT_URL=http://front:8080 - - INIT_WORKSPACE=demo-tracker - MODEL_ENABLED=* - ACCOUNTS_URL=http://localhost:3000 - ACCOUNT_PORT=3000 @@ -130,24 +119,35 @@ services: - internal-services - nginx-public + workspace: + image: hardcoreeng/workspace:${HULY_VERSION} + environment: + - SERVER_SECRET=${HULY_SECRET} + - MONGO_URL=mongodb://mongodb:27017 + - TRANSACTOR_URL=ws://transactor:3333;${NGINX_WS_SCHEME}://${SERVER_ADDRESS}/_transactor + - STORAGE_CONFIG=minio|minio?accessKey=minioadmin&secretKey=minioadmin + - MODEL_ENABLED=* + - ACCOUNTS_URL=http://account:3000 + - NOTIFY_INBOX_ONLY=true + restart: unless-stopped + networks: + - internal-services + - nginx-public + front: - image: hardcoreeng/front:v0.6.245 + image: hardcoreeng/front:${HULY_VERSION} environment: - SERVER_PORT=8080 - - SERVER_SECRET=c37fef1f157efe09785844215225ee3d1ab8086eb822055d5aa1bdedc72921bd - - ACCOUNTS_URL=https://example.com/_accounts - - REKONI_URL=https://example.com/_rekoni - - CALENDAR_URL=https://example.com:8095 - - GMAIL_URL=https://example.com:8088 - - TELEGRAM_URL=https://example.com:8086 + - SERVER_SECRET=${HULY_SECRET} + - ACCOUNTS_URL=${NGINX_HTTP_SCHEME}://${SERVER_ADDRESS}/_accounts + - REKONI_URL=${NGINX_HTTP_SCHEME}://${SERVER_ADDRESS}/_rekoni + - CALENDAR_URL=${NGINX_HTTP_SCHEME}://${SERVER_ADDRESS}/_calendar + - GMAIL_URL=${NGINX_HTTP_SCHEME}://${SERVER_ADDRESS}/_gmail + - TELEGRAM_URL=${NGINX_HTTP_SCHEME}://${SERVER_ADDRESS}/_telegram - UPLOAD_URL=/files - - TRANSACTOR_URL=${wss}://example.com/_transactor - ELASTIC_URL=http://elastic:9200 - - COLLABORATOR_URL=${wss}://example.com/_collaborator - - COLLABORATOR_API_URL=https://example.com/_collaborator - - MINIO_ENDPOINT=minio - - MINIO_ACCESS_KEY=minioadmin - - MINIO_SECRET_KEY=minioadmin + - COLLABORATOR_URL=${NGINX_WS_SCHEME}://${SERVER_ADDRESS}/_collaborator + - STORAGE_CONFIG=minio|minio?accessKey=minioadmin&secretKey=minioadmin - MONGO_URL=mongodb://mongodb:27017 - TITLE=Huly Self Host - DEFAULT_LANGUAGE=en diff --git a/setup.sh b/setup.sh index 1f42cda..8d2e5a0 100755 --- a/setup.sh +++ b/setup.sh @@ -1,5 +1,8 @@ -#!/bin/sh +#!/usr/bin/env bash + export SERVER_ADDRESS="$1" +export HULY_SECRET="secret" + echo "Setting Huly Server Address: $SERVER_ADDRESS" envsubst < template.conf > nginx.conf envsubst < template.env > .env diff --git a/template.compose.yaml b/template.compose.yaml index babe3e4..e14c65a 100644 --- a/template.compose.yaml +++ b/template.compose.yaml @@ -50,7 +50,7 @@ services: - 3000:3000 environment: - SERVER_PORT=3000 - - SERVER_SECRET=secret + - SERVER_SECRET=${HULY_SECRET} - MONGO_URL=mongodb://mongodb:27017 - TRANSACTOR_URL=ws://transactor:3333;ws://${SERVER_ADDRESS}:3333 - STORAGE_CONFIG=minio|minio?accessKey=minioadmin&secretKey=minioadmin @@ -65,7 +65,7 @@ services: - mongodb - minio environment: - - SERVER_SECRET=secret + - SERVER_SECRET=${HULY_SECRET} - MONGO_URL=mongodb://mongodb:27017 - TRANSACTOR_URL=ws://transactor:3333;ws://${SERVER_ADDRESS}:3333 - STORAGE_CONFIG=minio|minio?accessKey=minioadmin&secretKey=minioadmin @@ -85,7 +85,7 @@ services: - 8087:8080 environment: - SERVER_PORT=8080 - - SERVER_SECRET=secret + - SERVER_SECRET=${HULY_SECRET} - ACCOUNTS_URL=http://${SERVER_ADDRESS}:3000 - REKONI_URL=http://${SERVER_ADDRESS}:4004 - CALENDAR_URL=http://${SERVER_ADDRESS}:8095 @@ -110,7 +110,7 @@ services: - 3078:3078 environment: - COLLABORATOR_PORT=3078 - - SECRET=secret + - SECRET=${HULY_SECRET} - ACCOUNTS_URL=http://account:3000 - MONGO_URL=mongodb://mongodb:27017 - STORAGE_CONFIG=minio|minio?accessKey=minioadmin&secretKey=minioadmin @@ -121,13 +121,12 @@ services: - mongodb - elastic - minio - - rekoni - account ports: - 3333:3333 environment: - SERVER_PORT=3333 - - SERVER_SECRET=secret + - SERVER_SECRET=${HULY_SECRET} - SERVER_CURSOR_MAXTIMEMS=30000 - ELASTIC_URL=http://elastic:9200 - ELASTIC_INDEX_NAME=huly_storage_index @@ -137,7 +136,6 @@ services: - STORAGE_CONFIG=minio|minio?accessKey=minioadmin&secretKey=minioadmin - REKONI_URL=http://rekoni:4004 - FRONT_URL=http://${SERVER_ADDRESS}:8087 - - SERVER_PROVIDER=ws - ACCOUNTS_URL=http://account:3000 - LAST_NAME_FIRST=true restart: unless-stopped @@ -146,7 +144,7 @@ services: ports: - 4004:4004 environment: - - SECRET=secret + - SECRET=${HULY_SECRET} deploy: resources: limits: diff --git a/template.conf b/template.conf index 471781c..a1a5fd6 100644 --- a/template.conf +++ b/template.conf @@ -3,7 +3,7 @@ server { listen [::]:80; server_name ${SERVER_ADDRESS}; - + location / { proxy_pass http://localhost:8087; include proxy_params; diff --git a/traefik/README.md b/traefik/README.md index 5a950c7..55d257a 100644 --- a/traefik/README.md +++ b/traefik/README.md @@ -30,7 +30,7 @@ Setup is complete. Run 'docker compose up -d' to start the services. ``` -4. Modify the `docker-compose.yml` file to customize any settings +4. Modify the `docker-compose.yaml` file to customize any settings 5. Start the services diff --git a/traefik/docker-compose.yml b/traefik/docker-compose.yml deleted file mode 100644 index dc96f8b..0000000 --- a/traefik/docker-compose.yml +++ /dev/null @@ -1,242 +0,0 @@ -services: - traefik: - restart: unless-stopped - image: "traefik:v2.10" - container_name: "traefik" - ports: - - "80:80" - - "443:443" - - "3333:3333" - - "3078:3078" - volumes: - - "/var/run/docker.sock:/var/run/docker.sock:ro" - - ./letsencrypt:/letsencrypt - networks: - - traefik-public - command: - - "--log.level=DEBUG" # set to INFO for production - - "--api.insecure=false" - - "--api.dashboard=true" - - "--global.sendAnonymousUsage=false" - - "--global.checkNewVersion=false" - - "--providers.docker=true" - - "--providers.docker.exposedbydefault=false" - - "--providers.docker.network=traefik-public" - - "--entrypoints.web.address=:80" - - "--entrypoints.websecure.address=:443" - - "--entrypoints.transactor.address=:3333" # for transactor wss - - "--entrypoints.collaborator.address=:3078" # for collaborator wss - - "--entrypoints.web.http.redirections.entryPoint.to=websecure" - - "--entrypoints.web.http.redirections.entryPoint.scheme=https" - - "--certificatesresolvers.myresolver.acme.email=admin@example.com" - - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json" - - "--certificatesresolvers.myresolver.acme.tlschallenge=true" - - "--certificatesresolvers.myresolver.acme.caserver=http://acme-staging-v02.api.letsencrypt.org/directory" # For testing, comment out for production - labels: - - "traefik.enable=true" - - "traefik.http.routers.traefik.rule=Host(`example.com`) && (PathPrefix(`/api`) || PathPrefix(`/traefik`))" - - "traefik.http.routers.traefik.service=api@internal" - - "traefik.http.routers.traefik.entrypoints=websecure" - # strip prefix for traefik dashboard - - "traefik.http.routers.traefik.middlewares=strip-prefix-traefik" - - "traefik.http.middlewares.strip-prefix-traefik.stripprefix.prefixes=/traefik" - - "traefik.http.routers.traefik.tls=true" - - "traefik.http.routers.traefik.tls.certresolver=myresolver" - - mongodb: - image: "mongo:7-jammy" - container_name: mongodb - environment: - - PUID=1000 - - PGID=1000 - volumes: - - db:/data/db - restart: unless-stopped - networks: - - internal-services - - elastic: - image: "elasticsearch:7.14.2" - command: | - /bin/sh -c "./bin/elasticsearch-plugin list | grep -q ingest-attachment || yes | ./bin/elasticsearch-plugin install --silent ingest-attachment; - /usr/local/bin/docker-entrypoint.sh eswrapper" - volumes: - - elastic:/usr/share/elasticsearch/data - environment: - - ELASTICSEARCH_PORT_NUMBER=9200 - - BITNAMI_DEBUG=true - - discovery.type=single-node - - ES_JAVA_OPTS=-Xms1024m -Xmx1024m - - http.cors.enabled=true - - http.cors.allow-origin=http://localhost:8082 - healthcheck: - interval: 20s - retries: 10 - test: curl -s http://localhost:9200/_cluster/health | grep -vq '"status":"red"' - restart: unless-stopped - networks: - - internal-services - - minio: - image: "minio/minio" - command: server /data --address ":9000" --console-address ":9001" - volumes: - - files:/data - restart: unless-stopped - networks: - - internal-services - - rekoni: - image: hardcoreeng/rekoni-service:v0.6.245 - environment: - - SECRET=secret - deploy: - resources: - limits: - memory: 500M - restart: unless-stopped - networks: - - internal-services - - traefik-public - labels: - - "traefik.enable=true" - - "traefik.http.routers.rekoni.entrypoints=websecure" - - "traefik.http.services.rekoni.loadbalancer.server.port=4004" - - "traefik.http.routers.rekoni.rule=Host(`example.com`) && PathPrefix(`/rekoni`)" - - "traefik.http.routers.rekoni.middlewares=rekoni-stripprefix" - - "traefik.http.middlewares.rekoni-stripprefix.stripprefix.prefixes=/rekoni" - - "traefik.http.routers.rekoni.tls=true" - - "traefik.http.routers.rekoni.tls.certresolver=myresolver" - - transactor: - image: hardcoreeng/transactor:v0.6.245 - environment: - - SERVER_PORT=3333 - - SERVER_SECRET=secret - - SERVER_CURSOR_MAXTIMEMS=30000 - - ELASTIC_URL=http://elastic:9200 - - ELASTIC_INDEX_NAME=huly_storage_index - - MONGO_URL=mongodb://mongodb:27017 - - METRICS_CONSOLE=false - - METRICS_FILE=metrics.txt - - MINIO_ENDPOINT=minio - - MINIO_ACCESS_KEY=minioadmin - - MINIO_SECRET_KEY=minioadmin - - REKONI_URL=http://rekoni:4004 - - FRONT_URL=http://localhost:8087 - - SERVER_PROVIDER=wss - - ACCOUNTS_URL=http://account:3000 - - LAST_NAME_FIRST=true - - UPLOAD_URL=https://example.com/files - restart: unless-stopped - networks: - - internal-services - - traefik-public - labels: - - "traefik.enable=true" - - "traefik.http.routers.transactor.entrypoints=transactor" - - "traefik.http.routers.transactor.rule=Host(`example.com`)" - - "traefik.http.services.transactor.loadbalancer.server.port=3333" - - "traefik.http.routers.transactor.tls=true" - - "traefik.http.routers.transactor.tls.certresolver=myresolver" - - - collaborator: - image: hardcoreeng/collaborator:v0.6.245 - environment: - - COLLABORATOR_PORT=3078 - - SECRET=secret - - ACCOUNTS_URL=http://account:3000 - - TRANSACTOR_URL=ws://transactor:3333 - - UPLOAD_URL=/files - - MONGO_URL=mongodb://mongodb:27017 - - MINIO_ENDPOINT=minio - - MINIO_ACCESS_KEY=minioadmin - - MINIO_SECRET_KEY=minioadmin - restart: unless-stopped - networks: - - internal-services - - traefik-public - labels: - - "traefik.enable=true" - - "traefik.http.routers.collaborator.entrypoints=collaborator" - - "traefik.http.services.collaborator.loadbalancer.server.port=3078" - - "traefik.http.routers.collaborator.rule=Host(`example.com`)" - - "traefik.http.routers.collaborator.tls=true" - - "traefik.http.routers.collaborator.tls.certresolver=myresolver" - - account: - image: hardcoreeng/account:v0.6.245 - environment: - - SERVER_PORT=3000 - - SERVER_SECRET=secret - - MONGO_URL=mongodb://mongodb:27017 - - TRANSACTOR_URL=ws://transactor:3333 - - ENDPOINT_URL=wss://example.com:3333 # this is the transactor endpoint - - MINIO_ENDPOINT=minio - - MINIO_ACCESS_KEY=minioadmin - - MINIO_SECRET_KEY=minioadmin - - FRONT_URL=http://front:8080 - - INIT_WORKSPACE=demo-tracker - - MODEL_ENABLED=* - - ACCOUNTS_URL=http://localhost:3000 - - ACCOUNT_PORT=3000 - restart: unless-stopped - networks: - - internal-services - - traefik-public - labels: - - "traefik.enable=true" - - "traefik.http.routers.account.entrypoints=websecure" - - "traefik.http.services.account.loadbalancer.server.port=3000" - - "traefik.http.routers.account.rule=Host(`example.com`) && PathPrefix(`/accounts`)" - - "traefik.http.routers.account.middlewares=account-stripprefix" - - "traefik.http.middlewares.account-stripprefix.stripprefix.prefixes=/accounts" - - "traefik.http.routers.account.tls=true" - - "traefik.http.routers.account.tls.certresolver=myresolver" - - front: - image: hardcoreeng/front:v0.6.245 - environment: - - SERVER_PORT=8080 - - SERVER_SECRET=secret - - ACCOUNTS_URL=https://example.com/accounts - - REKONI_URL=https://example.com/rekoni - - CALENDAR_URL=https://example.com:8095 - - GMAIL_URL=https://example.com:8088 - - TELEGRAM_URL=https://example.com:8086 - - UPLOAD_URL=/files - - TRANSACTOR_URL=wss://example.com:3333 - - ELASTIC_URL=http://elastic:9200 - - COLLABORATOR_URL=wss://example.com:3078 - - COLLABORATOR_API_URL=https://example.com:3078 - - MINIO_ENDPOINT=minio - - MINIO_ACCESS_KEY=minioadmin - - MINIO_SECRET_KEY=minioadmin - - MONGO_URL=mongodb://mongodb:27017 - - TITLE=Huly Self Host - - DEFAULT_LANGUAGE=en - - LAST_NAME_FIRST=true - restart: unless-stopped - networks: - - internal-services - - traefik-public - labels: - - "traefik.enable=true" - - "traefik.http.routers.front.entrypoints=websecure" - - "traefik.http.services.front.loadbalancer.server.port=8080" - - "traefik.http.routers.front.rule=Host(`example.com`)" - - "traefik.http.routers.front.tls=true" - - "traefik.http.routers.front.tls.certresolver=myresolver" - -networks: - traefik-public: - name: traefik-public - internal-services: - name: internal-services - -volumes: - db: - letsencrypt: - elastic: - files: diff --git a/traefik/template-compose.yml b/traefik/template-compose.yaml similarity index 100% rename from traefik/template-compose.yml rename to traefik/template-compose.yaml