[{"data":1,"prerenderedAt":2894},["ShallowReactive",2],{"navigation_docs":3,"-run-own-server":613,"-run-own-server-surround":2891},[4,39,101,378,540,562,584,606],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":38},"Start","i-lucide-rocket","\u002Fstart","1.start",[10,14,18,22,26,30,34],{"title":11,"path":12,"stem":13},"Our approach","\u002Fstart\u002Four-approach","1.start\u002F0.our-approach",{"title":15,"path":16,"stem":17},"Introduction","\u002Fstart\u002Fintroduction","1.start\u002F1.introduction",{"title":19,"path":20,"stem":21},"Concepts","\u002Fstart\u002Fconcepts","1.start\u002F2.concepts",{"title":23,"path":24,"stem":25},"Glossary","\u002Fstart\u002Fglossary","1.start\u002F3.glossary",{"title":27,"path":28,"stem":29},"Try it locally","\u002Fstart\u002Ftry-it-locally","1.start\u002F4.try-it-locally",{"title":31,"path":32,"stem":33},"Features","\u002Fstart\u002Ffeatures","1.start\u002F5.features",{"title":35,"path":36,"stem":37},"Questions","\u002Fstart\u002Ffaq","1.start\u002F6.faq",false,{"title":40,"icon":41,"path":42,"stem":43,"children":44,"page":38},"Run SHADE","i-lucide-server","\u002Frun","2.run",[45,49,53,57,61,65,69,73,77,81,85,89,93,97],{"title":46,"path":47,"stem":48},"Setting up an instance (Coolify)","\u002Frun\u002Fcoolify","2.run\u002F1.coolify",{"title":50,"path":51,"stem":52},"Console commands","\u002Frun\u002Fconsole","2.run\u002F10.console",{"title":54,"path":55,"stem":56},"Rotating APP_SECRET","\u002Frun\u002Frotating-app-secret","2.run\u002F11.rotating-app-secret",{"title":58,"path":59,"stem":60},"Checking an instance","\u002Frun\u002Fdoctor","2.run\u002F12.doctor",{"title":62,"path":63,"stem":64},"Self-hosting by hand","\u002Frun\u002Fown-server-by-hand","2.run\u002F13.own-server-by-hand",{"title":66,"path":67,"stem":68},"NixOS (experimental)","\u002Frun\u002Fnixos","2.run\u002F14.nixos",{"title":70,"path":71,"stem":72},"Self-hosting without Coolify","\u002Frun\u002Fown-server","2.run\u002F2.own-server",{"title":74,"path":75,"stem":76},"Hosting the site on a static host","\u002Frun\u002Fstatic-hosts","2.run\u002F3.static-hosts",{"title":78,"path":79,"stem":80},"Licence","\u002Frun\u002Flicence","2.run\u002F4.licence",{"title":82,"path":83,"stem":84},"Updating and backups","\u002Frun\u002Fupdating-and-backups","2.run\u002F5.updating-and-backups",{"title":86,"path":87,"stem":88},"Troubleshooting","\u002Frun\u002Ftroubleshooting","2.run\u002F6.troubleshooting",{"title":90,"path":91,"stem":92},"Logs, request ids, traces and metrics","\u002Frun\u002Flogs","2.run\u002F7.logs",{"title":94,"path":95,"stem":96},"Maintenance mode","\u002Frun\u002Fmaintenance-mode","2.run\u002F8.maintenance-mode",{"title":98,"path":99,"stem":100},"Usage limits","\u002Frun\u002Fusage-limits","2.run\u002F9.usage-limits",{"title":102,"icon":103,"path":104,"stem":105,"children":106},"Guide","i-lucide-book-open","\u002Fguide","3.guide",[107,109,147,192,210,280,310,364],{"title":102,"path":104,"stem":108},"3.guide\u002Findex",{"title":110,"icon":111,"path":112,"stem":113,"children":114,"page":38},"Content","i-lucide-file-text","\u002Fguide\u002Fcontent","3.guide\u002F1.content",[115,119,123,127,131,135,139,143],{"title":116,"path":117,"stem":118},"Collections and entries","\u002Fguide\u002Fcontent\u002Fcollections","3.guide\u002F1.content\u002F1.collections",{"title":120,"path":121,"stem":122},"Field types","\u002Fguide\u002Fcontent\u002Ffields","3.guide\u002F1.content\u002F2.fields",{"title":124,"path":125,"stem":126},"Drafts, publishing and version history","\u002Fguide\u002Fcontent\u002Fversions","3.guide\u002F1.content\u002F3.versions",{"title":128,"path":129,"stem":130},"Languages","\u002Fguide\u002Fcontent\u002Flanguages","3.guide\u002F1.content\u002F4.languages",{"title":132,"path":133,"stem":134},"Data sources","\u002Fguide\u002Fcontent\u002Fdata-sources","3.guide\u002F1.content\u002F5.data-sources",{"title":136,"path":137,"stem":138},"Media","\u002Fguide\u002Fcontent\u002Fmedia","3.guide\u002F1.content\u002F6.media",{"title":140,"path":141,"stem":142},"Search","\u002Fguide\u002Fcontent\u002Fsearch","3.guide\u002F1.content\u002F7.search",{"title":144,"path":145,"stem":146},"Trash","\u002Fguide\u002Fcontent\u002Ftrash","3.guide\u002F1.content\u002F8.trash",{"title":148,"icon":149,"path":150,"stem":151,"children":152,"page":38},"Website","i-lucide-globe","\u002Fguide\u002Fwebsite","3.guide\u002F2.website",[153,156,160,164,168,172,176,180,184,188],{"title":148,"path":154,"stem":155},"\u002Fguide\u002Fwebsite\u002Fwebsite","3.guide\u002F2.website\u002F1.website",{"title":157,"path":158,"stem":159},"Scroll scenes","\u002Fguide\u002Fwebsite\u002Fscroll-scenes","3.guide\u002F2.website\u002F10.scroll-scenes",{"title":161,"path":162,"stem":163},"Pages and posts","\u002Fguide\u002Fwebsite\u002Fpages","3.guide\u002F2.website\u002F2.pages",{"title":165,"path":166,"stem":167},"The visual editor","\u002Fguide\u002Fwebsite\u002Fvisual-editor","3.guide\u002F2.website\u002F3.visual-editor",{"title":169,"path":170,"stem":171},"Roles and locks","\u002Fguide\u002Fwebsite\u002Froles-and-locks","3.guide\u002F2.website\u002F4.roles-and-locks",{"title":173,"path":174,"stem":175},"Header and footer","\u002Fguide\u002Fwebsite\u002Fheader-and-footer","3.guide\u002F2.website\u002F5.header-and-footer",{"title":177,"path":178,"stem":179},"Theme","\u002Fguide\u002Fwebsite\u002Ftheme","3.guide\u002F2.website\u002F6.theme",{"title":181,"path":182,"stem":183},"Redirects","\u002Fguide\u002Fwebsite\u002Fredirects","3.guide\u002F2.website\u002F7.redirects",{"title":185,"path":186,"stem":187},"Site settings","\u002Fguide\u002Fwebsite\u002Fsite-settings","3.guide\u002F2.website\u002F8.site-settings",{"title":189,"path":190,"stem":191},"The site","\u002Fguide\u002Fwebsite\u002Fthe-site","3.guide\u002F2.website\u002F9.the-site",{"title":193,"icon":194,"path":195,"stem":196,"children":197,"page":38},"Publishing","i-lucide-send","\u002Fguide\u002Fpublishing","3.guide\u002F3.publishing",[198,202,206],{"title":199,"path":200,"stem":201},"Publishing and preview","\u002Fguide\u002Fpublishing\u002Fpublishing","3.guide\u002F3.publishing\u002F1.publishing",{"title":203,"path":204,"stem":205},"Builds","\u002Fguide\u002Fpublishing\u002Fbuilds","3.guide\u002F3.publishing\u002F2.builds",{"title":207,"path":208,"stem":209},"CDN caches","\u002Fguide\u002Fpublishing\u002Fcaches","3.guide\u002F3.publishing\u002F3.caches",{"title":211,"icon":212,"path":213,"stem":214,"children":215,"page":38},"People, security and privacy","i-lucide-shield","\u002Fguide\u002Fpeople-and-security","3.guide\u002F4.people-and-security",[216,220,224,228,232,236,240,244,248,252,256,260,264,268,272,276],{"title":217,"path":218,"stem":219},"People in SHADE","\u002Fguide\u002Fpeople-and-security\u002Fpeople-in-shade","3.guide\u002F4.people-and-security\u002F0.people-in-shade",{"title":221,"path":222,"stem":223},"Team and roles","\u002Fguide\u002Fpeople-and-security\u002Fteam","3.guide\u002F4.people-and-security\u002F1.team",{"title":225,"path":226,"stem":227},"Errors and security alerts","\u002Fguide\u002Fpeople-and-security\u002Ferrors","3.guide\u002F4.people-and-security\u002F10.errors",{"title":229,"path":230,"stem":231},"Exporting an instance","\u002Fguide\u002Fpeople-and-security\u002Fexporting","3.guide\u002F4.people-and-security\u002F11.exporting",{"title":233,"path":234,"stem":235},"Organisations","\u002Fguide\u002Fpeople-and-security\u002Forganisations","3.guide\u002F4.people-and-security\u002F12.organisations",{"title":237,"path":238,"stem":239},"Signing in through an identity provider (team)","\u002Fguide\u002Fpeople-and-security\u002Fidentity-providers","3.guide\u002F4.people-and-security\u002F13.identity-providers",{"title":241,"path":242,"stem":243},"System status","\u002Fguide\u002Fpeople-and-security\u002Fsystem-status","3.guide\u002F4.people-and-security\u002F14.system-status",{"title":245,"path":246,"stem":247},"Appearance","\u002Fguide\u002Fpeople-and-security\u002Fappearance","3.guide\u002F4.people-and-security\u002F15.appearance",{"title":249,"path":250,"stem":251},"Accounts and personal pages","\u002Fguide\u002Fpeople-and-security\u002Faccounts","3.guide\u002F4.people-and-security\u002F2.accounts",{"title":253,"path":254,"stem":255},"Signing in (team)","\u002Fguide\u002Fpeople-and-security\u002Fsign-in","3.guide\u002F4.people-and-security\u002F3.sign-in",{"title":257,"path":258,"stem":259},"API tokens","\u002Fguide\u002Fpeople-and-security\u002Fapi-tokens","3.guide\u002F4.people-and-security\u002F4.api-tokens",{"title":261,"path":262,"stem":263},"Audit log","\u002Fguide\u002Fpeople-and-security\u002Faudit","3.guide\u002F4.people-and-security\u002F5.audit",{"title":265,"path":266,"stem":267},"Request protection","\u002Fguide\u002Fpeople-and-security\u002Fprotection","3.guide\u002F4.people-and-security\u002F6.protection",{"title":269,"path":270,"stem":271},"Personal data per person","\u002Fguide\u002Fpeople-and-security\u002Fprivacy","3.guide\u002F4.people-and-security\u002F7.privacy",{"title":273,"path":274,"stem":275},"Data retention","\u002Fguide\u002Fpeople-and-security\u002Fretention","3.guide\u002F4.people-and-security\u002F8.retention",{"title":277,"path":278,"stem":279},"Consent banner","\u002Fguide\u002Fpeople-and-security\u002Fconsent","3.guide\u002F4.people-and-security\u002F9.consent",{"title":281,"icon":282,"path":283,"stem":284,"children":285,"page":38},"Services","i-lucide-plug","\u002Fguide\u002Fservices","3.guide\u002F5.services",[286,290,294,298,302,306],{"title":287,"path":288,"stem":289},"Email","\u002Fguide\u002Fservices\u002Femail","3.guide\u002F5.services\u002F1.email",{"title":291,"path":292,"stem":293},"Opening hours","\u002Fguide\u002Fservices\u002Fopening-hours","3.guide\u002F5.services\u002F4.opening-hours",{"title":295,"path":296,"stem":297},"Webhooks","\u002Fguide\u002Fservices\u002Fwebhooks","3.guide\u002F5.services\u002F5.webhooks",{"title":299,"path":300,"stem":301},"Locations","\u002Fguide\u002Fservices\u002Flocations","3.guide\u002F5.services\u002F6.locations",{"title":303,"path":304,"stem":305},"VAT rates","\u002Fguide\u002Fservices\u002Fvat-rates","3.guide\u002F5.services\u002F7.vat-rates",{"title":307,"path":308,"stem":309},"Channels","\u002Fguide\u002Fservices\u002Fchannels","3.guide\u002F5.services\u002F8.channels",{"title":311,"icon":312,"path":313,"stem":314,"children":315,"page":38},"InstalledModules","i-lucide-puzzle","\u002Fguide\u002Fmodules","3.guide\u002F6.modules",[316,320,324,328,332,336,340,344,348,352,356,360],{"title":317,"path":318,"stem":319},"Modules","\u002Fguide\u002Fmodules\u002Fmanaging","3.guide\u002F6.modules\u002F1.managing",{"title":321,"path":322,"stem":323},"Dutch services (module)","\u002Fguide\u002Fmodules\u002Fnl","3.guide\u002F6.modules\u002F10.nl",{"title":325,"path":326,"stem":327},"Editorial (module)","\u002Fguide\u002Fmodules\u002Feditorial","3.guide\u002F6.modules\u002F11.editorial",{"title":329,"path":330,"stem":331},"Appointments (module)","\u002Fguide\u002Fmodules\u002Fappointments","3.guide\u002F6.modules\u002F2.appointments",{"title":333,"path":334,"stem":335},"Shop (the commerce module)","\u002Fguide\u002Fmodules\u002Fshop","3.guide\u002F6.modules\u002F3.shop",{"title":337,"path":338,"stem":339},"Untrusted modules","\u002Fguide\u002Fmodules\u002Funtrusted","3.guide\u002F6.modules\u002F4.untrusted",{"title":341,"path":342,"stem":343},"Analytics (module)","\u002Fguide\u002Fmodules\u002Fanalytics","3.guide\u002F6.modules\u002F5.analytics",{"title":345,"path":346,"stem":347},"Error forwarding (module)","\u002Fguide\u002Fmodules\u002Ferror-forwarding","3.guide\u002F6.modules\u002F6.error-forwarding",{"title":349,"path":350,"stem":351},"Client programs","\u002Fguide\u002Fmodules\u002Fprograms","3.guide\u002F6.modules\u002F7.programs",{"title":353,"path":354,"stem":355},"Import and export (module)","\u002Fguide\u002Fmodules\u002Fimport","3.guide\u002F6.modules\u002F8.import",{"title":357,"path":358,"stem":359},"Payments (module)","\u002Fguide\u002Fmodules\u002Fpayments","3.guide\u002F6.modules\u002F8.payments",{"title":361,"path":362,"stem":363},"Forms (module)","\u002Fguide\u002Fmodules\u002Fforms","3.guide\u002F6.modules\u002F9.forms",{"title":365,"icon":366,"path":367,"stem":368,"children":369,"page":38},"AI assistants","i-lucide-bot","\u002Fguide\u002Fai","3.guide\u002F7.ai",[370,374],{"title":371,"path":372,"stem":373},"AI assistants (MCP)","\u002Fguide\u002Fai\u002Fassistants","3.guide\u002F7.ai\u002F1.assistants",{"title":375,"path":376,"stem":377},"Connecting an AI assistant","\u002Fguide\u002Fai\u002Fconnecting","3.guide\u002F7.ai\u002F2.connecting",{"title":379,"icon":380,"path":381,"stem":382,"children":383,"page":38},"Developers","i-lucide-code","\u002Fdevelopers","4.developers",[384,388,392,396,400,404,408,412,416,420,424,428,432,435,489,493,497,501,536],{"title":385,"path":386,"stem":387},"Architecture","\u002Fdevelopers\u002Farchitecture","4.developers\u002F1.architecture",{"title":389,"path":390,"stem":391},"Capabilities","\u002Fdevelopers\u002Fcapabilities","4.developers\u002F10.capabilities",{"title":393,"path":394,"stem":395},"Trust","\u002Fdevelopers\u002Ftrust","4.developers\u002F11.trust",{"title":397,"path":398,"stem":399},"Redis and the ports","\u002Fdevelopers\u002Fredis","4.developers\u002F12.redis",{"title":401,"path":402,"stem":403},"The worker container role","\u002Fdevelopers\u002Fworker","4.developers\u002F13.worker",{"title":405,"path":406,"stem":407},"kv: a module's own key-value storage","\u002Fdevelopers\u002Fkv","4.developers\u002F14.kv",{"title":409,"path":410,"stem":411},"Processes: long-running work on the worker","\u002Fdevelopers\u002Fprocesses","4.developers\u002F15.processes",{"title":413,"path":414,"stem":415},"Network: a module's outgoing calls","\u002Fdevelopers\u002Fnetwork","4.developers\u002F16.network",{"title":417,"path":418,"stem":419},"Realtime","\u002Fdevelopers\u002Frealtime","4.developers\u002F17.realtime",{"title":421,"path":422,"stem":423},"Private files","\u002Fdevelopers\u002Ffiles","4.developers\u002F18.files",{"title":425,"path":426,"stem":427},"Notify","\u002Fdevelopers\u002Fnotify","4.developers\u002F19.notify",{"title":429,"path":430,"stem":431},"Collections","\u002Fdevelopers\u002Fcollections","4.developers\u002F2.collections",{"title":337,"path":433,"stem":434},"\u002Fdevelopers\u002Funtrusted","4.developers\u002F20.untrusted",{"title":436,"icon":312,"path":437,"stem":438,"children":439},"Writing a plugin","\u002Fdevelopers\u002Fmodules","4.developers\u002F3.modules\u002Findex",[440,442,446,450,454,458,462,466,470,473,477,481,485],{"title":441,"path":437,"stem":438},"Writing a module",{"title":443,"path":444,"stem":445},"Module SDK and tooling","\u002Fdevelopers\u002Fmodules\u002Fsdk-and-tooling","4.developers\u002F3.modules\u002F1.sdk-and-tooling",{"title":447,"path":448,"stem":449},"Connecting accounts with OAuth2","\u002Fdevelopers\u002Fmodules\u002Foauth","4.developers\u002F3.modules\u002F10.oauth",{"title":451,"path":452,"stem":453},"Calls between modules","\u002Fdevelopers\u002Fmodules\u002Fcalls-between-modules","4.developers\u002F3.modules\u002F11.calls-between-modules",{"title":455,"path":456,"stem":457},"Experimental parts","\u002Fdevelopers\u002Fmodules\u002Fexperimental-parts","4.developers\u002F3.modules\u002F12.experimental-parts",{"title":459,"path":460,"stem":461},"The manifest","\u002Fdevelopers\u002Fmodules\u002Fmanifest","4.developers\u002F3.modules\u002F2.manifest",{"title":463,"path":464,"stem":465},"Routes","\u002Fdevelopers\u002Fmodules\u002Froutes","4.developers\u002F3.modules\u002F3.routes",{"title":467,"path":468,"stem":469},"Admin screens and the site part","\u002Fdevelopers\u002Fmodules\u002Fadmin-and-site","4.developers\u002F3.modules\u002F4.admin-and-site",{"title":110,"path":471,"stem":472},"\u002Fdevelopers\u002Fmodules\u002Fcontent","4.developers\u002F3.modules\u002F5.content",{"title":474,"path":475,"stem":476},"Background work and services","\u002Fdevelopers\u002Fmodules\u002Fbackground-and-services","4.developers\u002F3.modules\u002F6.background-and-services",{"title":478,"path":479,"stem":480},"SDK reference","\u002Fdevelopers\u002Fmodules\u002Fsdk-reference","4.developers\u002F3.modules\u002F7.sdk-reference",{"title":482,"path":483,"stem":484},"The website module's SDK","\u002Fdevelopers\u002Fmodules\u002Fwebsite-sdk","4.developers\u002F3.modules\u002F8.website-sdk",{"title":486,"path":487,"stem":488},"Incoming webhooks","\u002Fdevelopers\u002Fmodules\u002Fincoming-webhooks","4.developers\u002F3.modules\u002F9.incoming-webhooks",{"title":490,"path":491,"stem":492},"Core and the website module","\u002Fdevelopers\u002Fcore-and-website-module","4.developers\u002F4.core-and-website-module",{"title":494,"path":495,"stem":496},"The API","\u002Fdevelopers\u002Fapi","4.developers\u002F6.api",{"title":498,"path":499,"stem":500},"API reference","\u002Fdevelopers\u002Fapi-reference","4.developers\u002F6.api-reference",{"title":502,"icon":503,"path":504,"stem":505,"children":506},"Sites in other frameworks","i-lucide-layout-template","\u002Fdevelopers\u002Fframeworks","4.developers\u002F7.frameworks\u002Findex",[507,508,512,516,520,524,528,532],{"title":502,"path":504,"stem":505},{"title":509,"path":510,"stem":511},"Accounts: sign-in and modules' routes","\u002Fdevelopers\u002Fframeworks\u002Faccounts","4.developers\u002F7.frameworks\u002F1.accounts",{"title":513,"path":514,"stem":515},"`@shadestack\u002Ftree`","\u002Fdevelopers\u002Fframeworks\u002Ftree","4.developers\u002F7.frameworks\u002F2.tree",{"title":517,"path":518,"stem":519},"Expressions and styles","\u002Fdevelopers\u002Fframeworks\u002Fexpressions-and-styles","4.developers\u002F7.frameworks\u002F3.expressions-and-styles",{"title":521,"path":522,"stem":523},"`@shadestack\u002Frender`","\u002Fdevelopers\u002Fframeworks\u002Frender","4.developers\u002F7.frameworks\u002F4.render",{"title":525,"path":526,"stem":527},"`@shadestack\u002Finteractions`","\u002Fdevelopers\u002Fframeworks\u002Finteractions","4.developers\u002F7.frameworks\u002F5.interactions",{"title":529,"path":530,"stem":531},"`@shadestack\u002Fa11y`","\u002Fdevelopers\u002Fframeworks\u002Fa11y","4.developers\u002F7.frameworks\u002F6.a11y",{"title":533,"path":534,"stem":535},"Your own page for SHADE's links","\u002Fdevelopers\u002Fframeworks\u002Flinks","4.developers\u002F7.frameworks\u002F7.links",{"title":537,"path":538,"stem":539},"Build a client module","\u002Fdevelopers\u002Fclient-module","4.developers\u002F9.client-module",{"title":541,"icon":542,"path":543,"stem":544,"children":545,"page":38},"Security","i-lucide-shield-check","\u002Fsecurity","5.security",[546,550,554,558],{"title":547,"path":548,"stem":549},"Reporting a vulnerability","\u002Fsecurity\u002Freporting","5.security\u002F0.reporting",{"title":551,"path":552,"stem":553},"Security testing","\u002Fsecurity\u002Ftesting","5.security\u002F1.testing",{"title":555,"path":556,"stem":557},"Hardening a production instance","\u002Fsecurity\u002Fhardening","5.security\u002F2.hardening",{"title":559,"path":560,"stem":561},"Manual testing with Kali Linux","\u002Fsecurity\u002Fmanual-testing","5.security\u002F3.manual-testing",{"title":563,"icon":564,"path":565,"stem":566,"children":567,"page":38},"Contributing","i-lucide-git-pull-request","\u002Fcontributing","6.contributing",[568,572,576,580],{"title":569,"path":570,"stem":571},"Reading the code","\u002Fcontributing\u002Freading-the-code","6.contributing\u002F1.reading-the-code",{"title":573,"path":574,"stem":575},"Docs site","\u002Fcontributing\u002Fdocs-site","6.contributing\u002F2.docs-site",{"title":577,"path":578,"stem":579},"Releases","\u002Fcontributing\u002Freleases","6.contributing\u002F3.releases",{"title":581,"path":582,"stem":583},"Load tests","\u002Fcontributing\u002Fload-tests","6.contributing\u002F4.load-tests",{"title":585,"icon":586,"path":587,"stem":588,"children":589,"page":38},"Project","i-lucide-map","\u002Fproject","7.project",[590,594,598,602],{"title":591,"path":592,"stem":593},"Roadmap","\u002Fproject\u002Froadmap","7.project\u002F1.roadmap",{"title":595,"path":596,"stem":597},"Known issues","\u002Fproject\u002Fknown-issues","7.project\u002F2.known-issues",{"title":599,"path":600,"stem":601},"Changelog","\u002Fproject\u002Fchangelog","7.project\u002F3.changelog",{"title":603,"path":604,"stem":605},"Decisions","\u002Fproject\u002Fdecisions","7.project\u002F4.decisions",{"title":607,"path":608,"stem":609,"children":610,"icon":612},"Community","\u002Fcommunity","8.community\u002Findex",[611],{"title":607,"path":608,"stem":609},"i-lucide-users",{"id":614,"title":70,"body":615,"description":714,"extension":2886,"links":2887,"meta":2888,"navigation":1362,"path":71,"seo":2889,"stem":72,"__hash__":2890},"docs\u002F2.run\u002F2.own-server.md",{"type":616,"value":617,"toc":2867},"minimark",[618,659,664,689,693,708,813,825,889,893,941,971,975,1194,1217,1228,1234,2035,2059,2076,2094,2122,2174,2193,2206,2216,2220,2223,2304,2328,2354,2359,2362,2385,2388,2394,2407,2411,2420,2467,2486,2490,2509,2529,2535,2541,2551,2555,2567,2573,2604,2624,2638,2642,2645,2649,2657,2674,2678,2690,2697,2701,2710,2718,2725,2746,2777,2781,2795,2804,2808,2841,2845,2851,2863],[619,620,621,622,626,627,630,631,634,635,638,639,642,643,646,647,650,651,654,655,658],"p",{},"Two commands run SHADE on a Linux server of your own: ",[623,624,625],"code",{},"shade install"," sets it up once, and ",[623,628,629],{},"shade update"," moves it to a\nnew version. They run SHADE's containers (",[623,632,633],{},"admin",", ",[623,636,637],{},"public"," and ",[623,640,641],{},"worker",", or one ",[623,644,645],{},"all"," container with ",[623,648,649],{},"--small","), its\nPostgres and Redis, and Caddy in front for HTTPS. ",[652,653,62],"a",{"href":63}," explains every\npart, for a proxy of your own or a server without Docker.\nOn NixOS, ",[652,656,657],{"href":67},"the flake"," runs SHADE without Docker (experimental).",[660,661,663],"h2",{"id":662},"what-you-need","What you need",[665,666,667,671,686],"ul",{},[668,669,670],"li",{},"A Linux server with Docker and its Compose plugin (2.23.1 or newer), and root.",[668,672,673,674,677,678,681,682,685],{},"A domain for SHADE's API (",[623,675,676],{},"api.example.com","), and optionally one for the admin (",[623,679,680],{},"admin.example.com",") and one for\nthe site (",[623,683,684],{},"www.example.com","). Point their DNS (A and AAAA records) at the server.",[668,687,688],{},"Ports 80 and 443 free, and open to the internet: Let's Encrypt checks each domain on port 80. Open 443 over UDP\ntoo, for HTTP\u002F3: a firewall at your provider (Hetzner's cloud firewall, for example) usually blocks UDP until you\nallow it. Without it browsers still connect over HTTP\u002F2.",[660,690,692],{"id":691},"installing","Installing",[619,694,695,696,699,700,703,704,707],{},"SHADE has pre-releases only; 0.1.0 isn't out. The commands here use ",[623,697,698],{},"0.1.0-next.2",": take the newest version in the\n",[652,701,702],{"href":600},"changelog",". Get the ",[623,705,706],{},"shade"," script from SHADE's image, then run it:",[709,710,715],"pre",{"className":711,"code":712,"language":713,"meta":714,"style":714},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","docker run --rm ghcr.io\u002Fshadehq-dev\u002Fshade:0.1.0-next.2 cat deploy\u002Fshade | sudo install -m 755 \u002Fdev\u002Fstdin \u002Fusr\u002Flocal\u002Fbin\u002Fshade\nsudo shade install --version 0.1.0-next.2 --api-domain api.example.com --email ops@example.com \\\n  --admin-domain admin.example.com --site-domain www.example.com\n","bash","",[623,716,717,765,798],{"__ignoreMap":714},[718,719,722,726,730,733,736,739,742,746,749,752,755,759,762],"span",{"class":720,"line":721},"line",1,[718,723,725],{"class":724},"sBMFI","docker",[718,727,729],{"class":728},"sfazB"," run",[718,731,732],{"class":728}," --rm",[718,734,735],{"class":728}," ghcr.io\u002Fshadehq-dev\u002Fshade:0.1.0-next.2",[718,737,738],{"class":728}," cat",[718,740,741],{"class":728}," deploy\u002Fshade",[718,743,745],{"class":744},"sMK4o"," |",[718,747,748],{"class":724}," sudo",[718,750,751],{"class":728}," install",[718,753,754],{"class":728}," -m",[718,756,758],{"class":757},"sbssI"," 755",[718,760,761],{"class":728}," \u002Fdev\u002Fstdin",[718,763,764],{"class":728}," \u002Fusr\u002Flocal\u002Fbin\u002Fshade\n",[718,766,768,771,774,776,779,782,785,788,791,794],{"class":720,"line":767},2,[718,769,770],{"class":724},"sudo",[718,772,773],{"class":728}," shade",[718,775,751],{"class":728},[718,777,778],{"class":728}," --version",[718,780,781],{"class":728}," 0.1.0-next.2",[718,783,784],{"class":728}," --api-domain",[718,786,787],{"class":728}," api.example.com",[718,789,790],{"class":728}," --email",[718,792,793],{"class":728}," ops@example.com",[718,795,797],{"class":796},"sTEyZ"," \\\n",[718,799,801,804,807,810],{"class":720,"line":800},3,[718,802,803],{"class":728},"  --admin-domain",[718,805,806],{"class":728}," admin.example.com",[718,808,809],{"class":728}," --site-domain",[718,811,812],{"class":728}," www.example.com\n",[619,814,815,816,820,821,824],{},"To run code that isn't released, build the image from a checkout of the ",[652,817,819],{"href":818},"\u002Fdevelopers\u002Fmodules\u002Fsdk-and-tooling#the-shade-workspace","SHADE\nworkspace"," (for SHADE's maintainers for now; a\ntested route for everyone else comes later) and pass it with ",[623,822,823],{},"--image",":",[709,826,828],{"className":711,"code":827,"language":713,"meta":714,"style":714},"docker build -f shade\u002Fapps\u002Fapi\u002FDockerfile -t shade:local shade\nsudo install -m 755 shade\u002Fdeploy\u002Fserver\u002Fshade \u002Fusr\u002Flocal\u002Fbin\u002Fshade\nsudo shade install --image shade:local --api-domain api.example.com --email ops@example.com\n",[623,829,830,852,867],{"__ignoreMap":714},[718,831,832,834,837,840,843,846,849],{"class":720,"line":721},[718,833,725],{"class":724},[718,835,836],{"class":728}," build",[718,838,839],{"class":728}," -f",[718,841,842],{"class":728}," shade\u002Fapps\u002Fapi\u002FDockerfile",[718,844,845],{"class":728}," -t",[718,847,848],{"class":728}," shade:local",[718,850,851],{"class":728}," shade\n",[718,853,854,856,858,860,862,865],{"class":720,"line":767},[718,855,770],{"class":724},[718,857,751],{"class":728},[718,859,754],{"class":728},[718,861,758],{"class":757},[718,863,864],{"class":728}," shade\u002Fdeploy\u002Fserver\u002Fshade",[718,866,764],{"class":728},[718,868,869,871,873,875,878,880,882,884,886],{"class":720,"line":800},[718,870,770],{"class":724},[718,872,773],{"class":728},[718,874,751],{"class":728},[718,876,877],{"class":728}," --image",[718,879,848],{"class":728},[718,881,784],{"class":728},[718,883,787],{"class":728},[718,885,790],{"class":728},[718,887,888],{"class":728}," ops@example.com\n",[619,890,891,824],{},[623,892,625],{},[894,895,896,912,929,935],"ol",{},[668,897,898,902,903,906,907,911],{},[899,900,901],"strong",{},"Checks the server",": Docker and Compose, ports 80 and 443 (and 443 over UDP), Docker starting at boot, a\nfirewall, and with ",[623,904,905],{},"--programs"," gVisor and the networks ",[652,908,910],{"href":909},"\u002Frun\u002Fown-server-by-hand#4-client-programs-optional-shade-programs","client programs"," need.",[668,913,914,920,921,924,925,928],{},[899,915,916,917],{},"Writes ",[623,918,919],{},"\u002Fetc\u002Fshade",", with new passwords and a new ",[623,922,923],{},"APP_SECRET",". It never writes over a file that is there: run\nit again with ",[623,926,927],{},"--force"," to write the compose file and the Caddyfile again; even then it keeps every secret.",[668,930,931,934],{},[899,932,933],{},"Starts everything"," and waits until each container is healthy, Caddy last, so the first request after your DNS points\nhere never meets an admin that is still starting.",[668,936,937,940],{},[899,938,939],{},"Makes the first admin",": it asks for your email, name and password.",[619,942,943,944,946,947,951,952,955,956,959,960,963,964,966,967,970],{},"Its other options: ",[623,945,649],{}," runs the small profile, one container for everything (",[652,948,950],{"href":949},"\u002Frun\u002Fcoolify#the-small-profile","what that gives\nup","); ",[623,953,954],{},"--staging"," takes certificates from Let's Encrypt's staging, for a trial run;\n",[623,957,958],{},"--no-admin"," skips the first admin: you then create the owner's account in the browser, with the one-time code in the\nadmin container's log (",[623,961,962],{},"docker compose logs | grep create-owner"," in ",[623,965,919],{},"), as on\n",[652,968,969],{"href":47},"Coolify",".",[660,972,974],{"id":973},"what-it-sets-up","What it sets up",[976,977,978,996],"table",{},[979,980,981],"thead",{},[982,983,984,990,993],"tr",{},[985,986,987,988],"th",{},"In ",[623,989,919],{},[985,991,992],{},"What it is",[985,994,995],{},"Readable by",[997,998,999,1024,1041,1057,1085,1098,1111,1123,1135,1152,1164,1181],"tbody",{},[982,1000,1001,1007,1021],{},[1002,1003,1004],"td",{},[623,1005,1006],{},"shade.env",[1002,1008,1009,1010,1013,1014,1017,1018,1020],{},"SHADE's env file: the running role's address (",[623,1011,1012],{},"DATABASE_URL",", as ",[623,1015,1016],{},"shade_app",") and Redis's, with their passwords, ",[623,1019,923],{},", the domains",[1002,1022,1023],{},"SHADE's containers (uid 1000), mode 600",[982,1025,1026,1031,1038],{},[1002,1027,1028],{},[623,1029,1030],{},"shade-owner.env",[1002,1032,1033,1034,1037],{},"One line, ",[623,1035,1036],{},"DATABASE_OWNER_URL",", the owner's address",[1002,1039,1040],{},"The admin container only (uid 1000), mode 600",[982,1042,1043,1048,1054],{},[1002,1044,1045],{},[623,1046,1047],{},"shade-backup.env",[1002,1049,1033,1050,1053],{},[623,1051,1052],{},"DATABASE_BACKUP_URL",", the backup role's address",[1002,1055,1056],{},"The worker container only (uid 1000), mode 600",[982,1058,1059,1076,1082],{},[1002,1060,1061,634,1064,634,1067,634,1070,634,1073],{},[623,1062,1063],{},"postgres-password",[623,1065,1066],{},"shade-db-password",[623,1068,1069],{},"shade-db-owner-password",[623,1071,1072],{},"shade-db-backup-password",[623,1074,1075],{},"rehearsal-password",[1002,1077,1078,1079,1081],{},"Postgres's passwords: its own, the running role's (",[623,1080,1016],{},"), the owner's, the backup role's and the restore rehearsal's",[1002,1083,1084],{},"Postgres (uid 70), mode 600",[982,1086,1087,1092,1095],{},[1002,1088,1089],{},[623,1090,1091],{},"redis.conf",[1002,1093,1094],{},"Redis's settings and password",[1002,1096,1097],{},"Redis (uid 999), mode 600",[982,1099,1100,1105,1108],{},[1002,1101,1102],{},[623,1103,1104],{},"compose.yml",[1002,1106,1107],{},"The containers, copied from SHADE's image",[1002,1109,1110],{},"root",[982,1112,1113,1118,1121],{},[1002,1114,1115],{},[623,1116,1117],{},"compose.override.yml",[1002,1119,1120],{},"Your own containers, such as the site: never written again",[1002,1122,1110],{},[982,1124,1125,1130,1133],{},[1002,1126,1127],{},[623,1128,1129],{},".env",[1002,1131,1132],{},"The settings Docker Compose reads: the image, the domains, the profile. No secret",[1002,1134,1110],{},[982,1136,1137,1142,1149],{},[1002,1138,1139],{},[623,1140,1141],{},"caddy\u002FCaddyfile",[1002,1143,1144,1145,1148],{},"Caddy's settings and SHADE's routes (the folder is Caddy's ",[623,1146,1147],{},"\u002Fetc\u002Fcaddy",")",[1002,1150,1151],{},"root, read by Caddy",[982,1153,1154,1159,1162],{},[1002,1155,1156],{},[623,1157,1158],{},"caddy\u002FCaddyfile.local",[1002,1160,1161],{},"Your own additions to the proxy: never written again",[1002,1163,1151],{},[982,1165,1166,1171,1178],{},[1002,1167,1168],{},[623,1169,1170],{},"caddy\u002Flb-cookie",[1002,1172,1173,1174,638,1176],{},"One line that sets the admin's stickiness cookie, with the secret it is keyed with (the Caddyfile imports it): kept by ",[623,1175,927],{},[623,1177,629],{},[1002,1179,1180],{},"Caddy (uid 1001), mode 600",[982,1182,1183,1188,1191],{},[1002,1184,1185],{},[623,1186,1187],{},"caddy-data\u002F",[1002,1189,1190],{},"The certificates and the Let's Encrypt account key",[1002,1192,1193],{},"Caddy (uid 1001), mode 700",[619,1195,1196,1199,1200,1202,1203,1205,1206,638,1208,1210,1211,1213,1214,1216],{},[623,1197,1198],{},"SHADE_ENV_FILE"," lists the files a container reads, separated by commas: the admin reads ",[623,1201,1006],{}," and\n",[623,1204,1030],{},", the worker ",[623,1207,1006],{},[623,1209,1047],{},", the public container ",[623,1212,1006],{}," only, and the small\nprofile's ",[623,1215,706],{}," container all three.",[619,1218,1219,1220,1223,1224,1227],{},"No secret is in a container's configuration: SHADE reads its env file, Postgres and Redis read their files, so\n",[623,1221,1222],{},"docker inspect"," shows none. Only Caddy publishes ports, 80 and 443 (443 over UDP as well, for HTTP\u002F3); SHADE's containers are reached only through it.\nCaddy gets no Docker socket and reads its routes from the ",[623,1225,1226],{},"Caddyfile",". Its admin API listens on a socket inside its\nown container, never on a port, so nothing else on the server or the network can change its routes. Every container\nkeeps at most 30 MB of logs.",[619,1229,1230,1231,1233],{},"SHADE's routes are defined once, in SHADE, and the ",[623,1232,1226],{}," is written from them. With the three domains above it\nreads:",[709,1235,1239],{"className":1236,"code":1237,"language":1238,"meta":714,"style":714},"language-caddyfile shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","# Written by SHADE (`shade install`, `shade update`) from its routes (apps\u002Fapi\u002Fsrc\u002Fdeploy\u002Froutes.ts). Do not edit:\n# the next update writes it again. Your own additions go in Caddyfile.local, which is never written.\n{\n    email ops@example.com\n    acme_ca https:\u002F\u002Facme-v02.api.letsencrypt.org\u002Fdirectory\n    storage file_system \u002Fdata\n    admin unix\u002F\u002Frun\u002Fcaddy\u002Fadmin.sock\n    http_port 8080\n    https_port 8443\n    servers {\n        timeouts {\n            read_header 30s\n            read_body 600s\n            idle 5m\n        }\n    }\n    log {\n        level WARN\n    }\n}\n\napi.example.com {\n    encode zstd gzip\n    header Alt-Svc `h3=\":443\"; ma=2592000`\n    handle_errors {\n        @starting0 expression `{err.status_code} in [502, 503] && {http.request.method} in [\"GET\", \"HEAD\", \"OPTIONS\"]`\n        handle @starting0 {\n            header Retry-After 5\n            header Content-Type \"application\u002Fjson\"\n            respond `{\"error\":{\"code\":\"UNAVAILABLE\",\"message\":\"SHADE is starting up. Try again in a moment.\",\"key\":\"api.errors.starting\"}}` 503\n        }\n        @unanswered0 expression `{err.status_code} in [502, 503]`\n        handle @unanswered0 {\n            header Content-Type \"application\u002Fjson\"\n            respond `{\"error\":{\"code\":\"BAD_GATEWAY\",\"message\":\"The server didn't answer. Check before trying again.\"}}` 502\n        }\n    }\n    handle \u002Fapi\u002Fv1\u002Faccount\u002F* {\n        reverse_proxy {\n            dynamic a public 4000 {\n                refresh 1s\n            }\n            lb_try_duration 15s\n            lb_try_interval 50ms\n            lb_retry_match {\n                method GET HEAD OPTIONS\n            }\n            fail_duration 1s\n            stream_close_delay 5m\n        }\n    }\n    handle {\n        reverse_proxy {\n            dynamic a admin 4000 {\n                refresh 1s\n            }\n            lb_try_duration 15s\n            lb_try_interval 50ms\n            lb_retry_match {\n                method GET HEAD OPTIONS\n            }\n            fail_duration 1s\n            stream_close_delay 5m\n        }\n    }\n}\n\nadmin.example.com {\n    encode zstd gzip\n    header Alt-Svc `h3=\":443\"; ma=2592000`\n    handle_errors {\n        @starting0 expression `{err.status_code} in [502, 503] && path('\u002Fapi\u002F*') && {http.request.method} in [\"GET\", \"HEAD\", \"OPTIONS\"]`\n        handle @starting0 {\n            header Retry-After 5\n            header Content-Type \"application\u002Fjson\"\n            respond `{\"error\":{\"code\":\"UNAVAILABLE\",\"message\":\"SHADE is starting up. Try again in a moment.\",\"key\":\"api.errors.starting\"}}` 503\n        }\n        @unanswered0 expression `{err.status_code} in [502, 503] && path('\u002Fapi\u002F*')`\n        handle @unanswered0 {\n            header Content-Type \"application\u002Fjson\"\n            respond `{\"error\":{\"code\":\"BAD_GATEWAY\",\"message\":\"The server didn't answer. Check before trying again.\"}}` 502\n        }\n        @starting1 expression `{err.status_code} in [502, 503] && {http.request.method} in [\"GET\", \"HEAD\", \"OPTIONS\"]`\n        handle @starting1 {\n            header Retry-After 5\n            header Content-Type \"text\u002Fplain; charset=utf-8\"\n            respond \"Starting, back in a moment.\" 503\n        }\n        @unanswered1 expression `{err.status_code} in [502, 503]`\n        handle @unanswered1 {\n            header Content-Type \"text\u002Fplain; charset=utf-8\"\n            respond \"The server didn't answer. Check before trying again.\" 502\n        }\n    }\n    handle {\n        reverse_proxy {\n            dynamic a admin 4000 {\n                refresh 1s\n            }\n            import \u002Fetc\u002Fcaddy\u002Flb-cookie\n            lb_try_duration 15s\n            lb_try_interval 50ms\n            lb_retry_match {\n                method GET HEAD OPTIONS\n            }\n            fail_duration 1s\n            stream_close_delay 5m\n        }\n    }\n}\n\nwww.example.com {\n    encode zstd gzip\n    header Alt-Svc `h3=\":443\"; ma=2592000`\n    handle_errors {\n        @starting0 expression `{err.status_code} in [502, 503] && (path('\u002Fapi\u002Fv1\u002Faccount\u002F*')) && {http.request.method} in [\"GET\", \"HEAD\", \"OPTIONS\"]`\n        handle @starting0 {\n            header Retry-After 5\n            header Content-Type \"application\u002Fjson\"\n            respond `{\"error\":{\"code\":\"UNAVAILABLE\",\"message\":\"SHADE is starting up. Try again in a moment.\",\"key\":\"api.errors.starting\"}}` 503\n        }\n        @unanswered0 expression `{err.status_code} in [502, 503] && (path('\u002Fapi\u002Fv1\u002Faccount\u002F*'))`\n        handle @unanswered0 {\n            header Content-Type \"application\u002Fjson\"\n            respond `{\"error\":{\"code\":\"BAD_GATEWAY\",\"message\":\"The server didn't answer. Check before trying again.\"}}` 502\n        }\n    }\n    handle \u002Fapi\u002Fv1\u002Faccount\u002F* {\n        reverse_proxy {\n            dynamic a public 4000 {\n                refresh 1s\n            }\n            lb_try_duration 15s\n            lb_try_interval 50ms\n            lb_retry_match {\n                method GET HEAD OPTIONS\n            }\n            fail_duration 1s\n            stream_close_delay 5m\n        }\n    }\n    handle {\n        reverse_proxy http:\u002F\u002Fsite:8080\n    }\n}\n\nimport \u002Fetc\u002Fcaddy\u002FCaddyfile.local\n","caddyfile",[623,1240,1241,1246,1251,1256,1262,1268,1274,1280,1286,1292,1298,1304,1310,1316,1322,1328,1334,1340,1346,1351,1357,1364,1370,1376,1382,1388,1394,1400,1406,1412,1418,1423,1429,1435,1440,1446,1451,1456,1462,1468,1474,1480,1486,1492,1498,1504,1510,1515,1521,1527,1532,1537,1543,1548,1554,1559,1564,1569,1574,1579,1584,1589,1594,1599,1604,1609,1614,1619,1625,1630,1635,1640,1646,1651,1656,1661,1666,1671,1677,1682,1687,1692,1697,1703,1709,1714,1720,1726,1731,1737,1743,1748,1754,1759,1764,1769,1774,1779,1784,1789,1795,1800,1805,1810,1815,1820,1825,1830,1835,1840,1845,1850,1856,1861,1866,1871,1877,1882,1887,1892,1897,1902,1908,1913,1918,1923,1928,1933,1938,1943,1948,1953,1958,1963,1968,1973,1978,1983,1988,1993,1998,2003,2008,2014,2019,2024,2029],{"__ignoreMap":714},[718,1242,1243],{"class":720,"line":721},[718,1244,1245],{},"# Written by SHADE (`shade install`, `shade update`) from its routes (apps\u002Fapi\u002Fsrc\u002Fdeploy\u002Froutes.ts). Do not edit:\n",[718,1247,1248],{"class":720,"line":767},[718,1249,1250],{},"# the next update writes it again. Your own additions go in Caddyfile.local, which is never written.\n",[718,1252,1253],{"class":720,"line":800},[718,1254,1255],{},"{\n",[718,1257,1259],{"class":720,"line":1258},4,[718,1260,1261],{},"    email ops@example.com\n",[718,1263,1265],{"class":720,"line":1264},5,[718,1266,1267],{},"    acme_ca https:\u002F\u002Facme-v02.api.letsencrypt.org\u002Fdirectory\n",[718,1269,1271],{"class":720,"line":1270},6,[718,1272,1273],{},"    storage file_system \u002Fdata\n",[718,1275,1277],{"class":720,"line":1276},7,[718,1278,1279],{},"    admin unix\u002F\u002Frun\u002Fcaddy\u002Fadmin.sock\n",[718,1281,1283],{"class":720,"line":1282},8,[718,1284,1285],{},"    http_port 8080\n",[718,1287,1289],{"class":720,"line":1288},9,[718,1290,1291],{},"    https_port 8443\n",[718,1293,1295],{"class":720,"line":1294},10,[718,1296,1297],{},"    servers {\n",[718,1299,1301],{"class":720,"line":1300},11,[718,1302,1303],{},"        timeouts {\n",[718,1305,1307],{"class":720,"line":1306},12,[718,1308,1309],{},"            read_header 30s\n",[718,1311,1313],{"class":720,"line":1312},13,[718,1314,1315],{},"            read_body 600s\n",[718,1317,1319],{"class":720,"line":1318},14,[718,1320,1321],{},"            idle 5m\n",[718,1323,1325],{"class":720,"line":1324},15,[718,1326,1327],{},"        }\n",[718,1329,1331],{"class":720,"line":1330},16,[718,1332,1333],{},"    }\n",[718,1335,1337],{"class":720,"line":1336},17,[718,1338,1339],{},"    log {\n",[718,1341,1343],{"class":720,"line":1342},18,[718,1344,1345],{},"        level WARN\n",[718,1347,1349],{"class":720,"line":1348},19,[718,1350,1333],{},[718,1352,1354],{"class":720,"line":1353},20,[718,1355,1356],{},"}\n",[718,1358,1360],{"class":720,"line":1359},21,[718,1361,1363],{"emptyLinePlaceholder":1362},true,"\n",[718,1365,1367],{"class":720,"line":1366},22,[718,1368,1369],{},"api.example.com {\n",[718,1371,1373],{"class":720,"line":1372},23,[718,1374,1375],{},"    encode zstd gzip\n",[718,1377,1379],{"class":720,"line":1378},24,[718,1380,1381],{},"    header Alt-Svc `h3=\":443\"; ma=2592000`\n",[718,1383,1385],{"class":720,"line":1384},25,[718,1386,1387],{},"    handle_errors {\n",[718,1389,1391],{"class":720,"line":1390},26,[718,1392,1393],{},"        @starting0 expression `{err.status_code} in [502, 503] && {http.request.method} in [\"GET\", \"HEAD\", \"OPTIONS\"]`\n",[718,1395,1397],{"class":720,"line":1396},27,[718,1398,1399],{},"        handle @starting0 {\n",[718,1401,1403],{"class":720,"line":1402},28,[718,1404,1405],{},"            header Retry-After 5\n",[718,1407,1409],{"class":720,"line":1408},29,[718,1410,1411],{},"            header Content-Type \"application\u002Fjson\"\n",[718,1413,1415],{"class":720,"line":1414},30,[718,1416,1417],{},"            respond `{\"error\":{\"code\":\"UNAVAILABLE\",\"message\":\"SHADE is starting up. Try again in a moment.\",\"key\":\"api.errors.starting\"}}` 503\n",[718,1419,1421],{"class":720,"line":1420},31,[718,1422,1327],{},[718,1424,1426],{"class":720,"line":1425},32,[718,1427,1428],{},"        @unanswered0 expression `{err.status_code} in [502, 503]`\n",[718,1430,1432],{"class":720,"line":1431},33,[718,1433,1434],{},"        handle @unanswered0 {\n",[718,1436,1438],{"class":720,"line":1437},34,[718,1439,1411],{},[718,1441,1443],{"class":720,"line":1442},35,[718,1444,1445],{},"            respond `{\"error\":{\"code\":\"BAD_GATEWAY\",\"message\":\"The server didn't answer. Check before trying again.\"}}` 502\n",[718,1447,1449],{"class":720,"line":1448},36,[718,1450,1327],{},[718,1452,1454],{"class":720,"line":1453},37,[718,1455,1333],{},[718,1457,1459],{"class":720,"line":1458},38,[718,1460,1461],{},"    handle \u002Fapi\u002Fv1\u002Faccount\u002F* {\n",[718,1463,1465],{"class":720,"line":1464},39,[718,1466,1467],{},"        reverse_proxy {\n",[718,1469,1471],{"class":720,"line":1470},40,[718,1472,1473],{},"            dynamic a public 4000 {\n",[718,1475,1477],{"class":720,"line":1476},41,[718,1478,1479],{},"                refresh 1s\n",[718,1481,1483],{"class":720,"line":1482},42,[718,1484,1485],{},"            }\n",[718,1487,1489],{"class":720,"line":1488},43,[718,1490,1491],{},"            lb_try_duration 15s\n",[718,1493,1495],{"class":720,"line":1494},44,[718,1496,1497],{},"            lb_try_interval 50ms\n",[718,1499,1501],{"class":720,"line":1500},45,[718,1502,1503],{},"            lb_retry_match {\n",[718,1505,1507],{"class":720,"line":1506},46,[718,1508,1509],{},"                method GET HEAD OPTIONS\n",[718,1511,1513],{"class":720,"line":1512},47,[718,1514,1485],{},[718,1516,1518],{"class":720,"line":1517},48,[718,1519,1520],{},"            fail_duration 1s\n",[718,1522,1524],{"class":720,"line":1523},49,[718,1525,1526],{},"            stream_close_delay 5m\n",[718,1528,1530],{"class":720,"line":1529},50,[718,1531,1327],{},[718,1533,1535],{"class":720,"line":1534},51,[718,1536,1333],{},[718,1538,1540],{"class":720,"line":1539},52,[718,1541,1542],{},"    handle {\n",[718,1544,1546],{"class":720,"line":1545},53,[718,1547,1467],{},[718,1549,1551],{"class":720,"line":1550},54,[718,1552,1553],{},"            dynamic a admin 4000 {\n",[718,1555,1557],{"class":720,"line":1556},55,[718,1558,1479],{},[718,1560,1562],{"class":720,"line":1561},56,[718,1563,1485],{},[718,1565,1567],{"class":720,"line":1566},57,[718,1568,1491],{},[718,1570,1572],{"class":720,"line":1571},58,[718,1573,1497],{},[718,1575,1577],{"class":720,"line":1576},59,[718,1578,1503],{},[718,1580,1582],{"class":720,"line":1581},60,[718,1583,1509],{},[718,1585,1587],{"class":720,"line":1586},61,[718,1588,1485],{},[718,1590,1592],{"class":720,"line":1591},62,[718,1593,1520],{},[718,1595,1597],{"class":720,"line":1596},63,[718,1598,1526],{},[718,1600,1602],{"class":720,"line":1601},64,[718,1603,1327],{},[718,1605,1607],{"class":720,"line":1606},65,[718,1608,1333],{},[718,1610,1612],{"class":720,"line":1611},66,[718,1613,1356],{},[718,1615,1617],{"class":720,"line":1616},67,[718,1618,1363],{"emptyLinePlaceholder":1362},[718,1620,1622],{"class":720,"line":1621},68,[718,1623,1624],{},"admin.example.com {\n",[718,1626,1628],{"class":720,"line":1627},69,[718,1629,1375],{},[718,1631,1633],{"class":720,"line":1632},70,[718,1634,1381],{},[718,1636,1638],{"class":720,"line":1637},71,[718,1639,1387],{},[718,1641,1643],{"class":720,"line":1642},72,[718,1644,1645],{},"        @starting0 expression `{err.status_code} in [502, 503] && path('\u002Fapi\u002F*') && {http.request.method} in [\"GET\", \"HEAD\", \"OPTIONS\"]`\n",[718,1647,1649],{"class":720,"line":1648},73,[718,1650,1399],{},[718,1652,1654],{"class":720,"line":1653},74,[718,1655,1405],{},[718,1657,1659],{"class":720,"line":1658},75,[718,1660,1411],{},[718,1662,1664],{"class":720,"line":1663},76,[718,1665,1417],{},[718,1667,1669],{"class":720,"line":1668},77,[718,1670,1327],{},[718,1672,1674],{"class":720,"line":1673},78,[718,1675,1676],{},"        @unanswered0 expression `{err.status_code} in [502, 503] && path('\u002Fapi\u002F*')`\n",[718,1678,1680],{"class":720,"line":1679},79,[718,1681,1434],{},[718,1683,1685],{"class":720,"line":1684},80,[718,1686,1411],{},[718,1688,1690],{"class":720,"line":1689},81,[718,1691,1445],{},[718,1693,1695],{"class":720,"line":1694},82,[718,1696,1327],{},[718,1698,1700],{"class":720,"line":1699},83,[718,1701,1702],{},"        @starting1 expression `{err.status_code} in [502, 503] && {http.request.method} in [\"GET\", \"HEAD\", \"OPTIONS\"]`\n",[718,1704,1706],{"class":720,"line":1705},84,[718,1707,1708],{},"        handle @starting1 {\n",[718,1710,1712],{"class":720,"line":1711},85,[718,1713,1405],{},[718,1715,1717],{"class":720,"line":1716},86,[718,1718,1719],{},"            header Content-Type \"text\u002Fplain; charset=utf-8\"\n",[718,1721,1723],{"class":720,"line":1722},87,[718,1724,1725],{},"            respond \"Starting, back in a moment.\" 503\n",[718,1727,1729],{"class":720,"line":1728},88,[718,1730,1327],{},[718,1732,1734],{"class":720,"line":1733},89,[718,1735,1736],{},"        @unanswered1 expression `{err.status_code} in [502, 503]`\n",[718,1738,1740],{"class":720,"line":1739},90,[718,1741,1742],{},"        handle @unanswered1 {\n",[718,1744,1746],{"class":720,"line":1745},91,[718,1747,1719],{},[718,1749,1751],{"class":720,"line":1750},92,[718,1752,1753],{},"            respond \"The server didn't answer. Check before trying again.\" 502\n",[718,1755,1757],{"class":720,"line":1756},93,[718,1758,1327],{},[718,1760,1762],{"class":720,"line":1761},94,[718,1763,1333],{},[718,1765,1767],{"class":720,"line":1766},95,[718,1768,1542],{},[718,1770,1772],{"class":720,"line":1771},96,[718,1773,1467],{},[718,1775,1777],{"class":720,"line":1776},97,[718,1778,1553],{},[718,1780,1782],{"class":720,"line":1781},98,[718,1783,1479],{},[718,1785,1787],{"class":720,"line":1786},99,[718,1788,1485],{},[718,1790,1792],{"class":720,"line":1791},100,[718,1793,1794],{},"            import \u002Fetc\u002Fcaddy\u002Flb-cookie\n",[718,1796,1798],{"class":720,"line":1797},101,[718,1799,1491],{},[718,1801,1803],{"class":720,"line":1802},102,[718,1804,1497],{},[718,1806,1808],{"class":720,"line":1807},103,[718,1809,1503],{},[718,1811,1813],{"class":720,"line":1812},104,[718,1814,1509],{},[718,1816,1818],{"class":720,"line":1817},105,[718,1819,1485],{},[718,1821,1823],{"class":720,"line":1822},106,[718,1824,1520],{},[718,1826,1828],{"class":720,"line":1827},107,[718,1829,1526],{},[718,1831,1833],{"class":720,"line":1832},108,[718,1834,1327],{},[718,1836,1838],{"class":720,"line":1837},109,[718,1839,1333],{},[718,1841,1843],{"class":720,"line":1842},110,[718,1844,1356],{},[718,1846,1848],{"class":720,"line":1847},111,[718,1849,1363],{"emptyLinePlaceholder":1362},[718,1851,1853],{"class":720,"line":1852},112,[718,1854,1855],{},"www.example.com {\n",[718,1857,1859],{"class":720,"line":1858},113,[718,1860,1375],{},[718,1862,1864],{"class":720,"line":1863},114,[718,1865,1381],{},[718,1867,1869],{"class":720,"line":1868},115,[718,1870,1387],{},[718,1872,1874],{"class":720,"line":1873},116,[718,1875,1876],{},"        @starting0 expression `{err.status_code} in [502, 503] && (path('\u002Fapi\u002Fv1\u002Faccount\u002F*')) && {http.request.method} in [\"GET\", \"HEAD\", \"OPTIONS\"]`\n",[718,1878,1880],{"class":720,"line":1879},117,[718,1881,1399],{},[718,1883,1885],{"class":720,"line":1884},118,[718,1886,1405],{},[718,1888,1890],{"class":720,"line":1889},119,[718,1891,1411],{},[718,1893,1895],{"class":720,"line":1894},120,[718,1896,1417],{},[718,1898,1900],{"class":720,"line":1899},121,[718,1901,1327],{},[718,1903,1905],{"class":720,"line":1904},122,[718,1906,1907],{},"        @unanswered0 expression `{err.status_code} in [502, 503] && (path('\u002Fapi\u002Fv1\u002Faccount\u002F*'))`\n",[718,1909,1911],{"class":720,"line":1910},123,[718,1912,1434],{},[718,1914,1916],{"class":720,"line":1915},124,[718,1917,1411],{},[718,1919,1921],{"class":720,"line":1920},125,[718,1922,1445],{},[718,1924,1926],{"class":720,"line":1925},126,[718,1927,1327],{},[718,1929,1931],{"class":720,"line":1930},127,[718,1932,1333],{},[718,1934,1936],{"class":720,"line":1935},128,[718,1937,1461],{},[718,1939,1941],{"class":720,"line":1940},129,[718,1942,1467],{},[718,1944,1946],{"class":720,"line":1945},130,[718,1947,1473],{},[718,1949,1951],{"class":720,"line":1950},131,[718,1952,1479],{},[718,1954,1956],{"class":720,"line":1955},132,[718,1957,1485],{},[718,1959,1961],{"class":720,"line":1960},133,[718,1962,1491],{},[718,1964,1966],{"class":720,"line":1965},134,[718,1967,1497],{},[718,1969,1971],{"class":720,"line":1970},135,[718,1972,1503],{},[718,1974,1976],{"class":720,"line":1975},136,[718,1977,1509],{},[718,1979,1981],{"class":720,"line":1980},137,[718,1982,1485],{},[718,1984,1986],{"class":720,"line":1985},138,[718,1987,1520],{},[718,1989,1991],{"class":720,"line":1990},139,[718,1992,1526],{},[718,1994,1996],{"class":720,"line":1995},140,[718,1997,1327],{},[718,1999,2001],{"class":720,"line":2000},141,[718,2002,1333],{},[718,2004,2006],{"class":720,"line":2005},142,[718,2007,1542],{},[718,2009,2011],{"class":720,"line":2010},143,[718,2012,2013],{},"        reverse_proxy http:\u002F\u002Fsite:8080\n",[718,2015,2017],{"class":720,"line":2016},144,[718,2018,1333],{},[718,2020,2022],{"class":720,"line":2021},145,[718,2023,1356],{},[718,2025,2027],{"class":720,"line":2026},146,[718,2028,1363],{"emptyLinePlaceholder":1362},[718,2030,2032],{"class":720,"line":2031},147,[718,2033,2034],{},"import \u002Fetc\u002Fcaddy\u002FCaddyfile.local\n",[619,2036,2037,2038,2041,2042,2045,2046,2048,2049,634,2052,1202,2055,2058],{},"Each SHADE ",[623,2039,2040],{},"reverse_proxy"," finds every container of a role by its name, once a second (",[623,2043,2044],{},"dynamic a","), so a second\n",[623,2047,637],{}," or admin container started beside the first is used, and none once it is gone.\nCaddy runs no health check of its own for those. A container takes requests once it is ready, because it opens the port\nCaddy uses (4000) only then, and it closes that port when it has drained. A refused connection therefore always means\nnothing was sent, and Caddy leaves that container out for a second and sends the request to another, or holds it up to\n15 seconds until one answers, for every method. A reset on a connection Caddy reused is sent again for ",[623,2050,2051],{},"GET",[623,2053,2054],{},"HEAD",[623,2056,2057],{},"OPTIONS"," only.",[619,2060,2061,2062,2065,2066,2068,2069,2071,2072,2075],{},"The admin's own domain keeps a browser on one admin while two run, with a cookie called ",[623,2063,2064],{},"shade_admin",", so a page never\nasks the other version for a file. The cookie is keyed with a secret of the server's own, kept in ",[623,2067,1170],{}," (made by\n",[623,2070,625],{},", readable by Caddy alone), so its value says nothing about the container. The API domain's uploads, content API and MCP get no\ncookie, which keeps them cacheable; an admin without a domain of its own has no such stickiness. ",[623,2073,2074],{},"stream_close_delay 5m"," keeps sockets and live streams open for up to five minutes when Caddy reloads this file.",[619,2077,2078,2079,634,2081,2083,2084,2086,2087,2090,2091,2093],{},"When no SHADE container answers, a visitor gets a short answer in place of Caddy's bare 502. A ",[623,2080,2051],{},[623,2082,2054],{}," or\n",[623,2085,2057],{}," request is told \"Starting, back in a moment.\" with ",[623,2088,2089],{},"Retry-After"," (in the API's error shape on the API paths,\nas text on the admin's screens; where the admin has no domain of its own, the API's domain answers in the API's error shape while the admin starts). Any other method gets a 502, \"The server didn't answer. Check before trying again.\",\nwithout ",[623,2092,2089],{},": the request may have reached the container before it went, so the client should check before it\nsends it again. Your own site's container, behind Caddy, answers for itself.",[619,2095,2096,2097,634,2100,638,2103,2106,2107,2109,2110,2112,2113,2115,2116,2118,2119,2121],{},"Caddy starts HTTPS for each domain by itself and redirects HTTP to it. It sets ",[623,2098,2099],{},"X-Forwarded-For",[623,2101,2102],{},"-Proto",[623,2104,2105],{},"-Host","\nfrom the connection it saw and never takes them from a client, and it compresses text answers with zstd or gzip. The\nlast line imports ",[623,2108,1158],{},", the file for your own additions (another site, a header, a redirect). ",[623,2111,625],{}," creates it with one comment line and ",[623,2114,629],{}," never writes it, as with ",[623,2117,1117],{},". After a change there, run\n",[623,2120,629],{}," or reload Caddy on its own:",[709,2123,2125],{"className":711,"code":2124,"language":713,"meta":714,"style":714},"cd \u002Fetc\u002Fshade && docker compose exec caddy caddy reload --config \u002Fetc\u002Fcaddy\u002FCaddyfile --adapter caddyfile --address unix\u002F\u002Frun\u002Fcaddy\u002Fadmin.sock\n",[623,2126,2127],{"__ignoreMap":714},[718,2128,2129,2133,2136,2139,2142,2145,2148,2151,2153,2156,2159,2162,2165,2168,2171],{"class":720,"line":721},[718,2130,2132],{"class":2131},"s2Zo4","cd",[718,2134,2135],{"class":728}," \u002Fetc\u002Fshade",[718,2137,2138],{"class":744}," &&",[718,2140,2141],{"class":724}," docker",[718,2143,2144],{"class":728}," compose",[718,2146,2147],{"class":728}," exec",[718,2149,2150],{"class":728}," caddy",[718,2152,2150],{"class":728},[718,2154,2155],{"class":728}," reload",[718,2157,2158],{"class":728}," --config",[718,2160,2161],{"class":728}," \u002Fetc\u002Fcaddy\u002FCaddyfile",[718,2163,2164],{"class":728}," --adapter",[718,2166,2167],{"class":728}," caddyfile",[718,2169,2170],{"class":728}," --address",[718,2172,2173],{"class":728}," unix\u002F\u002Frun\u002Fcaddy\u002Fadmin.sock\n",[619,2175,2176,2178,2179,2181,2182,2185,2186,2189,2190,2192],{},[899,2177,189],{}," is yours to add: put its container in ",[623,2180,1117],{}," under the name ",[623,2183,2184],{},"site",", listening on 8080\n(",[652,2187,62],{"href":2188},"\u002Frun\u002Fown-server-by-hand#2-docker-compose"," shows one). Its domain's account API goes to SHADE's\n",[623,2191,637],{}," container, so visitors' sign-in stays on the site's own domain.",[619,2194,2195,2198,2199,638,2202,2205],{},[899,2196,2197],{},"The firewall."," Docker opens the ports it publishes past ",[623,2200,2201],{},"ufw",[623,2203,2204],{},"firewalld",". That is why SHADE publishes only 80\nand 443; allow SSH in the firewall and nothing else. A firewall at your provider sits in front of Docker, so it has to\nallow 80 and 443 over TCP and 443 over UDP itself.",[619,2207,2208,2211,2212,2215],{},[899,2209,2210],{},"HTTP\u002F3."," Caddy answers over HTTP\u002F2 and HTTP\u002F3 on 443 and tells browsers about HTTP\u002F3 in the ",[623,2213,2214],{},"Alt-Svc"," header. A\nbrowser that can't reach UDP 443 stays on HTTP\u002F2, so a blocked port costs speed on slow mobile networks, nothing else.\nHetzner's cloud firewall, like most cloud firewalls, lets nothing in until a rule says so: add a rule for UDP 443 beside\nthe ones for TCP 80 and 443, or every browser stays on HTTP\u002F2 without an error to tell you.\nBehind Caddy, SHADE's containers speak HTTP\u002F1.1, which is all that hop on the same server needs.",[660,2217,2219],{"id":2218},"the-databases-roles","The database's roles",[619,2221,2222],{},"SHADE connects to Postgres as three roles instead of one, so that a leaked address of the running instance reaches its\nrows and nothing else. None is a superuser, and none may create databases or roles or replicate.",[976,2224,2225,2238],{},[979,2226,2227],{},[982,2228,2229,2232,2235],{},[985,2230,2231],{},"Role",[985,2233,2234],{},"Address",[985,2236,2237],{},"What it does",[997,2239,2240,2259,2281],{},[982,2241,2242,2247,2252],{},[1002,2243,2244,2246],{},[623,2245,1016],{},", the running role",[1002,2248,2249,2251],{},[623,2250,1012],{},", every container",[1002,2253,2254,2255,2258],{},"Runs every request, job and process. It owns nothing and has no ",[623,2256,2257],{},"BYPASSRLS",", so row-level security applies to it. It reads and writes the rows of every table, including the tables of later migrations and of modules, and cannot create, alter or truncate a table",[982,2260,2261,2266,2271],{},[1002,2262,2263,2265],{},[623,2264,706],{},", the owner",[1002,2267,2268,2270],{},[623,2269,1036],{},", the admin container and the console",[1002,2272,2273,2274,638,2277,2280],{},"Owns the database and every table, and alone changes the schema: core's and the modules' migrations, the backup taken before them, and the console's ",[623,2275,2276],{},"migrate",[623,2278,2279],{},"restore"," (run in the admin container)",[982,2282,2283,2289,2294],{},[1002,2284,2285,2288],{},[623,2286,2287],{},"shade_backup",", the backup role",[1002,2290,2291,2293],{},[623,2292,1052],{},", the worker only",[1002,2295,2296,2297,2299,2300,2303],{},"Reads every row (",[623,2298,2257],{},"), and every one of its transactions is read-only. It runs the worker's ",[623,2301,2302],{},"pg_dump"," and the backup's snapshot",[619,2305,2306,2307,2310,2311,2313,2314,2317,2318,2320,2321,2323,2324,2327],{},"The public container never holds the owner's address, and the worker and the public container drop it whatever their\nhost gives them; the public and admin containers likewise drop the backup role's. With backups on (",[623,2308,2309],{},"SHADE_BACKUP_URL","),\nthe worker needs ",[623,2312,1052],{},"; ",[623,2315,2316],{},"MIGRATE_ON_START"," on the admin needs ",[623,2319,1036],{},". Both addresses must\nname the same host, port and database as ",[623,2322,1012],{},". The image's bootstrap superuser, ",[623,2325,2326],{},"postgres",", is used only by\nthe script that makes the roles, once, on an empty volume.",[619,2329,2330,2331,2333,2334,2336,2337,2340,2341,2344,2345,2348,2349,2351,2352,970],{},"SHADE refuses to start when the role in ",[623,2332,1012],{}," is a superuser, has ",[623,2335,2257],{}," or owns a table, and says so:\n",[623,2338,2339],{},"DATABASE_URL connects as a role that may not run SHADE",". The ",[652,2342,2343],{"href":59},"doctor","'s ",[623,2346,2347],{},"database-role"," check reports the\nsame problems. Put the owner's address in ",[623,2350,1036],{}," and the backup role's in ",[623,2353,1052],{},[2355,2356,2358],"h3",{"id":2357},"row-level-security","Row-level security",[619,2360,2361],{},"Every table belongs to one part of SHADE, or to one module, and Postgres lets the running role touch its rows only\nwhen SHADE runs the statement as that owner. A part that needs another's rows asks that part, so a bug in one part\ncan't read or change another's data, and a statement SHADE didn't scope at all sees no rows and writes none.",[619,2363,2364,2365,2367,2368,2370,2371,2373,2374,2377,2378,2380,2381,2384],{},"The owner switches row-level security on and writes the policies after every migration run: the admin container with\n",[623,2366,2316],{},", the console's ",[623,2369,2276],{},", and installing or updating a module. They are written again from SHADE's\nown declarations and the installed modules' each time, never kept in the migration history, so there is nothing to\nmaintain by hand: the console's ",[623,2372,2276],{}," writes the modules' policies and views exactly as the admin's start does. A\nrun that would write what the last one wrote changes nothing and locks no table, and one that must wait more than ten\nseconds for a table's lock (a long report reading it, say) stops, and the start with it, rather than hold every\nrequest behind it; start again once the table is free. If a table\nhas it off (a table made by hand, or a database restored without the policies), every container refuses to start\nand names the tables: run ",[623,2375,2376],{},"node console\u002Fmigrate.mjs"," in the admin container. The ",[652,2379,2343],{"href":59},"'s\n",[623,2382,2383],{},"row-security"," check says the same.",[619,2386,2387],{},"Modules read a few columns of core's tables inside their own statements, such as an account's id and address for\n\"the signed-in customer's orders\". They get those through three views the owner makes in the same step (two of\naccounts and organisation members, one of the trash), each showing only those columns and only to the modules that\nneed them. They never get the accounts table itself, so no module can read a password hash or a session.",[619,2389,2390,2391,2393],{},"The backup role bypasses row-level security on purpose, since ",[623,2392,2302],{}," must read every row. One table is left open\nto every part for reading: the search index, whose policy made search several times slower; the search service is its\nonly way in and checks the owner itself, and only search writes it.",[619,2395,2396,2397,2399,2400,638,2403,2406],{},"A database made before the three roles cannot be converted: set the instance up again with a fresh database (nothing is\nlive before 0.1.0). ",[623,2398,625],{},", the deployment template, the ",[652,2401,2402],{"href":67},"NixOS module",[652,2404,2405],{"href":2188},"Self-hosting by\nhand"," make the roles themselves on a new database.",[660,2408,2410],{"id":2409},"from-staging-to-real-certificates","From staging to real certificates",[619,2412,2413,2414,2416,2417,2419],{},"A server installed with ",[623,2415,954],{}," serves certificates from Let's Encrypt's staging, which browsers don't trust. To\nswitch to real ones, run the installer again without ",[623,2418,954],{},", with the same domains and email:",[709,2421,2423],{"className":711,"code":2422,"language":713,"meta":714,"style":714},"sudo shade install --api-domain api.example.com --email you@example.com --image \u003Cthe image it runs> --force\n",[623,2424,2425],{"__ignoreMap":714},[718,2426,2427,2429,2431,2433,2435,2437,2439,2442,2444,2447,2450,2453,2456,2458,2461,2464],{"class":720,"line":721},[718,2428,770],{"class":724},[718,2430,773],{"class":728},[718,2432,751],{"class":728},[718,2434,784],{"class":728},[718,2436,787],{"class":728},[718,2438,790],{"class":728},[718,2440,2441],{"class":728}," you@example.com",[718,2443,877],{"class":728},[718,2445,2446],{"class":744}," \u003C",[718,2448,2449],{"class":728},"the",[718,2451,2452],{"class":728}," image",[718,2454,2455],{"class":728}," it",[718,2457,729],{"class":728},[718,2459,2460],{"class":796},"s",[718,2462,2463],{"class":744},">",[718,2465,2466],{"class":728}," --force\n",[619,2468,2469,2471,2472,2474,2475,2478,2479,2482,2483,2485],{},[623,2470,927],{}," writes the Caddyfile again and keeps every secret. Because the certificate authority changed, ",[623,2473,706],{}," restarts\nCaddy instead of reloading it (a reload would keep serving the staging certificates it already holds), and Caddy then\nasks Let's Encrypt for real ones. Give it a minute, then run ",[623,2476,2477],{},"shade doctor",". The staging certificates stay in\n",[623,2480,2481],{},"\u002Fetc\u002Fshade\u002Fcaddy-data",", unused. The same restart happens in ",[623,2484,629],{}," when a new release changes the directory.",[660,2487,2489],{"id":2488},"updating","Updating",[709,2491,2493],{"className":711,"code":2492,"language":713,"meta":714,"style":714},"sudo shade update --version 0.2.0\n",[623,2494,2495],{"__ignoreMap":714},[718,2496,2497,2499,2501,2504,2506],{"class":720,"line":721},[718,2498,770],{"class":724},[718,2500,773],{"class":728},[718,2502,2503],{"class":728}," update",[718,2505,778],{"class":728},[718,2507,2508],{"class":757}," 0.2.0\n",[619,2510,2511,2512,2514,2515,2517,2518,2521,2522,2524,2525,2528],{},"Read the ",[652,2513,702],{"href":600}," first. ",[623,2516,629],{}," pulls the new image, writes the compose file\nand the Caddyfile again from it, and pulls the Caddy, Postgres and Redis versions that release pins. It checks that\nCaddy can read the new Caddyfile and replaces the live one only then (one that fails leaves the live one as it\nwas), then reloads it without dropping a connection (when the release restarts Caddy anyway, the recreated Caddy reads the new file instead, at the end). Then it updates SHADE's containers one at a time, the\nadmin first (it migrates), and for each one starts a second container on the new image beside the old one. Once the new\none is healthy (",[623,2519,2520],{},"\u002Fhealth",") the old one is stopped, after the requests it was serving have finished, and Caddy sends\neverything to the new one. On the small profile the one ",[623,2523,706],{}," container is updated the same way. When a new container\nis not healthy within 15 minutes (",[623,2526,2527],{},"--timeout",") it is removed, the old one keeps serving and the update stops there with\nwhat the container said. The containers after it keep running the previous image.",[619,2530,2531,2532,2534],{},"Two containers of one role need memory for about a minute: up to the container's limit again (512 MB for the admin,\npublic and worker, 768 MB on the small profile). Before it starts a second container, ",[623,2533,629],{}," reads the memory\nthe server has free. With less than that, or when it cannot read it, it warns and recreates that container in place\ninstead, which leaves a gap of a few seconds to a minute for that role. When an earlier update that stopped halfway left\ntwo containers of a role, it keeps the one that is current once it is healthy and stops the other; it recreates in place\nonly when none of them is current.",[619,2536,2537,2538,2540],{},"Postgres, Redis and Caddy cannot be updated without a gap on one server. ",[623,2539,629],{}," says before it starts which of\nthem the release restarts, and what that costs (a few seconds of errors for Postgres, the loss of what Redis holds,\ndropped connections for Caddy), and does it last, after SHADE's containers, with Caddy at the very end. Most releases\nchange none of them. Because they restart after the new admin has migrated the database, a release whose migrations need a\nnewer Postgres says so in its notes.",[619,2542,2543,2544,2547,2548,2550],{},"Without ",[623,2545,2546],{},"--version"," it pulls the image it runs again. The ",[623,2549,706],{}," script updates itself from the new image.",[2355,2552,2554],{"id":2553},"when-an-update-stops-halfway","When an update stops halfway",[619,2556,2557,2558,2560,2561,2563,2564,970],{},"After a stop the admin may already run the new image, and it may have migrated the database, while ",[623,2559,1129],{}," still names the\nprevious image: ",[623,2562,1129],{}," only changes once every container runs the new one. The new settings wait in ",[623,2565,2566],{},"\u002Fetc\u002Fshade\u002F.env.new",[619,2568,2569,2570,2572],{},"Fix what the container's log says, then roll forward with the command ",[623,2571,706],{}," printed:",[709,2574,2576],{"className":711,"code":2575,"language":713,"meta":714,"style":714},"sudo shade update --image \u003Cthe new image>\n",[623,2577,2578],{"__ignoreMap":714},[718,2579,2580,2582,2584,2586,2588,2590,2592,2595,2598,2601],{"class":720,"line":721},[718,2581,770],{"class":724},[718,2583,773],{"class":728},[718,2585,2503],{"class":728},[718,2587,877],{"class":728},[718,2589,2446],{"class":744},[718,2591,2449],{"class":728},[718,2593,2594],{"class":728}," new",[718,2596,2597],{"class":728}," imag",[718,2599,2600],{"class":796},"e",[718,2602,2603],{"class":744},">\n",[619,2605,2606,2607,2609,2610,2613,2614,2616,2617,2620,2621,2623],{},"Plain ",[623,2608,629],{}," does the same while ",[623,2611,2612],{},".env.new"," is there: it goes on with the image the stopped update was moving to,\nnever back to the one ",[623,2615,1129],{}," names. ",[623,2618,2619],{},"docker compose up -d"," is not a recovery: it starts the admin on the image ",[623,2622,1129],{},"\nnames, under a database the new image already changed.",[619,2625,2626,2627,2630,2631,2635,2636,970],{},"To go back, run ",[623,2628,2629],{},"shade update --image \u003Cthe previous image>",". If the new admin already migrated the database, the old image\ndoesn't undo that: restore the ",[652,2632,2634],{"href":2633},"\u002Frun\u002Fupdating-and-backups#built-in-backups","backup taken before migrating"," first. A\nsuccessful update, or a successful run of the previous image, removes ",[623,2637,2612],{},[2355,2639,2641],{"id":2640},"requests-while-it-runs","Requests while it runs",[619,2643,2644],{},"While a role has two containers, Caddy sends each request to whichever is ready, and a request that reaches the one being\nstopped goes to the other. Requests already running on the container being stopped finish first, within its stop grace\n(two minutes for the admin, whose uploads can be long); a longer upload fails and is tried again. Where there was no memory for\na second container, the role is recreated in place: Caddy holds a request that arrives meanwhile for up to 15 seconds and\nsends it on once a container answers, so a restart of seconds shows up as a slow request, not an error, and one that takes\nlonger ends in the \"Starting, back in a moment.\" answer for the requests that waited that long. A restart of Postgres or\nRedis gives a few seconds of errors, and while Caddy itself restarts nothing answers at all, so connections drop and new\nones are refused until it is back. Schedule an update for a quiet hour all the same.",[2355,2646,2648],{"id":2647},"what-is-without-a-gap-and-what-is-not","What is without a gap, and what is not",[619,2650,2651,2652,638,2654,2656],{},"A normal update has no gap for the requests of visitors and the team: the admin, ",[623,2653,637],{},[623,2655,641],{}," each get a second\ncontainer, and the old one stops only once the new one is healthy. Four things are not covered by that.",[665,2658,2659,2665,2668,2671],{},[668,2660,2661,2662,2664],{},"The restart of Postgres, Redis or Caddy, when a release pins a new version of one of them. ",[623,2663,629],{}," names these\nbefore it starts.",[668,2666,2667],{},"A role recreated in place because the server lacks the memory for a second container.",[668,2669,2670],{},"Uploads that run longer than the admin's two minutes of stop grace, and streams or sockets that were open on the\ncontainer being stopped. Both are cut and come back on their own once the page reconnects.",[668,2672,2673],{},"A release that needs maintenance, below.",[2355,2675,2677],{"id":2676},"migrations-only-add","Migrations only add",[619,2679,2680,2681,638,2683,2685,2686,2689],{},"While the new admin migrates the database, the old ",[623,2682,637],{},[623,2684,641],{}," containers still run, on the new tables. So a\nrelease's migrations only add: new tables, new columns that are empty or have a default, new indexes. Dropping or renaming\na table or column, changing a column's type, adding ",[623,2687,2688],{},"NOT NULL"," without a default, and adding a constraint that the old\nversion's writes would break all wait for a later release, which does it once no running version still reads the old\nshape. The same holds for the shape of queued jobs and of what SHADE keeps in Redis: the new version reads the old, and\nthe old version tolerates the new.",[619,2691,2692,2693,2696],{},"SHADE checks this on every pull request (",[623,2694,2695],{},"pnpm migrations:add-only",", over the migrations added since the last release\ntag). Core's migrations are checked in SHADE's repository, and a module's where the workspace holds the module next to\nit; a module's own repository does not run the check yet. A migration that was already released and is edited, deleted or\nrenamed fails too. Dropping a constraint or a unique index is flagged, since old writes may rely on it. A step that drops\nsomething on purpose says in a comment which release stopped using it. Releases up to 0.1.0 are not checked: nothing runs\non them yet.",[2355,2698,2700],{"id":2699},"a-release-that-needs-maintenance","A release that needs maintenance",[619,2702,2703,2704,2706,2707,2709],{},"Now and then a change cannot wait a release: a conversion of stored data in place, a rename the old version cannot do\nwithout. Such a release is marked \"needs maintenance\" in its release file, and the ",[652,2705,702],{"href":600},"\nsays why. ",[623,2708,629],{}," refuses it. With a made-up release 0.3.0 as the example:",[709,2711,2716],{"className":2712,"code":2714,"language":2715,"meta":714},[2713],"language-text","This update needs maintenance: the release notes mark 0.3.0 as breaking (its migrations cannot run while the old version serves). No running container was changed.\nRun it again with --maintenance: shade update --image ghcr.io\u002Fshadehq-dev\u002Fshade:0.3.0 --maintenance\n","text",[623,2717,2714],{"__ignoreMap":714},[619,2719,2720,2721,2724],{},"Take a ",[652,2722,2723],{"href":2633},"backup"," first, then run the same update with the flag:",[709,2726,2728],{"className":711,"code":2727,"language":713,"meta":714,"style":714},"sudo shade update --version 0.3.0 --maintenance\n",[623,2729,2730],{"__ignoreMap":714},[718,2731,2732,2734,2736,2738,2740,2743],{"class":720,"line":721},[718,2733,770],{"class":724},[718,2735,773],{"class":728},[718,2737,2503],{"class":728},[718,2739,778],{"class":728},[718,2741,2742],{"class":757}," 0.3.0",[718,2744,2745],{"class":728}," --maintenance\n",[619,2747,2748,2749,2751,2752,2755,2756,2758,2759,2762,2763,2766,2767,2769,2770,2773,2774,2776],{},"With the flag, ",[623,2750,706],{}," switches ",[652,2753,2754],{"href":95},"maintenance mode"," on before the admin starts (visitors get SHADE's\n\"back soon\" answer, static pages stay up, admins keep working), recreates each container in place, so the old version never\nruns beside the new (the worker is stopped first, ",[623,2757,637],{}," keeps serving), and switches maintenance mode off once every\ncontainer is healthy. Maintenance mode is always off at the end, even if it was on before you started. The flag also works\non a release that is not marked, when you want the quiet anyway. If an update under maintenance stops halfway, maintenance mode stays on while you\nfix the cause. The command it prints to roll forward includes ",[623,2760,2761],{},"--maintenance",", and the run that succeeds switches it off. If\nit cannot, it says so, still finishes the update and gives the command: ",[623,2764,2765],{},"docker compose exec admin node console\u002Fmaintenance.mjs off","\nin ",[623,2768,919],{}," (",[623,2771,2772],{},"docker compose exec shade …"," with ",[623,2775,649],{},").",[660,2778,2780],{"id":2779},"checking","Checking",[709,2782,2784],{"className":711,"code":2783,"language":713,"meta":714,"style":714},"sudo shade doctor\n",[623,2785,2786],{"__ignoreMap":714},[718,2787,2788,2790,2792],{"class":720,"line":721},[718,2789,770],{"class":724},[718,2791,773],{"class":728},[718,2793,2794],{"class":728}," doctor\n",[619,2796,2797,2798,2800,2801,2803],{},"The ",[652,2799,2343],{"href":59},", run in the admin container, with the server's checks: each domain's certificate (trusted,\nand valid for 14 days more), each domain and ",[623,2802,2520],{}," answering through Caddy, Caddy's admin API out of reach, and the\nserver's clock synchronised.",[660,2805,2807],{"id":2806},"backing-up","Backing up",[619,2809,2810,2811,2813,2814,2816,2817,2819,2820,2822,2823,2825,2826,2829,2830,638,2832,963,2835,2837,2838,970],{},"Back up ",[623,2812,919],{}," whole, encrypted and away from the server: ",[623,2815,1006],{}," holds ",[623,2818,923],{},", without which the\nsecrets stored in the database cannot be read, and ",[623,2821,1187],{}," holds the certificates and the Let's Encrypt account. ",[623,2824,1158],{}," holds your own proxy\nsettings. The\ndatabase and the media are SHADE's ",[652,2827,2828],{"href":2633},"built-in backups",": set\n",[623,2831,2309],{},[623,2833,2834],{},"SHADE_BACKUP_KEY",[623,2836,1006],{},", then ",[623,2839,2840],{},"cd \u002Fetc\u002Fshade && docker compose up -d",[660,2842,2844],{"id":2843},"later-public-domains-for-client-services","Later: public domains for client services",[619,2846,2847,2848,2850],{},"Not built yet. ",[652,2849,349],{"href":350}," may get public domains of their own. The way\nin is a route added to Caddy while it runs. The admin socket is Caddy's own today; sharing it with the admin\ncontainer is the later work:",[665,2852,2853,2856],{},[668,2854,2855],{},"A route goes in only for a domain an admin approved, and only after SHADE checked that the domain's DNS points at\nthis server. A domain that doesn't point here fails its check again and again, until Let's Encrypt's limit on\nfailed checks (5 an hour per domain) stops every new certificate for it.",[668,2857,2858,2859,2862],{},"Caddy asks SHADE before it requests a certificate for a name (",[623,2860,2861],{},"on_demand_tls","), so a domain nobody approved gets\nnone, even when its DNS points at the server.",[2864,2865,2866],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}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);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}",{"title":714,"searchDepth":767,"depth":767,"links":2868},[2869,2870,2871,2872,2875,2876,2883,2884,2885],{"id":662,"depth":767,"text":663},{"id":691,"depth":767,"text":692},{"id":973,"depth":767,"text":974},{"id":2218,"depth":767,"text":2219,"children":2873},[2874],{"id":2357,"depth":800,"text":2358},{"id":2409,"depth":767,"text":2410},{"id":2488,"depth":767,"text":2489,"children":2877},[2878,2879,2880,2881,2882],{"id":2553,"depth":800,"text":2554},{"id":2640,"depth":800,"text":2641},{"id":2647,"depth":800,"text":2648},{"id":2676,"depth":800,"text":2677},{"id":2699,"depth":800,"text":2700},{"id":2779,"depth":767,"text":2780},{"id":2806,"depth":767,"text":2807},{"id":2843,"depth":767,"text":2844},"md",null,{},{"title":70,"description":714},"C0kf00qzlpyamlXAF-5zMHX1ijQnoLCCx3ga1zFdyeo",[2892,2893],{"title":66,"path":67,"stem":68,"description":714,"children":-1},{"title":74,"path":75,"stem":76,"description":714,"children":-1},1796500157531]