Database setup
This guide will help you install and setup PostgreSQL for hosting the database locally.
Windows
Section titled “Windows”Linux/WSL
Section titled “Linux/WSL”-
Open a terminal and run the following commands to install PostgreSQL:
Terminal window sudo apt updatesudo apt install postgresql-16 -
Run
sudo -u postgres psql --version
to ensure PostgreSQL was installed properly. It should print that the major version is 16. -
Run the following commands to setup PostgreSQL for the ground station.
Terminal window # Connect to PostgreSQL CLI as the postgres superusersudo -u postgres psql# Replace your_username and your_password with your desired valuesCREATE USER your_username WITH PASSWORD 'your_password' SUPERUSER;CREATE DATABASE gs; -
Log out, then verify that you can log in to your newly created user and database:
Terminal window \q # Log out# Replace your_username with your actual usernamepsql -U your_username -d gs# You should be logged into the database\q # Log out again -
From the root directory, run the following commands to create a new
.env
file:Terminal window cd gs/backend/configcp template.env .env -
Edit the
.env
file to add your login details in the quotes. In Linux/WSL, you can usevim
ornano
. -
Ensure that your Python virtual environment is activated. If not, follow Initial setup. Start the backend in development mode by running
fastapi dev gs/backend/main.py
from the root directory. This will also initialize the database.