{
  "manifest_version": "1.0.0",
  "template": {
    "id": "1f55c621-f354-4b53-9b8e-38e244047e8d",
    "slug": "mathesar-analytics",
    "name": "Mathesar",
    "description": "Spreadsheet-style editor for the data in a Postgres database",
    "url": "https://railway.com/deploy/mathesar-analytics",
    "upstream": {
      "image": "mathesar/mathesar:latest"
    }
  },
  "services": [
    {
      "name": "Mathesar",
      "source": {
        "image": "mathesar/mathesar:latest"
      },
      "needs_volume": true,
      "volume_mount_path": "/code/.media",
      "http": true
    },
    {
      "name": "Postgres",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "PORT",
      "service": "Mathesar",
      "description": "Port Railway probes and routes to",
      "secret": false,
      "strategy": "default",
      "default": "8000"
    },
    {
      "key": "DEBUG",
      "service": "Mathesar",
      "description": "Never enable in production",
      "secret": false,
      "strategy": "default",
      "default": "false"
    },
    {
      "key": "SECRET_KEY",
      "service": "Mathesar",
      "description": "Session signing and credential encryption key",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Mathesar",
      "description": "Internal metadata database name",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "ALLOWED_HOSTS",
      "service": "Mathesar",
      "description": "Host header allow-list; edge routes by host",
      "secret": false,
      "strategy": "default",
      "default": "*"
    },
    {
      "key": "POSTGRES_HOST",
      "service": "Mathesar",
      "description": "Private hostname of the database",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_PORT",
      "service": "Mathesar",
      "description": "Database port",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Mathesar",
      "description": "Role Mathesar connects as",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "WEB_CONCURRENCY",
      "service": "Mathesar",
      "description": "Gunicorn sync worker count",
      "secret": false,
      "strategy": "default",
      "default": "3"
    },
    {
      "key": "POSTGRES_SSLMODE",
      "service": "Mathesar",
      "description": "TLS mode for the internal connection",
      "secret": false,
      "strategy": "default",
      "default": "prefer"
    },
    {
      "key": "FILE_STORAGE_DICT",
      "service": "Mathesar",
      "description": "S3 backend for file columns",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Mathesar",
      "description": "Password for that role",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "FORWARDED_ALLOW_IPS",
      "service": "Mathesar",
      "description": "Trust proxy headers from Railway's edge",
      "secret": false,
      "strategy": "default",
      "default": "*"
    },
    {
      "key": "MATHESAR_ADMIN_EMAIL",
      "service": "Mathesar",
      "description": "Email for that administrator",
      "secret": false,
      "strategy": "default",
      "default": "admin@example.com"
    },
    {
      "key": "DJANGO_SETTINGS_MODULE",
      "service": "Mathesar",
      "description": "Django settings module to load",
      "secret": false,
      "strategy": "default",
      "default": "config.settings.production"
    },
    {
      "key": "MATHESAR_ADMIN_PASSWORD",
      "service": "Mathesar",
      "description": "Password for that administrator",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "MATHESAR_ADMIN_USERNAME",
      "service": "Mathesar",
      "description": "First administrator, created at boot",
      "secret": false,
      "strategy": "default",
      "default": "admin"
    },
    {
      "key": "PER_USER_DATABASES_ENABLED",
      "service": "Mathesar",
      "description": "Experimental per-user database mode",
      "secret": false,
      "strategy": "default",
      "default": "false"
    },
    {
      "key": "MATHESAR_DJANGO_ADMIN_ENABLED",
      "service": "Mathesar",
      "description": "Django /admin/ page, off by default",
      "secret": false,
      "strategy": "default",
      "default": "false"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Mathesar",
      "description": "Graceful shutdown window",
      "secret": false,
      "strategy": "default",
      "default": "30"
    },
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "Cluster location on the volume",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGHOST",
      "service": "Postgres",
      "description": "Data panel alias, not read by the server",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT",
      "service": "Postgres",
      "description": "Data panel alias, not read by the server",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGUSER",
      "service": "Postgres",
      "description": "Data panel alias, not read by the server",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "Postgres",
      "description": "Data panel alias, not read by the server",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "Postgres",
      "description": "Data panel alias, not read by the server",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Database created on first boot",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "DATABASE_URL",
      "service": "Postgres",
      "description": "Private connection string",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "Superuser created on first boot",
      "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": "Superuser password",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Postgres",
      "description": "Clean shutdown window",
      "secret": false,
      "strategy": "default",
      "default": "60"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "mathesar-analytics"
      }
    },
    "cli": "railway deploy --template mathesar-analytics",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "1f55c621-f354-4b53-9b8e-38e244047e8d",
            "serializedConfig": {
              "buckets": {
                "28fd3fc1-3d0f-4981-a3ce-4206ecdf07cd": {
                  "name": "mathesar-files"
                }
              },
              "services": {
                "07c1e9c1-c072-4c99-be16-8ee2693d93b4": {
                  "icon": "https://raw.githubusercontent.com/mathesar-foundation/mathesar/master/mathesar/static/non-code/icons/apple-touch-icon.png",
                  "name": "Mathesar",
                  "deploy": {
                    "startCommand": "/bin/bash -c 'for i in $(seq 1 60); do python3 -m mathesar.install && break; echo \"mathesar-bootstrap: internal database not ready, retry $i\"; sleep 5; done; if [ -n \"$MATHESAR_ADMIN_USERNAME\" ] && [ -n \"$MATHESAR_ADMIN_PASSWORD\" ]; then DJANGO_SUPERUSER_USERNAME=\"$MATHESAR_ADMIN_USERNAME\" DJANGO_SUPERUSER_EMAIL=\"${MATHESAR_ADMIN_EMAIL:-admin@example.com}\" DJANGO_SUPERUSER_PASSWORD=\"$MATHESAR_ADMIN_PASSWORD\" python3 manage.py createsuperuser --noinput && echo \"mathesar-bootstrap: created admin user $MATHESAR_ADMIN_USERNAME\" || echo \"mathesar-bootstrap: admin user already present, left unchanged\"; fi; exec bash ./bin/mathesar run -ne'",
                    "healthcheckPath": "/healthz/ready",
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "mathesar/mathesar:latest"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "Port Railway probes and routes to",
                      "defaultValue": "8000"
                    },
                    "DEBUG": {
                      "isOptional": false,
                      "description": "Never enable in production",
                      "defaultValue": "false"
                    },
                    "SECRET_KEY": {
                      "isOptional": false,
                      "description": "Session signing and credential encryption key",
                      "defaultValue": "{{SECRET_KEY}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Internal metadata database name",
                      "defaultValue": "${{Postgres.PGDATABASE}}"
                    },
                    "ALLOWED_HOSTS": {
                      "isOptional": false,
                      "description": "Host header allow-list; edge routes by host",
                      "defaultValue": "*"
                    },
                    "POSTGRES_HOST": {
                      "isOptional": false,
                      "description": "Private hostname of the database",
                      "defaultValue": "${{Postgres.PGHOST}}"
                    },
                    "POSTGRES_PORT": {
                      "isOptional": false,
                      "description": "Database port",
                      "defaultValue": "${{Postgres.PGPORT}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "Role Mathesar connects as",
                      "defaultValue": "${{Postgres.PGUSER}}"
                    },
                    "WEB_CONCURRENCY": {
                      "isOptional": false,
                      "description": "Gunicorn sync worker count",
                      "defaultValue": "3"
                    },
                    "POSTGRES_SSLMODE": {
                      "isOptional": false,
                      "description": "TLS mode for the internal connection",
                      "defaultValue": "prefer"
                    },
                    "FILE_STORAGE_DICT": {
                      "isOptional": false,
                      "description": "S3 backend for file columns",
                      "defaultValue": "{\"default\":{\"protocol\":\"s3\",\"nickname\":\"Object storage\",\"prefix\":\"${{mathesar-files.BUCKET}}\",\"kwargs\":{\"client_kwargs\":{\"endpoint_url\":\"${{mathesar-files.ENDPOINT}}\",\"region_name\":\"${{mathesar-files.REGION}}\",\"aws_access_key_id\":\"${{mathesar-files.ACCESS_KEY_ID}}\",\"aws_secret_access_key\":\"${{mathesar-files.SECRET_ACCESS_KEY}}\"}},\"public_form_access\":{\"enabled\":false,\"max_upload_size\":1073741824}}}"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Password for that role",
                      "defaultValue": "${{Postgres.PGPASSWORD}}"
                    },
                    "FORWARDED_ALLOW_IPS": {
                      "isOptional": false,
                      "description": "Trust proxy headers from Railway's edge",
                      "defaultValue": "*"
                    },
                    "MATHESAR_ADMIN_EMAIL": {
                      "isOptional": false,
                      "description": "Email for that administrator",
                      "defaultValue": "admin@example.com"
                    },
                    "DJANGO_SETTINGS_MODULE": {
                      "isOptional": false,
                      "description": "Django settings module to load",
                      "defaultValue": "config.settings.production"
                    },
                    "MATHESAR_ADMIN_PASSWORD": {
                      "isOptional": false,
                      "description": "Password for that administrator",
                      "defaultValue": "{{MATHESAR_ADMIN_PASSWORD}}"
                    },
                    "MATHESAR_ADMIN_USERNAME": {
                      "isOptional": false,
                      "description": "First administrator, created at boot",
                      "defaultValue": "admin"
                    },
                    "PER_USER_DATABASES_ENABLED": {
                      "isOptional": false,
                      "description": "Experimental per-user database mode",
                      "defaultValue": "false"
                    },
                    "MATHESAR_DJANGO_ADMIN_ENABLED": {
                      "isOptional": false,
                      "description": "Django /admin/ page, off by default",
                      "defaultValue": "false"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Graceful shutdown window",
                      "defaultValue": "30"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:8000": {
                        "port": 8000
                      }
                    }
                  },
                  "volumeMounts": {
                    "07c1e9c1-c072-4c99-be16-8ee2693d93b4": {
                      "mountPath": "/code/.media"
                    }
                  }
                },
                "5fee9ff6-ef94-4c02-8dad-1fadc19da6b4": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/postgresql.svg",
                  "name": "Postgres",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": false,
                      "description": "Cluster location on the volume",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "Data panel alias, not read by the server",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "Data panel alias, not read by the server",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "Data panel alias, not read by the server",
                      "defaultValue": "${{POSTGRES_USER}}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "Data panel alias, not read by the server",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "Data panel alias, not read by the server",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Database created on first boot",
                      "defaultValue": "railway"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Private connection string",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "Superuser created on first boot",
                      "defaultValue": "postgres"
                    },
                    "SSL_CERT_DAYS": {
                      "isOptional": false,
                      "description": "SSL certificate expiry in days",
                      "defaultValue": "820"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Superuser password",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Clean shutdown window",
                      "defaultValue": "60"
                    }
                  },
                  "volumeMounts": {
                    "5fee9ff6-ef94-4c02-8dad-1fadc19da6b4": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "Mathesar",
      "method": "GET",
      "path": "/healthz/ready",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 2,
    "needs_volume": true
  },
  "generated_at": "2026-09-20T10:14:37.339Z",
  "generator_version": "0.1.0",
  "status": "degraded",
  "validated_at": "2026-09-19T14:36:43.876Z",
  "success_rate_30d": 0.1667,
  "validation": {
    "last_run_id": "run_08bfd33b6d92478a91aa",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": false,
        "detail": "Your workspace has been restricted. Please contact support to resolve this."
      }
    ],
    "typical_ready_seconds": 37
  }
}
