{
  "manifest_version": "1.0.0",
  "template": {
    "id": "eff6a0e0-7bf2-4bc8-9340-64c7ee130f13",
    "slug": "lobechat-server-database-rag",
    "name": "LobeChat — Multi-Model AI Chat with RAG [Postgres]",
    "description": "Self-host LobeChat with history, RAG & 40+ providers — server mode",
    "url": "https://railway.com/deploy/lobechat-server-database-rag"
  },
  "services": [
    {
      "name": "LobeChat",
      "source": {
        "image": "lobehub/lobehub"
      },
      "needs_volume": false,
      "http": false
    },
    {
      "name": "RustFS",
      "source": {
        "image": "rustfs/rustfs:latest"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "http": false
    },
    {
      "name": "Postgres",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "tcp_ports": [
        5432
      ],
      "http": false
    },
    {
      "name": "Redis",
      "source": {
        "image": "redis:8.2.1"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "tcp_ports": [
        6379
      ],
      "http": false
    },
    {
      "name": "RustFS Init",
      "source": {
        "image": "alpine:latest"
      },
      "needs_volume": false,
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "APP_URL",
      "service": "LobeChat",
      "description": "Provide a value for APP_URL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "REDIS_TLS",
      "service": "LobeChat",
      "description": "Provide a value for REDIS_TLS.",
      "secret": false,
      "strategy": "default",
      "default": "0"
    },
    {
      "key": "REDIS_URL",
      "service": "LobeChat",
      "description": "Provide a value for REDIS_URL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "S3_BUCKET",
      "service": "LobeChat",
      "description": "Provide a value for S3_BUCKET.",
      "secret": false,
      "strategy": "default",
      "default": "lobe"
    },
    {
      "key": "S3_SET_ACL",
      "service": "LobeChat",
      "description": "Provide a value for S3_SET_ACL.",
      "secret": false,
      "strategy": "default",
      "default": "0"
    },
    {
      "key": "AUTH_SECRET",
      "service": "LobeChat",
      "description": "Provide a value for AUTH_SECRET.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "S3_ENDPOINT",
      "service": "LobeChat",
      "description": "Provide a value for S3_ENDPOINT.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "DATABASE_URL",
      "service": "LobeChat",
      "description": "Provide a value for DATABASE_URL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "REDIS_PREFIX",
      "service": "LobeChat",
      "description": "Provide a value for REDIS_PREFIX.",
      "secret": false,
      "strategy": "default",
      "default": "lobechat"
    },
    {
      "key": "S3_ACCESS_KEY",
      "service": "LobeChat",
      "description": "Provide a value for S3_ACCESS_KEY.",
      "secret": true,
      "strategy": "default",
      "default": "admin"
    },
    {
      "key": "INTERNAL_APP_URL",
      "service": "LobeChat",
      "description": "Provide a value for INTERNAL_APP_URL.",
      "secret": false,
      "strategy": "default",
      "default": "http://localhost:3210"
    },
    {
      "key": "S3_ACCESS_KEY_ID",
      "service": "LobeChat",
      "description": "Provide a value for S3_ACCESS_KEY_ID.",
      "secret": true,
      "strategy": "default",
      "default": "admin"
    },
    {
      "key": "KEY_VAULTS_SECRET",
      "service": "LobeChat",
      "description": "Provide a value for KEY_VAULTS_SECRET.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "S3_ENABLE_PATH_STYLE",
      "service": "LobeChat",
      "description": "Provide a value for S3_ENABLE_PATH_STYLE.",
      "secret": false,
      "strategy": "default",
      "default": "1"
    },
    {
      "key": "S3_SECRET_ACCESS_KEY",
      "service": "LobeChat",
      "description": "Provide a value for S3_SECRET_ACCESS_KEY.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "LLM_VISION_IMAGE_USE_BASE64",
      "service": "LobeChat",
      "description": "Provide a value for LLM_VISION_IMAGE_USE_BASE64.",
      "secret": false,
      "strategy": "default",
      "default": "1"
    },
    {
      "key": "RAILWAY_RUN_UID",
      "service": "RustFS",
      "description": "Provide a value for RAILWAY_RUN_UID.",
      "secret": false,
      "strategy": "default",
      "default": "0"
    },
    {
      "key": "RUSTFS_ACCESS_KEY",
      "service": "RustFS",
      "description": "Provide a value for RUSTFS_ACCESS_KEY.",
      "secret": true,
      "strategy": "default",
      "default": "admin"
    },
    {
      "key": "RUSTFS_SECRET_KEY",
      "service": "RustFS",
      "description": "Provide a value for RUSTFS_SECRET_KEY.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "RUSTFS_CONSOLE_ENABLE",
      "service": "RustFS",
      "description": "Provide a value for RUSTFS_CONSOLE_ENABLE.",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "Location where the database will be initialized",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGHOST",
      "service": "Postgres",
      "description": "Railway Private Domain Name.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT",
      "service": "Postgres",
      "description": "Port to connect to Postgres.",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGUSER",
      "service": "Postgres",
      "description": "Required variable for Data panel",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "Postgres",
      "description": "Required variable for the data panel.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "Postgres",
      "description": "Required variable for Data panel",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Default database created when image is started.",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "DATABASE_URL",
      "service": "Postgres",
      "description": "URL to connect to Postgres database.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "User to connect to Postgres DB",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "SSL_CERT_DAYS",
      "service": "Postgres",
      "description": "SSL certificate expiry in days.",
      "secret": false,
      "strategy": "default",
      "default": "820"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Postgres",
      "description": "Password to connect to DB",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "DATABASE_PUBLIC_URL",
      "service": "Postgres",
      "description": "Public URL to connect to Postgres database, used by the Data panel.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Postgres",
      "description": "Allow Postgres to cleanly shut down",
      "secret": false,
      "strategy": "default",
      "default": "60"
    },
    {
      "key": "REDISHOST",
      "service": "Redis",
      "description": "Provide a value for REDISHOST.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "REDISPORT",
      "service": "Redis",
      "description": "Provide a value for REDISPORT.",
      "secret": false,
      "strategy": "default",
      "default": "6379"
    },
    {
      "key": "REDISUSER",
      "service": "Redis",
      "description": "Provide a value for REDISUSER.",
      "secret": false,
      "strategy": "default",
      "default": "default"
    },
    {
      "key": "REDIS_URL",
      "service": "Redis",
      "description": "Connection string for connecting to redis using the private network",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDISPASSWORD",
      "service": "Redis",
      "description": "Provide a value for REDISPASSWORD.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDIS_PASSWORD",
      "service": "Redis",
      "description": "Provide a value for REDIS_PASSWORD.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "REDIS_PUBLIC_URL",
      "service": "Redis",
      "description": "Connection string for connecting to redis externally",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "RUSTFS_ACCESS_KEY",
      "service": "RustFS Init",
      "description": "Provide a value for RUSTFS_ACCESS_KEY.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "RUSTFS_SECRET_KEY",
      "service": "RustFS Init",
      "description": "Provide a value for RUSTFS_SECRET_KEY.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "lobechat-server-database-rag"
      }
    },
    "cli": "railway deploy --template lobechat-server-database-rag",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "eff6a0e0-7bf2-4bc8-9340-64c7ee130f13",
            "serializedConfig": {
              "services": {
                "1d4fa656-24d7-4425-a96a-2479e7ac079f": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/lobe-chat.svg",
                  "name": "LobeChat",
                  "source": {
                    "image": "lobehub/lobehub"
                  },
                  "variables": {
                    "APP_URL": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "https://${{RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "REDIS_TLS": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "0"
                    },
                    "REDIS_URL": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "${{Redis.REDIS_URL}}"
                    },
                    "S3_BUCKET": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "lobe"
                    },
                    "S3_SET_ACL": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "0"
                    },
                    "AUTH_SECRET": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "{{AUTH_SECRET}}"
                    },
                    "S3_ENDPOINT": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "https://${{RustFS.RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "postgresql://postgres:${{PostgreSQL.POSTGRES_PASSWORD}}@${{PostgreSQL.RAILWAY_PRIVATE_DOMAIN}}:5432/lobechat"
                    },
                    "REDIS_PREFIX": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "lobechat"
                    },
                    "S3_ACCESS_KEY": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "admin"
                    },
                    "INTERNAL_APP_URL": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "http://localhost:3210"
                    },
                    "S3_ACCESS_KEY_ID": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "admin"
                    },
                    "KEY_VAULTS_SECRET": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "{{KEY_VAULTS_SECRET}}"
                    },
                    "S3_ENABLE_PATH_STYLE": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "1"
                    },
                    "S3_SECRET_ACCESS_KEY": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "${{RustFS.RUSTFS_SECRET_KEY}}"
                    },
                    "LLM_VISION_IMAGE_USE_BASE64": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "1"
                    }
                  }
                },
                "6ddb0155-ad2b-4771-af62-d4b57fedf323": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/rustfs.svg",
                  "name": "RustFS",
                  "source": {
                    "image": "rustfs/rustfs:latest"
                  },
                  "variables": {
                    "RAILWAY_RUN_UID": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "0"
                    },
                    "RUSTFS_ACCESS_KEY": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "admin"
                    },
                    "RUSTFS_SECRET_KEY": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "{{RUSTFS_SECRET_KEY}}"
                    },
                    "RUSTFS_CONSOLE_ENABLE": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "true"
                    }
                  },
                  "volumeMounts": {
                    "6ddb0155-ad2b-4771-af62-d4b57fedf323": {
                      "mountPath": "/data"
                    }
                  }
                },
                "6f1f79ff-2238-47ba-8be3-ec0f5429a46b": {
                  "icon": "https://devicons.railway.app/i/postgresql.svg",
                  "name": "Postgres",
                  "build": {},
                  "deploy": {
                    "requiredMountPath": "/var/lib/postgresql/data"
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": false,
                      "description": "Location where the database will be initialized",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "Railway Private Domain Name.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "Port to connect to Postgres.",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "Required variable for Data panel",
                      "defaultValue": "${{ POSTGRES_USER }}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "Required variable for the data panel.",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "Required variable for Data panel",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Default database created when image is started.",
                      "defaultValue": "railway"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "URL to connect to Postgres database.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "User to connect to Postgres DB",
                      "defaultValue": "postgres"
                    },
                    "SSL_CERT_DAYS": {
                      "isOptional": true,
                      "description": "SSL certificate expiry in days.",
                      "defaultValue": "820"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Password to connect to DB",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "DATABASE_PUBLIC_URL": {
                      "description": "Public URL to connect to Postgres database, used by the Data panel.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}/${{PGDATABASE}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Allow Postgres to cleanly shut down",
                      "defaultValue": "60"
                    }
                  },
                  "networking": {
                    "tcpProxies": {
                      "5432": {}
                    },
                    "serviceDomains": {}
                  },
                  "volumeMounts": {
                    "6f1f79ff-2238-47ba-8be3-ec0f5429a46b": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  },
                  "haTemplateCode": "postgres-ha",
                  "haConversionConfig": {
                    "edge": {
                      "label": "Reverse Proxy",
                      "options": [
                        2,
                        3,
                        4,
                        5
                      ],
                      "nodeLabel": "HAProxy",
                      "description": "Routes traffic to the primary",
                      "defaultValue": 3
                    },
                    "replica": {
                      "label": "Replicas",
                      "options": [
                        2,
                        3,
                        4,
                        5,
                        6,
                        7
                      ],
                      "nodeLabel": "Postgres",
                      "description": "Streaming replicas for automatic failover",
                      "defaultValue": 2
                    },
                    "internal": {
                      "label": "Coordinator Nodes",
                      "options": [
                        3,
                        5,
                        7,
                        9
                      ],
                      "nodeLabel": "etcd",
                      "defaultValue": 3
                    },
                    "description": "This will convert your Postgres database to an HA cluster with Patroni failover and etcd consensus."
                  }
                },
                "7d9cfb58-a171-497a-b9d3-005a29e31e9a": {
                  "icon": "https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg",
                  "name": "Redis",
                  "deploy": {
                    "startCommand": "/bin/sh -c \"rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH\""
                  },
                  "source": {
                    "image": "redis:8.2.1"
                  },
                  "variables": {
                    "REDISHOST": {
                      "isOptional": false,
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "REDISPORT": {
                      "isOptional": false,
                      "defaultValue": "6379"
                    },
                    "REDISUSER": {
                      "isOptional": false,
                      "defaultValue": "default"
                    },
                    "REDIS_URL": {
                      "isOptional": false,
                      "description": "Connection string for connecting to redis using the private network",
                      "defaultValue": "redis://${{ REDISUSER }}:${{ REDIS_PASSWORD }}@${{ REDISHOST }}:${{ REDISPORT }}"
                    },
                    "REDISPASSWORD": {
                      "isOptional": false,
                      "defaultValue": "${{REDIS_PASSWORD}}"
                    },
                    "REDIS_PASSWORD": {
                      "isOptional": false,
                      "defaultValue": "{{REDIS_PASSWORD}}"
                    },
                    "REDIS_PUBLIC_URL": {
                      "description": "Connection string for connecting to redis externally",
                      "defaultValue": "redis://default:${{ REDIS_PASSWORD }}@${{ RAILWAY_TCP_PROXY_DOMAIN }}:${{ RAILWAY_TCP_PROXY_PORT }}"
                    }
                  },
                  "networking": {
                    "tcpProxies": {
                      "6379": {}
                    }
                  },
                  "volumeMounts": {
                    "7d9cfb58-a171-497a-b9d3-005a29e31e9a": {
                      "mountPath": "/data"
                    }
                  },
                  "haTemplateCode": "redis-ha",
                  "haConversionConfig": {
                    "edge": {
                      "label": "Reverse Proxies",
                      "options": [
                        1,
                        2
                      ],
                      "nodeLabel": "HAProxy",
                      "description": "HAProxy instances routing writes to the primary",
                      "defaultValue": 2
                    },
                    "replica": {
                      "label": "Redis Replicas",
                      "options": [
                        2,
                        3,
                        4,
                        5
                      ],
                      "nodeLabel": "Redis",
                      "description": "Nodes running Redis + colocated Sentinel",
                      "defaultValue": 2
                    },
                    "internal": null,
                    "description": "This will convert your Redis instance to an HA cluster with Sentinel failover and HAProxy routing to the primary."
                  }
                },
                "7f7cc875-77c3-4e92-9d72-37645737cce0": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/rustfs.svg",
                  "name": "RustFS Init",
                  "source": {
                    "image": "alpine:latest"
                  },
                  "variables": {
                    "RUSTFS_ACCESS_KEY": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "${{RustFS.RUSTFS_ACCESS_KEY}}"
                    },
                    "RUSTFS_SECRET_KEY": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "${{RustFS.RUSTFS_SECRET_KEY}}"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "resources": {
    "expected_services": 5,
    "needs_volume": true
  },
  "generated_at": "2026-09-23T22:14:45.316Z",
  "generator_version": "0.1.0",
  "status": "degraded",
  "validated_at": "2026-09-22T13:11:03.347Z",
  "success_rate_30d": 0,
  "validation": {
    "last_run_id": "run_e5cfce9929df4d62806e",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": false,
        "detail": "SUCCESS,CRASHED,SUCCESS,SUCCESS,SUCCESS"
      }
    ]
  }
}
