page.tsx141 lines · main
1import { DocsShell } from '../../../components/shell';
2
3export const metadata = {
4 title: 'doltgres — install + run',
5};
6
7export default function DoltgresInstallPage() {
8 return (
9 <DocsShell>
10 <h1 className="font-mono text-2xl tracking-tight">install + run</h1>
11 <p className="mt-2 font-mono text-sm text-[var(--color-text-muted)]">
12 get the DoltGres engine onto your machine, start the server on port 5432, and connect with
13 psql.
14 </p>
15
16 <div className="mt-6 rounded-md border border-[var(--color-border-subtle)] bg-[var(--color-surface)] p-4 font-mono text-xs text-[var(--color-text-muted)]">
17 <strong className="text-[var(--color-text)]">do you actually need this?</strong> DoltGres is
18 the engine underneath. On Briven (hosted) the database is provisioned, run, and managed for
19 you — you never install or start it yourself. This page is for self-hosting or running
20 DoltGres locally on your own machine.
21 </div>
22
23 <h2 className="mt-12 font-mono text-lg">1. install</h2>
24 <p className="mt-3 font-mono text-sm text-[var(--color-text-muted)]">
25 DoltGres ships as a single binary called <code>doltgres</code>. Pick the path that matches
26 your machine.
27 </p>
28
29 <div className="mt-6 flex flex-col gap-6 font-mono text-sm text-[var(--color-text-muted)]">
30 <div>
31 <p className="text-[var(--color-text)]">Linux / macOS</p>
32 <Snippet>{`sudo bash -c 'curl -L https://github.com/dolthub/doltgresql/releases/latest/download/install.sh | bash'`}</Snippet>
33 </div>
34
35 <div>
36 <p className="text-[var(--color-text)]">Windows</p>
37 <p className="mt-1 text-[var(--color-text-subtle)]">
38 Download the <code>.msi</code> installer from the{' '}
39 <a className="underline" href="https://github.com/dolthub/doltgresql/releases">
40 DoltGres GitHub releases page
41 </a>{' '}
42 and run it.
43 </p>
44 </div>
45
46 <div>
47 <p className="text-[var(--color-text)]">Docker</p>
48 <Snippet>{`docker run -e DOLTGRES_PASSWORD=myPassword -p 5432:5432 dolthub/doltgresql:latest`}</Snippet>
49 </div>
50
51 <div>
52 <p className="text-[var(--color-text)]">From source</p>
53 <Snippet>{`./scripts/build.sh`}</Snippet>
54 </div>
55 </div>
56
57 <h2 className="mt-12 font-mono text-lg">2. start the server</h2>
58 <p className="mt-3 font-mono text-sm text-[var(--color-text-muted)]">
59 Run the binary to start the server:
60 </p>
61 <Snippet>{`doltgres`}</Snippet>
62 <p className="mt-3 font-mono text-sm text-[var(--color-text-muted)]">
63 On its very first run, DoltGres creates a default user <code>postgres</code>, a default
64 database <code>postgres</code>, and a default password <code>password</code>. To set your
65 own instead, define these environment variables{' '}
66 <strong className="text-[var(--color-text)]">before the first run</strong>:
67 </p>
68 <Snippet>{`export DOLTGRES_USER=myUser
69export DOLTGRES_PASSWORD=myPassword
70doltgres`}</Snippet>
71 <p className="mt-3 font-mono text-sm text-[var(--color-text-subtle)]">
72 DoltGres listens on port <code>5432</code> — the standard PostgreSQL port — and speaks the
73 PostgreSQL wire protocol, so any PostgreSQL client can connect to it.
74 </p>
75
76 <h2 className="mt-12 font-mono text-lg">3. connect with psql</h2>
77 <p className="mt-3 font-mono text-sm text-[var(--color-text-muted)]">
78 Connect with the standard PostgreSQL client, <code>psql</code>:
79 </p>
80 <Snippet>{`PGPASSWORD=password psql -h localhost -U postgres`}</Snippet>
81 <p className="mt-3 font-mono text-sm text-[var(--color-text-muted)]">
82 Or with a connection string:
83 </p>
84 <Snippet>{`postgres://postgres@localhost:5432/postgres`}</Snippet>
85
86 <h2 className="mt-12 font-mono text-lg">connecting to a specific version</h2>
87 <p className="mt-3 font-mono text-sm text-[var(--color-text-muted)]">
88 Because DoltGres is versioned, a database name can be{' '}
89 <em>revision-qualified</em> — you append a revision (a branch name, a commit hash, or a tag)
90 after the database name to open a read-only snapshot at exactly that point. You can do it in
91 the connection string:
92 </p>
93 <Snippet>{`postgres://postgres@localhost:5432/mydb/<revision>`}</Snippet>
94 <p className="mt-3 font-mono text-sm text-[var(--color-text-muted)]">
95 Or switch to it inside an open session:
96 </p>
97 <Snippet>{`USE mydb/<revision>;`}</Snippet>
98
99 <h2 className="mt-12 font-mono text-lg">what to read next</h2>
100 <ul className="mt-3 flex flex-col gap-2 font-mono text-sm">
101 <NextLink
102 href="/doltgres"
103 title="doltgres overview"
104 body="what DoltGres is, and why Dolt (MySQL) is not DoltGres (PostgreSQL)"
105 />
106 <NextLink
107 href="/doltgres/version-control"
108 title="version control"
109 body="branch, commit, diff, and merge your data with SELECT dolt_* functions"
110 />
111 <NextLink
112 href="/doltgres/limitations"
113 title="beta + limitations"
114 body="DoltGres is pre-1.0 — here is what is still missing or slow"
115 />
116 </ul>
117 </DocsShell>
118 );
119}
120
121function Snippet({ children }: { children: string }) {
122 return (
123 <pre className="mt-3 overflow-x-auto rounded-md border border-[var(--color-border-subtle)] bg-[var(--color-surface)] p-4 font-mono text-xs">
124 <code>{children}</code>
125 </pre>
126 );
127}
128
129function NextLink({ href, title, body }: { href: string; title: string; body: string }) {
130 return (
131 <li>
132 <a
133 href={href}
134 className="block rounded-md border border-[var(--color-border-subtle)] bg-[var(--color-surface)] p-4 transition hover:border-[var(--color-border)]"
135 >
136 <p className="font-mono text-[var(--color-text)]">{title}</p>
137 <p className="mt-1 font-mono text-xs text-[var(--color-text-muted)]">{body}</p>
138 </a>
139 </li>
140 );
141}