[{"data":1,"prerenderedAt":419},["ShallowReactive",2],{"navigation":3,"page-\u002Fnetworking\u002Freaching-a-database":213,"surround-\u002Fnetworking\u002Freaching-a-database":414},[4,17,48,79,95,118,133,144,155,167,186],{"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":47,"exact":11},"Reference","\u002Freference","10.reference\u002F1.index",[22,23,27,31,35,39,43],{"title":18,"path":19,"stem":20,"exact":11,"children":-1},{"title":24,"path":25,"stem":26,"exact":11,"children":-1},"Variables","\u002Freference\u002Fvariables","10.reference\u002F2.variables",{"title":28,"path":29,"stem":30,"exact":11,"children":-1},"Hostnames and DNS","\u002Freference\u002Fhostnames-and-dns","10.reference\u002F3.hostnames-and-dns",{"title":32,"path":33,"stem":34,"exact":11,"children":-1},"Statuses","\u002Freference\u002Fstatuses","10.reference\u002F4.statuses",{"title":36,"path":37,"stem":38,"exact":11,"children":-1},"Limits","\u002Freference\u002Flimits","10.reference\u002F5.limits",{"title":40,"path":41,"stem":42,"exact":11,"children":-1},"Sizes","\u002Freference\u002Fsizes","10.reference\u002F6.sizes",{"title":44,"path":45,"stem":46,"exact":11,"children":-1},"The GitHub App","\u002Freference\u002Fgithub-app","10.reference\u002F7.github-app","i-lucide-book-open",{"title":49,"path":50,"stem":51,"children":52,"icon":78,"exact":11},"Troubleshooting","\u002Ftroubleshooting","11.troubleshooting\u002F1.index",[53,54,58,62,66,70,74],{"title":49,"path":50,"stem":51,"exact":11,"children":-1},{"title":55,"path":56,"stem":57,"exact":11,"children":-1},"Build failures","\u002Ftroubleshooting\u002Fbuild-failures","11.troubleshooting\u002F2.build-failures",{"title":59,"path":60,"stem":61,"exact":11,"children":-1},"Start and health failures","\u002Ftroubleshooting\u002Fstart-and-health-failures","11.troubleshooting\u002F3.start-and-health-failures",{"title":63,"path":64,"stem":65,"exact":11,"children":-1},"Reference failures","\u002Ftroubleshooting\u002Freference-failures","11.troubleshooting\u002F4.reference-failures",{"title":67,"path":68,"stem":69,"exact":11,"children":-1},"Failures that are Kuppit's","\u002Ftroubleshooting\u002Ffailures-that-are-kuppits","11.troubleshooting\u002F5.failures-that-are-kuppits",{"title":71,"path":72,"stem":73,"exact":11,"children":-1},"Domain issues","\u002Ftroubleshooting\u002Fdomain-issues","11.troubleshooting\u002F6.domain-issues",{"title":75,"path":76,"stem":77,"exact":11,"children":-1},"No preview for a pull request","\u002Ftroubleshooting\u002Fno-preview-for-a-pull-request","11.troubleshooting\u002F7.no-preview-for-a-pull-request","i-lucide-life-buoy",{"title":80,"path":81,"stem":82,"children":83,"icon":94,"exact":11},"Concepts","\u002Fconcepts","2.concepts\u002F1.index",[84,86,90],{"title":85,"path":81,"stem":82,"exact":11,"children":-1},"The Kuppit model",{"title":87,"path":88,"stem":89,"exact":11,"children":-1},"The application graph","\u002Fconcepts\u002Fthe-application-graph","2.concepts\u002F2.the-application-graph",{"title":91,"path":92,"stem":93,"exact":11,"children":-1},"How a service runs","\u002Fconcepts\u002Fhow-a-service-runs","2.concepts\u002F3.how-a-service-runs","i-lucide-shapes",{"title":96,"path":97,"stem":98,"children":99,"icon":117,"exact":11},"Deployments","\u002Fdeployments","3.deployments\u002F1.index",[100,101,105,109,113],{"title":96,"path":97,"stem":98,"exact":11,"children":-1},{"title":102,"path":103,"stem":104,"exact":11,"children":-1},"Builds","\u002Fdeployments\u002Fbuilds","3.deployments\u002F2.builds",{"title":106,"path":107,"stem":108,"exact":11,"children":-1},"Redeploy and roll back","\u002Fdeployments\u002Fredeploy-and-rollback","3.deployments\u002F3.redeploy-and-rollback",{"title":110,"path":111,"stem":112,"exact":11,"children":-1},"Logs","\u002Fdeployments\u002Flogs","3.deployments\u002F4.logs",{"title":114,"path":115,"stem":116,"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":119,"path":120,"stem":121,"children":122,"icon":132,"exact":11},"Resources","\u002Fresources","4.resources\u002F1.index",[123,124,128],{"title":119,"path":120,"stem":121,"exact":11,"children":-1},{"title":125,"path":126,"stem":127,"exact":11,"children":-1},"Web services","\u002Fresources\u002Fweb-services","4.resources\u002F2.web-services",{"title":129,"path":130,"stem":131,"exact":11,"children":-1},"PostgreSQL","\u002Fresources\u002Fpostgresql","4.resources\u002F3.postgresql","i-lucide-boxes",{"title":134,"icon":135,"path":136,"stem":137,"children":138,"page":143,"exact":11},"Configuration","i-lucide-sliders-horizontal","\u002Fconfiguration","5.configuration",[139],{"title":140,"path":141,"stem":142,"exact":11,"children":-1},"Environment variables","\u002Fconfiguration\u002Fvariables","5.configuration\u002F1.variables",false,{"title":145,"path":146,"stem":147,"children":148,"icon":154,"exact":11},"Networking","\u002Fnetworking","6.networking\u002F1.index",[149,150],{"title":145,"path":146,"stem":147,"exact":11,"children":-1},{"title":151,"path":152,"stem":153,"exact":11,"children":-1},"Reaching a database","\u002Fnetworking\u002Freaching-a-database","6.networking\u002F2.reaching-a-database","i-lucide-network",{"title":156,"path":157,"stem":158,"children":159,"icon":166,"exact":11},"Domains","\u002Fdomains","7.domains\u002F1.index",[160,162],{"title":161,"path":157,"stem":158,"exact":11,"children":-1},"Hostnames",{"title":163,"path":164,"stem":165,"exact":11,"children":-1},"Custom domains","\u002Fdomains\u002Fcustom-domains","7.domains\u002F2.custom-domains","i-lucide-globe",{"title":168,"path":169,"stem":170,"children":171,"icon":185,"exact":11},"Environments","\u002Fenvironments","8.environments\u002F1.index",[172,173,177,181],{"title":168,"path":169,"stem":170,"exact":11,"children":-1},{"title":174,"path":175,"stem":176,"exact":11,"children":-1},"Preview environments","\u002Fenvironments\u002Fpreview-environments","8.environments\u002F2.preview-environments",{"title":178,"path":179,"stem":180,"exact":11,"children":-1},"Named environments","\u002Fenvironments\u002Fnamed-environments","8.environments\u002F3.named-environments",{"title":182,"path":183,"stem":184,"exact":11,"children":-1},"Deleting an environment","\u002Fenvironments\u002Fdeleting-an-environment","8.environments\u002F4.deleting-an-environment","i-lucide-git-branch",{"title":187,"path":188,"stem":189,"children":190,"icon":212,"exact":11},"Guides","\u002Fguides","9.guides\u002F1.index",[191,192,196,200,204,208],{"title":187,"path":188,"stem":189,"exact":11,"children":-1},{"title":193,"path":194,"stem":195,"exact":11,"children":-1},"Deploy a Nuxt application","\u002Fguides\u002Fdeploy-a-nuxt-application","9.guides\u002F2.deploy-a-nuxt-application",{"title":197,"path":198,"stem":199,"exact":11,"children":-1},"Deploy a Next.js application","\u002Fguides\u002Fdeploy-a-nextjs-application","9.guides\u002F3.deploy-a-nextjs-application",{"title":201,"path":202,"stem":203,"exact":11,"children":-1},"Deploy an Express application","\u002Fguides\u002Fdeploy-an-express-application","9.guides\u002F4.deploy-an-express-application",{"title":205,"path":206,"stem":207,"exact":11,"children":-1},"Deploy with a Dockerfile","\u002Fguides\u002Fdeploy-with-a-dockerfile","9.guides\u002F5.deploy-with-a-dockerfile",{"title":209,"path":210,"stem":211,"exact":11,"children":-1},"Create a staging environment","\u002Fguides\u002Fcreate-a-staging-environment","9.guides\u002F6.create-a-staging-environment","i-lucide-map",{"id":214,"title":151,"badge":215,"body":216,"category":215,"description":408,"draft":143,"extension":409,"links":215,"meta":410,"navigation":11,"path":152,"seo":411,"sitemap":412,"stem":153,"__hash__":413},"docs\u002F6.networking\u002F2.reaching-a-database.md",null,{"type":217,"value":218,"toc":400},"minimark",[219,223,228,322,336,339,343,386,390],[220,221,222],"p",{},"A service does not reach its database over the public network. When a service references a database, Kuppit attaches the database to the service's revision, and the connection runs over a socket the infrastructure mounts inside the container. The application sees ordinary PostgreSQL connection variables; only their values are shaped by the socket.",[224,225,227],"h2",{"id":226},"what-the-variables-contain","What the variables contain",[229,230,231,244],"table",{},[232,233,234],"thead",{},[235,236,237,241],"tr",{},[238,239,240],"th",{},"Variable",[238,242,243],{},"Value",[245,246,247,267,284,301],"tbody",{},[235,248,249,256],{},[250,251,252],"td",{},[253,254,255],"code",{},"PGHOST",[250,257,258,259,262,263,266],{},"A directory path such as ",[253,260,261],{},"\u002Fcloudsql\u002F\u003Cinstance>",". PostgreSQL clients treat a host beginning with ",[253,264,265],{},"\u002F"," as a Unix socket directory.",[235,268,269,274],{},[250,270,271],{},[253,272,273],{},"PGPORT",[250,275,276,279,280,283],{},[253,277,278],{},"5432",". For a socket it names the socket file, ",[253,281,282],{},".s.PGSQL.5432",", rather than a TCP port.",[235,285,286,298],{},[250,287,288,291,292,291,295],{},[253,289,290],{},"PGUSER",", ",[253,293,294],{},"PGPASSWORD",[253,296,297],{},"PGDATABASE",[250,299,300],{},"The credentials Kuppit created with the database.",[235,302,303,308],{},[250,304,305],{},[253,306,307],{},"DATABASE_URL",[250,309,310,313,314,317,318,321],{},[253,311,312],{},"postgresql:\u002F\u002F\u003Cuser>:\u003Cpassword>@localhost\u002F\u003Cdatabase>?host=\u002Fcloudsql\u002F\u003Cinstance>&port=5432",". The ",[253,315,316],{},"localhost"," is a placeholder the ",[253,319,320],{},"host"," parameter overrides.",[220,323,324,325,328,329,332,333,335],{},"Every mainstream client understands this shape: ",[253,326,327],{},"pg",", Prisma, Drizzle, psycopg, ",[253,330,331],{},"database\u002Fsql",". Pass ",[253,334,307],{}," straight through, or pass the five parts; do not rebuild the string by hand from a template that assumes a hostname.",[220,337,338],{},"The values are composed when Kuppit prepares a deployment, from the database's state at that moment. They are never stored on the service and never shown in the dashboard.",[224,340,342],{"id":341},"what-it-means-for-you","What it means for you",[344,345,346,354,366,376],"ul",{},[347,348,349,353],"li",{},[350,351,352],"strong",{},"Encrypted, and never public."," The database accepts encrypted connections only, and no network is authorised to reach it. The socket is the one way in, and it exists only inside a revision that references the database.",[347,355,356,359,360,365],{},[350,357,358],{},"Same environment only."," A reference can only target a database beside the service in its environment. A database in another environment is, to a service, indistinguishable from one that does not exist. The exception is a database the environment ",[361,362,364],"a",{"href":363},"\u002Fenvironments#isolation","shares"," from another, which is bound into this environment on purpose.",[347,367,368,371,372,375],{},[350,369,370],{},"Local development is different."," Your machine has no socket. Use a local PostgreSQL, or a connection string of your own, in your local ",[253,373,374],{},".env","; the service's variables are Kuppit's alone.",[347,377,378,381,382,385],{},[350,379,380],{},"No client from outside."," There is no public address to point a desktop client at. The service's ",[350,383,384],{},"Connect"," tab describes the variables; a migration or an admin task runs from a service in the environment.",[224,387,389],{"id":388},"when-attachment-fails","When attachment fails",[220,391,392,393,395,396,399],{},"A reference is resolved when a deployment is prepared. If the database exists but its address is not known yet, or the service and the database sit on infrastructure that cannot be connected, the deployment fails before anything is built and says why. ",[361,394,63],{"href":64}," has the messages that are yours to fix; ",[361,397,398],{"href":68},"failures that are Kuppit's"," has the rest.",{"title":401,"searchDepth":402,"depth":402,"links":403},"",3,[404,406,407],{"id":226,"depth":405,"text":227},2,{"id":341,"depth":405,"text":342},{"id":388,"depth":405,"text":389},"How a service connects to a PostgreSQL database in its environment, why PGHOST is a path, and what a connection string looks like.","md",{},{"title":151,"description":408},{"loc":152},"o60596PFvbZrKN5Xnnsjh98J260toL-Du3yzcdlnT1o",[415,417],{"title":145,"path":146,"stem":147,"description":416,"children":-1},"How a request reaches your service, what Kuppit's edge does to it on the way, how services reach each other, and what is not there.",{"title":161,"path":157,"stem":158,"description":418,"children":-1},"The kuppit.app hostname every web service gets, how it is formed, and what happens to a request on its way to your service.",1788549619709]