Development
This page explains how to run the app in development environment.
Requirements
In order to properly run the application, you need at least the following installed:
- Git
- Docker
Installation
Start of by downloading or cloning the pdns-docker repository
git clone https://github.com/passivedns/pdns-docker.git
git clone git@github.com:passivedns/pdns-docker.git
gh repo clone passivedns/pdns-docker
Then, in the /pdns-docker/dev/
:
./init.sh
./init.ps1
cd PassiveDNS
git checkout -b [BRANCH-NAME]
Replacing [BRANCH-NAME]
with the name of the branch you are currently working on.
Run the application
Go back to the /pdns-docker/dev/
folder, and run the app:
cd ..
docker compose up
This should start all of the containers, but the web server and the frondend are not up yet. You can use Docker Desktop to access and manage them or the CLI directly.
Run web server and frontend
Web Server: open the api container, then into the Exec
tab:
poetry run uvicorn passiveDNS.webserver:app --reload --host 0.0.0.0 --port 8080 --log-level debug
FrontEnd: open the front container, then into the Exec
tab:
npm install && npm run dev
Web Server: open a shell inside the api container:
docker exec -it api sh
Then inside the shell:
poetry run uvicorn passiveDNS.webserver:app --reload --host 0.0.0.0 --port 8080 --log-level debug
FrontEnd: open a shell inside the front container:
docker exec -it front sh
Then inside the shell:
npm install && npm run dev
npm install
command only needs to be used once at start, later on you can simply use npm run dev
.Create an admin user
By default, the database is not initialized. You need to create an admin user in order to initialize it and be able to use the application.
Either by Docker Desktop or by CLI, in a shell of the API container (separate from the one you are running the app with) :
../docker-entrypoint.sh create-user [USERNAME] [PASSWORD] --admin
Replacing [USERNAME]
and [PASSWORD]
with the corresponding data.