mail hog working ftp working redis working
This commit is contained in:
parent
4623e3a53d
commit
a4c01aac2e
11
Makefile
11
Makefile
@ -27,12 +27,17 @@ DC = $(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) --env-file $(DOCKER_ENV_FILE) -
|
|||||||
|
|
||||||
all: build up
|
all: build up
|
||||||
|
|
||||||
$(WORDPRESS_DATA_DIR):
|
$(DATA_DIR):
|
||||||
|
@echo "$(gub)Creating data directory...$(reset)"
|
||||||
|
@mkdir -p $(DATA_DIR)
|
||||||
|
@chmod 777 $(DATA_DIR)
|
||||||
|
|
||||||
|
$(WORDPRESS_DATA_DIR): $(DATA_DIR)
|
||||||
@echo "$(gub)Creating WordPress data directory...$(reset)"
|
@echo "$(gub)Creating WordPress data directory...$(reset)"
|
||||||
@mkdir -p $(WORDPRESS_DATA_DIR)
|
@mkdir -p $(WORDPRESS_DATA_DIR)
|
||||||
@chmod 777 $(WORDPRESS_DATA_DIR)
|
@chmod 777 $(WORDPRESS_DATA_DIR)
|
||||||
|
|
||||||
$(MARIADB_DATA_DIR):
|
$(MARIADB_DATA_DIR): $(DATA_DIR)
|
||||||
@echo "$(gub)Creating MariaDB data directory...$(reset)"
|
@echo "$(gub)Creating MariaDB data directory...$(reset)"
|
||||||
@mkdir -p $(MARIADB_DATA_DIR)
|
@mkdir -p $(MARIADB_DATA_DIR)
|
||||||
@chmod 777 $(MARIADB_DATA_DIR)
|
@chmod 777 $(MARIADB_DATA_DIR)
|
||||||
@ -41,7 +46,7 @@ $(MARIADB_DATA_DIR):
|
|||||||
build: $(WORDPRESS_DATA_DIR) $(MARIADB_DATA_DIR)
|
build: $(WORDPRESS_DATA_DIR) $(MARIADB_DATA_DIR)
|
||||||
@echo "$(gub)Building Docker containers...$(reset)"
|
@echo "$(gub)Building Docker containers...$(reset)"
|
||||||
$(DC) build --build-arg HOST_UID=$(UID)
|
$(DC) build --build-arg HOST_UID=$(UID)
|
||||||
up:
|
up: $(WORDPRESS_DATA_DIR) $(MARIADB_DATA_DIR)
|
||||||
@echo "$(gub)Starting Docker containers...$(reset)"
|
@echo "$(gub)Starting Docker containers...$(reset)"
|
||||||
$(DC) up -d
|
$(DC) up -d
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,10 @@ WP_USER=inception
|
|||||||
WP_USER_PASSWORD=42inception42
|
WP_USER_PASSWORD=42inception42
|
||||||
WP_USER_EMAIL=inception2@duinvoetje.nl
|
WP_USER_EMAIL=inception2@duinvoetje.nl
|
||||||
|
|
||||||
|
FTP_USER=ftpuser
|
||||||
|
FTP_PASS=42ftp42
|
||||||
|
FTP_PORT=21
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,15 +1,17 @@
|
|||||||
services:
|
services:
|
||||||
mariadb:
|
mariadb:
|
||||||
container_name: mariadb
|
container_name: mariadb
|
||||||
image: mariadb
|
|
||||||
build:
|
build:
|
||||||
context: ./requirements/mariadb
|
context: ./requirements/mariadb
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
HOST_UID: ${HOST_UID:-1000}
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
|
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
|
||||||
- MYSQL_DATABASE=${MYSQL_DATABASE}
|
- MYSQL_DATABASE=${MYSQL_DATABASE}
|
||||||
- MYSQL_USER=${MYSQL_USER}
|
- MYSQL_USER=${MYSQL_USER}
|
||||||
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
||||||
|
- HOST_UID=${HOST_UID:-1000}
|
||||||
networks:
|
networks:
|
||||||
- docker-network
|
- docker-network
|
||||||
volumes:
|
volumes:
|
||||||
@ -18,7 +20,6 @@ services:
|
|||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
container_name: nginx
|
container_name: nginx
|
||||||
image: nginx
|
|
||||||
build:
|
build:
|
||||||
context: ./requirements/nginx
|
context: ./requirements/nginx
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
@ -30,6 +31,7 @@ services:
|
|||||||
- DOMAIN_NAME=${DOMAIN_NAME}
|
- DOMAIN_NAME=${DOMAIN_NAME}
|
||||||
ports:
|
ports:
|
||||||
- '443:443'
|
- '443:443'
|
||||||
|
- '8443:8443'
|
||||||
networks:
|
networks:
|
||||||
- docker-network
|
- docker-network
|
||||||
volumes:
|
volumes:
|
||||||
@ -38,10 +40,11 @@ services:
|
|||||||
|
|
||||||
wordpress:
|
wordpress:
|
||||||
container_name: wordpress
|
container_name: wordpress
|
||||||
image: wordpress
|
|
||||||
build:
|
build:
|
||||||
context: ./requirements/wordpress
|
context: ./requirements/wordpress
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
HOST_UID: ${HOST_UID:-1000}
|
||||||
depends_on:
|
depends_on:
|
||||||
- mariadb
|
- mariadb
|
||||||
environment:
|
environment:
|
||||||
@ -73,7 +76,6 @@ services:
|
|||||||
|
|
||||||
redis:
|
redis:
|
||||||
container_name: redis
|
container_name: redis
|
||||||
image: redis
|
|
||||||
build:
|
build:
|
||||||
context: ./requirements/redis
|
context: ./requirements/redis
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
@ -83,16 +85,18 @@ services:
|
|||||||
|
|
||||||
ftp:
|
ftp:
|
||||||
container_name: ftp
|
container_name: ftp
|
||||||
image: ftp
|
|
||||||
build:
|
build:
|
||||||
context: ./requirements/ftp
|
context: ./requirements/ftp
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
HOST_UID: ${HOST_UID:-1000}
|
||||||
depends_on:
|
depends_on:
|
||||||
- wordpress
|
- wordpress
|
||||||
environment:
|
environment:
|
||||||
- FTP_USER=${FTP_USER}
|
- FTP_USER=${FTP_USER}
|
||||||
- FTP_PASS=${FTP_PASS}
|
- FTP_PASS=${FTP_PASS}
|
||||||
- FTP_PORT=${FTP_PORT}
|
- FTP_PORT=${FTP_PORT}
|
||||||
|
- HOST_UID=${HOST_UID:-1000}
|
||||||
networks:
|
networks:
|
||||||
- docker-network
|
- docker-network
|
||||||
ports:
|
ports:
|
||||||
@ -101,6 +105,32 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- data_wordpress:/var/www/html
|
- data_wordpress:/var/www/html
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
stop_grace_period: 2s
|
||||||
|
adminer:
|
||||||
|
container_name: adminer
|
||||||
|
build:
|
||||||
|
context: ./requirements/adminer
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
depends_on:
|
||||||
|
- mariadb
|
||||||
|
environment:
|
||||||
|
- ADMINER_DEFAULT_SERVER=mariadb
|
||||||
|
networks:
|
||||||
|
- docker-network
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
mailhog:
|
||||||
|
container_name: mailhog
|
||||||
|
build:
|
||||||
|
context: ./requirements/mailhog
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
networks:
|
||||||
|
- docker-network
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- HOST_UID=${HOST_UID:-1000}=value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
docker-network:
|
docker-network:
|
||||||
|
|||||||
@ -1,16 +1,31 @@
|
|||||||
FROM alpine:3.20
|
FROM alpine:3.20
|
||||||
|
|
||||||
|
ARG HOST_UID=1000
|
||||||
|
|
||||||
|
# Install PHP-FPM and dependencies for Adminer
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
php83 \
|
php83 \
|
||||||
php83-fpm \
|
php83-fpm \
|
||||||
php83-mysqli \
|
php83-mysqli \
|
||||||
php83-mbstring \
|
php83-mbstring \
|
||||||
php83-session \
|
php83-session \
|
||||||
|
php83-json \
|
||||||
mariadb-client \
|
mariadb-client \
|
||||||
curl &&\
|
curl && \
|
||||||
rm -rf /var/cache/apk/*
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
# Add a new user and group
|
# Create user with matching UID
|
||||||
# Create group with GID = HOST_UID, then user with UID = HOST_UID and GID = HOST_UID
|
RUN addgroup -g ${HOST_UID} adminer && \
|
||||||
ARG HOST_UID
|
adduser -D -u ${HOST_UID} -G adminer adminer
|
||||||
|
|
||||||
|
# Create web directory and download Adminer
|
||||||
|
RUN mkdir -p /var/www/html && \
|
||||||
|
curl -L https://github.com/vrana/adminer/releases/download/v5.3.0/adminer-5.3.0.php -o /var/www/html/adminer.php && \
|
||||||
|
chown -R adminer:adminer /var/www/html
|
||||||
|
|
||||||
|
COPY ./conf/www.conf /etc/php83/php-fpm.d/www.conf
|
||||||
|
|
||||||
|
EXPOSE 9000
|
||||||
|
|
||||||
|
CMD ["php-fpm83", "-F"]
|
||||||
|
|
||||||
|
|||||||
10
srcs/requirements/adminer/conf/www.conf
Normal file
10
srcs/requirements/adminer/conf/www.conf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[www]
|
||||||
|
listen = 0.0.0.0:9000
|
||||||
|
user = adminer
|
||||||
|
group = adminer
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 5
|
||||||
|
pm.start_servers = 2
|
||||||
|
pm.min_spare_servers = 1
|
||||||
|
pm.max_spare_servers = 3
|
||||||
|
catch_workers_output = yes
|
||||||
@ -1,17 +1,18 @@
|
|||||||
FROM alpine:3.20
|
FROM alpine:3.20
|
||||||
|
|
||||||
|
# Accept build argument for host user ID
|
||||||
|
ARG HOST_UID=1000
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
vsftpd \
|
vsftpd \
|
||||||
&& rm -rf /var/cache/apk/*
|
&& rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
RUN adduser -D -h /home/ftpuser -s /bin/false ftpuser && \
|
|
||||||
echo "ftpuser:password" | chpasswd && \
|
|
||||||
mkdir -p /home/ftpuser/ftp && \
|
|
||||||
chmod 750 /home/ftpuser/ftp && \
|
|
||||||
chown -R ftpuser:ftpuser /home/ftpuser/ftp
|
|
||||||
|
|
||||||
COPY ./conf/vsftpd.conf /etc/vsftpd/vsftpd.conf
|
COPY ./conf/vsftpd.conf /etc/vsftpd/vsftpd.conf
|
||||||
|
COPY ./tools/docker-entrypoint.sh /docker-entrypoint.sh
|
||||||
|
RUN chmod +x /docker-entrypoint.sh
|
||||||
|
|
||||||
EXPOSE 20 21 30000-30009
|
EXPOSE 20 21 30000-30009
|
||||||
|
|
||||||
CMD ["vsftpd", "/etc/vsftpd/vsftpd.conf"]
|
CMD ["/docker-entrypoint.sh"]
|
||||||
|
# HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||||
|
# CMD nc -z localhost 21 || exit 1
|
||||||
@ -1,35 +1,22 @@
|
|||||||
# Allow local users to log in
|
# Access settings
|
||||||
local_enable=YES
|
local_enable=YES
|
||||||
|
anonymous_enable=NO
|
||||||
|
|
||||||
# Enable write permissions for local users
|
# Write settings
|
||||||
write_enable=YES
|
write_enable=YES
|
||||||
|
allow_writeable_chroot=YES
|
||||||
|
|
||||||
# Restrict users to their home directories
|
# Chroot settings
|
||||||
chroot_local_user=YES
|
chroot_local_user=YES
|
||||||
|
|
||||||
# Enable passive mode (useful for NAT and firewalls)
|
# Listen settings
|
||||||
|
listen=YES
|
||||||
|
background=NO
|
||||||
|
|
||||||
|
# Security settings
|
||||||
|
seccomp_sandbox=NO
|
||||||
|
|
||||||
|
# Passive mode settings
|
||||||
pasv_enable=YES
|
pasv_enable=YES
|
||||||
pasv_min_port=30000
|
pasv_min_port=30000
|
||||||
pasv_max_port=30009
|
pasv_max_port=30009
|
||||||
|
|
||||||
|
|
||||||
# Disable anonymous login
|
|
||||||
anonymous_enable=NO
|
|
||||||
|
|
||||||
# Set the FTP banner message
|
|
||||||
ftpd_banner=Welcome to the FTP server.
|
|
||||||
|
|
||||||
# Listen on IPv4
|
|
||||||
listen=YES
|
|
||||||
|
|
||||||
# Disable IPv6 (optional, if not needed)
|
|
||||||
listen_ipv6=NO
|
|
||||||
|
|
||||||
# Set the maximum number of clients
|
|
||||||
max_clients=10
|
|
||||||
|
|
||||||
# Set the maximum number of connections per IP
|
|
||||||
max_per_ip=5
|
|
||||||
|
|
||||||
# Log all FTP requests
|
|
||||||
xferlog_enable=YES
|
|
||||||
@ -1 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
adduser -D -u "${HOST_UID}" -h /var/www/html -s /bin/false "${FTP_USER}" 2>/dev/null || true
|
||||||
|
echo "${FTP_USER}:${FTP_PASS}" | chpasswd
|
||||||
|
mkdir -p /var/www/html
|
||||||
|
# chown -R "${FTP_USER}:${FTP_USER}" /var/www/html
|
||||||
|
echo "${FTP_USER}" > /etc/vsftpd.userlist
|
||||||
|
|
||||||
|
exec vsftpd /etc/vsftpd/vsftpd.conf
|
||||||
|
|||||||
29
srcs/requirements/mailhog/Dockerfile
Normal file
29
srcs/requirements/mailhog/Dockerfile
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
FROM alpine:3.21 AS builder
|
||||||
|
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
go \
|
||||||
|
git \
|
||||||
|
&& rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
ENV GOROOT /usr/lib/go
|
||||||
|
ENV GOPATH /go
|
||||||
|
ENV PATH /go/bin:$PATH
|
||||||
|
|
||||||
|
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
|
||||||
|
ENV GOTOOLCHAIN=auto
|
||||||
|
|
||||||
|
|
||||||
|
RUN go install github.com/mailhog/MailHog@latest
|
||||||
|
|
||||||
|
FROM alpine:3.20
|
||||||
|
|
||||||
|
ARG HOST_UID=1000
|
||||||
|
|
||||||
|
RUN adduser -D -u ${HOST_UID} mailhog
|
||||||
|
|
||||||
|
COPY --from=builder /go/bin/MailHog /usr/local/bin/MailHog
|
||||||
|
|
||||||
|
CMD ["MailHog"]
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||||
|
CMD curl --silent --fail http://localhost:8025/ || exit 1
|
||||||
@ -1,10 +1,6 @@
|
|||||||
|
|
||||||
FROM alpine:3.20
|
FROM alpine:3.20
|
||||||
|
|
||||||
# Install MariaDB and MariaDB client
|
|
||||||
# The --no-cache option is used to prevent the package manager from caching the downloaded packages
|
|
||||||
# rm -rf /var/cache/apk/* is used to remove any cached files after installation
|
|
||||||
# This helps to keep the image size small
|
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
mariadb \
|
mariadb \
|
||||||
mariadb-client && \
|
mariadb-client && \
|
||||||
@ -12,42 +8,24 @@ RUN apk add --no-cache \
|
|||||||
|
|
||||||
ARG HOST_UID
|
ARG HOST_UID
|
||||||
|
|
||||||
# Create a new user and group
|
|
||||||
RUN addgroup -S -g $HOST_UID mariadb && \
|
RUN addgroup -S -g $HOST_UID mariadb && \
|
||||||
adduser -S -u $HOST_UID mariadb -G mariadb
|
adduser -S -u $HOST_UID mariadb -G mariadb
|
||||||
|
|
||||||
# Create the necessary directories
|
|
||||||
RUN mkdir -p /var/run/mysqld && \
|
RUN mkdir -p /var/run/mysqld && \
|
||||||
chown -R mariadb:mariadb /var/run/mysqld && \
|
chown -R mariadb:mariadb /var/run/mysqld && \
|
||||||
chown -R mariadb:mariadb /var/lib/mysql && \
|
chown -R mariadb:mariadb /var/lib/mysql && \
|
||||||
chmod -R 750 /var/lib/mysql
|
chmod -R 750 /var/lib/mysql
|
||||||
|
|
||||||
# Copy the entrypoint script and configuration files
|
|
||||||
# and set the necessary permissions
|
|
||||||
# The entrypoint script will be responsible for initializing the database
|
|
||||||
# and starting the MariaDB server
|
|
||||||
# The configuration file will be used to set the server settings
|
|
||||||
# The init.sql file will be executed when the container is started for the first time
|
|
||||||
COPY ./tools/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
COPY ./tools/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||||
COPY ./conf/my.cnf /etc/my.cnf
|
COPY ./conf/my.cnf /etc/my.cnf
|
||||||
# COPY ./init.sql /usr/local/bin/init.sql
|
|
||||||
|
|
||||||
# Expose the MySQL port
|
|
||||||
#EXPOSE 3306
|
|
||||||
|
|
||||||
# Set the user and group to run the container
|
|
||||||
|
|
||||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||||
# Set the working directory
|
|
||||||
WORKDIR /var/lib/mysql
|
WORKDIR /var/lib/mysql
|
||||||
|
|
||||||
# Set the entrypoint script to be executed when the container starts
|
|
||||||
# The entrypoint script will initialize the database and start the server
|
|
||||||
USER mariadb
|
USER mariadb
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||||
|
|
||||||
# Start the MariaDB server
|
|
||||||
CMD ["mysqld", "--datadir=/var/lib/mysql", "--user=mariadb"]
|
CMD ["mysqld", "--datadir=/var/lib/mysql", "--user=mariadb"]
|
||||||
HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=1 CMD mysqladmin ping -h localhost || exit 1
|
HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=1 CMD mysqladmin ping -h localhost || exit 1
|
||||||
|
|
||||||
|
|||||||
@ -1,48 +1,19 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# If the first argument is 'mysqld', then start MariaDB
|
if [ "$1" = 'mysqld' ] && [ ! -d "/var/lib/mysql/mysql" ]; then
|
||||||
if [ "$1" = 'mysqld' ]; then
|
mysql_install_db --user=mariadb --datadir=/var/lib/mysql --rpm
|
||||||
# Initialize the database if it doesn't exist
|
mysqld --user=mariadb --skip-networking &
|
||||||
if [ ! -d "/var/lib/mysql/mysql" ]; then
|
pid=$!
|
||||||
echo "Initializing database..."
|
while ! mysqladmin ping --silent; do sleep 1; done
|
||||||
mysql_install_db --user=mariadb --datadir=/var/lib/mysql --rpm
|
mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}';"
|
||||||
echo "Database initialized."
|
[ "$MYSQL_DATABASE" ] && mysql -e "CREATE DATABASE IF NOT EXISTS \`${MYSQL_DATABASE}\`;"
|
||||||
|
[ "$MYSQL_USER" ] && [ "$MYSQL_PASSWORD" ] && \
|
||||||
# Start MariaDB temporarily to set up initial configuration
|
mysql -e "CREATE USER '${MYSQL_USER}'@'%' IDENTIFIED BY '${MYSQL_PASSWORD}';" && \
|
||||||
mysqld --user=mariadb --skip-networking &
|
mysql -e "GRANT ALL PRIVILEGES ON \`${MYSQL_DATABASE}\`.* TO '${MYSQL_USER}'@'%';"
|
||||||
pid="$!"
|
mysql -e "FLUSH PRIVILEGES;"
|
||||||
|
[ -f "/usr/bin/local/init.sql" ] && mysql "${MYSQL_DATABASE}" < /usr/bin/local/init.sql
|
||||||
# Wait for MariaDB to start
|
kill "$pid" && wait "$pid"
|
||||||
while ! mysqladmin ping --silent; do
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
# Set up root user and any initial database
|
|
||||||
echo "Setting up initial database..."
|
|
||||||
mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}';"
|
|
||||||
if [ -n "$MYSQL_DATABASE" ]; then
|
|
||||||
mysql -e "CREATE DATABASE IF NOT EXISTS \`${MYSQL_DATABASE}\`;"
|
|
||||||
fi
|
|
||||||
if [ -n "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then
|
|
||||||
mysql -e "CREATE USER '${MYSQL_USER}'@'%' IDENTIFIED BY '${MYSQL_PASSWORD}';"
|
|
||||||
mysql -e "GRANT ALL PRIVILEGES ON \`${MYSQL_DATABASE}\`.* TO '${MYSQL_USER}'@'%';"
|
|
||||||
fi
|
|
||||||
mysql -e "FLUSH PRIVILEGES;"
|
|
||||||
|
|
||||||
# Load initial SQL dump if init.sql exists
|
|
||||||
if [ -f "/usr/bin/local/init.sql" ]; then
|
|
||||||
echo "Loading initial SQL dump..."
|
|
||||||
mysql "${MYSQL_DATABASE}" < /usr/bin/local/init.sql
|
|
||||||
echo "Initial SQL dump loaded."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Stop temporary MariaDB instance
|
|
||||||
kill "$pid"
|
|
||||||
wait "$pid"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Starting MariaDB..."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|||||||
@ -14,6 +14,6 @@ RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
|
|||||||
-subj "/CN=${DOMAIN_NAME}"
|
-subj "/CN=${DOMAIN_NAME}"
|
||||||
|
|
||||||
COPY ./conf/nginx.conf /etc/nginx/nginx.conf
|
COPY ./conf/nginx.conf /etc/nginx/nginx.conf
|
||||||
EXPOSE 443
|
EXPOSE 443 8443
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=1 CMD curl --insecure -f https://127.0.0.1:443/ || exit 1
|
# HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=1 CMD curl --insecure -f https://127.0.0.1:443/ || exit 1
|
||||||
|
|||||||
@ -26,12 +26,43 @@ http {
|
|||||||
try_files $uri $uri/ /index.php$is_args$args;
|
try_files $uri $uri/ /index.php$is_args$args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location ~ /adminer\.php$ {
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
fastcgi_pass adminer:9000;
|
||||||
|
fastcgi_index adminer.php;
|
||||||
|
include fastcgi.conf;
|
||||||
|
}
|
||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
fastcgi_pass wordpress:9000;
|
fastcgi_pass wordpress:9000;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi.conf;
|
include fastcgi.conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 8443 ssl;
|
||||||
|
server_name ${DOMAIN_NAME};
|
||||||
|
|
||||||
|
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
|
||||||
|
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://mailhog:8025;
|
||||||
|
chunked_transfer_encoding on;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-NginX-Proxy true;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_buffering off;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -7,4 +7,4 @@ pm.max_children = 5
|
|||||||
pm.start_servers = 2
|
pm.start_servers = 2
|
||||||
pm.min_spare_servers = 1
|
pm.min_spare_servers = 1
|
||||||
pm.max_spare_servers = 3
|
pm.max_spare_servers = 3
|
||||||
catch_workers_output = yes
|
catch_workers_output = yes
|
||||||
|
|||||||
@ -1,5 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Set sendmail_path in php.ini for PHP 8.3 FPM
|
||||||
|
PHP_INI="/etc/php83/php.ini"
|
||||||
|
if [ -f "$PHP_INI" ]; then
|
||||||
|
sed -i '/^sendmail_path/d' "$PHP_INI"
|
||||||
|
echo 'sendmail_path = "/usr/sbin/sendmail -S mailhog:1025"' >> "$PHP_INI"
|
||||||
|
fi
|
||||||
|
|
||||||
# This script is used to install WordPress and configure it with a MariaDB database.
|
# This script is used to install WordPress and configure it with a MariaDB database.
|
||||||
# It checks for the presence of a database and user, creates them if they don't exist,
|
# It checks for the presence of a database and user, creates them if they don't exist,
|
||||||
# and sets up the WordPress configuration file with the database connection details.
|
# and sets up the WordPress configuration file with the database connection details.
|
||||||
@ -61,6 +68,17 @@ wp config set --allow-root \
|
|||||||
wp redis enable --allow-root \
|
wp redis enable --allow-root \
|
||||||
--path=/var/www/html
|
--path=/var/www/html
|
||||||
|
|
||||||
|
# wp config set --allow-root \
|
||||||
|
# SMTP_SERVER \
|
||||||
|
# "mailhog" \
|
||||||
|
# --type=constant \
|
||||||
|
# --path=/var/www/html
|
||||||
|
# wp config set --allow-root \
|
||||||
|
# SMTP_PORT \
|
||||||
|
# 1025 \
|
||||||
|
# --type=constant \
|
||||||
|
# --path=/var/www/html
|
||||||
|
|
||||||
echo "WordPress installation completed."
|
echo "WordPress installation completed."
|
||||||
|
|
||||||
chown -R wordpress:wordpress /var/www/html
|
chown -R wordpress:wordpress /var/www/html
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user