Check Backend, Frontend, Hooks and Plugins
- GLOBAL .env file for easy management of environment variables within services
make install-env # ask the team for the .env contents
Run the command above if you delete the root .env file by mistake or you had installed the project pre 15th March.
Here is the guide:
Install brew and follow the instructions (sometimes it asks you to run some additional commands):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
curl https://raw.githubusercontent.com/AUBGTheHUB/monolith/master/install_osx.sh | bash
And then run:
cd ~/go/src/monolith && make post-osx
# make sure to check the output towards the end as certain installations may require manual intervention.
- For Ubuntu WSL
curl https://raw.githubusercontent.com/AUBGTheHUB/monolith/master/install_wsl.sh | bash
And then run:
cd ~/go/src/monolith && make post-wsl
# make sure to check the output towards the end as certain installations may require manual intervention.
alias spa="cd ~/go/src/monolith"
make gum
This is a command-line tool for managing running services and setting up deployment environments
For developers: Spin up local server instances:
![image](https://private-user-images.githubusercontent.com/104720011/263230251-0f8e96f8-3931-4eaf-a72d-54a784b75971.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE4MjgwMjgsIm5iZiI6MTcyMTgyNzcyOCwicGF0aCI6Ii8xMDQ3MjAwMTEvMjYzMjMwMjUxLTBmOGU5NmY4LTM5MzEtNGVhZi1hNzJkLTU0YTc4NGI3NTk3MS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzI0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyNFQxMzI4NDhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wY2E1ZjgyZTQ1NGZjMzg5ZmViOTAyMzFiNGIzMWMxNDI5ODg2NjYwODgwN2U0OWNlN2I0MDVjMzM2M2Q0ZWM1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.litVjN50MYkkKVch1_3OiJk8YaPLSODmHBbndIuyNCs)
Similarly to the Makefile phonies, the three different options change the point towards which api requests are being made.
local api -> localhost:8000 / :6969
prod api -> https://thehub-aubg.com
dev api -> https://dev.thehub-aubg.com
For deployments:
- Static BEARER-TOKEN: Add this in the .env file (update root .env)
MONGO_URI=<uri> # Ask NOSYNCDEV for the uri
IS_OFFLINE=true # IS_TEST=true overwrites this
# so make sure that you set IS_TEST to false
# after you're done running integration/unit tests
- Run:
make run-api # Golang API
make run-py-api # Python API
- Run (hot reload):
make reload-api
-
using a task:
ctrl + P
(for mac keybindings might differ)- type
task Hot Reload API
-
or:
ctrl + shift + P
(for mac keybindings might differ)- type
Tasks: Run Task
and findHot Reload API
- Put breakpoints:
- Go to
main.go
, openRun and Debug
and choose theDebug API
task:
- Click the green arrow icon:
-
Open VSCode directly from within
packages/api
(e.g.spa && cd packages/api && code .
)
Notes:
-
No need to run any of this if you installed the project using either one of the installation scripts.
-
Object Uploader (S3 admin panel) won't work if you don't update your .env file with the appropriate content (ask the team)
-
Installation from
root
(needed when there are new packages added topackage.json
):
# update node to 16.16.0
make install-web
- Run from
root
:
make run-web # run this if you are applying changes to the api and you want to test them locally using the frontend (or if prod and dev are down)
make run-dev # run this if you want the frontend to make requests towards the api which is currently staged on the dev environment
make run-prod # run this if you want the frontend to make requests towards the production api on https://thehub-aubg.com
** For installing, running, cleaning and building from web
- take a look at the scripts
in web/package.json
- Lint (part of the hooks):
make lint # makes your code more readable π₯°
- Install pre-commit hook:
make install-hooks # POSIX compliant shells only
Do not install the hooks if you are going to be using Powershell
This is going to execute a script which will install git commit hooks.
The pre-hook is linting the JS code and the post-hook amends the changes to the commit, hence there will be no need for you to do it manually.
The hooks generate a files_for_commit.txt
, which is used for tracking state. Please, do ignore it!
- Install needed plugins by running the following phony:
make install-code-plugins # linters and better comments
docker-compose up --build
.
βββ packages
βββ api
βββ py-api
βββ services
β βββ url_shortener
βββ web
- Choose an issue you want to work on (e.g. #11 - Optimizations)
- Create a new branch by running the following command:
git checkout -b "11-specific-optimizations"
- When commiting, place the issue number at the beginning of the commit message
git add . # be careful if something important is not gitignored
git commit -m "#11 Added a new feature"
- Push your updates to the remote branch
git push --set-upstream origin 11-Optimizations
- Contribute π (Open a Pull Request towards the main branch)
- Reference the issue in the title
- Write a brief discription of what you have worked on
- If you encounter any issues setting up the project, ping the team in Discord or Messenger
- If you are stuck and you need help, ping the dev group chat in facebook π€Ό
- Do not forget to crack open a cold one π» with your fellow colleagues after spending countless hours debugging rendering issues π
MONGO DNS issue:
make run-api
cd ./packages/api/ && go run main.go
2022/10/03 01:57:24 error parsing uri: lookup thehubwebsite.h9aqj.mongodb.net on 192.168.68.1:53: cannot unmarshal DNS message
exit status 1
make: *** [Makefile:11: run-api] Error 1
--> resolve by doing this
- If you suspend either the react app job or the api job by mistake and cannot kill the job for some reason, use this to unbind the port
lsof -ti:PortNumberGoesHere | xargs kill -9
CODEOWNERS: NOSYNCDEV
After you are done working on a feature, you may add yourself to the CODEOWNERS
file.