- Docker or podman
- Docker-compose:
pip install docker-compose
- Taskfile
- Git
- Python >= 3.8
- Node >= v16 (NOTE: node v17 does not seem to work with websockets)
NOTE podman users (only for mac and linux):
By default all dev scripts use docker
binary. Podman users must install podman-docker
package or run the following command:
sudo ln -s $(which podman) $(dirname $(which podman)/docker)
NOTE: dependency on private repositories
You must create a personal github token in order to be able to work with private repos and export it:
export GITHUB_TOKEN=your token
It may also be convenient to place the above line in your .bashrc
or .zshrc
.
First you need to clone the eda-server
repository:
git clone https://github.com/ansible/eda-server.git
cd eda-server
Create virtual environment and install project
python -m venv .venv
source .venv/bin/activate
pip install -e .
Install Ansible and benthomasson.eda
collection:
pip install ansible
ansible-galaxy collection install benthomasson.eda
You need to start up a PostgreSQL database sever.
task dev:services:start
Then run database migrations:
task dev:run:migrations
task dev:api:start
Build UI files:
task dev:ui:start
Visit this url: http://localhost:9000/api/docs#/auth/register_register_api_auth_register_post
Click "Try it out" on /api/auth/register
Change email and password
Click execute
Visit this url:
For API docs
- http://localhost:8080/api/docs
- http://localhost:8080/api/redocs
- http://localhost:8080/api/openapi.json
Also you can check the openapi specification.
You have set up the development environment.
Note: Instead of running the above tasks individually, you can run the following.
task dev:start:all
Requires docker-compose installed. See the documentation for instructions. (latest stable version is recommended)
cd tools/docker
docker-compose up --build
NOTE Podman users:
Docker compose by default will try to expose the docker socket through a mount volume. Podman users must create a .env
file in tools/docker
dir defining the variable DOCKER_SOCKET_MOUNT
with the correct path of the socket. For example:
# .env file
DOCKER_SOCKET_MOUNT=/run/user/1000/podman/podman.sock
Requires:
- installation of Kubernetes CLI (kubectl)
- installation of kustomize
- installation of minikube
- installation of docker
- bash, version 5.1.* or above
Start minikube if it is not already running
minikube start
Check that minikube instance is up
minikube status
Build image and deployment files. (If you do not provide a version as shown below docker tag will default to "latest")
task minikube:build -- 001
Deploy application to minikube. (If you do not provide a version as shown below docker tag will default to "latest")
task minikube:deploy -- 001
Forward the webserver port to local host. (If you do not provide a local port it will default to "8080")
task minikube:fp:ui -- 8080
In a second terminal run the following cmd to create a dev
user with a password of none2tuff
.
(You will use this to log into the console.)
# Password can be specified as an command-line argument:
scripts/adduser.py --password none2tuff [email protected]
# OR passed via environment variable
PASSWORD=none2tuff scripts/adduser.py -E [email protected]
# OR submitted interactively
scripts/adduser.py [email protected]
# Enter password:
# Confirm password:
Visit this url for EDA app
Note: Instead of running the above build, deploy, and minikube-fp-ui tasks individually. It is possible to do the following, being mindful that it will use default values.
task minikube:all
You have set up the development environment.
If not started, start the PostgreSQL service, which is required for running integration tests.
docker-compose -f tools/docker/docker-compose.yml up postgres
Run all tests:
task test
Or call pytest
directly:
python -m pytest
When you start server using the binary eda-server
, it will use default project
logging settings. You can change the logging level by setting the environment variable
AE_LOG_LEVEL
. Example:
export AE_LOG_LEVEL=debug
This will change log level for uvicorn and project loggers, but will not affect 3rd party libraries.
If you need to update the default project logging configuration, you should edit the
src/eda_server/config/logging.yaml
file.
When starting server with uvicorn
binary directly, you should specify logging configuration
file path in --log-config
parameter. Note that in this case --log-level
parameter only
affects uvicorn
loggers, but not application ones. To change the application loggers levels
you should set AE_LOG_LEVEL
environment variable. Example:
uvicorn --log-config src/eda_server/config/logging.yaml ...