Skip to content

Commit 683fe6d

Browse files
committed
Merge remote-tracking branch 'origin/master' into upgrade/db_iso27002
* origin/master: Added the fixes of the core and the backoffice dependencies. Removed the unnecessary --ignore-platfrom-req=php from the github workflow. New release v2.13.4 Added the volumes to have the live changes applied to the container files. added the .vscode folder to the gitignore. Added the possibility to specify a shared network to be able to link the FO and BO apps. Fixed the docker process to be able run the application. Final security improvements and documentation Fix security issues: use MYSQL_PWD and utf8mb4 charset Make docker-entrypoint.sh executable Add Docker development environment for BackOffice Initial plan
2 parents 697f843 + f218a19 commit 683fe6d

20 files changed

Lines changed: 1683 additions & 435 deletions

.dockerignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Git files
2+
.git
3+
.gitignore
4+
.github
5+
6+
# Documentation
7+
README.md
8+
AUTHORS
9+
LICENSE
10+
*.md
11+
12+
# Development files
13+
vagrant/
14+
INSTALL/
15+
.idea
16+
.vscode
17+
.DS_Store
18+
19+
# Dependencies (will be installed in container)
20+
vendor/
21+
node_modules/
22+
23+
# Data directories (will be mounted as volumes)
24+
data/
25+
26+
# Build artifacts
27+
public/css/
28+
public/js/
29+
public/img/
30+
public/flags/
31+
public/views/
32+
33+
# Logs
34+
*.log
35+
npm-debug.log
36+
37+
# Cache
38+
*.cache
39+
.docker-initialized
40+
41+
# Environment files (should be configured separately)
42+
.env
43+
.env.dev

.env.dev

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# MariaDB Configuration
2+
DBPASSWORD_ADMIN=root
3+
DBNAME_COMMON=monarc_common
4+
DBNAME_MASTER=monarc_master
5+
DBUSER_MONARC=sqlmonarcuser
6+
DBPASSWORD_MONARC=sqlmonarcuser
7+
BODB_HOST_PORT=3308
8+
9+
# Shared Docker network name (must exist when using external network)
10+
MONARC_NETWORK_NAME=monarc-network
11+
12+
# Optional: set to 0/false/no to disable Xdebug in the image build
13+
XDEBUG_ENABLED=1
14+
XDEBUG_MODE=debug
15+
XDEBUG_START_WITH_REQUEST=trigger
16+
# On Linux, set XDEBUG_CLIENT_HOST to your Docker bridge (often 172.17.0.1).
17+
XDEBUG_CLIENT_HOST=host.docker.internal
18+
XDEBUG_CLIENT_PORT=9003
19+
XDEBUG_IDEKEY=IDEKEY
20+
XDEBUG_DISCOVER_CLIENT_HOST=0

.github/workflows/php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
run: composer validate
4545

4646
- name: Install PHP dependencies
47-
run: composer install --prefer-dist --no-progress --no-suggest --ignore-platform-req=php
47+
run: composer ins --prefer-dist --no-progress --no-suggest
4848

4949
- name: Create synlinks for MONARC PHP modules
5050
run: |

.github/workflows/releases.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
run: composer validate
3535

3636
- name: Install PHP dependencies
37-
run: composer ins --prefer-dist --no-progress --no-suggest --no-dev --ignore-platform-req=php
37+
run: composer ins --prefer-dist --no-progress --no-suggest --no-dev
3838

3939
- name: Symlink Monarc modules
4040
run: |

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ bin/
2020
data/*
2121
vagrant/.vagrant/
2222
vagrant/*.log
23+
.env
24+
.docker-initialized
25+
docker/db_data
26+
.vscode/

.vscode/launch.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Attach to Chrome",
9+
"port": 9222,
10+
"request": "attach",
11+
"type": "chrome",
12+
"webRoot": "${workspaceFolder}"
13+
},
14+
{
15+
"name": "Listen for Xdebug",
16+
"type": "php",
17+
"request": "launch",
18+
"port": 9003,
19+
"pathMappings": {
20+
"/var/www/html/monarc": "${workspaceFolder}"
21+
}
22+
},
23+
{
24+
"name": "Launch currently open script",
25+
"type": "php",
26+
"request": "launch",
27+
"program": "${file}",
28+
"cwd": "${fileDirname}",
29+
"port": 0,
30+
"runtimeArgs": [
31+
"-dxdebug.start_with_request=yes"
32+
],
33+
"env": {
34+
"XDEBUG_MODE": "debug,develop",
35+
"XDEBUG_CONFIG": "client_port=${port}"
36+
}
37+
},
38+
{
39+
"name": "Launch Built-in web server",
40+
"type": "php",
41+
"request": "launch",
42+
"runtimeArgs": [
43+
"-dxdebug.mode=debug",
44+
"-dxdebug.start_with_request=yes",
45+
"-S",
46+
"localhost:0"
47+
],
48+
"program": "",
49+
"cwd": "${workspaceRoot}",
50+
"port": 9003,
51+
"serverReadyAction": {
52+
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
53+
"uriFormat": "http://localhost:%s",
54+
"action": "openExternally"
55+
}
56+
}
57+
]
58+
}

Dockerfile

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
FROM ubuntu:22.04
2+
3+
ARG XDEBUG_ENABLED=1
4+
ARG XDEBUG_MODE=debug
5+
ARG XDEBUG_START_WITH_REQUEST=trigger
6+
ARG XDEBUG_CLIENT_HOST=host.docker.internal
7+
ARG XDEBUG_CLIENT_PORT=9003
8+
ARG XDEBUG_IDEKEY=IDEKEY
9+
ARG XDEBUG_DISCOVER_CLIENT_HOST=0
10+
11+
# Prevent interactive prompts during package installation
12+
ENV DEBIAN_FRONTEND=noninteractive
13+
ENV LANGUAGE=en_US.UTF-8
14+
ENV LANG=en_US.UTF-8
15+
ENV LC_ALL=en_US.UTF-8
16+
17+
# Install system dependencies
18+
RUN apt-get update && apt-get upgrade -y && \
19+
packages="vim zip unzip git gettext curl gsfonts mariadb-client apache2 php8.1 php8.1-cli \
20+
php8.1-common php8.1-mysql php8.1-zip php8.1-gd php8.1-mbstring php8.1-curl php8.1-xml \
21+
php8.1-bcmath php8.1-intl php8.1-imagick locales wget ca-certificates gnupg"; \
22+
if [ "$XDEBUG_ENABLED" = "1" ] || [ "$XDEBUG_ENABLED" = "true" ] || [ "$XDEBUG_ENABLED" = "yes" ]; then \
23+
packages="$packages php8.1-xdebug"; \
24+
fi; \
25+
apt-get install -y $packages && \
26+
locale-gen en_US.UTF-8 && \
27+
apt-get clean && \
28+
rm -rf /var/lib/apt/lists/*
29+
30+
# Configure PHP
31+
RUN sed -i 's/upload_max_filesize = .*/upload_max_filesize = 200M/' /etc/php/8.1/apache2/php.ini && \
32+
sed -i 's/post_max_size = .*/post_max_size = 50M/' /etc/php/8.1/apache2/php.ini && \
33+
sed -i 's/max_execution_time = .*/max_execution_time = 100/' /etc/php/8.1/apache2/php.ini && \
34+
sed -i 's/max_input_time = .*/max_input_time = 223/' /etc/php/8.1/apache2/php.ini && \
35+
sed -i 's/memory_limit = .*/memory_limit = 512M/' /etc/php/8.1/apache2/php.ini && \
36+
sed -i 's/session\\.gc_maxlifetime = .*/session.gc_maxlifetime = 604800/' /etc/php/8.1/apache2/php.ini && \
37+
sed -i 's/session\\.gc_probability = .*/session.gc_probability = 1/' /etc/php/8.1/apache2/php.ini && \
38+
sed -i 's/session\\.gc_divisor = .*/session.gc_divisor = 1000/' /etc/php/8.1/apache2/php.ini
39+
40+
# Configure Xdebug for development
41+
RUN if [ "$XDEBUG_ENABLED" = "1" ] || [ "$XDEBUG_ENABLED" = "true" ] || [ "$XDEBUG_ENABLED" = "yes" ]; then \
42+
echo "zend_extension=xdebug.so" > /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
43+
echo "xdebug.mode=${XDEBUG_MODE}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
44+
echo "xdebug.start_with_request=${XDEBUG_START_WITH_REQUEST}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
45+
echo "xdebug.client_host=${XDEBUG_CLIENT_HOST}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
46+
echo "xdebug.client_port=${XDEBUG_CLIENT_PORT}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
47+
echo "xdebug.discover_client_host=${XDEBUG_DISCOVER_CLIENT_HOST}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
48+
echo "xdebug.idekey=${XDEBUG_IDEKEY}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini; \
49+
fi
50+
51+
# Enable Apache modules
52+
RUN a2enmod rewrite ssl headers
53+
54+
# Set global ServerName to avoid AH00558 warning
55+
RUN echo "ServerName localhost" > /etc/apache2/conf-available/servername.conf \
56+
&& a2enconf servername
57+
58+
# Install Composer
59+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
60+
61+
# Install Node.js and npm
62+
RUN mkdir -p /etc/apt/keyrings && \
63+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
64+
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 && \
65+
apt-get update && \
66+
apt-get install -y nodejs && \
67+
npm install -g grunt-cli && \
68+
apt-get clean && \
69+
rm -rf /var/lib/apt/lists/*
70+
71+
# Set working directory
72+
WORKDIR /var/www/html/monarc
73+
74+
# Configure Apache
75+
RUN echo '<VirtualHost *:80>\n\
76+
ServerName localhost\n\
77+
DocumentRoot /var/www/html/monarc/public\n\
78+
\n\
79+
<Directory /var/www/html/monarc/public>\n\
80+
DirectoryIndex index.php\n\
81+
AllowOverride All\n\
82+
Require all granted\n\
83+
</Directory>\n\
84+
\n\
85+
<IfModule mod_headers.c>\n\
86+
Header always set X-Content-Type-Options nosniff\n\
87+
Header always set X-XSS-Protection "1; mode=block"\n\
88+
Header always set X-Robots-Tag none\n\
89+
Header always set X-Frame-Options SAMEORIGIN\n\
90+
</IfModule>\n\
91+
\n\
92+
SetEnv APP_ENV development\n\
93+
SetEnv APP_DIR /var/www/html/monarc\n\
94+
</VirtualHost>' > /etc/apache2/sites-available/000-default.conf
95+
96+
# Allow Apache override to all
97+
RUN sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf
98+
99+
# Create necessary directories
100+
RUN mkdir -p /var/www/html/monarc/data/cache \
101+
/var/www/html/monarc/data/LazyServices/Proxy \
102+
/var/www/html/monarc/data/DoctrineORMModule/Proxy \
103+
/var/www/html/monarc/data/import/files
104+
105+
# Copy entrypoint script
106+
COPY docker-entrypoint.sh /usr/local/bin/
107+
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
108+
109+
EXPOSE 80
110+
111+
ENTRYPOINT ["docker-entrypoint.sh"]
112+
CMD ["apachectl", "-D", "FOREGROUND"]

0 commit comments

Comments
 (0)