Giter VIP home page Giter VIP logo

ansible-events-ui2's Introduction

Event Driven Ansible Server

Setting up a development environment

Requirements

  • 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.

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 benthomasson.eda collection:

pip install ansible
ansible-galaxy collection install benthomasson.eda

3. Services

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

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

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

Run the application with docker-compose

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

Run the application on Minikube

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.

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 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 ...

ansible-events-ui2's People

Contributors

abaiken avatar alex-izquierdo avatar benthomasson avatar cutwater avatar ddonahue007 avatar dostonbek1 avatar eclarizio avatar hsong-rh avatar lgalis avatar red-hap avatar shannon-donahue avatar ttuffin avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.