Skip to content

Commit d8ecb62

Browse files
committed
Add database setup guide
1 parent 6529170 commit d8ecb62

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

docs/src/content/docs/start-here/database-setup.mdx

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,57 @@ sidebar:
66
badge:
77
text: WIP
88
variant: caution
9-
---
9+
---
10+
import { Steps } from '@astrojs/starlight/components';
11+
12+
This guide will help you install and setup PostgreSQL for hosting the database locally.
13+
14+
## Windows
15+
:::caution[]
16+
**Windows is not supported for firmware and ground station development.**
17+
18+
If you are using Windows, you will need to install Windows Subsystem for Linux (WSL). WSL lets you run a complete Linux environment directly inside Windows without virtual machine overhead or dual booting.
19+
20+
Make sure you follow the [Initial setup](/OBC-firmware/start-here/initial-setup) guide.
21+
:::
22+
23+
## Linux/WSL
24+
25+
<Steps>
26+
1. Open a terminal and run the following commands to install PostgreSQL:
27+
28+
```shell
29+
sudo apt update
30+
sudo apt install postgresql-16
31+
```
32+
33+
2. Run `sudo -u postgres psql --version` to ensure PostgreSQL was installed properly. It should print that the major version is 16.
34+
35+
3. Run the following commands to setup PostgreSQL for the ground station:
36+
37+
```shell
38+
# Connect to PostgreSQL CLI as the postgres superuser
39+
sudo -u postgres psql
40+
# Replace 'your_username' and 'your_password' with your desired values
41+
CREATE USER your_username WITH PASSWORD 'your_password' SUPERUSER;
42+
CREATE DATABASE gs
43+
```
44+
45+
4. Log out, then verify that you can log in to your newly created user and database:
46+
47+
```shell
48+
\q # Log out
49+
# Replace 'your_username' with your actual username
50+
psql -U your_username -d gs
51+
# You should be logged into the database
52+
\q # Log out again
53+
54+
5. From the root directory, run the following commands to create a new .env file:
55+
56+
```shell
57+
cd gs/backend/config
58+
cp template.env .env
59+
```
60+
61+
6. Edit the new .env file to add your login details in the quotes. In Linux/WSL, you can use `vim` or `nano`.
62+
</Steps>

docs/src/content/docs/start-here/initial-setup.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Follow Microsoft's official guide to install WSL: https://learn.microsoft.com/en
5858
5. Setup pre-commit:
5959

6060
```shell
61+
# The first command installs Deno, which is required for our pre-commit
6162
curl -fsSL https://deno.land/install.sh | sh
6263
pre-commit install
6364
```

0 commit comments

Comments
 (0)