We use devcontainers for our development environment. The following are steps to set the environment up.
- Clone this repository
- Reopen it inside of a container
- Run
poetry shellinside the container to get inside our python venv- If the dependencies are still not installed, you may need to run
poetry installorpoetry update
- If the dependencies are still not installed, you may need to run
- Run
python3 arbiter3/scripts/initialize.pyto initialize configuration files - If this is your first time running the code, you will want to run
python3 arbiter.py migrateto make our db schemas and db file if needed - After this you will want to create a super user to use the web interface, so run
python arbiter.py createsuperuserand it will ask you for username/password
The docker configuration files given make 3 containers:
- A base container with Python3 and develop/test on
- A container that runs a Prometheus server as a service which is forwarded to port 9090 on the host machine. The Prometheus web GUI is available at
localhost:9090. This is the Prometheus server Arbiter will talk to to collect user metrics by default. - A container for a Grafana server if you would like to use it for testing (it is not required for Arbiter to run)
Arbiter has two main components, the web server and the evaluation loop.
- You can start the webserver with
python3 arbiter.py runserver - After you have started the webserver, go to
localhost:8000/and log in - Once in, you can configure the policies you want Arbiter to use and enforce and where.
- Once all the configuration is set up, you can use the Dashboard page on the Admin to see user usage, and run the Arbiter evaluation loop (only one loop) or set limits on user/hosts with a
cgroup-warden. - Now that everything is set up, you can start up the evaluation loop to run forever, by using
python3 arbiter.py evaluatewith along with how long you want to wait between each loop using the--seconds,--minutes, and--hoursarguments. If no furation arguments are provided, the loop runs once and exits. Additionally, you can specifiy only certain Policies to evaluate if you want using--policiesand a list of Policy names.
The following describes how to get a single cgroup-warden up for testing. See TESTING.md for details.
- Open a local terminal (not in devcontainer)
cd testing/vagrantvagrant up