This is a quick instruction guide on how to setup the project for yourself, if interested. This is an actionable guide, meaning you will copy-paste a couple of lines of code. And your development environment will be ready to go!
-
Copy the .env.example file -> .env
$ cp .env.example .env
-
Fill out all of the environment varialbes (Check out the links / resources for each of them!)
-
Activate the virtual environment
$ source .venv/bin/activate
-
Install the python packages
$ pip install -r requirements.txt
-
If this is your first time running the project locally, please run the bootstrap (Or on every new branch you make!)
python3 bootstrap-backend.py
NOTE This will require you to fill out a ton of information.
We are always trying to keep the code consise & attempting to make the setup as easy for new developers to the project as possible.
If you get stuck at any point. Just contact the contributors on discord adoniscodes
or williamferns
This will quickly guide on how to setup the virtual environment for aws cdk lambdas.
-
Firstly cd into the python directory
$ cd backend/python
-
Enable the virtual environment / create it
$ rm -rf venv
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
You will be using Supabase. Meaning you need to know a bit about the ins-and-outs of the supabase cli to do migrations. Here is a quick guide on how to export the migrations / import them & how to save them to a remote database:
npx supabase db pull
will pull down the config from the table you linked environment variable ($SUPABASE_PROJECT_REF)
npx supabase migration up
will take the local migration scripts, and then apply them locally.
npx supabase db push
will take the local migration scripts, and push them up to the remote project ($SUPABASE_PROJECT_REF)
npx supabase db diff --local --file=<the name of the migration>
You can make a migration using this command. To specify the schema use the --schema=
flag.
https://www.youtube.com/watch?v=LHw5fPX8XCk
You will also interact a ton with the AWS toolchain. Mostly AWS CDK. Here are a couple of commands & guides to get you quickly off the ground.
HOW TO SETUP AWS LAMBDAS: https://youtu.be/o3s4VqlMsT8?si=ttvhKfdIkQt1FdZ0 HOW TO INTEGRATE EXTERNAL DEPENDENCIES AWS LAMBDAS: https://www.youtube.com/watch?v=FnfnDc6TVjw
cdk synth
Will build the changes for cdk locally, best to use to test if your code compiles
cdk deploy
Pushes your changes up to remote aws account
<command> --verbose
The verbose logs everything incase you run into errors
NOTE There will maybe be some errors. Here are some common solutions that worked for us.
- Ensure your virtual environment is deleted in the
backend/python
- Run the commands as sudo
- Attempt to modify the permissions of docker & then do the past 2 steps again:
sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "/home/$USER/.docker" -R
We are always trying to keep the code consise & attempting to make the setup as easy for new developers to the project as possible.
If you get stuck at any point. Just contact the contributors on discord adoniscodes
or williamferns
If you found a possible solution before getting into contact, feel free to modify the documentation, bootstrap scripts & more to accomodate these changes.
Thanks!