You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3. Make sure the required packages are built and installed:
13
+
2. Make sure the required packages are built and installed:
21
14
22
15
```sh
23
16
cd packages/notebook-types
@@ -26,10 +19,43 @@ You can find the auto-generated documentation for this Rust crate at [next.catco
26
19
pnpm install
27
20
```
28
21
29
-
4. Change to the migrator directory: `cd ../backend`
30
-
5. Copy the .env.development to both folders (`cp .env.development .env && cp .env.development ../migrator/.env`) and update the `DATABASE_URL` variable with
31
-
database username, password, and port. (If you used the above Docker command _as is_ it should already be correct.)
32
-
6. Run the initial database migration: `cargo run -p migrator apply`
22
+
3. Set up PostgreSQL (choose one of the options below)
23
+
24
+
-**Option A: Using Docker (Recommended)**
25
+
26
+
Run PostgreSQL in a Docker container:
27
+
28
+
```sh
29
+
docker run --name catcolab-postgres -e POSTGRES_PASSWORD=password \
30
+
-p 5432:5432 -d postgres:15
31
+
```
32
+
33
+
This creates a PostgreSQL instance with superuser `postgres` and password `password`. The `catcolab` database and user will be created automatically by the setup script in step 6.
34
+
35
+
The default `.env.development` file is pre-configured to work with this Docker setup.
36
+
37
+
- **Option B: Using local PostgreSQL installation**
38
+
39
+
Install and run PostgreSQL locally. Ensure you have superuser access (typically the `postgres` user).
40
+
41
+
**Note:** The default `.env.development` assumes the PostgreSQL superuser is `postgres` with password `password`.
42
+
If your local PostgreSQL has different superuser credentials, you'll need to update `DATABASE_SUPERUSER_URL`
43
+
in your `.env` file (see next step).
44
+
45
+
4. Change to the backend directory: `cd packages/backend`
46
+
5. Copy the `.env.development` file: `cp .env.development .env`
47
+
- If you're using the Docker command above as-is, the defaults will work perfectly
48
+
- If you're using local PostgreSQL with different superuser credentials, you can either:
49
+
- Update `DATABASE_SUPERUSER_URL` in `.env` to match your postgres superuser credentials, OR
50
+
- Remove `DATABASE_SUPERUSER_URL` from `.env` and you'll be prompted for your postgres password when running the setup
51
+
- **Note:** If you're using the Nix development shell (via `nix develop`), the environment is automatically configured and you don't need to copy `.env` files manually
52
+
6. Run the database setup:
53
+
- If using Nix shell: `cc-utils db setup` (the script is in your PATH)
54
+
- Otherwise: `../../infrastructure/scripts/cc-utils db setup`
55
+
- This command connects as the PostgreSQL superuser and automatically creates:
56
+
- The `catcolab` database user with appropriate permissions
57
+
- The `catcolab` database owned by that user
58
+
- It then runs all database migrations
33
59
7. Build the backend binary: `cargo build`
34
60
8. Run the unit tests: `cargo test`
35
61
@@ -72,10 +98,21 @@ pnpm run dev
72
98
73
99
## Running migrations
74
100
75
-
This package runs databaes migrations using `migrator` subcommand which uses the
101
+
This package runs database migrations using the `migrator` subcommand which uses the
0 commit comments