[{"data":1,"prerenderedAt":778},["ShallowReactive",2],{"docs-navigation":3,"docs:\u002Fdocs\u002Fself-hosting\u002Farchitecture":235,"docs-surround:\u002Fdocs\u002Fself-hosting\u002Farchitecture":773},[4],{"title":5,"path":6,"stem":7,"children":8},"Docs","\u002Fdocs","docs",[9,13,37,55,70,128,146,191,217],{"title":10,"path":6,"stem":11,"icon":12},"Hubstruct documentation","docs\u002Findex","book-open",{"title":14,"icon":15,"path":16,"stem":17,"children":18,"page":36},"Getting started","rocket","\u002Fdocs\u002Fgetting-started","docs\u002F1.getting-started",[19,24,28,32],{"title":20,"path":21,"stem":22,"icon":23},"Introduction","\u002Fdocs\u002Fgetting-started\u002Fintroduction","docs\u002F1.getting-started\u002F1.introduction",null,{"title":25,"path":26,"stem":27,"icon":23},"Requirements","\u002Fdocs\u002Fgetting-started\u002Frequirements","docs\u002F1.getting-started\u002F2.requirements",{"title":29,"path":30,"stem":31,"icon":23},"Quick start","\u002Fdocs\u002Fgetting-started\u002Fquick-start","docs\u002F1.getting-started\u002F3.quick-start",{"title":33,"path":34,"stem":35,"icon":23},"First steps","\u002Fdocs\u002Fgetting-started\u002Ffirst-steps","docs\u002F1.getting-started\u002F4.first-steps",false,{"title":38,"icon":39,"path":40,"stem":41,"children":42,"page":36},"Concepts","lightbulb","\u002Fdocs\u002Fconcepts","docs\u002F2.concepts",[43,47,51],{"title":44,"path":45,"stem":46,"icon":23},"How it works","\u002Fdocs\u002Fconcepts\u002Fhow-it-works","docs\u002F2.concepts\u002F1.how-it-works",{"title":48,"path":49,"stem":50,"icon":23},"Processing steps","\u002Fdocs\u002Fconcepts\u002Fprocessing","docs\u002F2.concepts\u002F2.processing",{"title":52,"path":53,"stem":54,"icon":23},"Media","\u002Fdocs\u002Fconcepts\u002Fmedia","docs\u002F2.concepts\u002F3.media",{"title":56,"path":57,"stem":58,"children":59,"icon":69},"Libraries","\u002Fdocs\u002Flibraries","docs\u002F3.libraries\u002F1.index",[60,61,65],{"title":56,"path":57,"stem":58,"icon":23},{"title":62,"path":63,"stem":64,"icon":23},"Storage","\u002Fdocs\u002Flibraries\u002Fs3","docs\u002F3.libraries\u002F3.s3",{"title":66,"path":67,"stem":68,"icon":23},"Uploading","\u002Fdocs\u002Flibraries\u002Fuploading","docs\u002F3.libraries\u002F4.uploading","layer-group",{"title":71,"icon":72,"path":73,"stem":74,"children":75,"page":36},"Features","wand-magic-sparkles","\u002Fdocs\u002Ffeatures","docs\u002F4.features",[76,80,84,88,92,96,100,104,108,112,116,120,124],{"title":77,"path":78,"stem":79,"icon":23},"Browsing","\u002Fdocs\u002Ffeatures\u002Fbrowsing","docs\u002F4.features\u002F01.browsing",{"title":81,"path":82,"stem":83,"icon":23},"Search","\u002Fdocs\u002Ffeatures\u002Fsearch","docs\u002F4.features\u002F02.search",{"title":85,"path":86,"stem":87,"icon":23},"Tags","\u002Fdocs\u002Ffeatures\u002Ftags","docs\u002F4.features\u002F03.tags",{"title":89,"path":90,"stem":91,"icon":23},"Albums","\u002Fdocs\u002Ffeatures\u002Falbums","docs\u002F4.features\u002F04.albums",{"title":93,"path":94,"stem":95,"icon":23},"People and faces","\u002Fdocs\u002Ffeatures\u002Fpeople","docs\u002F4.features\u002F05.people",{"title":97,"path":98,"stem":99,"icon":23},"Groups","\u002Fdocs\u002Ffeatures\u002Fgroups","docs\u002F4.features\u002F06.groups",{"title":101,"path":102,"stem":103,"icon":23},"Duplicates and stacks","\u002Fdocs\u002Ffeatures\u002Fduplicates-and-stacks","docs\u002F4.features\u002F07.duplicates-and-stacks",{"title":105,"path":106,"stem":107,"icon":23},"NSFW","\u002Fdocs\u002Ffeatures\u002Fnsfw","docs\u002F4.features\u002F08.nsfw",{"title":109,"path":110,"stem":111,"icon":23},"Trash","\u002Fdocs\u002Ffeatures\u002Ftrash","docs\u002F4.features\u002F09.trash",{"title":113,"path":114,"stem":115,"icon":23},"Home and the dashboard","\u002Fdocs\u002Ffeatures\u002Fhome-and-dashboard","docs\u002F4.features\u002F10.home-and-dashboard",{"title":117,"path":118,"stem":119,"icon":23},"Live updates and offline","\u002Fdocs\u002Ffeatures\u002Flive-updates","docs\u002F4.features\u002F11.live-updates",{"title":121,"path":122,"stem":123,"icon":23},"Appearance and the app","\u002Fdocs\u002Ffeatures\u002Fappearance","docs\u002F4.features\u002F12.appearance",{"title":125,"path":126,"stem":127,"icon":23},"Places","\u002Fdocs\u002Ffeatures\u002Fplaces","docs\u002F4.features\u002F13.places",{"title":129,"icon":130,"path":131,"stem":132,"children":133,"page":36},"Administration","sliders","\u002Fdocs\u002Fadministration","docs\u002F5.administration",[134,138,142],{"title":135,"path":136,"stem":137,"icon":23},"Users and sign-in","\u002Fdocs\u002Fadministration\u002Fusers-and-sign-in","docs\u002F5.administration\u002F1.users-and-sign-in",{"title":139,"path":140,"stem":141,"icon":23},"API keys","\u002Fdocs\u002Fadministration\u002Fapi-keys","docs\u002F5.administration\u002F2.api-keys",{"title":143,"path":144,"stem":145,"icon":23},"Processing settings","\u002Fdocs\u002Fadministration\u002Fprocessing-settings","docs\u002F5.administration\u002F3.processing-settings",{"title":147,"icon":148,"path":149,"stem":150,"children":151,"page":36},"Self-hosting","server","\u002Fdocs\u002Fself-hosting","docs\u002F6.self-hosting",[152,156,160,164,167,171,175,179,183,187],{"title":153,"path":154,"stem":155,"icon":23},"Architecture","\u002Fdocs\u002Fself-hosting\u002Farchitecture","docs\u002F6.self-hosting\u002F1.architecture",{"title":157,"path":158,"stem":159,"icon":23},"Telemetry","\u002Fdocs\u002Fself-hosting\u002Ftelemetry","docs\u002F6.self-hosting\u002F10.telemetry",{"title":161,"path":162,"stem":163,"icon":23},"Sharing one GPU","\u002Fdocs\u002Fself-hosting\u002Fgpu","docs\u002F6.self-hosting\u002F2.gpu",{"title":62,"path":165,"stem":166,"icon":23},"\u002Fdocs\u002Fself-hosting\u002Fstorage","docs\u002F6.self-hosting\u002F3.storage",{"title":168,"path":169,"stem":170,"icon":23},"Backups","\u002Fdocs\u002Fself-hosting\u002Fbackups","docs\u002F6.self-hosting\u002F4.backups",{"title":172,"path":173,"stem":174,"icon":23},"Updating","\u002Fdocs\u002Fself-hosting\u002Fupdating","docs\u002F6.self-hosting\u002F5.updating",{"title":176,"path":177,"stem":178,"icon":23},"Scaling","\u002Fdocs\u002Fself-hosting\u002Fscaling","docs\u002F6.self-hosting\u002F6.scaling",{"title":180,"path":181,"stem":182,"icon":23},"HTTPS and a domain","\u002Fdocs\u002Fself-hosting\u002Freverse-proxy","docs\u002F6.self-hosting\u002F7.reverse-proxy",{"title":184,"path":185,"stem":186,"icon":23},"Troubleshooting","\u002Fdocs\u002Fself-hosting\u002Ftroubleshooting","docs\u002F6.self-hosting\u002F8.troubleshooting",{"title":188,"path":189,"stem":190,"icon":23},"The config file","\u002Fdocs\u002Fself-hosting\u002Fconfig-file","docs\u002F6.self-hosting\u002F9.config-file",{"title":192,"icon":193,"path":194,"stem":195,"children":196,"page":36},"Reference","book","\u002Fdocs\u002Freference","docs\u002F7.reference",[197,201,205,209,213],{"title":198,"path":199,"stem":200,"icon":23},"Environment variables","\u002Fdocs\u002Freference\u002Fenvironment","docs\u002F7.reference\u002F1.environment",{"title":202,"path":203,"stem":204,"icon":23},"Worker roles","\u002Fdocs\u002Freference\u002Fworker-roles","docs\u002F7.reference\u002F2.worker-roles",{"title":206,"path":207,"stem":208,"icon":23},"API","\u002Fdocs\u002Freference\u002Fapi","docs\u002F7.reference\u002F3.api",{"title":210,"path":211,"stem":212,"icon":23},"Keyboard shortcuts","\u002Fdocs\u002Freference\u002Fkeyboard-shortcuts","docs\u002F7.reference\u002F4.keyboard-shortcuts",{"title":214,"path":215,"stem":216,"icon":23},"Models","\u002Fdocs\u002Freference\u002Fmodels","docs\u002F7.reference\u002F5.models",{"title":218,"icon":219,"path":220,"stem":221,"children":222,"page":36},"Hubstruct Cloud","cloud","\u002Fdocs\u002Fcloud","docs\u002F8.cloud",[223,227,231],{"title":224,"path":225,"stem":226,"icon":23},"Getting started with the cloud","\u002Fdocs\u002Fcloud\u002Fgetting-started","docs\u002F8.cloud\u002F1.getting-started",{"title":228,"path":229,"stem":230,"icon":23},"Plans and billing","\u002Fdocs\u002Fcloud\u002Fplans-and-billing","docs\u002F8.cloud\u002F2.plans-and-billing",{"title":232,"path":233,"stem":234,"icon":23},"Moving between cloud and self-hosted","\u002Fdocs\u002Fcloud\u002Fmoving","docs\u002F8.cloud\u002F3.moving",{"id":236,"title":153,"body":237,"description":767,"extension":768,"eyebrow":147,"icon":23,"meta":769,"navigation":770,"path":154,"seo":771,"stem":155,"__hash__":772},"docs\u002Fdocs\u002F6.self-hosting\u002F1.architecture.md",{"type":238,"value":239,"toc":755},"minimark",[240,253,258,479,484,497,547,551,554,598,602,612,632,640,644,665,669,676,711,734,738,751],[241,242,243,244,248,249,252],"p",{},"A self-hosted Hubstruct is one Compose project, named ",[245,246,247],"code",{},"hubstruct",", with these services. ",[250,251,44],"a",{"href":45}," explains what they do together; this page is the operator's view.",[254,255,257],"h2",{"id":256},"services","Services",[259,260,261,283],"table",{},[262,263,264],"thead",{},[265,266,267,271,274,277,280],"tr",{},[268,269,270],"th",{},"Service",[268,272,273],{},"Image",[268,275,276],{},"Port (host → container)",[268,278,279],{},"Data",[268,281,282],{},"Health check",[284,285,286,313,332,353,377,398,420,438,457],"tbody",{},[265,287,288,294,299,302,308],{},[289,290,291],"td",{},[245,292,293],{},"postgres",[289,295,296],{},[245,297,298],{},"pgvector\u002Fpgvector:pg18",[289,300,301],{},"127.0.0.1:5432 → 5432",[289,303,304,307],{},[245,305,306],{},"pgdata18"," volume",[289,309,310],{},[245,311,312],{},"pg_isready",[265,314,315,320,325,327,329],{},[289,316,317],{},[245,318,319],{},"migrator",[289,321,322],{},[245,323,324],{},"ghcr.io\u002Fhubstruct\u002Fmigrator",[289,326],{},[289,328],{},[289,330,331],{},"Runs once, exits 0",[265,333,334,339,344,346,351],{},[289,335,336],{},[245,337,338],{},"storage",[289,340,341],{},[245,342,343],{},"dxflrs\u002Fgarage",[289,345],{},[289,347,348],{},[245,349,350],{},"${MEDIA_DIR}\u002Fstorage\u002F{meta,data}",[289,352],{},[265,354,355,360,365,368,372],{},[289,356,357],{},[245,358,359],{},"models",[289,361,362],{},[245,363,364],{},"ghcr.io\u002Fhubstruct\u002Fmodels",[289,366,367],{},"127.0.0.1:8090 → 8080",[289,369,370,307],{},[245,371,359],{},[289,373,374],{},[245,375,376],{},"\u002Fhealth",[265,378,379,384,389,392,394],{},[289,380,381],{},[245,382,383],{},"vision",[289,385,386],{},[245,387,388],{},"ghcr.io\u002Fhubstruct\u002Fvision",[289,390,391],{},"127.0.0.1:8092 → 8092",[289,393],{},[289,395,396],{},[245,397,376],{},[265,399,400,405,410,413,415],{},[289,401,402],{},[245,403,404],{},"api",[289,406,407],{},[245,408,409],{},"ghcr.io\u002Fhubstruct\u002Fapi",[289,411,412],{},"127.0.0.1:3000 → 3000",[289,414],{},[289,416,417],{},[245,418,419],{},"\u002Fhealth\u002Fready",[265,421,422,427,432,434,436],{},[289,423,424],{},[245,425,426],{},"worker",[289,428,429],{},[245,430,431],{},"ghcr.io\u002Fhubstruct\u002Fworker",[289,433],{},[289,435],{},[289,437],{},[265,439,440,445,450,453,455],{},[289,441,442],{},[245,443,444],{},"console",[289,446,447],{},[245,448,449],{},"ghcr.io\u002Fhubstruct\u002Fconsole",[289,451,452],{},"4173 → 3000",[289,454],{},[289,456],{},[265,458,459,464,469,472,477],{},[289,460,461],{},[245,462,463],{},"otel-lgtm",[289,465,466],{},[245,467,468],{},"grafana\u002Fotel-lgtm",[289,470,471],{},"127.0.0.1:3001 → 3000, 127.0.0.1:4318 → 4318",[289,473,474,307],{},[245,475,476],{},"otel_lgtm",[289,478],{},[480,481,483],"h3",{"id":482},"which-ports-need-to-be-open","Which ports need to be open",[241,485,486,487,492,493,496],{},"Only ",[488,489,490],"strong",{},[245,491,444],{},", port 4173, is for people. The others are published for convenience, most of them only on the machine itself (",[245,494,495],{},"127.0.0.1","), and can be removed:",[498,499,500,515,521,527,533],"ul",{},[501,502,503,506,507,510,511,514],"li",{},[488,504,505],{},"3000"," (the API), on the machine itself only, is handy for scripts there and for the API reference at ",[245,508,509],{},"\u002Freference",". The app doesn't need it: it reaches the API over Compose's network. Keep it off the network: the API believes the address the app passes on for each browser, and its sign-in limits go by it. From elsewhere, use the API through the app, at ",[245,512,513],{},"\u002Fapi",".",[501,516,517,520],{},[488,518,519],{},"5432"," (PostgreSQL) is handy for backups and inspection from the host.",[501,522,523,526],{},[488,524,525],{},"8090"," (the models server) shows llama-swap's page of running models, and their logs, from the host.",[501,528,529,532],{},[488,530,531],{},"8092"," is for checking the vision service, which has no authentication.",[501,534,535,538,539,542,543,546],{},[488,536,537],{},"3001"," is Grafana, for ",[250,540,541],{"href":158},"telemetry",", and ",[488,544,545],{},"4318"," takes telemetry from a service run outside Compose. Both on the machine itself only.",[254,548,550],{"id":549},"start-order","Start order",[241,552,553],{},"Compose starts things in dependency order:",[555,556,557,562,570,583,588,593],"ol",{},[501,558,559,561],{},[245,560,293],{},", until it's healthy.",[501,563,564,566,567],{},[245,565,319],{},", which applies any new database migrations and exits. ",[488,568,569],{},"Everything that uses the database waits for it to finish successfully.",[501,571,572,575,576,578,579,578,581,514],{},[245,573,574],{},"models-download"," (once: it downloads the models, then exits), then ",[245,577,338],{},", ",[245,580,359],{},[245,582,383],{},[501,584,585,587],{},[245,586,404],{},", once the migrator is done and storage has started.",[501,589,590,592],{},[245,591,426],{},", likewise. The vision service is optional for it: the steps that need them wait while they're down.",[501,594,595,597],{},[245,596,444],{},", once the API is healthy.",[254,599,601],{"id":600},"health","Health",[241,603,604,605,608,609,611],{},"The API's ",[245,606,607],{},"\u002Fhealth\u002Flive"," answers whenever the process is up. ",[245,610,419],{}," checks each dependency with a short timeout:",[498,613,614,620,626],{},[501,615,616,619],{},[488,617,618],{},"ok",": everything is up.",[501,621,622,625],{},[488,623,624],{},"degraded",": an optional dependency is down, such as the models server or the vision service. The API still serves, and the steps that need it wait.",[501,627,628,631],{},[488,629,630],{},"down"," (HTTP 503): the database is down.",[241,633,634,635,639],{},"Both answer without signing in, and say only what's needed, with no addresses or error text. The dashboard's ",[250,636,638],{"href":637},"\u002Fdocs\u002Ffeatures\u002Fhome-and-dashboard#service-health","service health"," shows the same.",[254,641,643],{"id":642},"cpu-limits","CPU limits",[241,645,646,647,650,651,578,654,657,658,660,661,514],{},"Every service has a CPU limit from ",[245,648,649],{},".env"," (",[245,652,653],{},"API_CPUS",[245,655,656],{},"WORKER_CPUS"," and so on), so a busy one, such as the worker after a big upload, leaves the machine usable. See ",[250,659,176],{"href":177}," and the ",[250,662,664],{"href":663},"\u002Fdocs\u002Freference\u002Fenvironment#cpu-limits","environment reference",[254,666,668],{"id":667},"logs","Logs",[241,670,671,672,675],{},"The API, worker and migrator write ",[488,673,674],{},"structured JSON logs"," to standard output, one event per line, with the service's name and a request id for API calls. Read them with:",[677,678,683],"pre",{"className":679,"code":680,"language":681,"meta":682,"style":682},"language-bash shiki shiki-themes github-dark github-light","docker compose logs -f api worker\n","bash","",[245,684,685],{"__ignoreMap":682},[686,687,690,694,698,701,705,708],"span",{"class":688,"line":689},"line",1,[686,691,693],{"class":692},"sqoU-","docker",[686,695,697],{"class":696},"skb7c"," compose",[686,699,700],{"class":696}," logs",[686,702,704],{"class":703},"sTU5a"," -f",[686,706,707],{"class":696}," api",[686,709,710],{"class":696}," worker\n",[241,712,713,716,717,578,720,578,723,726,727,730,731,514],{},[245,714,715],{},"LOG_LEVEL"," sets how much they say: ",[245,718,719],{},"trace",[245,721,722],{},"debug",[245,724,725],{},"info"," (default), ",[245,728,729],{},"warn"," or ",[245,732,733],{},"error",[254,735,737],{"id":736},"networks","Networks",[241,739,740,741,578,744,578,747,750],{},"Everything is on the project's default network, where services reach each other by name: ",[245,742,743],{},"http:\u002F\u002Fapi:3000",[245,745,746],{},"http:\u002F\u002Fmodels:8080",[245,748,749],{},"http:\u002F\u002Fstorage:3900",". Nothing else needs to be reachable from outside.",[752,753,754],"style",{},"html pre.shiki code .sqoU-, html code.shiki .sqoU-{--shiki-default:#B392F0;--shiki-light:#6F42C1}html pre.shiki code .skb7c, html code.shiki .skb7c{--shiki-default:#9ECBFF;--shiki-light:#032F62}html pre.shiki code .sTU5a, html code.shiki .sTU5a{--shiki-default:#79B8FF;--shiki-light:#005CC5}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 .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);}",{"title":682,"searchDepth":756,"depth":756,"links":757},3,[758,762,763,764,765,766],{"id":256,"depth":759,"text":257,"children":760},2,[761],{"id":482,"depth":756,"text":483},{"id":549,"depth":759,"text":550},{"id":600,"depth":759,"text":601},{"id":642,"depth":759,"text":643},{"id":667,"depth":759,"text":668},{"id":736,"depth":759,"text":737},"Every container in a self-hosted install, its ports, volumes, health checks and what depends on what.","md",{},true,{"title":153,"description":767},"Oe2Bg9pDe_bpv36vdjhi3EuMvhj0k-eLIzL263ds1X8",[774,776],{"title":143,"path":144,"stem":145,"description":775,"children":-1},"Sizing and pausing each step, choosing the vision model, and the settings that apply to every library.",{"title":157,"path":158,"stem":159,"description":777,"children":-1},"[object Object]",1795744072947]