Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

compose changes to optionally enable tls

Ahmed Essamed2600abb1e5
diff --git a/.env.compose.example b/.env.compose.example
index 21072434..38d32aec 100644
--- a/.env.compose.example
+++ b/.env.compose.example
@@ -12,11 +12,12 @@ DATABASE_NAME=smythos-local
DATABASE_URL="$DATABASE_PROVIDER://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOST:3306/$DATABASE_NAME?allowPublicKeyRetrieval=true&useSSL=false"
APP_DOMAIN="localhost"
-APP_URL="https://$APP_DOMAIN" # Expansion of the APP_DOMAIN variable
+APP_URL="http://$APP_DOMAIN" # Expansion of the APP_DOMAIN variable
RUNTIME_DOMAIN="runtime.localhost"
-RUNTIME_URL="https://$RUNTIME_DOMAIN" # Expansion of the RUNTIME_DOMAIN variable
+RUNTIME_URL="http://$RUNTIME_DOMAIN" # Expansion of the RUNTIME_DOMAIN variable
DEFAULT_AGENT_DOMAIN="default.localhost"
PROD_AGENT_DOMAIN="prod.localhost"
+AGENT_DOMAIN_PORT="80" # remove this when using https (IMPORTANT)
MIDDLEWARE_API_PORT="5000"
RUNTIME_PORT="5053"
@@ -38,4 +39,5 @@ SESSION_SECRET=session_secret
EXPOSE_TRAEFIK_PORT="80"
EXPOSE_HTTPS_TRAEFIK_PORT="443"
DATABASE_ROOT_PASSWORD=smythos_root_password # used for creating root user for docker db
\ No newline at end of file
+ENABLE_TLS=false
\ No newline at end of file
diff --git a/DOCKER_COMPOSE.md b/DOCKER_COMPOSE.md
index bac31771..fcf3e5ba 100644
--- a/DOCKER_COMPOSE.md
+++ b/DOCKER_COMPOSE.md
@@ -152,15 +152,18 @@ docker run -d \
The docker compose setup includes automatic SSL certificate generation via Let's Encrypt:
-1. **Configure your domains** in `.env`:
+1. **Configure your domains & tls configuration** in `.env`:
```env
- APP_DOMAIN=http://yourdomain.com
- RUNTIME_DOMAIN=http://runtime.yourdomain.com
+ APP_DOMAIN=https://yourdomain.com
+ RUNTIME_DOMAIN=https://runtime.yourdomain.com
DEFAULT_AGENT_DOMAIN=dev.yourdomain.com
PROD_AGENT_DOMAIN=live.yourdomain.com
+ ENABLE_TLS=true
```
+ + remove the `AGENT_DOMAIN_PORT` variable
+
2. **Ensure DNS records** point to your server:
```
yourdomain.com A YOUR_SERVER_IP
diff --git a/Dockerfile b/Dockerfile
index 223cadfe..af0faacc 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -13,7 +13,7 @@ RUN apk add --no-cache \
WORKDIR /app
# Copy root package files
-COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .env ./
+COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
# Copy TypeScript config
COPY tsconfig.json ./
diff --git a/README.md b/README.md
index 93711ce3..7c58d6e0 100644
--- a/README.md
+++ b/README.md
@@ -174,7 +174,7 @@ We welcome contributions from the community! Whether you're fixing bugs, adding
## Contributors
-<a href="https://github.com/SmythOS/smythos-ui/graphs/contributors">
+<a href="https://github.com/SmythOS/smythos-studio/graphs/contributors">
<img src="https://contrib.rocks/image?repo=SmythOS/smythos-studio" />
</a>
diff --git a/docker-compose.yml b/docker-compose.yml
index a5f409f2..3734b501 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -16,13 +16,13 @@ services:
- --api.insecure=true
# Enable access logs (optional)
- --accesslog=true
- # Configure Let's Encrypt for automatic SSL (optional)
+ # Configure Let's Encrypt for automatic SSL (configured but only used when ENABLE_TLS=true)
- "--certificatesresolvers.le.acme.email=${LETSENCRYPT_EMAIL:[email protected]}"
- "--certificatesresolvers.le.acme.storage=/letsencrypt/acme.json"
- "--certificatesresolvers.le.acme.httpchallenge.entrypoint=web"
# Global redirect from HTTP to HTTPS (optional)
- - "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- - "--entrypoints.web.http.redirections.entryPoint.scheme=https"
+ # - "--entrypoints.web.http.redirections.entryPoint.to=websecure"
+ # - "--entrypoints.web.http.redirections.entryPoint.scheme=https"
ports:
- "${EXPOSE_TRAEFIK_PORT:-80}:80"
- "${EXPOSE_HTTPS_TRAEFIK_PORT:-443}:443"
@@ -134,7 +134,8 @@ services:
- "traefik.http.routers.smythos-app.entrypoints=web,websecure"
- "traefik.http.routers.smythos-app.service=smythos-app"
- "traefik.http.routers.smythos-app.middlewares=smythos@docker"
- - "traefik.http.routers.smythos-app.tls=true"
+ # TLS configuration (only enable for production with real domains)
+ - "traefik.http.routers.smythos-app.tls=${ENABLE_TLS:-false}"
- "traefik.http.routers.smythos-app.tls.certresolver=le"
@@ -142,11 +143,12 @@ services:
# Service definition
- "traefik.http.services.smythos-app.loadbalancer.server.port=5050"
- # Only create routes if RUNTIME_DOMAIN is set
+ # RUNTIME_DOMAIN routing to port 5053 (Runtime Server)
- "traefik.http.routers.smythos-runtime.rule=Host(`${RUNTIME_DOMAIN:-runtime.localhost}`)"
- "traefik.http.routers.smythos-runtime.entrypoints=web,websecure"
- "traefik.http.routers.smythos-runtime.service=smythos-runtime"
- - "traefik.http.routers.smythos-runtime.tls=true"
+ # TLS configuration (only enable for production with real domains)
+ - "traefik.http.routers.smythos-runtime.tls=${ENABLE_TLS:-false}"
- "traefik.http.routers.smythos-runtime.tls.certresolver=le"
- "traefik.http.services.smythos-runtime.loadbalancer.server.port=5053"
@@ -154,14 +156,16 @@ services:
- "traefik.http.routers.smythos-prod-agents.rule=Host(`${PROD_AGENT_DOMAIN:-prod.localhost}`) || HostRegexp(`^.+\\.${PROD_AGENT_DOMAIN:-prod\\.localhost}$$`)"
- "traefik.http.routers.smythos-prod-agents.entrypoints=web,websecure"
- "traefik.http.routers.smythos-prod-agents.service=smythos-runtime"
- - "traefik.http.routers.smythos-prod-agents.tls=true"
+ # TLS configuration (only enable for production with real domains)
+ - "traefik.http.routers.smythos-prod-agents.tls=${ENABLE_TLS:-false}"
- "traefik.http.routers.smythos-prod-agents.tls.certresolver=le"
# DEFAULT_AGENT_DOMAIN routing to port 5053 (Default/Development Agents)
- "traefik.http.routers.smythos-default-agents.rule=Host(`${DEFAULT_AGENT_DOMAIN:-default.localhost}`) || HostRegexp(`^.+\\.${DEFAULT_AGENT_DOMAIN:-default\\.localhost}$$`)"
- "traefik.http.routers.smythos-default-agents.entrypoints=web,websecure"
- "traefik.http.routers.smythos-default-agents.service=smythos-runtime"
- - "traefik.http.routers.smythos-default-agents.tls=true"
+ # TLS configuration (only enable for production with real domains)
+ - "traefik.http.routers.smythos-default-agents.tls=${ENABLE_TLS:-false}"
- "traefik.http.routers.smythos-default-agents.tls.certresolver=le"
# Security Headers Middleware
diff --git a/packages/runtime/src/core/middlewares/cors.mw.ts b/packages/runtime/src/core/middlewares/cors.mw.ts
index f51e9021..369f4f3b 100644
--- a/packages/runtime/src/core/middlewares/cors.mw.ts
+++ b/packages/runtime/src/core/middlewares/cors.mw.ts
@@ -3,7 +3,9 @@ import cors from 'cors';
import config from '@core/config';
// Minimal CORS - allow everything in development, configurable for production
-const allowedDomains = [config.env.PROD_AGENT_DOMAIN, config.env.UI_SERVER, config.env.DEFAULT_AGENT_DOMAIN, config.env.BASE_URL];
+const embDomainsScheme = process.env.ENABLE_TLS ? 'https' : 'http';
+const embDomains = [config.env.PROD_AGENT_DOMAIN, config.env.DEFAULT_AGENT_DOMAIN].map(domain => `${embDomainsScheme}://${domain}`);
+const allowedDomains = [...embDomains, config.env.UI_SERVER, config.env.BASE_URL];
const corsOptions: cors.CorsOptions = {
origin: process.env.NODE_ENV === 'production' ? allowedDomains : true,
credentials: true,
diff --git a/packages/runtime/src/modules/embodiment/middlewares/cors.mw.ts b/packages/runtime/src/modules/embodiment/middlewares/cors.mw.ts
index 3cbd727d..c3242b7e 100644
--- a/packages/runtime/src/modules/embodiment/middlewares/cors.mw.ts
+++ b/packages/runtime/src/modules/embodiment/middlewares/cors.mw.ts
@@ -13,7 +13,7 @@ const corsOptionsDelegate = async (req, callback) => {
const embodimentType = req.originalUrl.includes('form-preview') ? EMBODIMENT_TYPES.FormPreview : EMBODIMENT_TYPES.ChatBot;
// default origins are the origins that are allowed to make requests to the server
- const defaultOrigins = [config.env.UI_SERVER];
+ const defaultOrigins = [config.env.UI_SERVER, 'http://localhost', 'https://localhost'];
let agentAllowedDomains = []; // agent allowed domains are the origins that user has specified in the embodiment configuration
const allAllowedOrigins = [...defaultOrigins];