{
  "manifest_version": "1.0.0",
  "template": {
    "id": "4e702f12-88bd-491a-8022-f508ffecf6f0",
    "slug": "ollama-jupyter-lab-or-run-local-llms-fro",
    "name": "JupyterLab | Use Open Source Models in Notebooks Directly",
    "description": "[Jun '26] Host any LLM Model using Ollama & Use in Jupyter Notebooks",
    "url": "https://railway.com/deploy/ollama-jupyter-lab-or-run-local-llms-fro",
    "upstream": {
      "image": "jupyter/all-spark-notebook"
    }
  },
  "services": [
    {
      "name": "Jupyter",
      "source": {
        "image": "jupyter/all-spark-notebook"
      },
      "needs_volume": true,
      "volume_mount_path": "/home/jovyan/work",
      "http": true
    },
    {
      "name": "Ollama",
      "source": {
        "image": "ollama/ollama"
      },
      "needs_volume": true,
      "volume_mount_path": "/root/.ollama",
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "PORT",
      "service": "Jupyter",
      "description": "Port Jupyter listens on",
      "secret": false,
      "strategy": "default",
      "default": "8888"
    },
    {
      "key": "RESTARTABLE",
      "service": "Jupyter",
      "description": "Allows Jupyter to auto-restart if it crashes.",
      "secret": false,
      "strategy": "default",
      "default": "yes"
    },
    {
      "key": "OLLAMA_BASE_URL",
      "service": "Jupyter",
      "description": "Internally connect with ollama",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "RAILWAY_RUN_UID",
      "service": "Jupyter",
      "description": "Runs the container as root (0) to allow password setup and package installs.",
      "secret": false,
      "strategy": "default",
      "default": "0"
    },
    {
      "key": "JUPYTER_PASSWORD",
      "service": "Jupyter",
      "description": "login password - generated automatically",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "EXTRA_PIP_PACKAGES",
      "service": "Jupyter",
      "description": "Space-separated list of pip packages to auto-install at startup",
      "secret": false,
      "strategy": "default",
      "default": "ollama openai"
    },
    {
      "key": "JUPYTER_ENABLE_LAB",
      "service": "Jupyter",
      "description": "Enables JupyterLab interface instead of the classic notebook.",
      "secret": false,
      "strategy": "default",
      "default": "yes"
    },
    {
      "key": "OLLAMA_ORIGINS",
      "service": "Ollama",
      "description": "Comma-separated list of allowed origins for CORS.",
      "secret": false,
      "strategy": "default",
      "default": "*"
    },
    {
      "key": "OLLAMA_DEFAULT_MODELS",
      "service": "Ollama",
      "description": "You can specify the deepseek model to download at boot time (from https://ollama.com/library). Default is deepseek-r1. You can also specify in the jupyter notebook. Please look at overview of this template for more info.",
      "secret": false,
      "strategy": "default",
      "default": "deepseek-r1:1.5b"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "ollama-jupyter-lab-or-run-local-llms-fro"
      }
    },
    "cli": "railway deploy --template ollama-jupyter-lab-or-run-local-llms-fro",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "4e702f12-88bd-491a-8022-f508ffecf6f0",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "35f09f3d-8b84-4038-b4f2-6ac44df8ed77": {
                  "icon": "https://devicons.railway.app/jupyter",
                  "name": "Jupyter",
                  "deploy": {
                    "startCommand": "/bin/sh -c \" \\     if [ -n \\\"${EXTRA_PIP_PACKAGES}\\\" ]; then \\         echo \\\"Installing extra pip packages: ${EXTRA_PIP_PACKAGES}\\\"; \\         pip install --no-cache-dir ${EXTRA_PIP_PACKAGES}; \\     else \\         echo \\\"No extra pip packages to install\\\"; \\     fi && \\     (echo ${JUPYTER_PASSWORD}; echo ${JUPYTER_PASSWORD}) | jupyter server password 2>&1 && \\     chown ${NB_UID} /home/jovyan/.jupyter/jupyter_server_config.json && \\     rm -rf ${RAILWAY_VOLUME_MOUNT_PATH}/lost+found && \\     chown -R ${NB_UID} ${RAILWAY_VOLUME_MOUNT_PATH} && \\     start.sh run-one-constantly jupyter lab 2>&1 \\ \"",
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "jupyter/all-spark-notebook"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "Port Jupyter listens on",
                      "defaultValue": "8888"
                    },
                    "RESTARTABLE": {
                      "isOptional": false,
                      "description": "Allows Jupyter to auto-restart if it crashes.",
                      "defaultValue": "yes"
                    },
                    "OLLAMA_BASE_URL": {
                      "isOptional": false,
                      "description": "Internally connect with ollama",
                      "defaultValue": "http://${{Ollama.RAILWAY_PRIVATE_DOMAIN}}:11434"
                    },
                    "RAILWAY_RUN_UID": {
                      "isOptional": false,
                      "description": "Runs the container as root (0) to allow password setup and package installs.",
                      "defaultValue": "0"
                    },
                    "JUPYTER_PASSWORD": {
                      "isOptional": false,
                      "description": "login password - generated automatically",
                      "defaultValue": "{{JUPYTER_PASSWORD}}"
                    },
                    "EXTRA_PIP_PACKAGES": {
                      "isOptional": false,
                      "description": "Space-separated list of pip packages to auto-install at startup",
                      "defaultValue": "ollama openai"
                    },
                    "JUPYTER_ENABLE_LAB": {
                      "isOptional": false,
                      "description": "Enables JupyterLab interface instead of the classic notebook.",
                      "defaultValue": "yes"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>": {}
                    }
                  },
                  "volumeMounts": {
                    "35f09f3d-8b84-4038-b4f2-6ac44df8ed77": {
                      "mountPath": "/home/jovyan/work"
                    }
                  }
                },
                "47341140-a25e-40bb-9d1d-0db9928370a4": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/ollama-dark.svg",
                  "name": "Ollama",
                  "deploy": {
                    "startCommand": "bash -c \"ollama serve & sleep 5 && ollama pull $OLLAMA_DEFAULT_MODELS && wait\"",
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ollama/ollama"
                  },
                  "variables": {
                    "OLLAMA_ORIGINS": {
                      "isOptional": false,
                      "description": "Comma-separated list of allowed origins for CORS.",
                      "defaultValue": "*"
                    },
                    "OLLAMA_DEFAULT_MODELS": {
                      "isOptional": false,
                      "description": "You can specify the deepseek model to download at boot time (from https://ollama.com/library). Default is deepseek-r1. You can also specify in the jupyter notebook. Please look at overview of this template for more info.",
                      "defaultValue": "deepseek-r1:1.5b"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>": {}
                    }
                  },
                  "volumeMounts": {
                    "47341140-a25e-40bb-9d1d-0db9928370a4": {
                      "mountPath": "/root/.ollama"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "resources": {
    "expected_services": 2,
    "needs_volume": true
  },
  "generated_at": "2026-09-21T16:15:12.787Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-20T21:16:40.366Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_390cbeec64af4158b298",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 107,
    "typical_build_seconds": 0,
    "typical_start_seconds": 20,
    "slowest_service": "Jupyter"
  }
}
