[{"data":1,"prerenderedAt":668},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fapplications\u002Fday-two":3},{"id":4,"title":5,"body":6,"description":660,"extension":661,"meta":662,"navigation":663,"path":664,"seo":665,"stem":666,"__hash__":667},"docs\u002Fdocs\u002Fapplications\u002Fday-two.md","Scale, upgrade and roll back",{"type":7,"value":8,"toc":652},"minimark",[9,13,22,108,112,186,194,197,201,221,273,279,285,291,331,337,344,369,373,376,423,429,440,444,447,520,529,550,553,557,576,583,589,592,598,601,627,631,648],[10,11,5],"h1",{"id":12},"scale-upgrade-and-roll-back",[14,15,16,17,21],"p",{},"Once an application is deployed, five verbs cover day two. Two of them edit your ",[18,19,20],"code",{},"application.yaml"," for you, so read this page before you run them.",[23,24,25,41],"table",{},[26,27,28],"thead",{},[29,30,31,35,38],"tr",{},[32,33,34],"th",{},"Verb",[32,36,37],{},"Edits the spec?",[32,39,40],{},"New generation?",[42,43,44,57,68,83,96],"tbody",{},[29,45,46,52,55],{},[47,48,49],"td",{},[18,50,51],{},"status",[47,53,54],{},"no",[47,56,54],{},[29,58,59,64,66],{},[47,60,61],{},[18,62,63],{},"restart",[47,65,54],{},[47,67,54],{},[29,69,70,75,81],{},[47,71,72],{},[18,73,74],{},"scale",[47,76,77],{},[78,79,80],"strong",{},"yes",[47,82,80],{},[29,84,85,90,94],{},[47,86,87],{},[18,88,89],{},"upgrade",[47,91,92],{},[78,93,80],{},[47,95,80],{},[29,97,98,103,105],{},[47,99,100],{},[18,101,102],{},"rollback",[47,104,54],{},[47,106,107],{},"yes (N+1)",[109,110,111],"h2",{"id":63},"Restart",[113,114,119],"pre",{"className":115,"code":116,"language":117,"meta":118,"style":118},"language-bash shiki shiki-themes github-dark-high-contrast","sg application restart --config application.yaml            # every owned instance\nsg application restart --config application.yaml web       # one group\nsg application restart --config application.yaml web-1     # one instance, by key\n","bash","",[18,120,121,148,167],{"__ignoreMap":118},[122,123,126,130,134,137,141,144],"span",{"class":124,"line":125},"line",1,[122,127,129],{"class":128},"s_sBn","sg",[122,131,133],{"class":132},"sTRMh"," application",[122,135,136],{"class":132}," restart",[122,138,140],{"class":139},"sCcAr"," --config",[122,142,143],{"class":132}," application.yaml",[122,145,147],{"class":146},"sQrFR","            # every owned instance\n",[122,149,151,153,155,157,159,161,164],{"class":124,"line":150},2,[122,152,129],{"class":128},[122,154,133],{"class":132},[122,156,136],{"class":132},[122,158,140],{"class":139},[122,160,143],{"class":132},[122,162,163],{"class":132}," web",[122,165,166],{"class":146},"       # one group\n",[122,168,170,172,174,176,178,180,183],{"class":124,"line":169},3,[122,171,129],{"class":128},[122,173,133],{"class":132},[122,175,136],{"class":132},[122,177,140],{"class":139},[122,179,143],{"class":132},[122,181,182],{"class":132}," web-1",[122,184,185],{"class":146},"     # one instance, by key\n",[113,187,192],{"className":188,"code":190,"language":191,"meta":118},[189],"language-text","Restart application instances hello-web-1? This interrupts service. [y\u002FN]:\napplication hello restart run \u003Crun-id> finished: 1 instance(s) restarted and verified; no generation recorded.\n","text",[18,193,190],{"__ignoreMap":118},[14,195,196],{},"Restart re-runs the health checks afterwards. A selector that matches nothing refuses.",[109,198,200],{"id":199},"scale-a-group","Scale a group",[14,202,203,205,206,209,210,212,213,216,217,220],{},[18,204,74],{}," changes a group's ",[18,207,208],{},"count"," and placements, writes the result into ",[18,211,20],{},", then runs the normal deploy pipeline. You must give the ",[78,214,215],{},"complete"," resulting placement, one ",[18,218,219],{},"--target"," per resulting instance:",[113,222,224],{"className":115,"code":223,"language":117,"meta":118,"style":118},"sg application scale --config application.yaml web --count 3 \\\n  --target web-0=node-a --target web-1=node-b --target web-2=node-c --dry-run\n",[18,225,226,251],{"__ignoreMap":118},[122,227,228,230,232,235,237,239,241,244,247],{"class":124,"line":125},[122,229,129],{"class":128},[122,231,133],{"class":132},[122,233,234],{"class":132}," scale",[122,236,140],{"class":139},[122,238,143],{"class":132},[122,240,163],{"class":132},[122,242,243],{"class":139}," --count",[122,245,246],{"class":139}," 3",[122,248,250],{"class":249},"sWyjQ"," \\\n",[122,252,253,256,259,262,265,267,270],{"class":124,"line":150},[122,254,255],{"class":139},"  --target",[122,257,258],{"class":132}," web-0=node-a",[122,260,261],{"class":139}," --target",[122,263,264],{"class":132}," web-1=node-b",[122,266,261],{"class":139},[122,268,269],{"class":132}," web-2=node-c",[122,271,272],{"class":139}," --dry-run\n",[14,274,275,278],{},[18,276,277],{},"--dry-run"," shows the edited spec and the resulting deploy plan without writing a file or touching a host:",[113,280,283],{"className":281,"code":282,"language":191,"meta":118},[189],"Application group web scale preview (no file or host changes).\n…\nPlan hash: …\n",[18,284,282],{"__ignoreMap":118},[14,286,287,288,290],{},"Happy with it? Drop ",[18,289,277],{},":",[113,292,294],{"className":115,"code":293,"language":117,"meta":118,"style":118},"sg application scale --config application.yaml web --count 3 \\\n  --target web-0=node-a --target web-1=node-b --target web-2=node-c\n",[18,295,296,316],{"__ignoreMap":118},[122,297,298,300,302,304,306,308,310,312,314],{"class":124,"line":125},[122,299,129],{"class":128},[122,301,133],{"class":132},[122,303,234],{"class":132},[122,305,140],{"class":139},[122,307,143],{"class":132},[122,309,163],{"class":132},[122,311,243],{"class":139},[122,313,246],{"class":139},[122,315,250],{"class":249},[122,317,318,320,322,324,326,328],{"class":124,"line":150},[122,319,255],{"class":139},[122,321,258],{"class":132},[122,323,261],{"class":139},[122,325,264],{"class":132},[122,327,261],{"class":139},[122,329,330],{"class":132}," web-2=node-c\n",[113,332,335],{"className":333,"code":334,"language":191,"meta":118},[189],"Scale application group web and deploy the resulting plan? [y\u002FN]:\n",[18,336,334],{"__ignoreMap":118},[14,338,339,340,343],{},"A successful deploy records a new generation. Scaling down removes the highest-numbered instances; ",[18,341,342],{},"--count 0"," is allowed.",[345,346,348],"note",{"kind":347},"warning",[14,349,350,351,353,354,357,358,361,362,364,365,368],{},"What happens to the edited ",[18,352,20],{}," when you answer ",[18,355,356],{},"N"," is still being settled in ",[18,359,360],{},"0.1.0-dev",". Always run ",[18,363,277],{}," first, keep your specs in git, and check ",[18,366,367],{},"git diff"," after a declined scale or upgrade.",[109,370,372],{"id":371},"upgrade-a-group","Upgrade a group",[14,374,375],{},"Ship a new image to a group:",[113,377,379],{"className":115,"code":378,"language":117,"meta":118,"style":118},"sg application upgrade --config application.yaml web --image hello-web-2 --dry-run\nsg application upgrade --config application.yaml web --image hello-web-2\n",[18,380,381,404],{"__ignoreMap":118},[122,382,383,385,387,390,392,394,396,399,402],{"class":124,"line":125},[122,384,129],{"class":128},[122,386,133],{"class":132},[122,388,389],{"class":132}," upgrade",[122,391,140],{"class":139},[122,393,143],{"class":132},[122,395,163],{"class":132},[122,397,398],{"class":139}," --image",[122,400,401],{"class":132}," hello-web-2",[122,403,272],{"class":139},[122,405,406,408,410,412,414,416,418,420],{"class":124,"line":150},[122,407,129],{"class":128},[122,409,133],{"class":132},[122,411,389],{"class":132},[122,413,140],{"class":139},[122,415,143],{"class":132},[122,417,163],{"class":132},[122,419,398],{"class":139},[122,421,422],{"class":132}," hello-web-2\n",[113,424,427],{"className":425,"code":426,"language":191,"meta":118},[189],"Upgrade application group web (image hello-web-2) and deploy the resulting plan? [y\u002FN]:\n",[18,428,426],{"__ignoreMap":118},[14,430,431,432,435,436,439],{},"An image change ",[78,433,434],{},"recreates"," the group's instances, so the plan grades it ",[18,437,438],{},"high",". Container data that isn't on a volume goes with the old instance.",[109,441,443],{"id":442},"upgrade-a-service","Upgrade a service",[14,445,446],{},"Move a database to a newer release within its major version:",[113,448,450],{"className":115,"code":449,"language":117,"meta":118,"style":118},"sg application upgrade --config application.yaml db --service postgres --version \u003Cnewer-17.x-package-version> --dry-run\nsg application upgrade --config application.yaml db --service postgres --version \u003Cnewer-17.x-package-version>\n",[18,451,452,491],{"__ignoreMap":118},[122,453,454,456,458,460,462,464,467,470,473,476,479,482,486,489],{"class":124,"line":125},[122,455,129],{"class":128},[122,457,133],{"class":132},[122,459,389],{"class":132},[122,461,140],{"class":139},[122,463,143],{"class":132},[122,465,466],{"class":132}," db",[122,468,469],{"class":139}," --service",[122,471,472],{"class":132}," postgres",[122,474,475],{"class":139}," --version",[122,477,478],{"class":249}," \u003C",[122,480,481],{"class":132},"newer-17.x-package-versio",[122,483,485],{"class":484},"sMAXC","n",[122,487,488],{"class":249},">",[122,490,272],{"class":139},[122,492,493,495,497,499,501,503,505,507,509,511,513,515,517],{"class":124,"line":150},[122,494,129],{"class":128},[122,496,133],{"class":132},[122,498,389],{"class":132},[122,500,140],{"class":139},[122,502,143],{"class":132},[122,504,466],{"class":132},[122,506,469],{"class":139},[122,508,472],{"class":132},[122,510,475],{"class":139},[122,512,478],{"class":249},[122,514,481],{"class":132},[122,516,485],{"class":484},[122,518,519],{"class":249},">\n",[14,521,522,523,525,526,528],{},"The ",[18,524,277],{}," plan shows the exact version that would be installed. Major-version moves change the on-disk format, so expect ",[18,527,129],{}," to refuse them on a volume that already holds data.",[14,530,531,534,535,538,539,542,543,546,547,549],{},[18,532,533],{},"--version"," follows the same rules as in the spec: never ",[18,536,537],{},"latest","; for PostgreSQL a major or an exact package version, for ClickHouse an exact release. A change that isn't safe for the data already on the volume refuses with ",[18,540,541],{},"sg:service-version-incompatible",". You can combine ",[18,544,545],{},"--image"," and ",[18,548,533],{}," in one upgrade; at least one is required.",[14,551,552],{},"Service version upgrades are CLI-only. The panel's upgrade takes an image only.",[109,554,556],{"id":555},"roll-back","Roll back",[113,558,560],{"className":115,"code":559,"language":117,"meta":118,"style":118},"sg application rollback --config application.yaml\n",[18,561,562],{"__ignoreMap":118},[122,563,564,566,568,571,573],{"class":124,"line":125},[122,565,129],{"class":128},[122,567,133],{"class":132},[122,569,570],{"class":132}," rollback",[122,572,140],{"class":139},[122,574,575],{"class":132}," application.yaml\n",[14,577,578,579,582],{},"Rollback takes the exact spec recorded with generation N-1 and deploys it as a ",[78,580,581],{},"new"," generation N+1. It tells you what it picked before it asks:",[113,584,587],{"className":585,"code":586,"language":191,"meta":118},[189],"rollback: application hello selects generation 1 and plans generation 3 from its recorded bytes; individual steps are not undone and data volumes are reattached, not restored.\n",[18,588,586],{"__ignoreMap":118},[14,590,591],{},"and when it's done:",[113,593,596],{"className":594,"code":595,"language":191,"meta":118},[189],"rollback: application hello redeployed generation 1 as generation 3 (run \u003Crun-id>); data volumes are reattached, not touched.\n",[18,597,595],{"__ignoreMap":118},[14,599,600],{},"Three things to understand:",[602,603,604,611,617],"ul",{},[605,606,607,610],"li",{},[78,608,609],{},"It's a redeploy, not an undo."," Individual steps aren't reversed. The old spec is applied fresh.",[605,612,613,616],{},[78,614,615],{},"Data isn't restored."," Volumes are reattached as they are now. Rollback doesn't bring back yesterday's rows.",[605,618,619,622,623,626],{},[78,620,621],{},"It only goes back one."," No generation N-1, or an invalid one, means ",[18,624,625],{},"sg:rollback-unavailable",". It never falls back further. Run rollback again and you're going back one from the new generation.",[109,628,630],{"id":629},"see-the-history","See the history",[14,632,633,634,637,638,641,642,647],{},"The panel lists generations, newest first, at ",[18,635,636],{},"GET \u002Fapi\u002Fv1\u002Fapplications\u002F\u003Cname>\u002Fgenerations",". Failed and aborted deploys show up in run history (",[18,639,640],{},"\u002Fapi\u002Fv1\u002Fruns",") but never as generations. See ",[643,644,646],"a",{"href":645},"\u002Fdocs\u002Fpanel","The admin panel",".",[649,650,651],"style",{},"html pre.shiki code .s_sBn, html code.shiki .s_sBn{--shiki-default:#FFB757}html pre.shiki code .sTRMh, html code.shiki .sTRMh{--shiki-default:#ADDCFF}html pre.shiki code .sCcAr, html code.shiki .sCcAr{--shiki-default:#91CBFF}html pre.shiki code .sQrFR, html code.shiki .sQrFR{--shiki-default:#BDC4CC}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 pre.shiki code .sWyjQ, html code.shiki .sWyjQ{--shiki-default:#FF9492}html pre.shiki code .sMAXC, html code.shiki .sMAXC{--shiki-default:#F0F3F6}",{"title":118,"searchDepth":150,"depth":150,"links":653},[654,655,656,657,658,659],{"id":63,"depth":150,"text":111},{"id":199,"depth":150,"text":200},{"id":371,"depth":150,"text":372},{"id":442,"depth":150,"text":443},{"id":555,"depth":150,"text":556},{"id":629,"depth":150,"text":630},"Day-two operations for a running application. Restart instances, scale a group, ship a new image or database release, and go back a generation.","md",{},true,"\u002Fdocs\u002Fapplications\u002Fday-two",{"title":5,"description":660},"docs\u002Fapplications\u002Fday-two","HZK9HQK0dOqEgCzBCX3Zx8TCtcRQZiZho1K15ZnDLs8",1796464240885]