-
Open terminal as admin and run:
run wsl --install
-
Reboot your machine
-
Open ubuntu (executable) and run:
sudo apt update
- Open Ubuntu terminal and run:
sudo su
- Paste one big command from developerportal into root cmd line(https://developerportal.pg.com/docs/default/component/devdocs/network/ssl-inspection/Solutions/#option-2-one-big-command)
- Press enter in the first pink window
- Use space key to add pgrootcert, then press enter
- CTRL+D to exit root terminal
- Start docker service:
sudo service docker stop sudo service docker start
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo docker run hello-world
Prerequisite (have git credentials manager set up on windows: https://docs.github.com/en/get-started/getting-started-with-git/caching-your-github-credentials-in-git)
sudo-apt-get install git
git config --global user.name "YOURNAME"
git config --global user.email "YOURGITHUB EMAIL"
git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager.exe"
git clone https://github.com/Ahmed-Haitham/CE-IT-Hub-Hackathon-2024
- Make sure that VS code is added to your windows path (environment variable settings)
- Open your vs code on windows and install the wsl extension
- From your ubuntu terminal, type:
Likely now you will get errors from VS code. Restarting your computer and opening vs code again should fix it.
cd /mnt/c code .
- From your vs code connected to wsl ubuntu, add a .env file in the root directory. This file will contain required variables for your database configuration.
You can paste the following for development purpose. For PROD, .env file should contain strong passwords/secrets:
PG_INSTANCE=pginstance PG_USER=user PG_PASSWORD=pass DB_PORT=5432 JWT_SECRET_KEY=asd3j4kEdj! JWT_REFRESH_SECRET_KEY=lkf3Rsad312@df% ADMIN_USERNAME=admin ADMIN_PASSWORD=admin
- Build the application:
cd CE-IT-Hub-Hackathon-2024 sudo docker compose up -d --build
- Now you should have 2 containers running (web and db). Check it by running:
sudo docker compose ps
- If you have issues spinning up containers, use:
sudo docker compose logs CONTAINERNAME
- Now you should have a running postgres db on port 5432 and a fastapi server on http://127.0.0.1:8000/. To spin the containers down:
sudo docker compose down
- If you also want to delete the persisted database volume:
sudo docker compose down -v
This will help you by making vs code suggest valid autocompletes:
cd ENV DIRECTORY
python3 -m venv hackenv
pip install -r requirements.txt