From adbf264f7453ff445576c8407232299ffde90fbf Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 13 Jan 2026 10:46:49 +0000
Subject: [PATCH 1/6] Initial plan
From 3ee958d75801b211d346af6391193ee87df7761c Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 13 Jan 2026 10:53:16 +0000
Subject: [PATCH 2/6] Add Docker development environment for BackOffice
Co-authored-by: ruslanbaidan <3246171+ruslanbaidan@users.noreply.github.com>
---
.dockerignore | 43 +++++
.env.dev | 6 +
.gitignore | 2 +
Dockerfile | 115 +++++++++++++
INSTALL/INSTALL.docker.md | 170 ++++++++++++++++++
README.docker.md | 354 ++++++++++++++++++++++++++++++++++++++
README.md | 16 ++
docker-compose.dev.yml | 63 +++++++
docker-dev.sh | 100 +++++++++++
docker-entrypoint.sh | 142 +++++++++++++++
10 files changed, 1011 insertions(+)
create mode 100644 .dockerignore
create mode 100644 .env.dev
create mode 100644 Dockerfile
create mode 100644 INSTALL/INSTALL.docker.md
create mode 100644 README.docker.md
create mode 100644 docker-compose.dev.yml
create mode 100755 docker-dev.sh
create mode 100644 docker-entrypoint.sh
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..17688f6
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,43 @@
+# Git files
+.git
+.gitignore
+.github
+
+# Documentation
+README.md
+AUTHORS
+LICENSE
+*.md
+
+# Development files
+vagrant/
+INSTALL/
+.idea
+.vscode
+.DS_Store
+
+# Dependencies (will be installed in container)
+vendor/
+node_modules/
+
+# Data directories (will be mounted as volumes)
+data/
+
+# Build artifacts
+public/css/
+public/js/
+public/img/
+public/flags/
+public/views/
+
+# Logs
+*.log
+npm-debug.log
+
+# Cache
+*.cache
+.docker-initialized
+
+# Environment files (should be configured separately)
+.env
+.env.dev
diff --git a/.env.dev b/.env.dev
new file mode 100644
index 0000000..b3cc454
--- /dev/null
+++ b/.env.dev
@@ -0,0 +1,6 @@
+# MariaDB Configuration
+DBPASSWORD_ADMIN=root
+DBNAME_COMMON=monarc_common
+DBNAME_MASTER=monarc_master
+DBUSER_MONARC=sqlmonarcuser
+DBPASSWORD_MONARC=sqlmonarcuser
diff --git a/.gitignore b/.gitignore
index 487c18a..c9bf48d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,3 +20,5 @@ bin/
data/*
vagrant/.vagrant/
vagrant/*.log
+.env
+.docker-initialized
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..a7891f2
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,115 @@
+FROM ubuntu:22.04
+
+# Prevent interactive prompts during package installation
+ENV DEBIAN_FRONTEND=noninteractive
+ENV LANGUAGE=en_US.UTF-8
+ENV LANG=en_US.UTF-8
+ENV LC_ALL=en_US.UTF-8
+
+# Install system dependencies
+RUN apt-get update && apt-get upgrade -y && \
+ apt-get install -y \
+ vim \
+ zip \
+ unzip \
+ git \
+ gettext \
+ curl \
+ gsfonts \
+ mariadb-client \
+ apache2 \
+ php8.1 \
+ php8.1-cli \
+ php8.1-common \
+ php8.1-mysql \
+ php8.1-zip \
+ php8.1-gd \
+ php8.1-mbstring \
+ php8.1-curl \
+ php8.1-xml \
+ php8.1-bcmath \
+ php8.1-intl \
+ php8.1-imagick \
+ php8.1-xdebug \
+ locales \
+ wget \
+ ca-certificates \
+ gnupg && \
+ locale-gen en_US.UTF-8 && \
+ apt-get clean && \
+ rm -rf /var/lib/apt/lists/*
+
+# Configure PHP
+RUN sed -i 's/upload_max_filesize = .*/upload_max_filesize = 200M/' /etc/php/8.1/apache2/php.ini && \
+ sed -i 's/post_max_size = .*/post_max_size = 50M/' /etc/php/8.1/apache2/php.ini && \
+ sed -i 's/max_execution_time = .*/max_execution_time = 100/' /etc/php/8.1/apache2/php.ini && \
+ sed -i 's/max_input_time = .*/max_input_time = 223/' /etc/php/8.1/apache2/php.ini && \
+ sed -i 's/memory_limit = .*/memory_limit = 512M/' /etc/php/8.1/apache2/php.ini && \
+ sed -i 's/session\\.gc_maxlifetime = .*/session.gc_maxlifetime = 604800/' /etc/php/8.1/apache2/php.ini && \
+ sed -i 's/session\\.gc_probability = .*/session.gc_probability = 1/' /etc/php/8.1/apache2/php.ini && \
+ sed -i 's/session\\.gc_divisor = .*/session.gc_divisor = 1000/' /etc/php/8.1/apache2/php.ini
+
+# Configure Xdebug for development
+RUN echo "zend_extension=xdebug.so" > /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
+ echo "xdebug.mode=debug" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
+ echo "xdebug.discover_client_host=1" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
+ echo "xdebug.idekey=IDEKEY" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini
+
+# Enable Apache modules
+RUN a2enmod rewrite ssl headers
+
+# Install Composer
+RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
+
+# Install Node.js and npm
+RUN mkdir -p /etc/apt/keyrings && \
+ curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
+ echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_15.x nodistro main" > /etc/apt/sources.list.d/nodesource.list && \
+ apt-get update && \
+ apt-get install -y nodejs npm && \
+ npm install -g grunt-cli && \
+ apt-get clean && \
+ rm -rf /var/lib/apt/lists/*
+
+# Set working directory
+WORKDIR /var/www/html/monarc
+
+# Configure Apache
+RUN echo '\n\
+ ServerName localhost\n\
+ DocumentRoot /var/www/html/monarc/public\n\
+\n\
+ \n\
+ DirectoryIndex index.php\n\
+ AllowOverride All\n\
+ Require all granted\n\
+ \n\
+\n\
+ \n\
+ Header always set X-Content-Type-Options nosniff\n\
+ Header always set X-XSS-Protection "1; mode=block"\n\
+ Header always set X-Robots-Tag none\n\
+ Header always set X-Frame-Options SAMEORIGIN\n\
+ \n\
+\n\
+ SetEnv APP_ENV development\n\
+ SetEnv APP_DIR /var/www/html/monarc\n\
+' > /etc/apache2/sites-available/000-default.conf
+
+# Allow Apache override to all
+RUN sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf
+
+# Create necessary directories
+RUN mkdir -p /var/www/html/monarc/data/cache \
+ /var/www/html/monarc/data/LazyServices/Proxy \
+ /var/www/html/monarc/data/DoctrineORMModule/Proxy \
+ /var/www/html/monarc/data/import/files
+
+# Copy entrypoint script
+COPY docker-entrypoint.sh /usr/local/bin/
+RUN chmod +x /usr/local/bin/docker-entrypoint.sh
+
+EXPOSE 80
+
+ENTRYPOINT ["docker-entrypoint.sh"]
+CMD ["apachectl", "-D", "FOREGROUND"]
diff --git a/INSTALL/INSTALL.docker.md b/INSTALL/INSTALL.docker.md
new file mode 100644
index 0000000..e90b114
--- /dev/null
+++ b/INSTALL/INSTALL.docker.md
@@ -0,0 +1,170 @@
+# Docker Installation Guide for MONARC BackOffice
+
+This document provides installation instructions for setting up MONARC BackOffice using Docker for development purposes.
+
+## Quick Installation
+
+```bash
+# Clone the repository
+git clone https://github.com/monarc-project/MonarcAppBO
+cd MonarcAppBO
+
+# Start with the helper script (recommended)
+./docker-dev.sh start
+
+# Or use docker-compose directly
+cp .env.dev .env
+docker compose -f docker-compose.dev.yml up -d --build
+```
+
+## What Gets Installed
+
+The Docker setup includes:
+
+1. **MONARC BackOffice Application**
+ - Ubuntu 22.04 base
+ - PHP 8.1 with all required extensions
+ - Apache web server
+ - Composer for PHP dependencies
+ - Node.js for frontend
+ - All MONARC modules and dependencies
+
+2. **MariaDB 10.11**
+ - Database for MONARC application data
+ - Pre-configured with proper character sets
+
+## First Time Setup
+
+When you start the environment for the first time:
+
+1. Docker images will be built (5-10 minutes)
+2. Dependencies will be installed automatically
+3. Databases will be created and initialized
+4. Frontend repositories will be cloned and built
+
+## Access URLs
+
+After startup, access the application at:
+
+- **MONARC BackOffice**: http://localhost:5002
+
+## Default Credentials
+
+The BackOffice uses the same authentication system as your configured instances.
+You'll need to configure user accounts through the application.
+
+⚠️ **Security Warning**: Change these credentials before deploying to production!
+
+## System Requirements
+
+- Docker Engine 20.10 or later
+- Docker Compose V2
+- At least 4GB RAM available for Docker
+- At least 10GB free disk space
+- Linux, macOS, or Windows with WSL2
+
+## Configuration
+
+Environment variables are defined in the `.env` file (copied from `.env.dev`):
+
+- Database credentials
+- Service ports
+
+You can customize these before starting the environment.
+
+## Troubleshooting
+
+### Port Conflicts
+
+If port 5002 or 3306 is already in use:
+
+1. Edit `docker-compose.dev.yml`
+2. Change the host port (left side of the port mapping)
+3. Example: Change `"5002:80"` to `"8002:80"`
+
+### Permission Issues
+
+If you encounter permission errors:
+
+```bash
+docker exec -it monarc-bo-app bash
+chown -R www-data:www-data /var/www/html/monarc/data
+chmod -R 775 /var/www/html/monarc/data
+```
+
+### Service Not Starting
+
+Check the logs:
+
+```bash
+./docker-dev.sh logs
+# or
+docker compose -f docker-compose.dev.yml logs
+```
+
+### Reset Everything
+
+To start completely fresh:
+
+```bash
+./docker-dev.sh reset
+# or
+docker compose -f docker-compose.dev.yml down -v
+```
+
+## Common Tasks
+
+### View Logs
+```bash
+./docker-dev.sh logs
+```
+
+### Access Container Shell
+```bash
+./docker-dev.sh shell
+```
+
+### Access Database
+```bash
+./docker-dev.sh db
+```
+
+### Stop Services
+```bash
+./docker-dev.sh stop
+```
+
+### Restart Services
+```bash
+./docker-dev.sh restart
+```
+
+## Comparison with Other Installation Methods
+
+| Method | Complexity | Time | Best For |
+|--------|-----------|------|----------|
+| Docker | Low | Fast (2-5 min startup) | Development |
+| Vagrant | Medium | Slow (10-15 min startup) | Development |
+| Manual | High | Slow (30+ min) | Production |
+| VM | Low | Medium | Testing |
+
+## Next Steps
+
+After installation:
+
+1. Read the [full Docker documentation](README.docker.md)
+2. Review the [MONARC documentation](https://www.monarc.lu/documentation)
+3. Configure your BackOffice instances
+4. Start developing!
+
+## Getting Help
+
+- **Documentation**: [README.docker.md](README.docker.md)
+- **MONARC Website**: https://www.monarc.lu
+- **GitHub Issues**: https://github.com/monarc-project/MonarcAppBO/issues
+- **Community**: https://www.monarc.lu/community
+
+## License
+
+This project is licensed under the GNU Affero General Public License version 3.
+See [LICENSE](LICENSE) for details.
diff --git a/README.docker.md b/README.docker.md
new file mode 100644
index 0000000..c7e795a
--- /dev/null
+++ b/README.docker.md
@@ -0,0 +1,354 @@
+# Docker Development Environment for MONARC BackOffice
+
+This guide explains how to set up a local development environment for MONARC BackOffice using Docker.
+
+## Prerequisites
+
+- Docker Engine 20.10 or later
+- Docker Compose V2 (comes with Docker Desktop)
+- At least 4GB of RAM available for Docker
+- At least 10GB of free disk space
+
+## Quick Start
+
+### Option 1: Using the Helper Script (Recommended)
+
+1. **Clone the repository** (if you haven't already):
+ ```bash
+ git clone https://github.com/monarc-project/MonarcAppBO
+ cd MonarcAppBO
+ ```
+
+2. **Start the development environment**:
+ ```bash
+ ./docker-dev.sh start
+ ```
+
+ This will automatically:
+ - Create `.env` file from `.env.dev` if it doesn't exist
+ - Build and start all services
+ - Display access URLs
+
+ The first run will take several minutes as it:
+ - Builds the Docker images
+ - Installs all dependencies (PHP, Node.js)
+ - Clones frontend repositories
+ - Initializes databases
+ - Builds the frontend
+
+3. **Access the application**:
+ - MONARC BackOffice: http://localhost:5002
+
+### Option 2: Using Docker Compose Directly
+
+1. **Clone the repository** (if you haven't already):
+ ```bash
+ git clone https://github.com/monarc-project/MonarcAppBO
+ cd MonarcAppBO
+ ```
+
+2. **Copy the environment file**:
+ ```bash
+ cp .env.dev .env
+ ```
+
+3. **Customize environment variables** (optional):
+ Edit `.env` file to change default passwords and configuration.
+
+4. **Start the development environment**:
+ ```bash
+ docker compose -f docker-compose.dev.yml up --build
+ ```
+
+5. **Access the application**:
+ - MONARC BackOffice: http://localhost:5002
+
+## Services
+
+The development environment includes the following services:
+
+| Service | Description | Port | Container Name |
+|---------|-------------|------|----------------|
+| monarc | Main BackOffice application (PHP/Apache) | 5002 | monarc-bo-app |
+| db | MariaDB database | 3306 | monarc-bo-db |
+
+## Development Workflow
+
+### Helper Script Commands
+
+The `docker-dev.sh` script provides convenient commands for managing the development environment:
+
+```bash
+./docker-dev.sh start # Start all services
+./docker-dev.sh stop # Stop all services
+./docker-dev.sh restart # Restart all services
+./docker-dev.sh logs # View logs from all services
+./docker-dev.sh logs-app # View logs from MONARC application
+./docker-dev.sh shell # Open a shell in the MONARC container
+./docker-dev.sh db # Open MySQL client
+./docker-dev.sh status # Show status of all services
+./docker-dev.sh reset # Reset everything (removes all data)
+```
+
+### Live Code Editing
+
+The application source code is mounted as a volume, so changes you make on your host machine will be immediately reflected in the container. After making changes:
+
+1. **PHP/Backend changes**: Apache automatically reloads modified files
+2. **Frontend changes**: You may need to rebuild the frontend:
+ ```bash
+ docker exec -it monarc-bo-app bash
+ cd /var/www/html/monarc
+ ./scripts/update-all.sh -d
+ ```
+
+### Accessing the Container
+
+Using helper script:
+```bash
+./docker-dev.sh shell
+```
+
+Or directly with docker:
+```bash
+docker exec -it monarc-bo-app bash
+```
+
+### Database Access
+
+Using helper script:
+```bash
+./docker-dev.sh db # Connect to MariaDB
+```
+
+Or directly with docker:
+```bash
+# Connect to MariaDB
+docker exec -it monarc-bo-db mysql -usqlmonarcuser -psqlmonarcuser monarc_common
+```
+
+### Viewing Logs
+
+Using helper script:
+```bash
+./docker-dev.sh logs # All services
+./docker-dev.sh logs-app # MONARC application only
+```
+
+Or directly with docker compose:
+```bash
+# View logs for all services
+docker compose -f docker-compose.dev.yml logs -f
+
+# View logs for a specific service
+docker compose -f docker-compose.dev.yml logs -f monarc
+```
+
+### Restarting Services
+
+Using helper script:
+```bash
+./docker-dev.sh restart # Restart all services
+```
+
+Or directly with docker compose:
+```bash
+# Restart all services
+docker compose -f docker-compose.dev.yml restart
+
+# Restart a specific service
+docker compose -f docker-compose.dev.yml restart monarc
+```
+
+### Stopping the Environment
+
+Using helper script:
+```bash
+./docker-dev.sh stop # Stop all services (keeps data)
+./docker-dev.sh reset # Stop and remove everything including data
+```
+
+Or directly with docker compose:
+```bash
+# Stop all services (keeps data)
+docker compose -f docker-compose.dev.yml stop
+
+# Stop and remove containers (keeps volumes/data)
+docker compose -f docker-compose.dev.yml down
+
+# Stop and remove everything including data
+docker compose -f docker-compose.dev.yml down -v
+```
+
+## Common Tasks
+
+### Resetting the Database
+
+To completely reset the databases:
+```bash
+docker compose -f docker-compose.dev.yml down -v
+docker compose -f docker-compose.dev.yml up --build
+```
+
+### Installing New PHP Dependencies
+
+```bash
+docker exec -it monarc-bo-app bash
+composer require package/name
+```
+
+### Installing New Node Dependencies
+
+```bash
+docker exec -it monarc-bo-app bash
+cd node_modules/ng_backoffice # or ng_anr
+npm install package-name
+```
+
+### Running Database Migrations
+
+```bash
+docker exec -it monarc-bo-app bash
+php ./vendor/robmorgan/phinx/bin/phinx migrate -c ./module/Monarc/BackOffice/migrations/phinx.php
+```
+
+### Rebuilding Frontend
+
+```bash
+docker exec -it monarc-bo-app bash
+cd /var/www/html/monarc
+./scripts/update-all.sh -d
+```
+
+## Debugging
+
+### Xdebug Configuration
+
+Xdebug is pre-configured in the development environment. To use it:
+
+1. Configure your IDE to listen on port 9003
+2. Set the IDE key to `IDEKEY`
+3. Start debugging in your IDE
+4. Trigger a request to the application
+
+For PhpStorm:
+- Go to Settings → PHP → Debug
+- Set Xdebug port to 9003
+- Enable "Can accept external connections"
+- Set the path mappings: `/var/www/html/monarc` → your local project path
+
+### Checking Service Health
+
+```bash
+# Check if all services are running
+docker compose -f docker-compose.dev.yml ps
+
+# Check specific service health
+docker compose -f docker-compose.dev.yml ps monarc
+```
+
+## Troubleshooting
+
+### Port Conflicts
+
+If you get port conflicts, you can change the ports in the `docker-compose.dev.yml` file:
+```yaml
+ports:
+ - "5002:80" # Change 5002 to another available port
+```
+
+### Permission Issues
+
+If you encounter permission issues with mounted volumes:
+```bash
+docker exec -it monarc-bo-app bash
+chown -R www-data:www-data /var/www/html/monarc/data
+chmod -R 775 /var/www/html/monarc/data
+```
+
+### Database Connection Issues
+
+Check if the database is healthy:
+```bash
+docker compose -f docker-compose.dev.yml ps db
+```
+
+If needed, restart the database:
+```bash
+docker compose -f docker-compose.dev.yml restart db
+```
+
+### Rebuilding from Scratch
+
+If something goes wrong and you want to start fresh:
+```bash
+# Stop everything
+docker compose -f docker-compose.dev.yml down -v
+
+# Remove all related containers, images, and volumes
+docker system prune -a
+
+# Rebuild and start
+docker compose -f docker-compose.dev.yml up --build
+```
+
+## Performance Optimization
+
+For better performance on macOS and Windows:
+
+1. **Use Docker volume mounts for dependencies**: The compose file already uses named volumes for `vendor` and `node_modules` to improve performance.
+
+2. **Allocate more resources**: In Docker Desktop settings, increase:
+ - CPUs: 4 or more
+ - Memory: 4GB or more
+ - Swap: 1GB or more
+
+3. **Enable caching**: The Dockerfile uses apt cache and composer optimizations.
+
+## Comparison with Vagrant
+
+| Feature | Docker | Vagrant |
+|---------|--------|---------|
+| Startup time | Fast (~2-3 min) | Slow (~10-15 min) |
+| Resource usage | Lower | Higher |
+| Isolation | Container-level | VM-level |
+| Portability | Excellent | Good |
+| Live code reload | Yes | Yes |
+| Learning curve | Moderate | Low |
+
+## Environment Variables Reference
+
+All environment variables are defined in the `.env` file:
+
+| Variable | Description | Default |
+|----------|-------------|---------|
+| `DBPASSWORD_ADMIN` | MariaDB root password | `root` |
+| `DBNAME_COMMON` | Common database name | `monarc_common` |
+| `DBNAME_MASTER` | Master database name | `monarc_master` |
+| `DBUSER_MONARC` | Database user | `sqlmonarcuser` |
+| `DBPASSWORD_MONARC` | Database password | `sqlmonarcuser` |
+
+## Security Notes
+
+⚠️ **Important**: The default credentials provided are for development only. Never use these in production!
+
+For production deployments:
+1. Change all default passwords
+2. Use proper SSL/TLS certificates
+3. Follow security best practices
+
+## Additional Resources
+
+- [MONARC Website](https://www.monarc.lu)
+- [MONARC Documentation](https://www.monarc.lu/documentation)
+- [GitHub Repository](https://github.com/monarc-project/MonarcAppBO)
+- [MonarcAppFO (FrontOffice)](https://github.com/monarc-project/MonarcAppFO)
+
+## Getting Help
+
+If you encounter issues:
+
+1. Check the [troubleshooting section](#troubleshooting)
+2. Review the logs: `docker compose -f docker-compose.dev.yml logs`
+3. Open an issue on [GitHub](https://github.com/monarc-project/MonarcAppBO/issues)
+4. Join the MONARC community discussions
diff --git a/README.md b/README.md
index a4a5226..afa9877 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,22 @@ For installation instructions see
[INSTALL](https://github.com/monarc-project/MonarcAppBO/tree/master/INSTALL).
+Development Environment
+-----------------------
+
+For local development, you can use either:
+
+- **Docker** (recommended): See [README.docker.md](README.docker.md) for instructions
+ ```bash
+ ./docker-dev.sh start
+ ```
+
+- **Vagrant**: See [vagrant/README.rst](vagrant/README.rst) for instructions
+ ```bash
+ cd vagrant && vagrant up
+ ```
+
+
License
-------
diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml
new file mode 100644
index 0000000..f839684
--- /dev/null
+++ b/docker-compose.dev.yml
@@ -0,0 +1,63 @@
+services:
+ # MariaDB database for MONARC BackOffice
+ db:
+ image: mariadb:10.11
+ container_name: monarc-bo-db
+ environment:
+ MYSQL_ROOT_PASSWORD: ${DBPASSWORD_ADMIN}
+ MYSQL_DATABASE: ${DBNAME_COMMON}
+ MYSQL_USER: ${DBUSER_MONARC}
+ MYSQL_PASSWORD: ${DBPASSWORD_MONARC}
+ command:
+ - --character-set-server=utf8mb4
+ - --collation-server=utf8mb4_general_ci
+ - --bind-address=0.0.0.0
+ ports:
+ - "3306:3306"
+ volumes:
+ - db_data:/var/lib/mysql
+ networks:
+ - monarc-network
+ healthcheck:
+ test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${DBPASSWORD_ADMIN}"]
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ # Main MONARC BackOffice application
+ monarc:
+ build:
+ context: .
+ dockerfile: Dockerfile
+ container_name: monarc-bo-app
+ environment:
+ DBHOST: db
+ DBNAME_COMMON: ${DBNAME_COMMON}
+ DBNAME_MASTER: ${DBNAME_MASTER}
+ DBUSER_MONARC: ${DBUSER_MONARC}
+ DBPASSWORD_MONARC: ${DBPASSWORD_MONARC}
+ APP_ENV: development
+ APP_DIR: /var/www/html/monarc
+ ports:
+ - "5002:80"
+ depends_on:
+ db:
+ condition: service_healthy
+ networks:
+ - monarc-network
+ volumes:
+ # Mount the application code for live development
+ - ./:/var/www/html/monarc
+ # Preserve vendor directory in named volume for better performance
+ - vendor_data:/var/www/html/monarc/vendor
+ - node_modules_data:/var/www/html/monarc/node_modules
+ working_dir: /var/www/html/monarc
+
+networks:
+ monarc-network:
+ driver: bridge
+
+volumes:
+ db_data:
+ vendor_data:
+ node_modules_data:
diff --git a/docker-dev.sh b/docker-dev.sh
new file mode 100755
index 0000000..6a6c512
--- /dev/null
+++ b/docker-dev.sh
@@ -0,0 +1,100 @@
+#!/bin/bash
+# Helper script for managing MONARC BackOffice Docker development environment
+
+set -e
+
+COMPOSE_FILE="docker-compose.dev.yml"
+
+# Colors for output
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+RED='\033[0;31m'
+NC='\033[0m' # No Color
+
+usage() {
+ echo -e "${GREEN}MONARC BackOffice Docker Development Environment Manager${NC}"
+ echo ""
+ echo "Usage: $0 [command]"
+ echo ""
+ echo "Commands:"
+ echo " start Start all services (builds on first run)"
+ echo " stop Stop all services"
+ echo " restart Restart all services"
+ echo " logs View logs from all services"
+ echo " logs-app View logs from MONARC application"
+ echo " shell Open a shell in the MONARC container"
+ echo " db Open MySQL client in the database"
+ echo " reset Reset everything (removes all data)"
+ echo " status Show status of all services"
+ echo ""
+}
+
+check_env() {
+ if [ ! -f .env ]; then
+ echo -e "${YELLOW}No .env file found. Creating from .env.dev...${NC}"
+ cp .env.dev .env
+ echo -e "${GREEN}.env file created. You can edit it to customize configuration.${NC}"
+ fi
+}
+
+case "$1" in
+ start)
+ check_env
+ echo -e "${GREEN}Starting MONARC BackOffice development environment...${NC}"
+ docker compose -f "$COMPOSE_FILE" up -d --build
+ echo -e "${GREEN}Services started!${NC}"
+ echo -e "MONARC BackOffice: http://localhost:5002"
+ echo -e "\n${YELLOW}To view logs: $0 logs${NC}"
+ ;;
+
+ stop)
+ echo -e "${YELLOW}Stopping all services...${NC}"
+ docker compose -f "$COMPOSE_FILE" stop
+ echo -e "${GREEN}Services stopped.${NC}"
+ ;;
+
+ restart)
+ echo -e "${YELLOW}Restarting all services...${NC}"
+ docker compose -f "$COMPOSE_FILE" restart
+ echo -e "${GREEN}Services restarted.${NC}"
+ ;;
+
+ logs)
+ docker compose -f "$COMPOSE_FILE" logs -f
+ ;;
+
+ logs-app)
+ docker compose -f "$COMPOSE_FILE" logs -f monarc
+ ;;
+
+ shell)
+ echo -e "${GREEN}Opening shell in MONARC container...${NC}"
+ docker exec -it monarc-bo-app bash
+ ;;
+
+ db)
+ echo -e "${GREEN}Opening MySQL client...${NC}"
+ docker exec -it monarc-bo-db mysql -usqlmonarcuser -psqlmonarcuser monarc_common
+ ;;
+
+ reset)
+ echo -e "${RED}WARNING: This will remove all data!${NC}"
+ read -p "Are you sure? (yes/no): " confirm
+ if [ "$confirm" = "yes" ]; then
+ echo -e "${YELLOW}Stopping and removing all containers, volumes, and data...${NC}"
+ docker compose -f "$COMPOSE_FILE" down -v
+ echo -e "${GREEN}Reset complete. Run '$0 start' to start fresh.${NC}"
+ else
+ echo -e "${GREEN}Reset cancelled.${NC}"
+ fi
+ ;;
+
+ status)
+ docker compose -f "$COMPOSE_FILE" ps
+ ;;
+
+ *)
+ usage
+ exit 1
+ ;;
+esac
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
new file mode 100644
index 0000000..f37617f
--- /dev/null
+++ b/docker-entrypoint.sh
@@ -0,0 +1,142 @@
+#!/bin/bash
+set -e
+
+# Colors for output
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+NC='\033[0m' # No Color
+
+echo -e "${GREEN}Starting MONARC BackOffice setup...${NC}"
+
+# Wait for database to be ready
+echo -e "${YELLOW}Waiting for MariaDB to be ready...${NC}"
+while ! mysqladmin ping -h"${DBHOST}" -u"${DBUSER_MONARC}" -p"${DBPASSWORD_MONARC}" --silent 2>/dev/null; do
+ echo "Waiting for MariaDB..."
+ sleep 2
+done
+echo -e "${GREEN}MariaDB is ready!${NC}"
+
+# Check if this is the first run
+if [ ! -f "/var/www/html/monarc/.docker-initialized" ]; then
+ echo -e "${GREEN}First run detected, initializing application...${NC}"
+
+ cd /var/www/html/monarc
+
+ # Install composer dependencies
+ if [ ! -d "vendor" ]; then
+ echo -e "${YELLOW}Installing Composer dependencies...${NC}"
+ composer install --ignore-platform-req=php
+ fi
+
+ # Create module symlinks
+ echo -e "${YELLOW}Creating module symlinks...${NC}"
+ mkdir -p module/Monarc
+ cd module/Monarc
+ ln -sfn ./../../vendor/monarc/core Core
+ ln -sfn ./../../vendor/monarc/backoffice BackOffice
+ cd /var/www/html/monarc
+
+ # Clone frontend repositories
+ echo -e "${YELLOW}Setting up frontend repositories...${NC}"
+ mkdir -p node_modules
+ cd node_modules
+
+ if [ ! -d "ng_backoffice" ]; then
+ git clone --config core.fileMode=false https://github.com/monarc-project/ng-backoffice.git ng_backoffice
+ fi
+
+ if [ ! -d "ng_anr" ]; then
+ git clone --config core.fileMode=false https://github.com/monarc-project/ng-anr.git ng_anr
+ fi
+
+ cd /var/www/html/monarc
+
+ # Check if database exists and create if needed
+ echo -e "${YELLOW}Setting up databases...${NC}"
+ DB_EXISTS=$(mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" -p"${DBPASSWORD_MONARC}" -e "SHOW DATABASES LIKE '${DBNAME_MASTER}';" | grep -c "${DBNAME_MASTER}" || true)
+
+ if [ "$DB_EXISTS" -eq 0 ]; then
+ echo -e "${YELLOW}Creating databases...${NC}"
+ mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" -p"${DBPASSWORD_MONARC}" -e "CREATE DATABASE ${DBNAME_MASTER} DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;"
+ mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" -p"${DBPASSWORD_MONARC}" -e "CREATE DATABASE ${DBNAME_COMMON} DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;"
+
+ echo -e "${YELLOW}Populating databases...${NC}"
+ mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" -p"${DBPASSWORD_MONARC}" ${DBNAME_COMMON} < db-bootstrap/monarc_structure.sql
+ mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" -p"${DBPASSWORD_MONARC}" ${DBNAME_COMMON} < db-bootstrap/monarc_data.sql
+ fi
+
+ # Generate local config if it doesn't exist
+ if [ ! -f "config/autoload/local.php" ]; then
+ echo -e "${YELLOW}Creating local configuration...${NC}"
+ cat > config/autoload/local.php < [
+ 'connection' => [
+ 'orm_default' => [
+ 'params' => [
+ 'host' => '${DBHOST}',
+ 'user' => '${DBUSER_MONARC}',
+ 'password' => '${DBPASSWORD_MONARC}',
+ 'dbname' => '${DBNAME_COMMON}',
+ ],
+ ],
+ 'orm_cli' => [
+ 'params' => [
+ 'host' => '${DBHOST}',
+ 'user' => '${DBUSER_MONARC}',
+ 'password' => '${DBPASSWORD_MONARC}',
+ 'dbname' => '${DBNAME_MASTER}',
+ ],
+ ],
+ ],
+ ],
+
+ 'activeLanguages' => array('fr','en','de','nl','es','ro','it','ja','pl','pt','ru','zh'),
+
+ 'appVersion' => \$package_json['version'],
+
+ 'checkVersion' => false,
+ 'appCheckingURL' => 'https://version.monarc.lu/check/MONARC',
+
+ 'email' => [
+ 'name' => 'MONARC',
+ 'from' => 'info@monarc.lu',
+ ],
+
+ 'mospApiUrl' => 'https://objects.monarc.lu/api/',
+
+ 'monarc' => [
+ 'ttl' => 60, // timeout
+ 'salt' => '', // private salt for password encryption
+ ],
+];
+EOF
+ fi
+
+ # Update and build frontend
+ echo -e "${YELLOW}Building frontend...${NC}"
+ ./scripts/update-all.sh -d
+
+ # Set permissions
+ echo -e "${YELLOW}Setting permissions...${NC}"
+ chown -R www-data:www-data /var/www/html/monarc/data
+ chmod -R 775 /var/www/html/monarc/data
+
+ # Mark initialization as complete
+ touch /var/www/html/monarc/.docker-initialized
+ echo -e "${GREEN}Initialization complete!${NC}"
+else
+ echo -e "${GREEN}Application already initialized, starting services...${NC}"
+fi
+
+# Execute the main command
+exec "$@"
From 91348d03ba36f1cfc402010ba9a3ef70725a1c06 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 13 Jan 2026 10:55:39 +0000
Subject: [PATCH 3/6] Make docker-entrypoint.sh executable
Co-authored-by: ruslanbaidan <3246171+ruslanbaidan@users.noreply.github.com>
---
docker-entrypoint.sh | 0
1 file changed, 0 insertions(+), 0 deletions(-)
mode change 100644 => 100755 docker-entrypoint.sh
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
old mode 100644
new mode 100755
From e4447e53f7db36fe97c3271d16538e3f05ac6931 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 13 Jan 2026 10:57:21 +0000
Subject: [PATCH 4/6] Fix security issues: use MYSQL_PWD and utf8mb4 charset
- Use MYSQL_PWD environment variable to avoid exposing passwords in process list
- Use utf8mb4 charset consistently with MariaDB configuration
- Load environment variables from .env in docker-dev.sh db command
Co-authored-by: ruslanbaidan <3246171+ruslanbaidan@users.noreply.github.com>
---
docker-dev.sh | 6 +++++-
docker-entrypoint.sh | 13 +++++++------
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/docker-dev.sh b/docker-dev.sh
index 6a6c512..e9bb7aa 100755
--- a/docker-dev.sh
+++ b/docker-dev.sh
@@ -74,7 +74,11 @@ case "$1" in
db)
echo -e "${GREEN}Opening MySQL client...${NC}"
- docker exec -it monarc-bo-db mysql -usqlmonarcuser -psqlmonarcuser monarc_common
+ # Load environment variables
+ if [ -f .env ]; then
+ export $(grep -v '^#' .env | xargs)
+ fi
+ docker exec -it monarc-bo-db mysql -u"${DBUSER_MONARC:-sqlmonarcuser}" -p"${DBPASSWORD_MONARC:-sqlmonarcuser}" "${DBNAME_COMMON:-monarc_common}"
;;
reset)
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index f37617f..49e8c1b 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -11,7 +11,8 @@ echo -e "${GREEN}Starting MONARC BackOffice setup...${NC}"
# Wait for database to be ready
echo -e "${YELLOW}Waiting for MariaDB to be ready...${NC}"
-while ! mysqladmin ping -h"${DBHOST}" -u"${DBUSER_MONARC}" -p"${DBPASSWORD_MONARC}" --silent 2>/dev/null; do
+export MYSQL_PWD="${DBPASSWORD_MONARC}"
+while ! mysqladmin ping -h"${DBHOST}" -u"${DBUSER_MONARC}" --silent 2>/dev/null; do
echo "Waiting for MariaDB..."
sleep 2
done
@@ -54,16 +55,16 @@ if [ ! -f "/var/www/html/monarc/.docker-initialized" ]; then
# Check if database exists and create if needed
echo -e "${YELLOW}Setting up databases...${NC}"
- DB_EXISTS=$(mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" -p"${DBPASSWORD_MONARC}" -e "SHOW DATABASES LIKE '${DBNAME_MASTER}';" | grep -c "${DBNAME_MASTER}" || true)
+ DB_EXISTS=$(mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" -e "SHOW DATABASES LIKE '${DBNAME_MASTER}';" | grep -c "${DBNAME_MASTER}" || true)
if [ "$DB_EXISTS" -eq 0 ]; then
echo -e "${YELLOW}Creating databases...${NC}"
- mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" -p"${DBPASSWORD_MONARC}" -e "CREATE DATABASE ${DBNAME_MASTER} DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;"
- mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" -p"${DBPASSWORD_MONARC}" -e "CREATE DATABASE ${DBNAME_COMMON} DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;"
+ mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" -e "CREATE DATABASE ${DBNAME_MASTER} DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;"
+ mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" -e "CREATE DATABASE ${DBNAME_COMMON} DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;"
echo -e "${YELLOW}Populating databases...${NC}"
- mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" -p"${DBPASSWORD_MONARC}" ${DBNAME_COMMON} < db-bootstrap/monarc_structure.sql
- mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" -p"${DBPASSWORD_MONARC}" ${DBNAME_COMMON} < db-bootstrap/monarc_data.sql
+ mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" ${DBNAME_COMMON} < db-bootstrap/monarc_structure.sql
+ mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" ${DBNAME_COMMON} < db-bootstrap/monarc_data.sql
fi
# Generate local config if it doesn't exist
From 1c71d78523c092f783f3b2091be6da01be5a6ea5 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 13 Jan 2026 10:59:12 +0000
Subject: [PATCH 5/6] Final security improvements and documentation
- Use MYSQL_PWD in docker-dev.sh db command to avoid password exposure
- Add explanatory comment for --ignore-platform-req flag
Co-authored-by: ruslanbaidan <3246171+ruslanbaidan@users.noreply.github.com>
---
docker-dev.sh | 4 +++-
docker-entrypoint.sh | 2 ++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/docker-dev.sh b/docker-dev.sh
index e9bb7aa..5165713 100755
--- a/docker-dev.sh
+++ b/docker-dev.sh
@@ -78,7 +78,9 @@ case "$1" in
if [ -f .env ]; then
export $(grep -v '^#' .env | xargs)
fi
- docker exec -it monarc-bo-db mysql -u"${DBUSER_MONARC:-sqlmonarcuser}" -p"${DBPASSWORD_MONARC:-sqlmonarcuser}" "${DBNAME_COMMON:-monarc_common}"
+ # Use MYSQL_PWD to avoid password exposure in process list
+ export MYSQL_PWD="${DBPASSWORD_MONARC:-sqlmonarcuser}"
+ docker exec -it monarc-bo-db mysql -u"${DBUSER_MONARC:-sqlmonarcuser}" "${DBNAME_COMMON:-monarc_common}"
;;
reset)
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 49e8c1b..43f633d 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -27,6 +27,8 @@ if [ ! -f "/var/www/html/monarc/.docker-initialized" ]; then
# Install composer dependencies
if [ ! -d "vendor" ]; then
echo -e "${YELLOW}Installing Composer dependencies...${NC}"
+ # Using --ignore-platform-req=php to allow flexibility in development environment
+ # This is acceptable for development but should not be used in production
composer install --ignore-platform-req=php
fi
From 2e59da0d947c006e394f97fcf0ab332cc81c2420 Mon Sep 17 00:00:00 2001
From: Ruslan Baidan
Date: Wed, 14 Jan 2026 14:24:04 +0100
Subject: [PATCH 6/6] Fixed the docker process to be able run the application.
---
.env.dev | 10 +++
.gitignore | 1 +
.vscode/launch.json | 58 +++++++++++++++++
Dockerfile | 63 +++++++++----------
INSTALL/INSTALL.docker.md | 20 +++---
Makefile | 85 +++++++++++++++++++++++++
README.docker.md | 65 ++++++++++++--------
README.md | 2 +-
docker-compose.dev.yml | 15 +++++
docker-dev.sh | 106 --------------------------------
docker-entrypoint.sh | 73 ++++++++++++----------
docker/db-init/10-dev-grants.sh | 12 ++++
12 files changed, 301 insertions(+), 209 deletions(-)
create mode 100644 .vscode/launch.json
create mode 100644 Makefile
delete mode 100755 docker-dev.sh
create mode 100644 docker/db-init/10-dev-grants.sh
diff --git a/.env.dev b/.env.dev
index b3cc454..fc3c352 100644
--- a/.env.dev
+++ b/.env.dev
@@ -4,3 +4,13 @@ DBNAME_COMMON=monarc_common
DBNAME_MASTER=monarc_master
DBUSER_MONARC=sqlmonarcuser
DBPASSWORD_MONARC=sqlmonarcuser
+
+# Optional: set to 0/false/no to disable Xdebug in the image build
+XDEBUG_ENABLED=1
+XDEBUG_MODE=debug
+XDEBUG_START_WITH_REQUEST=trigger
+# On Linux, set XDEBUG_CLIENT_HOST to your Docker bridge (often 172.17.0.1).
+XDEBUG_CLIENT_HOST=host.docker.internal
+XDEBUG_CLIENT_PORT=9003
+XDEBUG_IDEKEY=IDEKEY
+XDEBUG_DISCOVER_CLIENT_HOST=0
diff --git a/.gitignore b/.gitignore
index c9bf48d..ee954a3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,4 @@ vagrant/.vagrant/
vagrant/*.log
.env
.docker-initialized
+docker/db_data
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..f9d4bc9
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,58 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "Attach to Chrome",
+ "port": 9222,
+ "request": "attach",
+ "type": "chrome",
+ "webRoot": "${workspaceFolder}"
+ },
+ {
+ "name": "Listen for Xdebug",
+ "type": "php",
+ "request": "launch",
+ "port": 9003,
+ "pathMappings": {
+ "/var/www/html/monarc": "${workspaceFolder}"
+ }
+ },
+ {
+ "name": "Launch currently open script",
+ "type": "php",
+ "request": "launch",
+ "program": "${file}",
+ "cwd": "${fileDirname}",
+ "port": 0,
+ "runtimeArgs": [
+ "-dxdebug.start_with_request=yes"
+ ],
+ "env": {
+ "XDEBUG_MODE": "debug,develop",
+ "XDEBUG_CONFIG": "client_port=${port}"
+ }
+ },
+ {
+ "name": "Launch Built-in web server",
+ "type": "php",
+ "request": "launch",
+ "runtimeArgs": [
+ "-dxdebug.mode=debug",
+ "-dxdebug.start_with_request=yes",
+ "-S",
+ "localhost:0"
+ ],
+ "program": "",
+ "cwd": "${workspaceRoot}",
+ "port": 9003,
+ "serverReadyAction": {
+ "pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
+ "uriFormat": "http://localhost:%s",
+ "action": "openExternally"
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index a7891f2..0bb5eb9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,13 @@
FROM ubuntu:22.04
+ARG XDEBUG_ENABLED=1
+ARG XDEBUG_MODE=debug
+ARG XDEBUG_START_WITH_REQUEST=trigger
+ARG XDEBUG_CLIENT_HOST=host.docker.internal
+ARG XDEBUG_CLIENT_PORT=9003
+ARG XDEBUG_IDEKEY=IDEKEY
+ARG XDEBUG_DISCOVER_CLIENT_HOST=0
+
# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
ENV LANGUAGE=en_US.UTF-8
@@ -8,33 +16,13 @@ ENV LC_ALL=en_US.UTF-8
# Install system dependencies
RUN apt-get update && apt-get upgrade -y && \
- apt-get install -y \
- vim \
- zip \
- unzip \
- git \
- gettext \
- curl \
- gsfonts \
- mariadb-client \
- apache2 \
- php8.1 \
- php8.1-cli \
- php8.1-common \
- php8.1-mysql \
- php8.1-zip \
- php8.1-gd \
- php8.1-mbstring \
- php8.1-curl \
- php8.1-xml \
- php8.1-bcmath \
- php8.1-intl \
- php8.1-imagick \
- php8.1-xdebug \
- locales \
- wget \
- ca-certificates \
- gnupg && \
+ packages="vim zip unzip git gettext curl gsfonts mariadb-client apache2 php8.1 php8.1-cli \
+ php8.1-common php8.1-mysql php8.1-zip php8.1-gd php8.1-mbstring php8.1-curl php8.1-xml \
+ php8.1-bcmath php8.1-intl php8.1-imagick locales wget ca-certificates gnupg"; \
+ if [ "$XDEBUG_ENABLED" = "1" ] || [ "$XDEBUG_ENABLED" = "true" ] || [ "$XDEBUG_ENABLED" = "yes" ]; then \
+ packages="$packages php8.1-xdebug"; \
+ fi; \
+ apt-get install -y $packages && \
locale-gen en_US.UTF-8 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
@@ -50,23 +38,32 @@ RUN sed -i 's/upload_max_filesize = .*/upload_max_filesize = 200M/' /etc/php/8.1
sed -i 's/session\\.gc_divisor = .*/session.gc_divisor = 1000/' /etc/php/8.1/apache2/php.ini
# Configure Xdebug for development
-RUN echo "zend_extension=xdebug.so" > /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
- echo "xdebug.mode=debug" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
- echo "xdebug.discover_client_host=1" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
- echo "xdebug.idekey=IDEKEY" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini
+RUN if [ "$XDEBUG_ENABLED" = "1" ] || [ "$XDEBUG_ENABLED" = "true" ] || [ "$XDEBUG_ENABLED" = "yes" ]; then \
+ echo "zend_extension=xdebug.so" > /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
+ echo "xdebug.mode=${XDEBUG_MODE}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
+ echo "xdebug.start_with_request=${XDEBUG_START_WITH_REQUEST}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
+ echo "xdebug.client_host=${XDEBUG_CLIENT_HOST}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
+ echo "xdebug.client_port=${XDEBUG_CLIENT_PORT}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
+ echo "xdebug.discover_client_host=${XDEBUG_DISCOVER_CLIENT_HOST}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
+ echo "xdebug.idekey=${XDEBUG_IDEKEY}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini; \
+ fi
# Enable Apache modules
RUN a2enmod rewrite ssl headers
+# Set global ServerName to avoid AH00558 warning
+RUN echo "ServerName localhost" > /etc/apache2/conf-available/servername.conf \
+ && a2enconf servername
+
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Install Node.js and npm
RUN mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
- echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_15.x nodistro main" > /etc/apt/sources.list.d/nodesource.list && \
+ echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" > /etc/apt/sources.list.d/nodesource.list && \
apt-get update && \
- apt-get install -y nodejs npm && \
+ apt-get install -y nodejs && \
npm install -g grunt-cli && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
diff --git a/INSTALL/INSTALL.docker.md b/INSTALL/INSTALL.docker.md
index e90b114..ba4b6c7 100644
--- a/INSTALL/INSTALL.docker.md
+++ b/INSTALL/INSTALL.docker.md
@@ -9,8 +9,10 @@ This document provides installation instructions for setting up MONARC BackOffic
git clone https://github.com/monarc-project/MonarcAppBO
cd MonarcAppBO
-# Start with the helper script (recommended)
-./docker-dev.sh start
+# Start with Makefile (recommended)
+make start
+# Optional: use ENV to select docker-compose..yml (default: dev)
+# make start ENV=prod
# Or use docker-compose directly
cp .env.dev .env
@@ -97,7 +99,7 @@ chmod -R 775 /var/www/html/monarc/data
Check the logs:
```bash
-./docker-dev.sh logs
+make logs
# or
docker compose -f docker-compose.dev.yml logs
```
@@ -107,7 +109,7 @@ docker compose -f docker-compose.dev.yml logs
To start completely fresh:
```bash
-./docker-dev.sh reset
+make reset
# or
docker compose -f docker-compose.dev.yml down -v
```
@@ -116,27 +118,27 @@ docker compose -f docker-compose.dev.yml down -v
### View Logs
```bash
-./docker-dev.sh logs
+make logs
```
### Access Container Shell
```bash
-./docker-dev.sh shell
+make shell
```
### Access Database
```bash
-./docker-dev.sh db
+make db
```
### Stop Services
```bash
-./docker-dev.sh stop
+make stop
```
### Restart Services
```bash
-./docker-dev.sh restart
+make restart
```
## Comparison with Other Installation Methods
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..50a0c07
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,85 @@
+.DEFAULT_GOAL := help
+
+SHELL := /bin/bash
+
+ENV ?= dev
+COMPOSE_FILE ?= docker-compose.$(ENV).yml
+COMPOSE := docker compose -f $(COMPOSE_FILE)
+
+GREEN := \033[0;32m
+YELLOW := \033[1;33m
+RED := \033[0;31m
+NC := \033[0m
+
+.PHONY: help check-env start stop restart logs logs-app shell db reset status
+
+help:
+ @printf "%b\n" "$(GREEN)MONARC BackOffice Docker Development Environment Manager$(NC)"
+ @printf "\n%b\n" "Usage: make "
+ @printf "%b\n" "Environment: ENV= (default: dev, uses docker-compose..yml)"
+ @printf "\n%b\n" "Commands:"
+ @printf " %-12s %s\n" "start" "Start all services (builds on first run)"
+ @printf " %-12s %s\n" "stop" "Stop all services"
+ @printf " %-12s %s\n" "restart" "Restart all services"
+ @printf " %-12s %s\n" "logs" "View logs from all services"
+ @printf " %-12s %s\n" "logs-app" "View logs from MONARC application"
+ @printf " %-12s %s\n" "shell" "Open a shell in the MONARC container"
+ @printf " %-12s %s\n" "db" "Open MySQL client in the database"
+ @printf " %-12s %s\n" "reset" "Reset everything (removes all data)"
+ @printf " %-12s %s\n" "status" "Show status of all services"
+
+check-env:
+ @if [ ! -f .env ]; then \
+ printf "%b\n" "$(YELLOW)No .env file found. Creating from .env.dev...$(NC)"; \
+ cp .env.dev .env; \
+ printf "%b\n" "$(GREEN).env file created. You can edit it to customize configuration.$(NC)"; \
+ fi
+
+start: check-env
+ @printf "%b\n" "$(GREEN)Starting MONARC BackOffice development environment...$(NC)"
+ @$(COMPOSE) up -d --build
+ @printf "%b\n" "$(GREEN)Services started!$(NC)"
+ @printf "%b\n" "MONARC BackOffice: http://localhost:5002"
+ @printf "\n%b\n" "$(YELLOW)To view logs: make logs ENV=$(ENV)$(NC)"
+
+stop:
+ @printf "%b\n" "$(YELLOW)Stopping all services...$(NC)"
+ @$(COMPOSE) stop
+ @printf "%b\n" "$(GREEN)Services stopped.$(NC)"
+
+restart:
+ @printf "%b\n" "$(YELLOW)Restarting all services...$(NC)"
+ @$(COMPOSE) restart
+ @printf "%b\n" "$(GREEN)Services restarted.$(NC)"
+
+logs:
+ @$(COMPOSE) logs -f
+
+logs-app:
+ @$(COMPOSE) logs -f monarc
+
+shell:
+ @printf "%b\n" "$(GREEN)Opening shell in MONARC container...$(NC)"
+ @docker exec -it monarc-bo-app bash
+
+db:
+ @printf "%b\n" "$(GREEN)Opening MySQL client...$(NC)"
+ @if [ -f .env ]; then \
+ export $$(grep -v '^#' .env | xargs); \
+ fi; \
+ export MYSQL_PWD="$${DBPASSWORD_MONARC:-sqlmonarcuser}"; \
+ docker exec -it monarc-bo-db mysql -u"$${DBUSER_MONARC:-sqlmonarcuser}" "$${DBNAME_COMMON:-monarc_common}"
+
+reset:
+ @printf "%b\n" "$(RED)WARNING: This will remove all data!$(NC)"; \
+ read -p "Are you sure? (yes/no): " confirm; \
+ if [ "$$confirm" = "yes" ]; then \
+ printf "%b\n" "$(YELLOW)Stopping and removing all containers, volumes, and data...$(NC)"; \
+ $(COMPOSE) down -v; \
+ printf "%b\n" "$(GREEN)Reset complete. Run 'make start' to start fresh.$(NC)"; \
+ else \
+ printf "%b\n" "$(GREEN)Reset cancelled.$(NC)"; \
+ fi
+
+status:
+ @$(COMPOSE) ps
diff --git a/README.docker.md b/README.docker.md
index c7e795a..412d52a 100644
--- a/README.docker.md
+++ b/README.docker.md
@@ -11,7 +11,7 @@ This guide explains how to set up a local development environment for MONARC Bac
## Quick Start
-### Option 1: Using the Helper Script (Recommended)
+### Option 1: Using the Makefile (Recommended)
1. **Clone the repository** (if you haven't already):
```bash
@@ -21,7 +21,7 @@ This guide explains how to set up a local development environment for MONARC Bac
2. **Start the development environment**:
```bash
- ./docker-dev.sh start
+ make start
```
This will automatically:
@@ -74,20 +74,21 @@ The development environment includes the following services:
## Development Workflow
-### Helper Script Commands
+### Makefile Commands
-The `docker-dev.sh` script provides convenient commands for managing the development environment:
+The Makefile provides convenient commands for managing the development environment.
+Use `ENV=` to select `docker-compose..yml` (default: `dev`).
```bash
-./docker-dev.sh start # Start all services
-./docker-dev.sh stop # Stop all services
-./docker-dev.sh restart # Restart all services
-./docker-dev.sh logs # View logs from all services
-./docker-dev.sh logs-app # View logs from MONARC application
-./docker-dev.sh shell # Open a shell in the MONARC container
-./docker-dev.sh db # Open MySQL client
-./docker-dev.sh status # Show status of all services
-./docker-dev.sh reset # Reset everything (removes all data)
+make start # Start all services
+make stop # Stop all services
+make restart # Restart all services
+make logs # View logs from all services
+make logs-app # View logs from MONARC application
+make shell # Open a shell in the MONARC container
+make db # Open MySQL client
+make status # Show status of all services
+make reset # Reset everything (removes all data)
```
### Live Code Editing
@@ -104,9 +105,9 @@ The application source code is mounted as a volume, so changes you make on your
### Accessing the Container
-Using helper script:
+Using Makefile:
```bash
-./docker-dev.sh shell
+make shell
```
Or directly with docker:
@@ -116,9 +117,9 @@ docker exec -it monarc-bo-app bash
### Database Access
-Using helper script:
+Using Makefile:
```bash
-./docker-dev.sh db # Connect to MariaDB
+make db # Connect to MariaDB
```
Or directly with docker:
@@ -129,10 +130,10 @@ docker exec -it monarc-bo-db mysql -usqlmonarcuser -psqlmonarcuser monarc_common
### Viewing Logs
-Using helper script:
+Using Makefile:
```bash
-./docker-dev.sh logs # All services
-./docker-dev.sh logs-app # MONARC application only
+make logs # All services
+make logs-app # MONARC application only
```
Or directly with docker compose:
@@ -146,9 +147,9 @@ docker compose -f docker-compose.dev.yml logs -f monarc
### Restarting Services
-Using helper script:
+Using Makefile:
```bash
-./docker-dev.sh restart # Restart all services
+make restart # Restart all services
```
Or directly with docker compose:
@@ -162,10 +163,10 @@ docker compose -f docker-compose.dev.yml restart monarc
### Stopping the Environment
-Using helper script:
+Using Makefile:
```bash
-./docker-dev.sh stop # Stop all services (keeps data)
-./docker-dev.sh reset # Stop and remove everything including data
+make stop # Stop all services (keeps data)
+make reset # Stop and remove everything including data
```
Or directly with docker compose:
@@ -224,7 +225,12 @@ cd /var/www/html/monarc
### Xdebug Configuration
-Xdebug is pre-configured in the development environment. To use it:
+Xdebug is enabled by default in the development image. To disable it, set
+`XDEBUG_ENABLED=0` in `.env` and rebuild the image (for example, `make start`).
+You can also tune the connection behavior via `.env`:
+`XDEBUG_START_WITH_REQUEST`, `XDEBUG_CLIENT_HOST`, and `XDEBUG_CLIENT_PORT`.
+
+When enabled, Xdebug is pre-configured. To use it:
1. Configure your IDE to listen on port 9003
2. Set the IDE key to `IDEKEY`
@@ -327,6 +333,13 @@ All environment variables are defined in the `.env` file:
| `DBNAME_MASTER` | Master database name | `monarc_master` |
| `DBUSER_MONARC` | Database user | `sqlmonarcuser` |
| `DBPASSWORD_MONARC` | Database password | `sqlmonarcuser` |
+| `XDEBUG_ENABLED` | Enable Xdebug in the build (`1/0`, `true/false`, `yes/no`) | `1` |
+| `XDEBUG_MODE` | Xdebug modes (`debug`, `develop`, etc.) | `debug` |
+| `XDEBUG_START_WITH_REQUEST` | Start mode (`trigger` or `yes`) | `trigger` |
+| `XDEBUG_CLIENT_HOST` | Host IDE address | `host.docker.internal` |
+| `XDEBUG_CLIENT_PORT` | IDE port | `9003` |
+| `XDEBUG_IDEKEY` | IDE key | `IDEKEY` |
+| `XDEBUG_DISCOVER_CLIENT_HOST` | Auto-detect client host (`1/0`) | `0` |
## Security Notes
diff --git a/README.md b/README.md
index afa9877..ea454f3 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ For local development, you can use either:
- **Docker** (recommended): See [README.docker.md](README.docker.md) for instructions
```bash
- ./docker-dev.sh start
+ make start
```
- **Vagrant**: See [vagrant/README.rst](vagrant/README.rst) for instructions
diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml
index f839684..abd9ef2 100644
--- a/docker-compose.dev.yml
+++ b/docker-compose.dev.yml
@@ -16,6 +16,7 @@ services:
- "3306:3306"
volumes:
- db_data:/var/lib/mysql
+ - ./docker/db-init:/docker-entrypoint-initdb.d:ro
networks:
- monarc-network
healthcheck:
@@ -29,6 +30,14 @@ services:
build:
context: .
dockerfile: Dockerfile
+ args:
+ XDEBUG_ENABLED: ${XDEBUG_ENABLED:-1}
+ XDEBUG_MODE: ${XDEBUG_MODE:-debug}
+ XDEBUG_START_WITH_REQUEST: ${XDEBUG_START_WITH_REQUEST:-trigger}
+ XDEBUG_CLIENT_HOST: ${XDEBUG_CLIENT_HOST:-host.docker.internal}
+ XDEBUG_CLIENT_PORT: ${XDEBUG_CLIENT_PORT:-9003}
+ XDEBUG_IDEKEY: ${XDEBUG_IDEKEY:-IDEKEY}
+ XDEBUG_DISCOVER_CLIENT_HOST: ${XDEBUG_DISCOVER_CLIENT_HOST:-0}
container_name: monarc-bo-app
environment:
DBHOST: db
@@ -36,6 +45,7 @@ services:
DBNAME_MASTER: ${DBNAME_MASTER}
DBUSER_MONARC: ${DBUSER_MONARC}
DBPASSWORD_MONARC: ${DBPASSWORD_MONARC}
+ DBPASSWORD_ADMIN: ${DBPASSWORD_ADMIN}
APP_ENV: development
APP_DIR: /var/www/html/monarc
ports:
@@ -59,5 +69,10 @@ networks:
volumes:
db_data:
+ driver: local
+ driver_opts:
+ type: none
+ device: ./docker/db_data
+ o: bind
vendor_data:
node_modules_data:
diff --git a/docker-dev.sh b/docker-dev.sh
deleted file mode 100755
index 5165713..0000000
--- a/docker-dev.sh
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/bin/bash
-# Helper script for managing MONARC BackOffice Docker development environment
-
-set -e
-
-COMPOSE_FILE="docker-compose.dev.yml"
-
-# Colors for output
-GREEN='\033[0;32m'
-YELLOW='\033[1;33m'
-RED='\033[0;31m'
-NC='\033[0m' # No Color
-
-usage() {
- echo -e "${GREEN}MONARC BackOffice Docker Development Environment Manager${NC}"
- echo ""
- echo "Usage: $0 [command]"
- echo ""
- echo "Commands:"
- echo " start Start all services (builds on first run)"
- echo " stop Stop all services"
- echo " restart Restart all services"
- echo " logs View logs from all services"
- echo " logs-app View logs from MONARC application"
- echo " shell Open a shell in the MONARC container"
- echo " db Open MySQL client in the database"
- echo " reset Reset everything (removes all data)"
- echo " status Show status of all services"
- echo ""
-}
-
-check_env() {
- if [ ! -f .env ]; then
- echo -e "${YELLOW}No .env file found. Creating from .env.dev...${NC}"
- cp .env.dev .env
- echo -e "${GREEN}.env file created. You can edit it to customize configuration.${NC}"
- fi
-}
-
-case "$1" in
- start)
- check_env
- echo -e "${GREEN}Starting MONARC BackOffice development environment...${NC}"
- docker compose -f "$COMPOSE_FILE" up -d --build
- echo -e "${GREEN}Services started!${NC}"
- echo -e "MONARC BackOffice: http://localhost:5002"
- echo -e "\n${YELLOW}To view logs: $0 logs${NC}"
- ;;
-
- stop)
- echo -e "${YELLOW}Stopping all services...${NC}"
- docker compose -f "$COMPOSE_FILE" stop
- echo -e "${GREEN}Services stopped.${NC}"
- ;;
-
- restart)
- echo -e "${YELLOW}Restarting all services...${NC}"
- docker compose -f "$COMPOSE_FILE" restart
- echo -e "${GREEN}Services restarted.${NC}"
- ;;
-
- logs)
- docker compose -f "$COMPOSE_FILE" logs -f
- ;;
-
- logs-app)
- docker compose -f "$COMPOSE_FILE" logs -f monarc
- ;;
-
- shell)
- echo -e "${GREEN}Opening shell in MONARC container...${NC}"
- docker exec -it monarc-bo-app bash
- ;;
-
- db)
- echo -e "${GREEN}Opening MySQL client...${NC}"
- # Load environment variables
- if [ -f .env ]; then
- export $(grep -v '^#' .env | xargs)
- fi
- # Use MYSQL_PWD to avoid password exposure in process list
- export MYSQL_PWD="${DBPASSWORD_MONARC:-sqlmonarcuser}"
- docker exec -it monarc-bo-db mysql -u"${DBUSER_MONARC:-sqlmonarcuser}" "${DBNAME_COMMON:-monarc_common}"
- ;;
-
- reset)
- echo -e "${RED}WARNING: This will remove all data!${NC}"
- read -p "Are you sure? (yes/no): " confirm
- if [ "$confirm" = "yes" ]; then
- echo -e "${YELLOW}Stopping and removing all containers, volumes, and data...${NC}"
- docker compose -f "$COMPOSE_FILE" down -v
- echo -e "${GREEN}Reset complete. Run '$0 start' to start fresh.${NC}"
- else
- echo -e "${GREEN}Reset cancelled.${NC}"
- fi
- ;;
-
- status)
- docker compose -f "$COMPOSE_FILE" ps
- ;;
-
- *)
- usage
- exit 1
- ;;
-esac
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 43f633d..9ee6504 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -21,17 +21,15 @@ echo -e "${GREEN}MariaDB is ready!${NC}"
# Check if this is the first run
if [ ! -f "/var/www/html/monarc/.docker-initialized" ]; then
echo -e "${GREEN}First run detected, initializing application...${NC}"
-
+
cd /var/www/html/monarc
-
- # Install composer dependencies
- if [ ! -d "vendor" ]; then
- echo -e "${YELLOW}Installing Composer dependencies...${NC}"
- # Using --ignore-platform-req=php to allow flexibility in development environment
- # This is acceptable for development but should not be used in production
- composer install --ignore-platform-req=php
- fi
-
+
+ # Install composer dependencies (always, to ensure binaries like Phinx are present)
+ echo -e "${YELLOW}Installing Composer dependencies...${NC}"
+ # Using --ignore-platform-req=php to allow flexibility in development environment
+ # This is acceptable for development but should not be used in production
+ composer install --ignore-platform-req=php --no-interaction
+
# Create module symlinks
echo -e "${YELLOW}Creating module symlinks...${NC}"
mkdir -p module/Monarc
@@ -39,40 +37,44 @@ if [ ! -f "/var/www/html/monarc/.docker-initialized" ]; then
ln -sfn ./../../vendor/monarc/core Core
ln -sfn ./../../vendor/monarc/backoffice BackOffice
cd /var/www/html/monarc
-
+
# Clone frontend repositories
echo -e "${YELLOW}Setting up frontend repositories...${NC}"
mkdir -p node_modules
cd node_modules
-
+
if [ ! -d "ng_backoffice" ]; then
git clone --config core.fileMode=false https://github.com/monarc-project/ng-backoffice.git ng_backoffice
fi
-
+
if [ ! -d "ng_anr" ]; then
git clone --config core.fileMode=false https://github.com/monarc-project/ng-anr.git ng_anr
fi
-
+
cd /var/www/html/monarc
-
- # Check if database exists and create if needed
+
+ # Check if master database exists and create databases if needed
echo -e "${YELLOW}Setting up databases...${NC}"
- DB_EXISTS=$(mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" -e "SHOW DATABASES LIKE '${DBNAME_MASTER}';" | grep -c "${DBNAME_MASTER}" || true)
-
+ DB_EXISTS=$(mysql -h"${DBHOST}" -u"root" -p"${DBPASSWORD_ADMIN}" -e "SHOW DATABASES LIKE '${DBNAME_MASTER}';" | grep -c "${DBNAME_MASTER}" || true)
+
if [ "$DB_EXISTS" -eq 0 ]; then
echo -e "${YELLOW}Creating databases...${NC}"
- mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" -e "CREATE DATABASE ${DBNAME_MASTER} DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;"
- mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" -e "CREATE DATABASE ${DBNAME_COMMON} DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;"
-
- echo -e "${YELLOW}Populating databases...${NC}"
+ mysql -h"${DBHOST}" -u"root" -p"${DBPASSWORD_ADMIN}" -e "CREATE DATABASE IF NOT EXISTS ${DBNAME_MASTER} DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;"
+ mysql -h"${DBHOST}" -u"root" -p"${DBPASSWORD_ADMIN}" -e "CREATE DATABASE IF NOT EXISTS ${DBNAME_COMMON} DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;"
+
+ echo -e "${YELLOW}Granting privileges to ${DBUSER_MONARC}...${NC}"
+ mysql -h"${DBHOST}" -u"root" -p"${DBPASSWORD_ADMIN}" -e "GRANT ALL PRIVILEGES ON ${DBNAME_MASTER}.* TO '${DBUSER_MONARC}'@'%';"
+ mysql -h"${DBHOST}" -u"root" -p"${DBPASSWORD_ADMIN}" -e "GRANT ALL PRIVILEGES ON ${DBNAME_COMMON}.* TO '${DBUSER_MONARC}'@'%';"
+ mysql -h"${DBHOST}" -u"root" -p"${DBPASSWORD_ADMIN}" -e "FLUSH PRIVILEGES;"
+
+ echo -e "${YELLOW}Populating common database...${NC}"
mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" ${DBNAME_COMMON} < db-bootstrap/monarc_structure.sql
mysql -h"${DBHOST}" -u"${DBUSER_MONARC}" ${DBNAME_COMMON} < db-bootstrap/monarc_data.sql
fi
-
- # Generate local config if it doesn't exist
- if [ ! -f "config/autoload/local.php" ]; then
- echo -e "${YELLOW}Creating local configuration...${NC}"
- cat > config/autoload/local.php < config/autoload/local.php <