[{"data":1,"prerenderedAt":606},["ShallowReactive",2],{"navigation":3,"page-\u002Fresources\u002Fpostgresql":105,"surround-\u002Fresources\u002Fpostgresql":601},[4,17,25,48,63,74,86],{"title":5,"path":6,"stem":7,"children":8,"icon":16,"exact":11},"Getting started","\u002Fgetting-started","1.getting-started\u002F1.index",[9,12],{"title":10,"path":6,"stem":7,"exact":11,"children":-1},"Introduction",true,{"title":13,"path":14,"stem":15,"exact":11,"children":-1},"Quickstart","\u002Fgetting-started\u002Fquickstart","1.getting-started\u002F2.quickstart","i-lucide-rocket",{"title":18,"path":19,"stem":20,"children":21,"icon":24,"exact":11},"Concepts","\u002Fconcepts","2.concepts\u002F1.index",[22],{"title":23,"path":19,"stem":20,"exact":11,"children":-1},"The Kuppit model","i-lucide-shapes",{"title":26,"path":27,"stem":28,"children":29,"icon":47,"exact":11},"Deployments","\u002Fdeployments","3.deployments\u002F1.index",[30,31,35,39,43],{"title":26,"path":27,"stem":28,"exact":11,"children":-1},{"title":32,"path":33,"stem":34,"exact":11,"children":-1},"Builds","\u002Fdeployments\u002Fbuilds","3.deployments\u002F2.builds",{"title":36,"path":37,"stem":38,"exact":11,"children":-1},"Redeploy and roll back","\u002Fdeployments\u002Fredeploy-and-rollback","3.deployments\u002F3.redeploy-and-rollback",{"title":40,"path":41,"stem":42,"exact":11,"children":-1},"Logs","\u002Fdeployments\u002Flogs","3.deployments\u002F4.logs",{"title":44,"path":45,"stem":46,"exact":11,"children":-1},"When a deployment fails","\u002Fdeployments\u002Fwhen-a-deployment-fails","3.deployments\u002F5.when-a-deployment-fails","i-lucide-cloud-upload",{"title":49,"path":50,"stem":51,"children":52,"icon":62,"exact":11},"Resources","\u002Fresources","4.resources\u002F1.index",[53,54,58],{"title":49,"path":50,"stem":51,"exact":11,"children":-1},{"title":55,"path":56,"stem":57,"exact":11,"children":-1},"Web services","\u002Fresources\u002Fweb-services","4.resources\u002F2.web-services",{"title":59,"path":60,"stem":61,"exact":11,"children":-1},"PostgreSQL","\u002Fresources\u002Fpostgresql","4.resources\u002F3.postgresql","i-lucide-boxes",{"title":64,"icon":65,"path":66,"stem":67,"children":68,"page":73,"exact":11},"Configuration","i-lucide-sliders-horizontal","\u002Fconfiguration","5.configuration",[69],{"title":70,"path":71,"stem":72,"exact":11,"children":-1},"Environment variables","\u002Fconfiguration\u002Fvariables","5.configuration\u002F1.variables",false,{"title":75,"path":76,"stem":77,"children":78,"icon":85,"exact":11},"Domains","\u002Fdomains","7.domains\u002F1.index",[79,81],{"title":80,"path":76,"stem":77,"exact":11,"children":-1},"Hostnames",{"title":82,"path":83,"stem":84,"exact":11,"children":-1},"Custom domains","\u002Fdomains\u002Fcustom-domains","7.domains\u002F2.custom-domains","i-lucide-globe",{"title":87,"path":88,"stem":89,"children":90,"icon":104,"exact":11},"Environments","\u002Fenvironments","8.environments\u002F1.index",[91,92,96,100],{"title":87,"path":88,"stem":89,"exact":11,"children":-1},{"title":93,"path":94,"stem":95,"exact":11,"children":-1},"Preview environments","\u002Fenvironments\u002Fpreview-environments","8.environments\u002F2.preview-environments",{"title":97,"path":98,"stem":99,"exact":11,"children":-1},"Named environments","\u002Fenvironments\u002Fnamed-environments","8.environments\u002F3.named-environments",{"title":101,"path":102,"stem":103,"exact":11,"children":-1},"Deleting an environment","\u002Fenvironments\u002Fdeleting-an-environment","8.environments\u002F4.deleting-an-environment","i-lucide-git-branch",{"id":106,"title":59,"badge":107,"body":108,"category":107,"description":595,"draft":73,"extension":596,"links":107,"meta":597,"navigation":11,"path":60,"seo":598,"sitemap":599,"stem":61,"__hash__":600},"docs\u002F4.resources\u002F3.postgresql.md",null,{"type":109,"value":110,"toc":586},"minimark",[111,115,120,123,127,150,160,164,167,217,227,231,306,309,313,316,409,417,421,432,442,445,552,559,569,573,579,582],[112,113,114],"p",{},"A PostgreSQL resource is a managed database that Kuppit provisions, backs up and keeps credentials for. Services connect to it by referencing the variables it exposes; you never copy a connection string by hand.",[116,117,119],"h2",{"id":118},"where-a-database-can-live","Where a database can live",[112,121,122],{},"A database is added to Production or to a custom environment. Preview environments never get one: they are created from pull requests and are meant to be disposable, and copying production data into every pull request is the accident that rule exists to prevent.",[116,124,126],{"id":125},"adding-a-database","Adding a database",[112,128,129,130,134,135,138,139,141,142,146,147,149],{},"On an environment's ",[131,132,133],"strong",{},"Overview",", choose ",[131,136,137],{},"Add resource",", then ",[131,140,59],{},". Kuppit asks how the database should be created, and for a name. The default name is ",[143,144,145],"code",{},"database",", and the name is how services address it in references, so ",[143,148,145],{}," is a good choice unless the environment has more than one.",[112,151,152,153,156,157,159],{},"Review the plan and create it. Provisioning takes a few minutes; the resource shows its progress and becomes ",[131,154,155],{},"Ready"," when it can accept connections. A database that fails to provision can be retried or deleted from its ",[131,158,133],{},".",[116,161,163],{"id":162},"new-cloned-or-shared","New, cloned or shared",[112,165,166],{},"When the project already has a database in another environment, there are three ways to create this one:",[168,169,170,183],"table",{},[171,172,173],"thead",{},[174,175,176,180],"tr",{},[177,178,179],"th",{},"Choice",[177,181,182],{},"What it does",[184,185,186,197,207],"tbody",{},[174,187,188,194],{},[189,190,191],"td",{},[131,192,193],{},"Create a new database",[189,195,196],{},"Provision an empty, isolated PostgreSQL database in this environment.",[174,198,199,204],{},[189,200,201],{},[131,202,203],{},"Clone an existing database",[189,205,206],{},"Create an isolated database using a one-time copy of another environment's data. Changes after creation are independent.",[174,208,209,214],{},[189,210,211],{},[131,212,213],{},"Share an existing database",[189,215,216],{},"Use a database from another environment. Both environments read and write the same data.",[112,218,219,220,222,223,226],{},"A shared database belongs to the environment it was created in. This environment's ",[131,221,133],{}," marks it ",[131,224,225],{},"Shared",", and writes from here change that environment's data. Removing it from this environment does not delete it.",[116,228,230],{"id":229},"sizes","Sizes",[168,232,233,249],{},[171,234,235],{},[174,236,237,240,243,246],{},[177,238,239],{},"Size",[177,241,242],{},"vCPU",[177,244,245],{},"Memory",[177,247,248],{},"Storage",[184,250,251,264,278,292],{},[174,252,253,256,259,262],{},[189,254,255],{},"Starter",[189,257,258],{},"shared",[189,260,261],{},"—",[189,263,261],{},[174,265,266,269,272,275],{},[189,267,268],{},"Small",[189,270,271],{},"1",[189,273,274],{},"3.75 GB",[189,276,277],{},"20 GB",[174,279,280,283,286,289],{},[189,281,282],{},"Medium",[189,284,285],{},"2",[189,287,288],{},"8 GB",[189,290,291],{},"50 GB",[174,293,294,297,300,303],{},[189,295,296],{},"Large",[189,298,299],{},"4",[189,301,302],{},"16 GB",[189,304,305],{},"100 GB",[112,307,308],{},"Sizes are provisional during the alpha and are set when the database is created.",[116,310,312],{"id":311},"variables-a-database-exposes","Variables a database exposes",[112,314,315],{},"A database exposes six variables. They are names only: the values are composed when Kuppit prepares a deployment, from the database's current credentials and address, and are never stored on a service or shown in the dashboard.",[168,317,318,331],{},[171,319,320],{},[174,321,322,325,328],{},[177,323,324],{},"Variable",[177,326,327],{},"Secret",[177,329,330],{},"Value",[184,332,333,345,360,372,385,397],{},[174,334,335,340,342],{},[189,336,337],{},[143,338,339],{},"PGHOST",[189,341],{},[189,343,344],{},"The address services connect to.",[174,346,347,352,354],{},[189,348,349],{},[143,350,351],{},"PGPORT",[189,353],{},[189,355,356,357,159],{},"The port, normally ",[143,358,359],{},"5432",[174,361,362,367,369],{},[189,363,364],{},[143,365,366],{},"PGUSER",[189,368],{},[189,370,371],{},"The database user.",[174,373,374,379,382],{},[189,375,376],{},[143,377,378],{},"PGPASSWORD",[189,380,381],{},"Yes",[189,383,384],{},"The user's password.",[174,386,387,392,394],{},[189,388,389],{},[143,390,391],{},"PGDATABASE",[189,393],{},[189,395,396],{},"The database name.",[174,398,399,404,406],{},[189,400,401],{},[143,402,403],{},"DATABASE_URL",[189,405,381],{},[189,407,408],{},"A complete connection string.",[112,410,411,413,414,416],{},[143,412,378],{}," and ",[143,415,403],{}," are secret wherever they end up: a service variable that references one is treated as a secret regardless of what you named it.",[116,418,420],{"id":419},"connecting-a-service","Connecting a service",[112,422,423,424,427,428,431],{},"On the service's ",[131,425,426],{},"Variables"," tab, add a variable and choose ",[131,429,430],{},"Reference"," instead of typing a value. Select the database and the variable it should resolve to. The service stores the reference, not the value:",[433,434,440],"pre",{"className":435,"code":437,"language":438,"meta":439},[436],"language-text","DATABASE_URL = ${{ database.DATABASE_URL }}\n","text","",[143,441,437],{"__ignoreMap":439},[112,443,444],{},"Then redeploy. Your application reads the resolved value as an ordinary environment variable:",[433,446,451],{"className":447,"code":448,"filename":449,"language":450,"meta":439,"style":439},"language-ts shiki shiki-themes material-theme-lighter github-light github-dark","import { Client } from 'pg'\n\nconst db = new Client({\n    connectionString: process.env.DATABASE_URL\n})\n","server\u002Fdb.ts","ts",[143,452,453,487,493,520,543],{"__ignoreMap":439},[454,455,458,462,466,470,473,476,480,484],"span",{"class":456,"line":457},"line",1,[454,459,461],{"class":460},"sVHd0","import",[454,463,465],{"class":464},"sP7_E"," {",[454,467,469],{"class":468},"su5hD"," Client",[454,471,472],{"class":464}," }",[454,474,475],{"class":460}," from",[454,477,479],{"class":478},"sjJ54"," '",[454,481,483],{"class":482},"s_sjI","pg",[454,485,486],{"class":478},"'\n",[454,488,490],{"class":456,"line":489},2,[454,491,492],{"emptyLinePlaceholder":11},"\n",[454,494,496,500,504,508,511,514,517],{"class":456,"line":495},3,[454,497,499],{"class":498},"sbsja","const",[454,501,503],{"class":502},"s_hVV"," db",[454,505,507],{"class":506},"smGrS"," =",[454,509,510],{"class":506}," new",[454,512,469],{"class":513},"sGLFI",[454,515,516],{"class":468},"(",[454,518,519],{"class":464},"{\n",[454,521,523,527,530,533,535,538,540],{"class":456,"line":522},4,[454,524,526],{"class":525},"skxfh","    connectionString",[454,528,529],{"class":464},":",[454,531,532],{"class":468}," process",[454,534,159],{"class":464},[454,536,537],{"class":468},"env",[454,539,159],{"class":464},[454,541,542],{"class":502},"DATABASE_URL\n",[454,544,546,549],{"class":456,"line":545},5,[454,547,548],{"class":464},"}",[454,550,551],{"class":468},")\n",[112,553,554,555,558],{},"References are resolved when Kuppit prepares runtime configuration for a deployment. If a managed database credential changes, a service referencing ",[143,556,557],{},"${{ database.DATABASE_URL }}"," does not require you to copy the new value into its variables; the next deployment picks it up.",[112,560,561,562,565,566,568],{},"The service's ",[131,563,564],{},"Connect"," tab lists every reference it holds, and the environment's ",[131,567,133],{}," draws the connection as an edge from the database to the service.",[116,570,572],{"id":571},"deleting-a-database","Deleting a database",[574,575,576],"warning",{},[112,577,578],{},"Deleting a database permanently destroys its data. This cannot be undone.",[112,580,581],{},"Deleting also removes every variable that references the database, so each connected service loses its connection at its next deployment. Kuppit names those services before you confirm. Usage history is kept for billing; nothing else can be recovered.",[583,584,585],"style",{},"html pre.shiki code .sVHd0, html code.shiki .sVHd0{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#D73A49;--shiki-default-font-style:inherit;--shiki-dark:#F97583;--shiki-dark-font-style:inherit}html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sjJ54, html code.shiki .sjJ54{--shiki-light:#39ADB5;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s_sjI, html code.shiki .s_sjI{--shiki-light:#91B859;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .s_hVV, html code.shiki .s_hVV{--shiki-light:#90A4AE;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .skxfh, html code.shiki .skxfh{--shiki-light:#E53935;--shiki-default:#24292E;--shiki-dark:#E1E4E8}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);}",{"title":439,"searchDepth":495,"depth":495,"links":587},[588,589,590,591,592,593,594],{"id":118,"depth":489,"text":119},{"id":125,"depth":489,"text":126},{"id":162,"depth":489,"text":163},{"id":229,"depth":489,"text":230},{"id":311,"depth":489,"text":312},{"id":419,"depth":489,"text":420},{"id":571,"depth":489,"text":572},"Provision a managed PostgreSQL database in an environment and connect your services to it through variables.","md",{},{"title":59,"description":595},{"loc":60},"6BIg5urR8Lf13YPqe8ZKgTIKPwyi_1VnnrDbNlBmMQQ",[602,604],{"title":55,"path":56,"stem":57,"description":603,"children":-1},"What a web service is, how Kuppit builds one from your repository, and what your application must do to run on it.",{"title":70,"path":71,"stem":72,"description":605,"children":-1},"How variables are set on services and environments, how references connect resources, and how secrets are handled.",1788534985201]