Skip to content

diagho-core

The core application of the Diagho project.

Installation

Requirements

  • Docker: we use Docker to develop and run Diagho. This is a strict requirement to use this project.
  • Docker Compose: we use Docker Compose to simplify the orchestration of all Diagho application services, using configuration files for different environments (such as dev, test, staging or prod).

Download this repository and unzip it on your computer. You should rename the folder diagho-core-main in diagho-core.

Or clone the repository directly on your computer:

1
$ git clone git@github.com:DiaghoProject/diagho-core.git

Warning!\ You may have to change permissions on some scripts :

1
$ chmod +x utils/*.sh

Install and run a development environment

Diagho stores config in environment variables. When using Docker Compose to run Diagho, the .env file is used to define all required environment variables. You should never edit this .env file directly or store sensitive information in it, but you can override one or more of these variables by defining them directly in the shell before launching docker compose (values in the shell take precedence over those specified in the .env file.).

Notes for Windows users:\ You should set the following environment variable to enable path conversion from Windows-style to Unix-style in volume definitions:\ COMPOSE_CONVERT_WINDOWS_PATHS=1

Once you have customized your environment variables, you can build and start a development environment with the following command:

1
$ make dev

This previous command builds all the required services for development and starts them all except the Django web server and workers.

Django web server

To start the Django web server, please open a terminal in the container:

1
$ docker exec -it diagho_dev_core_1 /bin/bash

Then run:

1
2
(core) $ cd /code
(core) $ make demo

Or run sequentially:

1
2
3
4
5
6
7
8
(core) $ cd /code
(core) $ make collectstatic
(core) $ make migrations
(core) $ make migrate
(core) $ make populate-db
(core) $ make load-catalog
(core) $ make createsuperuser
(core) $ make runserver

Celery workers

To start Celery workers, please run in two different terminals:

1
$ docker exec -it diagho_dev_core_1 make -C /code worker-gateway

and:

1
$ docker exec -it diagho_dev_core_1 make -C /code worker-computation

Exposed ports when using Docker Compose to run Diagho

port service environment variable environment description
8080 reverse-proxy NGINX_HOST_PORT dev, demo NGINX server (Diagho entry point)
8081 core CORE_HOST_PORT_DEV dev Django dev server
5672 broker RABBITMQ_HOST_PORT_DEV dev RabbitMQ server
15672 broker RABBITMQ_MANAGEMENT_HOST_PORT dev, demo RabbitMQ management and monitoring
5432 core-db POSTGRES_HOST_PORT_DEV dev PostgreSQL server
6379 cache REDIS_HOST_PORT_DEV dev PostgreSQL server

Tech/framework used

  • NGINX: a free and open-source web server used as a reverse proxy;
  • Django: a Python-based free and open-source web framework;
  • Celery: Distributed Task Queue for Python;
  • PostgreSQL: a free and open-source relational database management system;
  • RabbitMQ: the most widely deployed open source message broker;

Contributing

For the sake of simplicity, to ease interaction with the community, we use the Git flow for open-source projects. In a few words:

  • The main branch is always stable and deployable;
  • Tags from the main branch are considered as releases;
  • The staging branch is the work-in-progress branch;
  • Contributors have to fork or create a new feature-branch to work on (if they are allowed to in the original repository) and propose a pull request to merge their branch to staging.

If you'd like to contribute, please raise an issue or fork the repository and use a feature branch. Pull requests are warmly welcome!

Versioning

We use SemVer for versioning. See the CHANGELOG file for details.

Licensing

The code in this project is licensed under MIT license. See the LICENSE file for details.


Last update: October 4, 2023