Skip to content

mfann-or/eda-server

 
 

Repository files navigation

Event Driven Ansible Server

Installation

For instructions on how to quickly spin up a preview instance of eda-server, please see INSTALL.md.

Setting up a development environment

The below instructions detail how to setup a development environment for eda-server.

Requirements

  • Docker or podman
  • Docker-compose: pip install docker-compose
  • Taskfile
  • Git
  • Python >= 3.9
  • python3-pip
  • python3-devel
  • gcc
  • npm >= v16 (NOTE: node v17 does not seem to work with websockets)

NOTE podman users (only for MacOS 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
    
  • DOCKER_HOST environment variable must be defined pointing to the podman socket to be able to use docker-compose. Example:

    export DOCKER_HOST=unix:///run/user/$UID/podman/podman.sock
    
  • Ensure the podman.socket service is enabled and running:

    systemctl --user enable --now podman.socket
    

1. Clone the repository

First you need to clone the eda-server repository:

git clone https://github.com/ansible/eda-server.git
cd eda-server

2. Virtual environment

Create virtual environment and install project

python -m venv .venv
source .venv/bin/activate
pip install -e .

Install Ansible and ansible.eda collection:

pip install ansible
ansible-galaxy collection install ansible.eda

3. Services

Note: Instead of running the below task steps individually, you can execute all tasks with task dev:all:start and then follow the steps in the Accessing the UI section.

You need to start up a PostgreSQL database sever:

task dev:services:start

Then run database migrations:

task dev:run:migrations

4. Start api server

task dev:api:start

5. User interface

Build UI files:

task dev:ui:start

6. Accessing the UI

  1. Create a dev superuser account Defaults: user: [email protected], password: none2tuff
task dev:user:add
  1. You can now login to the UI at http://localhost:8080/eda/.

API docs can be accessed at:

You have finished setting up the development environment.

Running tests

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 

Logging

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 EDA_LOG_LEVEL. Example:

export EDA_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 EDA_LOG_LEVEL environment variable. Example:

uvicorn --log-config src/eda_server/config/logging.yaml ...

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 47.7%
  • Python 45.1%
  • JavaScript 4.2%
  • Shell 2.5%
  • Dockerfile 0.2%
  • Mako 0.1%
  • Other 0.2%