[{"data":1,"prerenderedAt":683},["ShallowReactive",2],{"docs-navigation":3,"docs:\u002Fdocs\u002Fself-hosting\u002Fscaling":235,"docs-surround:\u002Fdocs\u002Fself-hosting\u002Fscaling":678},[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":176,"body":237,"description":672,"extension":673,"eyebrow":147,"icon":23,"meta":674,"navigation":675,"path":177,"seo":676,"stem":178,"__hash__":677},"docs\u002Fdocs\u002F6.self-hosting\u002F6.scaling.md",{"type":238,"value":239,"toc":665},"minimark",[240,244,248,259,345,353,358,361,460,464,471,587,599,603,606,661],[241,242,243],"p",{},"One worker container does everything by default, and that suits most libraries. For a large library, or several machines, you can split the work up.",[245,246,202],"h2",{"id":247},"worker-roles",[241,249,250,254,255,258],{},[251,252,253],"code",{},"WORKER_ROLES"," says what a worker container runs. By default it's ",[251,256,257],{},"all",". Otherwise it's a comma-separated list:",[260,261,262,275],"table",{},[263,264,265],"thead",{},[266,267,268,272],"tr",{},[269,270,271],"th",{},"Role",[269,273,274],{},"Runs",[276,277,278,289,306,316,326,336],"tbody",{},[266,279,280,286],{},[281,282,283],"td",{},[251,284,285],{},"steps",[281,287,288],{},"Every processing step",[266,290,291,296],{},[281,292,293],{},[251,294,295],{},"step:\u003Cname>",[281,297,298,299,302,303],{},"One step, such as ",[251,300,301],{},"step:tagging"," or ",[251,304,305],{},"step:description",[266,307,308,313],{},[281,309,310],{},[251,311,312],{},"albums",[281,314,315],{},"Keeping albums' rule picks current",[266,317,318,323],{},[281,319,320],{},[251,321,322],{},"people",[281,324,325],{},"Placing faces with people",[266,327,328,333],{},[281,329,330],{},[251,331,332],{},"places",[281,334,335],{},"Putting media in places by where they were taken",[266,337,338,342],{},[281,339,340],{},[251,341,257],{},[281,343,344],{},"Everything (the default)",[241,346,347,348,352],{},"The full list of step names is in the ",[349,350,351],"a",{"href":203},"worker roles reference",". An unknown role stops the worker at start with a message listing the valid ones.",[354,355,357],"h3",{"id":356},"several-workers","Several workers",[241,359,360],{},"Run several worker containers, each with its own roles. Any number can share a role: taking work is race-safe, so two workers never do the same media, and leases keep longer runs apart. For example, to give tagging its own container, using a models server on another machine with a GPU:",[362,363,369],"pre",{"className":364,"code":365,"filename":366,"language":367,"meta":368,"style":368},"language-yaml shiki shiki-themes github-dark github-light","services:\n  worker:\n    environment:\n      WORKER_ROLES: steps,albums,people,places\n  worker-tagging:\n    extends: worker\n    environment:\n      WORKER_ROLES: step:tagging,step:nsfw\n      MODELS_URL: http:\u002F\u002Fgpu-box.lan:8090\n","compose.override.yml","yaml","",[251,370,371,384,392,400,413,421,432,439,449],{"__ignoreMap":368},[372,373,376,380],"span",{"class":374,"line":375},"line",1,[372,377,379],{"class":378},"shQVT","services",[372,381,383],{"class":382},"shWlK",":\n",[372,385,387,390],{"class":374,"line":386},2,[372,388,389],{"class":378},"  worker",[372,391,383],{"class":382},[372,393,395,398],{"class":374,"line":394},3,[372,396,397],{"class":378},"    environment",[372,399,383],{"class":382},[372,401,403,406,409],{"class":374,"line":402},4,[372,404,405],{"class":378},"      WORKER_ROLES",[372,407,408],{"class":382},": ",[372,410,412],{"class":411},"skb7c","steps,albums,people,places\n",[372,414,416,419],{"class":374,"line":415},5,[372,417,418],{"class":378},"  worker-tagging",[372,420,383],{"class":382},[372,422,424,427,429],{"class":374,"line":423},6,[372,425,426],{"class":378},"    extends",[372,428,408],{"class":382},[372,430,431],{"class":411},"worker\n",[372,433,435,437],{"class":374,"line":434},7,[372,436,397],{"class":378},[372,438,383],{"class":382},[372,440,442,444,446],{"class":374,"line":441},8,[372,443,405],{"class":378},[372,445,408],{"class":382},[372,447,448],{"class":411},"step:tagging,step:nsfw\n",[372,450,452,455,457],{"class":374,"line":451},9,[372,453,454],{"class":378},"      MODELS_URL",[372,456,408],{"class":382},[372,458,459],{"class":411},"http:\u002F\u002Fgpu-box.lan:8090\n",[245,461,463],{"id":462},"cpu-limits","CPU limits",[241,465,466,467,470],{},"Every service has a CPU limit from ",[251,468,469],{},".env",", so one busy service can't take the whole machine:",[260,472,473,486],{},[263,474,475],{},[266,476,477,480,483],{},[269,478,479],{},"Variable",[269,481,482],{},"Default",[269,484,485],{},"Service",[276,487,488,501,513,526,538,551,564,575],{},[266,489,490,495,498],{},[281,491,492],{},[251,493,494],{},"POSTGRES_CPUS",[281,496,497],{},"6",[281,499,500],{},"The database",[266,502,503,508,510],{},[281,504,505],{},[251,506,507],{},"MODELS_CPUS",[281,509,497],{},[281,511,512],{},"The models server",[266,514,515,520,523],{},[281,516,517],{},[251,518,519],{},"VISION_CPUS",[281,521,522],{},"8",[281,524,525],{},"The vision service (and its threads per model)",[266,527,528,533,535],{},[281,529,530],{},[251,531,532],{},"WORKER_CPUS",[281,534,497],{},[281,536,537],{},"The worker",[266,539,540,545,548],{},[281,541,542],{},[251,543,544],{},"API_CPUS",[281,546,547],{},"3",[281,549,550],{},"The API",[266,552,553,558,561],{},[281,554,555],{},[251,556,557],{},"WEB_CPUS",[281,559,560],{},"2",[281,562,563],{},"The app",[266,565,566,571,573],{},[281,567,568],{},[251,569,570],{},"STORAGE_CPUS",[281,572,560],{},[281,574,62],{},[266,576,577,582,584],{},[281,578,579],{},[251,580,581],{},"MIGRATOR_CPUS",[281,583,560],{},[281,585,586],{},"The migrator",[241,588,589,590,592,593,595,596,598],{},"The defaults suit an 8 to 16 core machine. On a smaller one, lower ",[251,591,494],{},", ",[251,594,532],{}," and ",[251,597,519],{}," so the app stays responsive while the worker is busy.",[245,600,602],{"id":601},"large-libraries","Large libraries",[241,604,605],{},"With hundreds of thousands of media:",[607,608,609,632,637,647,655],"ul",{},[610,611,612,616,617,595,620,623,624,627,628,631],"li",{},[613,614,615],"strong",{},"Give PostgreSQL memory."," Search and duplicate checks use vector indexes that are fastest in memory. Raise ",[251,618,619],{},"shared_buffers",[251,621,622],{},"effective_cache_size"," with a ",[251,625,626],{},"command:"," on the ",[251,629,630],{},"postgres"," service.",[610,633,634],{},[613,635,636],{},"Put the database on an SSD.",[610,638,639,642,643,646],{},[613,640,641],{},"Tune step concurrency"," for your hardware in ",[349,644,645],{"href":144},"Settings → Processing",".",[610,648,649,652,653,646],{},[613,650,651],{},"Give the models server a card that fits every model at once",", so it never has to stop one to start another. See ",[349,654,161],{"href":162},[610,656,657,660],{},[613,658,659],{},"Expect the first pass to take days",", not hours: every media goes through a dozen steps. The dashboard's work queue shows each step's pace and how long the rest will take.",[662,663,664],"style",{},"html pre.shiki code .shQVT, html code.shiki .shQVT{--shiki-default:#85E89D;--shiki-light:#22863A}html pre.shiki code .shWlK, html code.shiki .shWlK{--shiki-default:#E1E4E8;--shiki-light:#24292E}html pre.shiki code .skb7c, html code.shiki .skb7c{--shiki-default:#9ECBFF;--shiki-light:#032F62}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":368,"searchDepth":394,"depth":394,"links":666},[667,670,671],{"id":247,"depth":386,"text":202,"children":668},[669],{"id":356,"depth":394,"text":357},{"id":462,"depth":386,"text":463},{"id":601,"depth":386,"text":602},"Splitting the worker across containers with worker roles, CPU limits, and what to tune for large libraries.","md",{},true,{"title":176,"description":672},"FsW9z5qbHCmdp0dViGb457CaYvbDRfAFqNcj0tQsg3I",[679,681],{"title":172,"path":173,"stem":174,"description":680,"children":-1},"Getting a new version, what happens to the database when you do, and going back if you need to.",{"title":180,"path":181,"stem":182,"description":682,"children":-1},"Putting Hubstruct behind a reverse proxy with HTTPS, with examples for Caddy and nginx, and what the proxy must allow.",1795744073324]