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.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
env expand feat & config changes
Ahmed Essamc9d22dcff13d
diff --git a/.env.example b/.env.exampleindex 46af653f..c3ccccd3 100644--- a/.env.example+++ b/.env.example@@ -1,17 +1,20 @@-# Shared-OPENAI_API_KEY="openai-api-key"NODE_ENV="development"+DATABASE_PROVIDER=mysql+DATABASE_HOST=localhost+DATABASE_USER=root+DATABASE_PASSWORD=samplepassword111+DATABASE_NAME=smythos-local+# Expansion to build the database url (this entry is MANDATORY for Prisma to work)+DATABASE_URL="$DATABASE_PROVIDER://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOST:3306/$DATABASE_NAME?allowPublicKeyRetrieval=true&useSSL=false"+DEFAULT_AGENT_DOMAIN="localagent.stage.smyth.ai" # staging agents domain+PROD_AGENT_DOMAIN="localagent.stage.smyth.ai" # deployed / prod agent domain+APP_DOMAIN="http://localhost:5050"+RUNTIME_DOMAIN="http://localhost:5053"MIDDLEWARE_API_PORT="5000"-APP_PORT="4000"APP_DEV_SERVER_PORT="4001"RUNTIME_PORT="5053"-APP_DOMAIN="http://localhost:4000"-RUNTIME_DOMAIN="http://localhost:5053"---DATABASE_URL="mysql://username:password@localhost:3306/smythos-local?allowPublicKeyRetrieval=true&useSSL=false"-DEFAULT_AGENT_DOMAIN="localagent.stage.smyth.ai" # staging agents domain-PROD_AGENT_DOMAIN="localagent.stage.smyth.ai" # deployed / prod agent domain+APP_PORT="5050"+OPENAI_API_KEY="openai-api-key"diff --git a/.env.full.example b/.env.full.exampleindex 3378c0f2..3f16b197 100644--- a/.env.full.example+++ b/.env.full.example@@ -81,7 +81,17 @@ REQ_LIMIT_PER_MINUTE=MAX_CONCURRENT_REQUESTS=# Middleware API portMIDDLEWARE_API_PORT=++# Database provider+## options: mysql (will support more in the future)+DATABASE_PROVIDER=mysql+DATABASE_HOST=+DATABASE_USER=+DATABASE_PASSWORD=+DATABASE_NAME=# Database URL# Format: mysql://<username>:<password>@<host>:<port>/<database># Example: mysql://user:password@mysql:3306/smythos_db-DATABASE_URL=+# You can use the expansion to build the database url instead of re-defining the credentials+# Expansion example: mysql://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOST:3306/$DATABASE_NAME?allowPublicKeyRetrieval=true&useSSL=false+DATABASE_URL=$DATABASE_PROVIDER://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOST:3306/$DATABASE_NAME?allowPublicKeyRetrieval=true&useSSL=falsediff --git a/Dockerfile b/Dockerfileindex 480918e3..287a819e 100644--- a/Dockerfile+++ b/Dockerfile@@ -6,7 +6,8 @@ RUN apk add --no-cache \openssl \openssl-dev \libc6-compat \- ca-certificates+ ca-certificates \+ curl# Set working directoryWORKDIR /app@@ -43,11 +44,11 @@ RUN PRISMA_CLI_BINARY_TARGETS="linux-musl-openssl-3.0.x" pnpm run prisma:generatRUN mkdir -p /root && mkdir -p /root/smythos-data && echo '{}' > /root/smythos-data/vault.json-COPY docker-endpoint.sh /app/start.sh+COPY docker-entrypoint.sh /app/start.shRUN sed -i 's/\r$//' /app/start.sh && chmod +x /app/start.sh-# Expose only the app port-EXPOSE 4000+# Expose app port + runtime port+EXPOSE 5050 5053# Start the applicationCMD ["/app/start.sh"]diff --git a/docker-compose.yml b/docker-compose.ymlindex 20e887ce..b9ce7a91 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -11,26 +11,34 @@ services:MYSQL_DATABASE: smythos_dbMYSQL_USER: smythos_userMYSQL_PASSWORD: smythos_password- ports:- - "3306:3306"volumes:- mysql_data:/var/lib/mysqlnetworks:- smythos-networkcommand: --default-authentication-plugin=mysql_native_password+ healthcheck:+ test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-psmythos_root_password"]+ interval: 10s+ timeout: 5s+ retries: 5+ start_period: 30s# Redis Cacheredis:image: redis:7-alpinecontainer_name: smythos-redisrestart: unless-stopped- ports:- - "6379:6379"volumes:- redis_data:/datanetworks:- smythos-networkcommand: redis-server --appendonly yes+ healthcheck:+ test: ["CMD", "redis-cli", "ping"]+ interval: 10s+ timeout: 3s+ retries: 5+ start_period: 10s# SmythOS Applicationsmythos:@@ -40,7 +48,8 @@ services:container_name: smythos-apprestart: unless-stoppedports:- - "4000:4000"+ - "5050:5050"+ - "5053:5053"env_file:- .envenvironment:@@ -51,28 +60,23 @@ services:REDIS_PORT: 6379REDIS_SENTINEL_HOSTS: ""REDIS_MASTER_NAME: ""- OPENAI_API_KEY: '{YOUR_OPENAI_API_KEY}'- # Default port configurations (can be overridden by .env file)- MIDDLEWARE_API_PORT: ${MIDDLEWARE_API_PORT:-5000}- APP_PORT: ${APP_PORT:-4000}- APP_DEV_SERVER_PORT: ${APP_DEV_SERVER_PORT:-4001}- RUNTIME_PORT: ${RUNTIME_PORT:-5053}- APP_DOMAIN: ${APP_DOMAIN:-http://localhost:4000}- RUNTIME_DOMAIN: ${RUNTIME_DOMAIN:-http://localhost:5053}volumes:- smythos_data:/root/smythos-datanetworks:- smythos-networkdepends_on:- - mysql- - redis+ mysql:+ condition: service_healthy+ redis:+ condition: service_healthyhealthcheck:- test: ["CMD", "curl", "-f", "http://localhost:4000/health"]+ test: ["CMD", "sh", "-c", "wget --no-verbose --tries=1 --spider http://localhost:5050/health && wget --no-verbose --tries=1 --spider http://localhost:5053/health"]interval: 30stimeout: 10sretries: 3start_period: 60s+networks:smythos-network:diff --git a/docker-endpoint.sh b/docker-entrypoint.shsimilarity index 84%rename from docker-endpoint.shrename to docker-entrypoint.shindex bb0ea568..a78632ba 100644--- a/docker-endpoint.sh+++ b/docker-entrypoint.sh@@ -1,7 +1,7 @@#!/bin/sh-echo "Waiting for MySQL to be ready..."-sleep 10+# echo "Waiting for MySQL to be ready..."+# sleep 10echo "Running Prisma migrations..."cd /app/packages/middlewarediff --git a/packages/app/package.json b/packages/app/package.jsonindex a1212790..fab9efc4 100644--- a/packages/app/package.json+++ b/packages/app/package.json@@ -69,6 +69,7 @@"cronstrue": "^2.50.0","date-fns": "^3.6.0","dotenv": "^16.3.1",+ "dotenv-expand": "^12.0.3","dotenv-flow": "^4.1.0","ejs": "^3.1.9","express": "^4.18.2",diff --git a/packages/app/src/backend/config.ts b/packages/app/src/backend/config.tsindex f62d67ab..8433f2de 100644--- a/packages/app/src/backend/config.ts+++ b/packages/app/src/backend/config.ts@@ -1,12 +1,15 @@import crypto from 'crypto';+import expandEnv from 'dotenv-expand';import dotenvFlow from 'dotenv-flow';import Joi from 'joi';import os from 'os';import path from 'path';-dotenvFlow.config({- files: ['../../.env', '../.env'],-});+expandEnv.expand(+ dotenvFlow.config({+ files: ['../../.env', '../.env'],+ }),+);const getDefaultDataPath = () => {const homeDir = os.homedir();diff --git a/packages/app/src/react/vite.config.ts b/packages/app/src/react/vite.config.tsindex fb4714f6..bf25de63 100644--- a/packages/app/src/react/vite.config.ts+++ b/packages/app/src/react/vite.config.ts@@ -1,11 +1,14 @@import react from '@vitejs/plugin-react-swc';+import expandEnv from 'dotenv-expand';import dotenvFlow from 'dotenv-flow';import path from 'path';import { defineConfig } from 'vite';-dotenvFlow.config({- files: ['../../.env', '../../../../.env'],-});+expandEnv.expand(+ dotenvFlow.config({+ files: ['../../.env', '../../../../.env'],+ }),+);// https://vite.dev/config/diff --git a/packages/runtime/package.json b/packages/runtime/package.jsonindex 82de2ac5..2e8f927c 100644--- a/packages/runtime/package.json+++ b/packages/runtime/package.json@@ -59,6 +59,7 @@"cookie-parser": "^1.4.7","cors": "^2.8.5","dotenv": "^16.4.5",+ "dotenv-expand": "^12.0.3","dotenv-flow": "^4.1.0","express": "^4.21.1","express-session": "^1.18.1",diff --git a/packages/runtime/src/core/config.ts b/packages/runtime/src/core/config.tsindex 68c5732e..fb91c832 100644--- a/packages/runtime/src/core/config.ts+++ b/packages/runtime/src/core/config.ts@@ -3,9 +3,13 @@ import os from 'os';import path from 'path';import { fileURLToPath } from 'url';-dotenvFlow.config({- files: ['../../.env', '../.env'],-});+import expandEnv from 'dotenv-expand';++expandEnv.expand(+ dotenvFlow.config({+ files: ['../../.env', '../.env'],+ }),+);const __filename = fileURLToPath(import.meta.url);const __dirname = path.dirname(__filename);diff --git a/packages/runtime/src/index.ts b/packages/runtime/src/index.tsindex 89035c9f..4c69df2a 100644--- a/packages/runtime/src/index.ts+++ b/packages/runtime/src/index.ts@@ -56,6 +56,9 @@ const ensureVaultFileExists = () => {};const vaultFilePath = path.join(getDefaultDataPath(), 'vault.json');+ const dir = path.dirname(vaultFilePath);+ fs.mkdirSync(dir, { recursive: true });+if (!fs.existsSync(vaultFilePath)) {fs.writeFileSync(vaultFilePath, JSON.stringify(baseVaultContent, null, 2));}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex baf3c369..f81c1290 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -143,6 +143,9 @@ importers:dotenv:specifier: ^16.3.1version: 16.6.1+ dotenv-expand:+ specifier: ^12.0.3+ version: 12.0.3dotenv-flow:specifier: ^4.1.0version: 4.1.0@@ -513,6 +516,9 @@ importers:dotenv:specifier: ^16.0.3version: 16.6.1+ dotenv-expand:+ specifier: ^12.0.3+ version: 12.0.3dotenv-flow:specifier: ^4.1.0version: 4.1.0@@ -604,6 +610,9 @@ importers:dependency-cruiser:specifier: ^15.4.0version: 15.5.0+ dotenv-cli:+ specifier: ^10.0.0+ version: 10.0.0env-cmd:specifier: ^11.0.0version: 11.0.0@@ -706,6 +715,9 @@ importers:dotenv:specifier: ^16.4.5version: 16.6.1+ dotenv-expand:+ specifier: ^12.0.3+ version: 12.0.3dotenv-flow:specifier: ^4.1.0version: 4.1.0@@ -5463,6 +5475,18 @@ packages:resolution: {integrity: sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==}+ resolution: {integrity: sha512-lnOnttzfrzkRx2echxJHQRB6vOAMSCzzZg79IxpC00tU42wZPuZkQxNNrrwVAxaQZIIh001l4PxVlCrBxngBzA==}+ hasBin: true++ resolution: {integrity: sha512-zIHwmZPRshsCdpMDyVsqGmgyP0yT8GAgXUnkdAoJisxvf33k7yO6OuoKmcTGuXPWSsm8Oh88nZicRLA9Y0rUeA==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-uc47g4b+4k/M/SeaW1y4OApx+mtLWl92l5LMPP0GNXctZqELk+YGgOPIIC5elYmUH4OuoK3JLhuRUYegeySiFA==}+ engines: {node: '>=12'}+resolution: {integrity: sha512-0cwP9jpQBQfyHwvE0cRhraZMkdV45TQedA8AAUZMsFzvmLcQyc1HPv+oX0OOYwLFjIlvgVepQ+WuQHbqDaHJZg==}engines: {node: '>= 12.0.0'}@@ -5471,6 +5495,10 @@ packages:resolution: {integrity: sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==}engines: {node: '>=12'}+ resolution: {integrity: sha512-Sf2LSQP+bOlhKWWyhFsn0UsfdK/kCWRv1iuA2gXAwt3dyNabr6QSj00I2V10pidqz69soatm9ZwZvpQMTIOd5Q==}+ engines: {node: '>=12'}+resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}engines: {node: '>= 0.4'}@@ -15737,12 +15765,29 @@ snapshots:domelementtype: 2.3.0domhandler: 5.0.3+ dependencies:+ cross-spawn: 7.0.6+ dotenv: 17.2.2+ dotenv-expand: 11.0.7+ minimist: 1.2.8++ dependencies:+ dotenv: 16.6.1++ dependencies:+ dotenv: 16.6.1+dependencies:dotenv: 16.6.1+ [email protected]: {}+dependencies:call-bind-apply-helpers: 1.0.2