Open-source engineering management that unlocks developer potential
Join our Open Source Community
Middleware is an open-source tool designed to help engineering leaders measure and analyze the effectiveness of their teams using the DORA metrics. The DORA metrics are a set of four key values that provide insights into software delivery performance and operational efficiency.
They are:
Table of Contents
Ensure that you have docker installed and running.
Open the terminal and run the following command:
docker volume create middleware_postgres_data
docker volume create middleware_keys
docker run --name middleware \
-p 3333:3333 \
-p 9696:9696 \
-p 9697:9697 \
-v middleware_postgres_data:/var/lib/postgresql/data \
-v middleware_keys:/app/keys \
-d middlewareeng/middleware:latest
docker logs -f middleware
Wait for sometime for the services to be up.
The app shall be available on your host at http://localhost:3333.
In case you want to stop the container, run the following command:
docker stop middleware
In order to fetch latest version from remote and then starting the system, use following command:
docker pull middlewareeng/middleware:latest
docker rm -f middleware || true
docker run --name middleware \
-p 3333:3333 \
-v middleware_postgres_data:/var/lib/postgresql/data \
-v middleware_keys:/app/keys \
-d middlewareeng/middleware:latest
docker logs -f middleware
If you see an error like: Conflict. The container name "/middleware" is already in use by container
. \
Then run following command before running the container again:
docker rm -f middleware
If you wish to delete all the data saved in the container, you can delete the volumes created by running the following command:
docker volume rm middleware_postgres_data middleware_keys
Gitpod enables development on remote machines and helps you get started with Middleware if your machine does not support running the project locally.
If you want to run the project locally you can setup using docker or setup everything manually.
Click the button below to open this project in Gitpod.
This will open a fully configured workspace in your browser with all the necessary dependencies already installed.
After initialization, you can access the server at port 3333 of the gitpod instance.
[!IMPORTANT] We recommend minimum 16GB RAM when developing locally.
If you don't have docker installed, please install docker over here. Make sure docker is running.
Clone the Repository:
git clone https://github.com/middlewarehq/middleware
Navigate to the Project Directory:
cd middleware
Run dev.sh
script in the project root πͺ\
./dev.sh
creates a .env
file with required development environments and runs a CLI with does all the heavy lifting from tracking the container with docker compose watch
to providing you with logs from different services.\
The usage is as follows:
./local-setup.sh # Optional; See note
./dev.sh
You may update the env.example
and set ENVIRONMENT=prod
to run it in production setup.\
Further if any changes are required to be made to ports, you may update the docker-compose.yml
file, accordingly.
Note about local-setup.sh
: While you don't need to run this script, it takes care of any local environment setup for automatic linting without which your PRs may fail the linter check.
Access the Application: Once the project is running, access the application through your web browser at http://localhost:3333. Further, other services can be accessed at:
localhost
, port: 5434
, username: postgres
, password: postgres
, db name: mhq-oss
.localhost
, port: 6385
.View the logs: Although the CLI tracks all logs, the logs of services running inside the container can be viewed in different terminals using the following commands:
Frontend logs
docker exec -it middleware-dev tail --lines 500 -f /var/log/web-server/web-server.log
Backend api server logs
docker exec -it middleware-dev tail --lines 500 -f /var/log/apiserver/apiserver.log
Backend sync server logs
docker exec -it middleware-dev tail --lines 500 -f /var/log/sync_server/sync_server.log
Redis logs
docker exec -it middleware-dev tail --lines 500 -f /var/log/redis/redis.log
Postgres logs
docker exec -it middleware-dev tail --lines 500 -f /var/log/postgres/postgres.log
To set up middleware locally, follow these steps:
Clone the Repository:
git clone https://github.com/middlewarehq/middleware.git
Navigate to the Project Directory:
cd middleware
Run Redis and Postgres Containers:
If you don't have docker installed, please install docker over here
Run the following commands to run Postgres and Redis using docker.
cd database-docker && docker-compose up -d
If you don't prefer Docker, you can choose to install Postgres and Redis manually.
Once you are done with using or developing Middleware, you can choose to close these running container. (NOTE: Don't do this if you are following this document and trying to run Middleware.)
cd database-docker/
docker-compose down -v
Generate Encryption keys:
Generate encryption keys for the project by running the following command in the project root directory:
cd setup_utils && . ./generate_config_ini.sh && cd ..
Backend Server Setup
Install python version 3.11.6
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Move backend directory to create a virtual environment
cd backend
python -m venv venv
Activate virtual environment
. venv/bin/activate
Install Dependencies
pip install -r requirements.txt -r dev-requirements.txt
Create a .env
file in the root directory and add the following environment variables, replacing the values with your own if needed:
DB_HOST=localhost
DB_NAME=mhq-oss
DB_PASS=postgres
DB_PORT=5434
DB_USER=postgres
REDIS_HOST=localhost
REDIS_PORT=6385
ANALYTICS_SERVER_PORT=9696
SYNC_SERVER_PORT=9697
DEFAULT_SYNC_DAYS=31
Start the backend servers
Change Directory to analytics_server
cd analytics_server
For backend analytics server:
flask --app app --debug run --port 9696
For backend sync server:
flask --app sync_app --debug run --port 9697
NOTE: Open this sync sever in a new terminal window after activating the virtual environment only after starting analytics server.
Web Server Setup
Access the Application: Once the project is running, access the application through your web browser at http://localhost:3333. \ Additionally:
Middleware can display DORA Metrics using exclusively Pull Requests based data. The aim is to provide Dora Metrics to anyone and everyone using their Git data, regardless of other integrations, in as few steps as possible.
In its totality, Dora Metrics are derived from Pull Requests, Deployments, and Incidents.
To learn more about how it's done, look at our documentation here.
Coming Soon!
To get started contributing to middleware check out our CONTRIBUTING.md.
[!IMPORTANT] β¨ We offer SWAG for solving issues labelled
advanced
! β¨ Please confirm with our team on respective issues before proceeding.[!IMPORTANT] π©βπ» When new hiring positions open, we look at our open source contributors first! π¨βπ» Join our Slack so we can reach out to you.
We appreciate your contributions and look forward to working together to make Middleware even better!
This sections contains some automation scripts that can generate boilerplate code to extend certain features and ship faster π
python make_new_setting.py
script in the ./backend/dev_scripts
directoryIf you are in the root directory, you can run:
python ./backend/dev_scripts/make_new_setting.py
done
once you have added all the fields.https://github.com/middlewarehq/middleware/assets/70485812/f0529fa7-a2cb-44b1-ae07-2a7c97f56bef
To get started contributing to middleware check out our SECURITY.md.
We look forward to your part in keeping Middleware secure!
This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details.