Compare commits
42 Commits
24bdc06190
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8e9a56c232 | ||
![]() |
b81160d3b9 | ||
![]() |
d45c9a0fbe | ||
![]() |
d4da0caa07 | ||
![]() |
6f5b6e4691 | ||
![]() |
2ef71aa2e8 | ||
![]() |
cf85f63fff | ||
![]() |
44baf158d9 | ||
![]() |
29aa1f2d40 | ||
![]() |
69b7243685 | ||
![]() |
ce59badfe0 | ||
![]() |
2a45817793 | ||
![]() |
882de4be42 | ||
![]() |
7a28d26bf1 | ||
![]() |
63f4a92a8d | ||
![]() |
7073907fe1 | ||
![]() |
a627334290 | ||
![]() |
44f51163aa | ||
![]() |
2f54fe7f0c | ||
![]() |
e4113f9365 | ||
![]() |
f58e56d3a0 | ||
![]() |
08620ec1fc | ||
![]() |
2d5a809397 | ||
![]() |
31f0dd7913 | ||
![]() |
3ab3f2175e | ||
![]() |
bdf2ab2f48 | ||
![]() |
1270dad444 | ||
![]() |
89e2780710 | ||
![]() |
4e007fd421 | ||
![]() |
0e9c43d34d | ||
![]() |
8df5735249 | ||
![]() |
4337a4c02c | ||
![]() |
a50eadfab8 | ||
![]() |
7de989dbde | ||
![]() |
2f847a6dbe | ||
![]() |
f1c348f974 | ||
![]() |
49a4491d61 | ||
![]() |
3871443b24 | ||
![]() |
becf6ef471 | ||
![]() |
3d04ad8b25 | ||
![]() |
8eec361aa7 | ||
![]() |
022c2ea5de |
5
.env
5
.env
@@ -1,5 +0,0 @@
|
||||
HOST_HTTP_PORT=80
|
||||
HOST_HTTPS_PORT=443
|
||||
NGINX_HTTP_PORT=8888
|
||||
NGINX_HTTPS_PORT=8843
|
||||
PHP_VERSIONS=7.2 7.1 # Set this without quotes!
|
17
.env.template
Normal file
17
.env.template
Normal file
@@ -0,0 +1,17 @@
|
||||
# IPv4
|
||||
NGINX_HTTP_IPV4_HOST=127.0.0.1
|
||||
NGINX_HTTP_IPV4_PORT=8888
|
||||
NGINX_HTTPS_IPV4_HOST=127.0.0.1
|
||||
NGINX_HTTPS_IPV4_PORT=8843
|
||||
|
||||
# IPv6
|
||||
NGINX_HTTP_IPV6_HOST=::1
|
||||
NGINX_HTTP_IPV6_PORT=8888
|
||||
NGINX_HTTPS_IPV6_HOST=::1
|
||||
NGINX_HTTPS_IPV6_PORT=8843
|
||||
|
||||
# Container Ports (constant)
|
||||
NGINX_CONTAINER_HTTP_PORT=80
|
||||
NGINX_CONTAINER_HTTPS_PORT=443
|
||||
|
||||
PHP_VERSIONS=7.4 7.2
|
21
.gitignore
vendored
21
.gitignore
vendored
@@ -1,7 +1,18 @@
|
||||
# Add volumes to .gitignore
|
||||
nginx-srv/sites-available
|
||||
nginx-srv/www
|
||||
nginx-srv/etc
|
||||
nginx-srv/var
|
||||
|
||||
multi-php-fpm/etc
|
||||
multi-php-fpm/run
|
||||
#
|
||||
multi-php-fpm-srv/run
|
||||
|
||||
mariadb-srv/run
|
||||
mariadb-srv/var
|
||||
|
||||
# Ignore Docker files
|
||||
docker-compose.yaml
|
||||
docker-compose.yml
|
||||
compose.yaml
|
||||
compose.yml
|
||||
docker-compose.env
|
||||
docker-compose.override.yaml
|
||||
docker-compose.override.yml
|
||||
.env
|
||||
|
21
README.md
Normal file
21
README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# Dockerized LEMP Stack
|
||||
|
||||
Simple Linux + Nginx + PHP-FPM + MariaDB setup using Docker.
|
||||
|
||||
## Services
|
||||
|
||||
- **`nginx-srv`** - Nginx web server (connects to PHP-FPM via Unix socket)
|
||||
- **`multi-php-fpm-srv`** - PHP-FPM processor (supports multiple PHP versions)
|
||||
- **`mariadb-srv`** - MariaDB database server
|
||||
|
||||
## Requirements
|
||||
- Docker
|
||||
- Docker Compose
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. Clone the repo:
|
||||
```bash
|
||||
git clone https://git.digitalstack.es/Digitalstack/lemp-dockerized.git
|
||||
cd lemp-dockerized
|
||||
docker compose up -d
|
21
TODO.md
Normal file
21
TODO.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# LEMP Stack Improvements
|
||||
|
||||
### PHP-FPM Pools
|
||||
- [ ] Copy custom pools from host to `/etc/php/8.2/fpm/pool.d/`
|
||||
- Ensure host-mounted pools override defaults
|
||||
- Add validation to check pool syntax on startup
|
||||
|
||||
## System Configuration
|
||||
- [ ] Optimize package installation:
|
||||
- Skip `apt-get update` when installing downloaded packages
|
||||
- [ ] Configure system locales (e.g., `en_US.UTF-8`)
|
||||
|
||||
## Technical Debt
|
||||
- [ ] Code refactor:
|
||||
- Set correct ownership and permissions for all mount points. Such as www-data, mysql.
|
||||
- Modularize Dockerfiles (base vs. production)
|
||||
- Implement health checks for services
|
||||
- Clean up obsolete scripts
|
||||
|
||||
## help-menu
|
||||
- Use docker compose folder as dynamic name
|
11
del_vols.sh
Executable file
11
del_vols.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
#sudo rm -rfv nginx-srv/var # Removes /var/www
|
||||
|
||||
#sudo rm -rfv nginx-srv/etc # Removes /etc/letsencrypt # Removes letsencrypt certificates and configuration.
|
||||
|
||||
sudo rm -rfv multi-php-fpm-srv/run # Remove *.sock files
|
||||
|
||||
sudo rm -rfv mariadb-srv/run # Remove *.sock files
|
||||
|
||||
#sudo rm -rfv mariadb-srv/var # Removes MariaDB databases
|
45
docker-compose.template.yaml
Normal file
45
docker-compose.template.yaml
Normal file
@@ -0,0 +1,45 @@
|
||||
services:
|
||||
nginx-srv:
|
||||
image: eroncero/nginx-srv:latest
|
||||
build:
|
||||
context: ./nginx-srv
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "${NGINX_HTTP_IPV4_HOST}:${NGINX_HTTP_IPV4_PORT}:${NGINX_CONTAINER_HTTP_PORT}"
|
||||
- "${NGINX_HTTP_IPV6_HOST}:${NGINX_HTTP_IPV6_PORT}:${NGINX_CONTAINER_HTTP_PORT}"
|
||||
- "${NGINX_HTTPS_IPV4_HOST}:${NGINX_HTTPS_IPV4_PORT}:${NGINX_CONTAINER_HTTPS_PORT}"
|
||||
- "${NGINX_HTTPS_IPV6_HOST}:${NGINX_HTTPS_IPV6_PORT}:${NGINX_CONTAINER_HTTPS_PORT}"
|
||||
restart: unless-stopped
|
||||
hostname: nginx-srv
|
||||
volumes:
|
||||
- ./mnt/place-config/etc/nginx:/mnt/place-config/etc/nginx # Config ready to be copied into the container.
|
||||
- ./nginx-srv/var/www:/var/www # Webpage public html.
|
||||
- ./nginx-srv/etc/letsencrypt:/etc/letsencrypt
|
||||
- ./multi-php-fpm-srv/run/php:/run/php # Socket files dir. It will be mounted and shared from the PHP container.
|
||||
|
||||
multi-php-fpm-srv:
|
||||
image: eroncero/multi-php-fpm-srv:latest
|
||||
build:
|
||||
context: ./multi-php-fpm-srv
|
||||
dockerfile: Dockerfile
|
||||
restart: unless-stopped
|
||||
hostname: multi-php-fpm-srv
|
||||
environment:
|
||||
- PHP_VERSIONS=${PHP_VERSIONS} # Inherits from .env
|
||||
volumes:
|
||||
- ./mnt/place-config/etc/php:/mnt/place-config/etc/php # Config ready to be copied into the container.
|
||||
- ./multi-php-fpm-srv/run/php:/run/php
|
||||
- ./mariadb-srv/run/mysql:/run/mysqld # php-mysql should be able connecting to the MariaDB socket.
|
||||
|
||||
mariadb-srv:
|
||||
image: eroncero/mariadb-srv:latest
|
||||
build:
|
||||
context: ./mariadb-srv
|
||||
dockerfile: Dockerfile
|
||||
restart: unless-stopped
|
||||
hostname: mariadb-srv
|
||||
volumes:
|
||||
- ./mnt/place-config/etc/mysql:/mnt/place-config/etc/mysql # Config ready to be copied into the container.
|
||||
- ./mariadb-srv/var/lib/mysql:/var/lib/mysql # Databases
|
||||
#- ./mariadb-srv/etc/mysql/conf.d:/etc/mysql/conf.d/ # Custom config that overrides default one.
|
||||
- ./mariadb-srv/run/mysqld/:/run/mysqld # Socket
|
@@ -1,20 +0,0 @@
|
||||
services:
|
||||
nginx-srv:
|
||||
image: eroncero/nginx-srv
|
||||
ports:
|
||||
- "127.0.0.1:${NGINX_HTTP_PORT}:${HOST_HTTP_PORT}"
|
||||
- "[::1]:${NGINX_HTTPS_PORT}:${HOST_HTTPS_PORT}"
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./nginx-srv/sites-available:/etc/nginx/sites-available
|
||||
- ./nginx-srv/www:/var/www
|
||||
- ./multi-php-fpm/run/php:/run/php
|
||||
|
||||
multi-php-fpm:
|
||||
image: eroncero/multi-php-fpm
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- PHP_VERSIONS=${PHP_VERSIONS} # Inherits from .env
|
||||
volumes:
|
||||
- ./multi-php-fpm/etc/php:/etc/php
|
||||
- ./multi-php-fpm/run/php:/run/php
|
8
help-menu.sh
Normal file
8
help-menu.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
echo "================================================"
|
||||
echo "Welcome to help-menu"
|
||||
echo "================================================"
|
||||
echo "To run LEMP-Dockerized: 'docker compose up -d'"
|
||||
echo "To check current running services (containers): 'docker compose ps'"
|
||||
echo "To check process in real-time: 'docker compose stats' (CTRL+c to exit)"
|
||||
echo "To stop LEMP-Dockerized: 'docker compose down'"
|
11
mariadb-srv/Dockerfile
Normal file
11
mariadb-srv/Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
||||
FROM debian:bookworm
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
|
||||
RUN apt-get update; apt-get full-upgrade -y; apt-get install iputils-ping -y; apt-get autoclean -y; apt-get install mariadb-server mariadb-client -y --download-only
|
||||
|
||||
COPY project/entrypoint/entrypoint.sh /entrypoint/entrypoint.sh
|
||||
COPY project/entrypoint/install-packages.sh /entrypoint/install-packages.sh
|
||||
|
||||
ENTRYPOINT ["/bin/sh", "/entrypoint/entrypoint.sh"]
|
14
mariadb-srv/project/entrypoint/entrypoint.sh
Normal file
14
mariadb-srv/project/entrypoint/entrypoint.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
/bin/sh /entrypoint/install-packages.sh
|
||||
|
||||
chown -R mysql:mysql /run/mysqld
|
||||
chown -R mysql:mysql /var/lib/mysql
|
||||
|
||||
service mariadb start
|
||||
|
||||
# Run the CMD that was passed (or default)
|
||||
exec "$@"
|
||||
|
||||
tail -f /dev/null
|
||||
|
3
mariadb-srv/project/entrypoint/install-packages.sh
Normal file
3
mariadb-srv/project/entrypoint/install-packages.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
apt-get install -y mariadb-server mariadb-client
|
@@ -1,7 +1,7 @@
|
||||
; Start a new pool named 'www'.
|
||||
; Start a new pool named 'prestashop8_1'.
|
||||
; the variable $pool can be used in any directive and will be replaced by the
|
||||
; pool name ('www' here)
|
||||
[www]
|
||||
; pool name ('prestashop8_1' here)
|
||||
[prestashop8_1]
|
||||
|
||||
; Per pool prefix
|
||||
; It only applies on the following directives:
|
||||
@@ -38,10 +38,10 @@ group = www-data
|
||||
; (IPv6 and IPv4-mapped) on a specific port;
|
||||
; '/path/to/unix/socket' - to listen on a unix socket.
|
||||
; Note: This value is mandatory.
|
||||
listen = /run/php/php8.2-fpm.sock
|
||||
listen = /run/php/php8.1-fpm-prestashop8_1.sock
|
||||
|
||||
; Set listen(2) backlog.
|
||||
; Default Value: 511 (-1 on Linux, FreeBSD and OpenBSD)
|
||||
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
|
||||
;listen.backlog = 511
|
||||
|
||||
; Set permissions for unix socket, if one is used. In Linux, read/write
|
||||
@@ -68,10 +68,6 @@ listen.group = www-data
|
||||
; Default Value: any
|
||||
;listen.allowed_clients = 127.0.0.1
|
||||
|
||||
; Set the associated the route table (FIB). FreeBSD only
|
||||
; Default Value: -1
|
||||
;listen.setfib = 1
|
||||
|
||||
; Specify the nice(2) priority to apply to the pool processes (only if set)
|
||||
; The value can vary from -19 (highest priority) to 20 (lower priority)
|
||||
; Note: - It will only work if the FPM master process is launched as root
|
||||
@@ -80,8 +76,7 @@ listen.group = www-data
|
||||
; Default Value: no set
|
||||
; process.priority = -19
|
||||
|
||||
; Set the process dumpable flag (PR_SET_DUMPABLE prctl for Linux or
|
||||
; PROC_TRACE_CTL procctl for FreeBSD) even if the process user
|
||||
; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user
|
||||
; or group is different than the master process user. It allows to create process
|
||||
; core dump and ptrace the process for the pool user.
|
||||
; Default Value: no
|
||||
@@ -249,7 +244,7 @@ pm.max_spare_servers = 3
|
||||
; last request memory: 0
|
||||
;
|
||||
; Note: There is a real-time FPM status monitoring sample web page available
|
||||
; It's available in: /usr/share/php/8.2/fpm/status.html
|
||||
; It's available in: /usr/share/php/8.1/fpm/status.html
|
||||
;
|
||||
; Note: The value must start with a leading slash (/). The value can be
|
||||
; anything, but it may not be a good idea to use the .php extension or it
|
||||
@@ -353,22 +348,6 @@ pm.max_spare_servers = 3
|
||||
; Default: "%R - %u %t \"%m %r\" %s"
|
||||
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{milli}d %{kilo}M %C%%"
|
||||
|
||||
; A list of request_uri values which should be filtered from the access log.
|
||||
;
|
||||
; As a security precuation, this setting will be ignored if:
|
||||
; - the request method is not GET or HEAD; or
|
||||
; - there is a request body; or
|
||||
; - there are query parameters; or
|
||||
; - the response code is outwith the successful range of 200 to 299
|
||||
;
|
||||
; Note: The paths are matched against the output of the access.format tag "%r".
|
||||
; On common configurations, this may look more like SCRIPT_NAME than the
|
||||
; expected pre-rewrite URI.
|
||||
;
|
||||
; Default Value: not set
|
||||
;access.suppress_path[] = /ping
|
||||
;access.suppress_path[] = /health_check.php
|
||||
|
||||
; The log file for slow requests
|
||||
; Default Value: not set
|
||||
; Note: slowlog is mandatory if request_slowlog_timeout is set
|
||||
@@ -485,6 +464,16 @@ pm.max_spare_servers = 3
|
||||
; specified at startup with the -d argument
|
||||
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
|
||||
;php_flag[display_errors] = off
|
||||
;php_admin_value[error_log] = /var/log/fpm-php.www.log
|
||||
;php_admin_flag[log_errors] = on
|
||||
;php_admin_value[memory_limit] = 32M
|
||||
php_admin_value[error_log] = /var/log/fpm-php-prestashop8_1.log
|
||||
php_admin_flag[log_errors] = on
|
||||
php_admin_value[memory_limit] = 256M
|
||||
php_admin_value[post_max_filesize] = 256M
|
||||
php_admin_value[upload_max_filesize] = 256M
|
||||
php_admin_value[allow_url_fopen] = on
|
||||
php_admin_value[file_uploads] = on
|
||||
php_admin_value[short_open_tag] = on
|
||||
php_admin_value[cgi_fix_pathinfo] = 0
|
||||
php_admin_value[max_execution_time] = 360
|
||||
php_admin_value[allow_url_include] = Off
|
||||
php_admin_value[date.timezone] = Europe/Madrid
|
||||
php_admin_value[max_execution_time] = 130
|
@@ -1,21 +1,21 @@
|
||||
FROM debian:bookworm
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ARG DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
RUN apt-get update; apt-get full-upgrade -y; apt-get autoclean -y
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
|
||||
RUN apt-get update; apt-get full-upgrade -y; apt-get install vim curl iputils-ping -y; apt-get autoclean -y
|
||||
|
||||
COPY project/buildtime/sury-repo.sh /tmp/buildtime/sury-repo.sh
|
||||
RUN /bin/sh /tmp/buildtime/sury-repo.sh
|
||||
|
||||
ARG BUILDTIME_PHP_VER_INST="8.2"
|
||||
ENV BUILDTIME_PHP_VER_INST="8.2"
|
||||
COPY project/buildtime/buildtime_php_ver_inst.sh /tmp/buildtime/buildtime_php_ver_inst.sh
|
||||
COPY project/buildtime/preserve-files.sh /tmp/buildtime/preserve-files.sh
|
||||
RUN /bin/sh /tmp/buildtime/buildtime_php_ver_inst.sh
|
||||
ENV DEF_PHP_INTERPRETER="8.2"
|
||||
ENV PHP_VERSIONS=
|
||||
|
||||
COPY project/entrypoint/entrypoint.sh /entrypoint/entrypoint.sh
|
||||
COPY project/entrypoint/copy-config.sh /entrypoint/copy-config.sh
|
||||
COPY project/entrypoint/container-php-ver-inst.sh /entrypoint/container-php-ver-inst.sh
|
||||
COPY project/entrypoint/install-php-versions.sh /entrypoint/install-php-versions.sh
|
||||
COPY project/entrypoint/start-php-fpm.sh /entrypoint/start-php-fpm.sh
|
||||
RUN /bin/sh /tmp/buildtime/preserve-files.sh
|
||||
ENTRYPOINT ["/bin/sh", "/entrypoint/entrypoint.sh"]
|
@@ -4,7 +4,7 @@ apt-get update
|
||||
|
||||
BUILDTIME_PHP_VER_INST="8.2"
|
||||
|
||||
apt-get install -y \
|
||||
apt-get install -y --download-only \
|
||||
php$BUILDTIME_PHP_VER_INST-fpm \
|
||||
php$BUILDTIME_PHP_VER_INST-bcmath \
|
||||
php$BUILDTIME_PHP_VER_INST-bz2 \
|
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# To add this repository please do:
|
||||
|
||||
apt-get -y install lsb-release ca-certificates curl
|
||||
apt-get install lsb-release ca-certificates curl -y
|
||||
curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
|
||||
dpkg -i /tmp/debsuryorg-archive-keyring.deb
|
||||
sh -c 'echo "deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
|
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
|
||||
apt-get update
|
||||
|
||||
apt-get install -y \
|
||||
php$BUILDTIME_PHP_VER_INST-fpm \
|
||||
php$BUILDTIME_PHP_VER_INST-bcmath \
|
||||
php$BUILDTIME_PHP_VER_INST-bz2 \
|
||||
php$BUILDTIME_PHP_VER_INST-common \
|
||||
php$BUILDTIME_PHP_VER_INST-curl \
|
||||
php$BUILDTIME_PHP_VER_INST-dba \
|
||||
php$BUILDTIME_PHP_VER_INST-enchant \
|
||||
php$BUILDTIME_PHP_VER_INST-gd \
|
||||
php$BUILDTIME_PHP_VER_INST-gmp \
|
||||
php$BUILDTIME_PHP_VER_INST-http \
|
||||
php$BUILDTIME_PHP_VER_INST-imap \
|
||||
php$BUILDTIME_PHP_VER_INST-interbase \
|
||||
php$BUILDTIME_PHP_VER_INST-intl \
|
||||
php$BUILDTIME_PHP_VER_INST-ldap \
|
||||
php$BUILDTIME_PHP_VER_INST-mbstring \
|
||||
php$BUILDTIME_PHP_VER_INST-memcache \
|
||||
php$BUILDTIME_PHP_VER_INST-memcached \
|
||||
php$BUILDTIME_PHP_VER_INST-mysql \
|
||||
php$BUILDTIME_PHP_VER_INST-odbc \
|
||||
php$BUILDTIME_PHP_VER_INST-opcache \
|
||||
php$BUILDTIME_PHP_VER_INST-pgsql \
|
||||
php$BUILDTIME_PHP_VER_INST-ps \
|
||||
php$BUILDTIME_PHP_VER_INST-pspell \
|
||||
php$BUILDTIME_PHP_VER_INST-raphf \
|
||||
php$BUILDTIME_PHP_VER_INST-readline \
|
||||
php$BUILDTIME_PHP_VER_INST-snmp \
|
||||
php$BUILDTIME_PHP_VER_INST-soap \
|
||||
php$BUILDTIME_PHP_VER_INST-sqlite3 \
|
||||
php$BUILDTIME_PHP_VER_INST-stomp \
|
||||
php$BUILDTIME_PHP_VER_INST-sybase \
|
||||
php$BUILDTIME_PHP_VER_INST-tidy \
|
||||
php$BUILDTIME_PHP_VER_INST-xdebug \
|
||||
php$BUILDTIME_PHP_VER_INST-xml \
|
||||
php$BUILDTIME_PHP_VER_INST-xsl \
|
||||
php$BUILDTIME_PHP_VER_INST-zip \
|
56
multi-php-fpm-srv/project/entrypoint/copy-config.sh
Normal file
56
multi-php-fpm-srv/project/entrypoint/copy-config.sh
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Configuration
|
||||
SRC_BASE="/mnt/place-config/etc/php"
|
||||
DEST_BASE="/etc/php"
|
||||
|
||||
# Use both environment variables if they exist
|
||||
VERSIONS_TO_PROCESS="$(echo "${PHP_VERSIONS:-} ${BUILDTIME_PHP_VER_INST:-}" | xargs -n1 | sort -u | xargs)"
|
||||
|
||||
if [ -z "$VERSIONS_TO_PROCESS" ]; then
|
||||
echo "ℹ️ No PHP versions specified in environment variables"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "🔍 Processing PHP versions: $VERSIONS_TO_PROCESS"
|
||||
|
||||
for version in $VERSIONS_TO_PROCESS; do
|
||||
src_dir="${SRC_BASE}/${version}/fpm/pool.d"
|
||||
dest_dir="${DEST_BASE}/${version}/fpm/pool.d"
|
||||
|
||||
echo -e "\n📦 Checking PHP ${version}..."
|
||||
|
||||
# Verify source directory exists
|
||||
if [ ! -d "$src_dir" ]; then
|
||||
echo " ⚠️ Source directory not found: $src_dir"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Count .conf files
|
||||
conf_files=("$src_dir"/*.conf)
|
||||
if [ ${#conf_files[@]} -eq 0 ]; then
|
||||
echo " ✅ No .conf files to copy (directory empty)"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Process each .conf file
|
||||
copied=0
|
||||
for conf_file in "${conf_files[@]}"; do
|
||||
if [ ! -f "$conf_file" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
filename=$(basename "$conf_file")
|
||||
echo " ➤ Copying: $filename"
|
||||
|
||||
cp -f "$conf_file" "$dest_dir/" && \
|
||||
chmod 644 "${dest_dir}/${filename}" && \
|
||||
chown root:root "${dest_dir}/${filename}" && \
|
||||
copied=$((copied + 1))
|
||||
done
|
||||
|
||||
echo " ✔ Copied $copied files for PHP $version"
|
||||
done
|
||||
|
||||
echo -e "\n✅ Configuration copy completed"
|
13
multi-php-fpm-srv/project/entrypoint/entrypoint.sh
Normal file
13
multi-php-fpm-srv/project/entrypoint/entrypoint.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
/bin/sh /entrypoint/container-php-ver-inst.sh
|
||||
/bin/sh /entrypoint/install-php-versions.sh
|
||||
/bin/bash /entrypoint/copy-config.sh
|
||||
|
||||
/bin/sh /entrypoint/start-php-fpm.sh
|
||||
|
||||
# Run the CMD that was passed (or default)
|
||||
exec "$@"
|
||||
|
||||
tail -f /dev/null
|
||||
|
76
multi-php-fpm-srv/project/entrypoint/install-php-versions.sh
Normal file
76
multi-php-fpm-srv/project/entrypoint/install-php-versions.sh
Normal file
@@ -0,0 +1,76 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
export DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
|
||||
# Validate required variables
|
||||
if [ -z "${PHP_VERSIONS:-}" ]; then
|
||||
echo "ERROR: PHP_VERSIONS environment variable is not set" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${DEF_PHP_INTERPRETER:-}" ]; then
|
||||
echo "ERROR: DEF_PHP_INTERPRETER environment variable is not set" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify package availability before installation
|
||||
apt-get update
|
||||
|
||||
# Install each PHP version with validation
|
||||
for version in $PHP_VERSIONS; do
|
||||
# Validate version format (X.Y)
|
||||
if ! echo "$version" | grep -Eq '^[0-9]+\.[0-9]+$'; then
|
||||
echo "ERROR: Invalid PHP version format '$version'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Installing PHP $version packages..."
|
||||
if ! apt-get install -y \
|
||||
php${version}-fpm \
|
||||
php${version}-bcmath \
|
||||
php${version}-bz2 \
|
||||
php${version}-common \
|
||||
php${version}-curl \
|
||||
php${version}-dba \
|
||||
php${version}-enchant \
|
||||
php${version}-gd \
|
||||
php${version}-gmp \
|
||||
php${version}-http \
|
||||
php${version}-imap \
|
||||
php${version}-interbase \
|
||||
php${version}-intl \
|
||||
php${version}-ldap \
|
||||
php${version}-mbstring \
|
||||
php${version}-memcache \
|
||||
php${version}-memcached \
|
||||
php${version}-mysql \
|
||||
php${version}-odbc \
|
||||
php${version}-opcache \
|
||||
php${version}-pgsql \
|
||||
php${version}-ps \
|
||||
php${version}-pspell \
|
||||
php${version}-raphf \
|
||||
php${version}-readline \
|
||||
php${version}-snmp \
|
||||
php${version}-soap \
|
||||
php${version}-sqlite3 \
|
||||
php${version}-stomp \
|
||||
php${version}-sybase \
|
||||
php${version}-tidy \
|
||||
php${version}-xdebug \
|
||||
php${version}-xml \
|
||||
php${version}-xsl \
|
||||
php${version}-zip; then
|
||||
echo "ERROR: Failed to install PHP $version packages" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Set default PHP version with validation
|
||||
if ! update-alternatives --set php "/usr/bin/php${DEF_PHP_INTERPRETER}"; then
|
||||
echo "ERROR: Failed to set default PHP interpreter to $DEF_PHP_INTERPRETER" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
@@ -1,7 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
mkdir -p /etc/php # Creates /etc/php if it doesn't exist
|
||||
mv /tmp/buildtime/etc/php/* /etc/php/
|
||||
|
||||
# Start each version listed in PHP_VERSIONS
|
||||
for version in $PHP_VERSIONS; do
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/mysqlnd.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/opcache.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/pdo.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/xml.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/bcmath.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/bz2.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/calendar.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/ctype.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/curl.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/dba.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/dom.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/enchant.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/exif.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/ffi.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/fileinfo.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/ftp.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/gd.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/gettext.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/gmp.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/iconv.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/igbinary.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/imap.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/intl.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/ldap.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/mbstring.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/memcache.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/msgpack.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/mysqli.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/odbc.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/pdo_dblib.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/pdo_firebird.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/pdo_mysql.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/pdo_odbc.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/pdo_pgsql.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/pdo_sqlite.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/pgsql.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/phar.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/posix.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/ps.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/pspell.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/raphf.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/readline.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/shmop.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/simplexml.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/snmp.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/soap.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/sockets.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/sqlite3.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/stomp.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/sysvmsg.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/sysvsem.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/sysvshm.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/tidy.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/tokenizer.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/xdebug.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/xmlreader.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/xmlwriter.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/xsl.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/zip.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/http.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/memcached.ini
|
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/mysqlnd.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/opcache.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/pdo.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/xml.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/bcmath.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/bz2.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/calendar.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/ctype.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/curl.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/dba.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/dom.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/enchant.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/exif.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/ffi.ini
|
@@ -1 +0,0 @@
|
||||
/etc/php/8.2/mods-available/fileinfo.ini
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user