Deploy dify 1.17
Deploy Dify 1.17 on Railway — LLM apps, RAG, agents, plugins, and workflows
Plugins
local-sandbox
Just deployed
/workspace
plugin-daemon
Just deployed
/app/storage
agent-backend
Just deployed
Data
postgres
Just deployed
/var/lib/postgresql/data
redis
Just deployed
/data
weaviate
Just deployed
/var/lib/weaviate
minio
Just deployed
/data
Gateway
Just deployed
Core
dify-api
Just deployed
api-websocket
Just deployed
Just deployed
worker-beat
Just deployed
Just deployed
Security
ssrf-proxy
Just deployed
Just deployed
/dependencies
agent-ssrf-proxy
Just deployed
Deploy and Host Dify on Railway
Dify is an open-source LLM app development platform with visual workflows, RAG pipelines, agents, and API management. This template deploys the full Dify 1.17 production stack on Railway.
About Hosting Dify
Hosting Dify on Railway maps the official Dify Docker Compose stack to individual Railway services. Only nginx is public; everything else communicates over Railway's private network.
The stack includes:
- nginx — reverse proxy (custom image) for
/,/console/api,/api,/v1,/files,/socket.io,/e/(plugin webhooks) - postgres — PostgreSQL 15 for Dify and plugin metadata
- redis — managed Redis for cache and Celery
- weaviate — vector database for RAG knowledge bases
- minio — S3-compatible object storage (shared files across api/worker)
- api / api-websocket / worker / worker-beat — Dify backend (
langgenius/dify-api:1.17.0) - web — Dify frontend (
langgenius/dify-web:1.17.0) - plugin-daemon — Dify plugin runtime
- agent-backend / local-sandbox — Dify Agent shell workspaces
- sandbox / ssrf-proxy / agent-ssrf-proxy — secure code execution with SSRF protection
After deploy:
- Generate a public domain on the nginx service (Settings → Networking).
- Redeploy so
CONSOLE_API_URL,APP_API_URL, and related URL variables resolve. - Open
https:///installto create the admin account. - Add LLM provider API keys in Settings → Model Providers.
Common Use Cases
- Self-hosted AI app builder with full data ownership
- RAG knowledge bases and agent workflows without SaaS lock-in
- Staging or demo Dify instance for team evaluation
- Plugin marketplace integration with outbound SSRF controls
Publishing as a Railway template
All services use public Docker images (langgenius/* and GHCR gateway/SSRF images). Custom nginx, ssrf-proxy, and agent-ssrf-proxy images are built by GitHub Actions (.github/workflows/publish-dify-images.yml) and published to ghcr.io/sethumadhavan-k/dify-*:1.17.0.
After deploy, create the template:
railway templates create --project --environment production
Your template deploy URL: https://railway.com/deploy/dify-117 (do not use dify — that slug is the official Railway template by Jack).
Dependencies for Dify Hosting
- Public domain on nginx — Required for
CONSOLE_API_URL, file URLs, and WebSocket endpoints - Public Docker images — all services pull from Docker Hub / GHCR (no repo build required for template generation)
- External LLM API keys — Railway is CPU-only; inference uses OpenAI, Anthropic, or other providers you configure in Dify
- Optional INIT_PASSWORD — Protect the
/installsetup page on the api service
Deployment Dependencies
Environment Variables (highlights)
| Variable | Service | Description |
|---|---|---|
SECRET_KEY | api, worker | Auto-generated app secret — do not rotate after first deploy |
CONSOLE_API_URL / APP_API_URL | api, worker, web | https://${{nginx.RAILWAY_PUBLIC_DOMAIN}} |
NEXT_PUBLIC_SOCKET_URL | web | wss://${{nginx.RAILWAY_PUBLIC_DOMAIN}} |
S3_* | api, worker | Wired to MinIO over the private network |
WEAVIATE_* | api, worker, weaviate | Vector store for knowledge bases |
PLUGIN_DAEMON_KEY | api, plugin-daemon | Plugin authentication key |
SANDBOX_API_KEY | api, sandbox | Code execution sandbox key |
OPENAI_API_KEY | api | Optional; configure providers in Dify UI instead |
INIT_PASSWORD | dify-api | Optional; protect the /install setup page |
Optional integration variables (OPENAI_API_KEY, OPENAI_API_BASE, SMTP_*, MAIL_TYPE, INIT_PASSWORD) default to empty in template.json and can be left unset for a minimal deploy.
Volumes
| Service | Mount path | Purpose |
|---|---|---|
| postgres | /var/lib/postgresql/data | Database files |
| weaviate | /var/lib/weaviate | Vector index data |
| minio | /data | S3 object storage |
| plugin-daemon | /app/storage | Plugin packages and cache |
| sandbox | /dependencies | Sandbox Python dependencies (conf uses image defaults; Railway allows one volume per service) |
| local-sandbox | /workspace | Agent shell workspace (home dir is ephemeral) |
Implementation Details
Private network: Backends are not exposed publicly. nginx proxies using ${{service.RAILWAY_PRIVATE_DOMAIN}} and fixed container ports (API 5001, Web 3000, Plugin daemon 5002).
Shared storage: Railway cannot share volumes across services. This template uses MinIO (S3-compatible) instead of local filesystem storage.
Healthchecks: nginx uses /nginx-health (local, does not wait on backends). dify-api and api-websocket use /health on port 5001 (set PORT=5001 so Railway probes match DIFY_PORT). sandbox and local-sandbox set PORT to 8194 / 5004 for /health and /healthz.
SSRF proxies: Code sandbox and agent local sandbox egress route through dedicated Squid proxies, matching upstream Dify security architecture.
Why Deploy Dify on Railway?
Railway hosts your full infrastructure stack on one platform — services, databases, volumes, and networking — so you can run a production-grade Dify instance without managing Docker Compose on a VM.
By deploying Dify on Railway, you get private service networking, persistent volumes, and one-click scaling while keeping full control of your data and LLM provider credentials.
Template Content
dify-api
langgenius/dify-api:1.17.0MODE
PORT
DB_PORT
DB_TYPE
DIFY_PORT
S3_REGION
DEPLOY_ENV
REDIS_PORT
SECRET_KEY
DB_PASSWORD
STORAGE_TYPE
VECTOR_STORE
S3_BUCKET_NAME
SANDBOX_API_KEY
S3_ADDRESS_STYLE
WEAVIATE_API_KEY
MIGRATION_ENABLED
PLUGIN_DAEMON_KEY
DIFY_AGENT_API_TOKEN
CODE_EXECUTION_API_KEY
AGENT_BACKEND_API_TOKEN
INNER_API_KEY_FOR_PLUGIN
PLUGIN_DIFY_INNER_API_KEY
DIFY_AGENT_RUNTIME_BACKEND
DIFY_AGENT_SERVER_SECRET_KEY
DIFY_AGENT_LOCAL_SANDBOX_AUTH_TOKEN
WEAVIATE_AUTHENTICATION_APIKEY_ALLOWED_KEYS
api-websocket
langgenius/dify-api:1.17.0MODE
PORT
DB_PORT
DB_TYPE
DIFY_PORT
S3_REGION
DEPLOY_ENV
REDIS_PORT
SECRET_KEY
DB_PASSWORD
STORAGE_TYPE
VECTOR_STORE
S3_BUCKET_NAME
SANDBOX_API_KEY
GUNICORN_TIMEOUT
S3_ADDRESS_STYLE
WEAVIATE_API_KEY
MIGRATION_ENABLED
PLUGIN_DAEMON_KEY
SERVER_WORKER_CLASS
DIFY_AGENT_API_TOKEN
SERVER_WORKER_AMOUNT
CODE_EXECUTION_API_KEY
AGENT_BACKEND_API_TOKEN
INNER_API_KEY_FOR_PLUGIN
PLUGIN_DIFY_INNER_API_KEY
SERVER_WORKER_CONNECTIONS
DIFY_AGENT_RUNTIME_BACKEND
DIFY_AGENT_LOCAL_SANDBOX_AUTH_TOKEN
WEAVIATE_AUTHENTICATION_APIKEY_ALLOWED_KEYS
postgres
postgres:15-alpinePGDATA
POSTGRES_DB
POSTGRES_USER
POSTGRES_PASSWORD
redis
redis:8.2REDISPORT
REDISUSER
MARKETPLACE_URL
MARKETPLACE_API_URL
local-sandbox
langgenius/dify-agent-local-sandbox:1.17.0PORT
NO_PROXY
SHELLCTL_AUTH_TOKEN
worker-beat
langgenius/dify-api:1.17.0MODE
DB_PORT
DB_TYPE
S3_REGION
DEPLOY_ENV
REDIS_PORT
SECRET_KEY
DB_PASSWORD
STORAGE_TYPE
VECTOR_STORE
S3_BUCKET_NAME
SANDBOX_API_KEY
S3_ADDRESS_STYLE
WEAVIATE_API_KEY
MIGRATION_ENABLED
PLUGIN_DAEMON_KEY
DIFY_AGENT_API_TOKEN
CODE_EXECUTION_API_KEY
AGENT_BACKEND_API_TOKEN
INNER_API_KEY_FOR_PLUGIN
PLUGIN_DIFY_INNER_API_KEY
DIFY_AGENT_RUNTIME_BACKEND
DIFY_AGENT_LOCAL_SANDBOX_AUTH_TOKEN
WEAVIATE_AUTHENTICATION_APIKEY_ALLOWED_KEYS
plugin-daemon
langgenius/dify-plugin-daemon:0.6.10-localDB_PORT
DB_TYPE
REDIS_PORT
SERVER_KEY
DB_DATABASE
DB_PASSWORD
DB_SSL_MODE
SERVER_PORT
DIFY_INNER_API_KEY
PLUGIN_STORAGE_TYPE
PLUGIN_WORKING_PATH
FORCE_VERIFYING_SIGNATURE
PLUGIN_STORAGE_LOCAL_ROOT
weaviate
semitechnologies/weaviate:1.27.0CLUSTER_HOSTNAME
QUERY_DEFAULTS_LIMIT
PERSISTENCE_DATA_PATH
DEFAULT_VECTORIZER_MODULE
AUTHENTICATION_APIKEY_USERS
AUTHENTICATION_APIKEY_ENABLED
AUTHORIZATION_ADMINLIST_USERS
AUTHORIZATION_ADMINLIST_ENABLED
AUTHENTICATION_APIKEY_ALLOWED_KEYS
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED
HTTP_PORT
COREDUMP_DIR
SANDBOX_PORT
agent-backend
langgenius/dify-agent-backend:1.17.0DIFY_AGENT_API_TOKEN
DIFY_AGENT_INNER_API_KEY
DIFY_AGENT_RUNTIME_BACKEND
DIFY_AGENT_SERVER_SECRET_KEY
DIFY_AGENT_PLUGIN_DAEMON_API_KEY
DIFY_AGENT_LOCAL_SANDBOX_AUTH_TOKEN
PORT
API_KEY
GIN_MODE
SANDBOX_PORT
ENABLE_NETWORK
WORKER_TIMEOUT
PORT
API_PORT
WEB_PORT
API_WEBSOCKET_PORT
PLUGIN_DAEMON_PORT
NGINX_PROXY_READ_TIMEOUT
NGINX_PROXY_SEND_TIMEOUT
minio
minio/minio:latestMINIO_ROOT_USER
MINIO_ROOT_PASSWORD
MODE
DB_PORT
DB_TYPE
S3_REGION
DEPLOY_ENV
REDIS_PORT
SECRET_KEY
DB_PASSWORD
STORAGE_TYPE
VECTOR_STORE
S3_BUCKET_NAME
SANDBOX_API_KEY
S3_ADDRESS_STYLE
WEAVIATE_API_KEY
MIGRATION_ENABLED
PLUGIN_DAEMON_KEY
DIFY_AGENT_API_TOKEN
CODE_EXECUTION_API_KEY
AGENT_BACKEND_API_TOKEN
INNER_API_KEY_FOR_PLUGIN
PLUGIN_DIFY_INNER_API_KEY
DIFY_AGENT_RUNTIME_BACKEND
DIFY_AGENT_LOCAL_SANDBOX_AUTH_TOKEN
WEAVIATE_AUTHENTICATION_APIKEY_ALLOWED_KEYS
agent-ssrf-proxy
ghcr.io/sethumadhavan-k/dify-agent-ssrf-proxy:1.17.0HTTP_PORT
COREDUMP_DIR
