[{"data":1,"prerenderedAt":182},["ShallowReactive",2],{"doc-\u002Fdocs\u002Fself-hosting\u002Frailway":3,"github-stars":179},{"id":4,"title":5,"body":6,"description":170,"extension":171,"meta":172,"navigation":173,"order":102,"path":174,"section":175,"seo":176,"stem":177,"__hash__":178},"docs\u002Fdocs\u002Fself-hosting\u002Frailway.md","Railway",{"type":7,"value":8,"toc":164},"minimark",[9,14,24,29,37,41,47,58,62,65,111,123,127,141,160],[10,11,13],"h1",{"id":12},"deploy-on-railway","Deploy on Railway",[15,16,17,23],"p",{},[18,19,5],"a",{"href":20,"rel":21},"https:\u002F\u002Frailway.app",[22],"nofollow"," deploys containers with a managed Postgres and\ngenerated domains. Clerq runs on it as a Postgres plugin plus the published app\nimage, which migrates the database itself on first boot.",[25,26,28],"h2",{"id":27},"_1-create-a-project-and-add-postgres","1. Create a project and add Postgres",[15,30,31,32,36],{},"Create a new project, then ",[33,34,35],"strong",{},"Add a service -> Database -> PostgreSQL",". Railway\nprovisions it and exposes connection variables you can reference from the app.",[25,38,40],{"id":39},"_2-add-the-app-service","2. Add the app service",[15,42,43,46],{},[33,44,45],{},"Add a service -> Docker Image"," and use:",[48,49,55],"pre",{"className":50,"code":52,"language":53,"meta":54},[51],"language-text","ghcr.io\u002Fpunterdigital\u002Fclerq:latest\n","text","",[56,57,52],"code",{"__ignoreMap":54},[25,59,61],{"id":60},"_3-set-variables","3. Set variables",[15,63,64],{},"On the app service, add variables. Reference the database with Railway's\nvariable syntax so it stays in sync:",[48,66,70],{"className":67,"code":68,"language":69,"meta":54,"style":54},"language-bash shiki shiki-themes github-dark","DATABASE_URL=${{Postgres.DATABASE_URL}}\nBETTER_AUTH_SECRET=a-32-char-random-secret\nBETTER_AUTH_URL=https:\u002F\u002Fyour-app.up.railway.app\n","bash",[56,71,72,88,100],{"__ignoreMap":54},[73,74,77,81,85],"span",{"class":75,"line":76},"line",1,[73,78,80],{"class":79},"s95oV","DATABASE_URL",[73,82,84],{"class":83},"snl16","=",[73,86,87],{"class":79},"${{Postgres.DATABASE_URL}}\n",[73,89,91,94,96],{"class":75,"line":90},2,[73,92,93],{"class":79},"BETTER_AUTH_SECRET",[73,95,84],{"class":83},[73,97,99],{"class":98},"sU2Wk","a-32-char-random-secret\n",[73,101,103,106,108],{"class":75,"line":102},3,[73,104,105],{"class":79},"BETTER_AUTH_URL",[73,107,84],{"class":83},[73,109,110],{"class":98},"https:\u002F\u002Fyour-app.up.railway.app\n",[15,112,113,114,117,118,122],{},"Railway injects ",[56,115,116],{},"PORT"," automatically and the image listens on it, so you do not\nset it yourself. See\n",[18,119,121],{"href":120},"\u002Fdocs\u002Fself-hosting\u002Fenvironment-variables","Environment variables"," for the full\nreference.",[25,124,126],{"id":125},"_4-generate-a-domain-and-redeploy","4. Generate a domain and redeploy",[15,128,129,130,133,134,136,137,140],{},"Under the app service's ",[33,131,132],{},"Settings -> Networking",", generate a domain. Set\n",[56,135,105],{}," to that ",[56,138,139],{},"https:\u002F\u002F"," domain, then redeploy so auth callbacks\nuse the right origin. On boot the container migrates the database and starts\nserving - open the domain and create your account.",[142,143,144],"blockquote",{},[15,145,146,147,149,150,154,155,159],{},"The generated domain is only known after the first deploy, so setting\n",[56,148,105],{}," and redeploying once is expected. For backups and version\npinning, see ",[18,151,153],{"href":152},"\u002Fdocs\u002Fself-hosting\u002Fbackups-and-upgrades","Backups & upgrades","\nand the ",[18,156,158],{"href":157},"\u002Fdocs\u002Fself-hosting\u002Fproduction","production checklist",".",[161,162,163],"style",{},"html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":54,"searchDepth":102,"depth":102,"links":165},[166,167,168,169],{"id":27,"depth":90,"text":28},{"id":39,"depth":90,"text":40},{"id":60,"depth":90,"text":61},{"id":125,"depth":90,"text":126},"Deploy Clerq on Railway - add Postgres, deploy the published image, and reference the database with one variable.","md",{},true,"\u002Fdocs\u002Fself-hosting\u002Frailway","One-click deploy",{"title":5,"description":170},"docs\u002Fself-hosting\u002Frailway","bFJpRvu3-KVSYX6cbwirH9EqaV29bcxqXRCQK_xppZ8",{"stars":180,"repo":181},0,"PunterDigital\u002Fclerq",1781535397978]