This project uses Docker Compose to deploy a multi-component environment, including a web server, a PHP application, a distributed database, a message queue, caching, NoSQL, Elasticsearch with Kibana, and other services. Below are the main components and their purposes.
-
server (nginx)
- Uses the official
nginx:alpineimage. - Acts as a reverse proxy.
- Mounts configuration files, SSL certificates, and the main nginx configuration from local directories.
- Exposes ports 80 (HTTP) and 443 (HTTPS).
- Uses the official
-
webapp (PHP application)
- Built using a Dockerfile located at
./config/infrastructure/php/Dockerfile. - Uses environment variables, including database connection settings (using Citus).
- Mounts local code into the container as well as PHP and Blackfire configuration files.
- Depends on the
citus-coordinatorandrabbitmqservices.
- Built using a Dockerfile located at
-
citus-coordinator and citus-worker (PostgreSQL + Citus)
- citus-coordinator: The primary coordinator for the distributed database.
- citus-worker-1 and citus-worker-2: Workers for distributed data storage and processing.
- Uses the
citusdata/citus:12.1.3images. - Enables horizontal scaling of PostgreSQL with the Citus extension.
-
rabbitmq
- Image:
rabbitmq:3.12-management. - Manages message queues for asynchronous task processing.
- Exposes ports 5672 (AMQP) and 15672 (management interface).
- Image:
-
mongodb
- Image:
mongo:6.0. - A NoSQL database for storing documents.
- Configured with a root user and password; port 27017 is open for access.
- Image:
-
node_container
- Built using a Dockerfile in the
./frontenddirectory. - Builds and runs the frontend application (runs
npm run devandnode server.js). - Mounts the frontend source code for development.
- Exposes port 3005, which is mapped to the application running inside the container.
- Built using a Dockerfile in the
-
blackfire
- Image:
blackfire/blackfire. - A tool for profiling and monitoring the performance of the PHP application.
- Uses environment variables for authentication.
- Image:
-
jmeter
- Image:
justb4/jmeter:latest. - Used for load testing.
- Mounts directories containing test plans (
.jmxfiles) and logs for testing.
- Image:
-
redis
- Image:
redis:7-alpine. - Provides caching and fast data access.
- Exposes port 6379.
- Image:
-
elasticsearch
- Image:
docker.elastic.co/elasticsearch/elasticsearch:8.11.1. - Used as a search engine and backend for logging.
- Runs in single-node mode (
discovery.type=single-node). - Memory is limited using
ES_JAVA_OPTS.
- Image:
-
kibana
- Image:
docker.elastic.co/kibana/kibana:8.11.1. - A web interface for visualizing and analyzing Elasticsearch data.
- Connects to Elasticsearch via the
ELASTICSEARCH_HOSTSenvironment variable.
- Image:
-
Network
architecht_network- All services are connected to the common external network
architecht_networkfor interaction.
- All services are connected to the common external network
-
Persistent Data Volumes
citus_coordinator_data— PostgreSQL data (Citus Coordinator).rabbitmq_data— RabbitMQ data.mongodb_data— MongoDB data.esdata— Elasticsearch data.- Other volumes are used for node_modules (if necessary).
-
Ensure that Docker and Docker Compose are installed on your machine.
-
Configure environment variables in the
.env.localfile (if required). -
Start Docker Compose:
docker-compose up -d
-
Check the status of the containers:
docker-compose ps- Access the services:
-
The web application will be available via nginx on ports 80 and 443.
-
Kibana is available at http://localhost:5601.
-
The RabbitMQ management interface is available at http://localhost:15672 (login/password: guest/guest).
-
NGINX as a reverse proxy to distribute incoming requests among services.
-
A PHP application with Blackfire support for profiling.
-
A distributed database based on Citus for horizontal scaling of PostgreSQL.
-
RabbitMQ for asynchronous message processing.
-
MongoDB for NoSQL data storage.
-
A Node.js container for frontend development and build processes.
-
JMeter for load testing.
-
Redis for caching.
-
Elasticsearch and Kibana for logging and data analysis.
Conclusion This stack enables you to develop, test, and scale a web application using modern tools and technologies. Each part of the environment is isolated in a container, simplifying dependency management and ensuring flexibility in deployment.