Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c3d3a8bf9 | ||
|
|
e0228574fa | ||
|
|
57e6c3893d | ||
|
|
b647c5f014 | ||
|
|
8deb1c3223 | ||
|
|
a4c01aac2e | ||
|
|
4623e3a53d | ||
|
|
4e10bf3b5b | ||
|
|
493fdd675c | ||
|
|
63f9b5b9b0 | ||
|
|
856ac6a99b | ||
|
|
3ac4ffb970 | ||
|
|
78fa3b54d5 | ||
|
|
1810c6f65e | ||
|
|
15cdddea05 | ||
|
|
6c45ee6f3b | ||
|
|
4a61e55095 | ||
|
|
401cdfb6c5 | ||
|
|
1bc7d4bb6f | ||
|
|
96e9821448 | ||
|
|
8ded6e8358 | ||
|
|
0b15a19325 | ||
|
|
4bf28f2e28 | ||
|
|
51ebedd83a | ||
|
|
8f16f647b0 | ||
|
|
3813c6f0d8 | ||
|
|
5f3da3f9bc | ||
|
|
1583341361 | ||
|
|
3091d74121 | ||
|
|
f9e2e64750 | ||
|
|
edf43ac9c5 | ||
|
|
81ddf62aec |
1
.gitignore
vendored
1
.gitignore
vendored
@ -0,0 +1 @@
|
|||||||
|
data/
|
||||||
54
Makefile
54
Makefile
@ -6,23 +6,49 @@
|
|||||||
# By: whaffman <whaffman@student.codam.nl> +#+ #
|
# By: whaffman <whaffman@student.codam.nl> +#+ #
|
||||||
# +#+ #
|
# +#+ #
|
||||||
# Created: 2025/05/12 15:33:56 by whaffman #+# #+# #
|
# Created: 2025/05/12 15:33:56 by whaffman #+# #+# #
|
||||||
# Updated: 2025/05/13 08:59:04 by whaffman ######## odam.nl #
|
# Updated: 2025/05/22 16:23:30 by whaffman ######## odam.nl #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
|
|
||||||
DOCKER_COMPOSE = docker compose
|
DOCKER_COMPOSE = docker compose
|
||||||
DOCKER_COMPOSE_FILE = ./srcs/docker-compose.yml
|
DOCKER_COMPOSE_FILE = ./srcs/docker-compose.yml
|
||||||
DC = $(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE)
|
DOCKER_ENV_FILE = ./srcs/.env
|
||||||
|
|
||||||
|
DATA_DIR = /home/whaffman/data
|
||||||
|
WORDPRESS_DATA_DIR = $(DATA_DIR)/wordpress
|
||||||
|
MARIADB_DATA_DIR = $(DATA_DIR)/mariadb
|
||||||
|
|
||||||
|
UID := $(shell id -u)
|
||||||
|
|
||||||
|
DC = $(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) --env-file $(DOCKER_ENV_FILE) --project-name ""
|
||||||
|
|
||||||
.PHONY: all build up down remove
|
.PHONY: all build up down remove
|
||||||
|
|
||||||
all: build up
|
all: build up
|
||||||
build:
|
|
||||||
|
$(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)"
|
||||||
|
@mkdir -p $(WORDPRESS_DATA_DIR)
|
||||||
|
@chmod 777 $(WORDPRESS_DATA_DIR)
|
||||||
|
|
||||||
|
$(MARIADB_DATA_DIR): $(DATA_DIR)
|
||||||
|
@echo "$(gub)Creating MariaDB data directory...$(reset)"
|
||||||
|
@mkdir -p $(MARIADB_DATA_DIR)
|
||||||
|
@chmod 777 $(MARIADB_DATA_DIR)
|
||||||
|
|
||||||
|
|
||||||
|
build: $(WORDPRESS_DATA_DIR) $(MARIADB_DATA_DIR)
|
||||||
@echo "$(gub)Building Docker containers...$(reset)"
|
@echo "$(gub)Building Docker containers...$(reset)"
|
||||||
$(DC) build
|
$(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 --build
|
$(DC) up -d
|
||||||
|
|
||||||
down:
|
down:
|
||||||
@echo "$(gub)Stopping Docker containers...$(reset)"
|
@echo "$(gub)Stopping Docker containers...$(reset)"
|
||||||
@ -31,6 +57,14 @@ down:
|
|||||||
clean:
|
clean:
|
||||||
@echo "$(gub)Cleaning up Docker containers...$(reset)"
|
@echo "$(gub)Cleaning up Docker containers...$(reset)"
|
||||||
$(DC) down --rmi local --volumes --remove-orphans
|
$(DC) down --rmi local --volumes --remove-orphans
|
||||||
|
@echo "$(gub)Removing data directories...$(reset)"
|
||||||
|
@rm -rf $(DATA_DIR)
|
||||||
|
@echo "$(gub)Removing Docker networks...$(reset)"
|
||||||
|
@docker network prune -f
|
||||||
|
@echo "$(gub)Removing Docker volumes...$(reset)"
|
||||||
|
@docker volume prune -f
|
||||||
|
@echo "$(gub)Removing Docker images...$(reset)"
|
||||||
|
@docker rmi -f $(shell docker images -q)
|
||||||
|
|
||||||
logs:
|
logs:
|
||||||
@echo "$(gub)Displaying logs...$(reset)"
|
@echo "$(gub)Displaying logs...$(reset)"
|
||||||
@ -48,14 +82,6 @@ ps:
|
|||||||
@echo "$(gub)Displaying all containers...$(reset)"
|
@echo "$(gub)Displaying all containers...$(reset)"
|
||||||
@docker ps -a
|
@docker ps -a
|
||||||
|
|
||||||
|
|
||||||
remove:
|
|
||||||
@echo "$(gub)Removing Docker containers...$(reset)"
|
|
||||||
@$(DC) rm -f
|
|
||||||
@$(DC) volume rm -f
|
|
||||||
@$(DC) network rm -f
|
|
||||||
|
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
|
|
||||||
green:=$(shell tput setaf 2)
|
green:=$(shell tput setaf 2)
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
test
|
|
||||||
@ -1 +0,0 @@
|
|||||||
test
|
|
||||||
22
setup.sh
Executable file
22
setup.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SUBDOMAINS=(
|
||||||
|
"whaffman.42.fr" "mail.whaffman.42.fr" "adminer.whaffman.42.fr" "ftp.whaffman.42.fr" "static.whaffman.42.fr")
|
||||||
|
HOSTS_FILE="/etc/hosts"
|
||||||
|
IP="127.0.0.1"
|
||||||
|
|
||||||
|
for SUBDOMAIN in "${SUBDOMAINS[@]}"; do
|
||||||
|
if ! grep -q "$SUBDOMAIN" "$HOSTS_FILE"; then
|
||||||
|
echo "$IP $SUBDOMAIN" | sudo tee -a "$HOSTS_FILE" > /dev/null
|
||||||
|
echo "Added $SUBDOMAIN to $HOSTS_FILE"
|
||||||
|
else
|
||||||
|
echo "$SUBDOMAIN already exists in $HOSTS_FILE"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ! -d "/home/whaffman" ]; then
|
||||||
|
sudo mkdir -p /home/whaffman
|
||||||
|
echo "Created /home/whaffman"
|
||||||
|
fi
|
||||||
|
sudo chmod 777 /home/whaffman
|
||||||
|
echo "Granted read/write permissions to everyone for /home/whaffman"
|
||||||
31
srcs/.env
Normal file
31
srcs/.env
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
DOMAIN_NAME=whaffman.42.fr
|
||||||
|
|
||||||
|
MYSQL_DATABASE=wordpress
|
||||||
|
MYSQL_USER=wordpress
|
||||||
|
MYSQL_PASSWORD=42wordpress42
|
||||||
|
MYSQL_ROOT_PASSWORD=42root42
|
||||||
|
|
||||||
|
DB_HOST=mariadb
|
||||||
|
DB_PORT=3306
|
||||||
|
|
||||||
|
WP_TITLE=Inception
|
||||||
|
WP_DESCRIPTION=Inception project
|
||||||
|
|
||||||
|
WP_ADMIN=theboss
|
||||||
|
WP_ADMIN_PASSWORD=42theboss42
|
||||||
|
WP_ADMIN_EMAIL=inception@duinvoetje.nl
|
||||||
|
|
||||||
|
WP_THEME=my-minimalist-blog
|
||||||
|
|
||||||
|
WP_USER=inception
|
||||||
|
WP_USER_PASSWORD=42inception42
|
||||||
|
WP_USER_EMAIL=inception2@duinvoetje.nl
|
||||||
|
|
||||||
|
FTP_USER=ftpuser
|
||||||
|
FTP_PASS=42ftp42
|
||||||
|
FTP_PORT=21
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,72 +1,173 @@
|
|||||||
name: inception
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
mariadb:
|
mariadb:
|
||||||
container_name: mariadb
|
container_name: mariadb
|
||||||
restart: always
|
|
||||||
build:
|
build:
|
||||||
context: ./requirements/mariadb
|
context: ./requirements/mariadb
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
args:
|
||||||
- '3306:3306'
|
HOST_UID: ${HOST_UID:-1000}
|
||||||
|
environment:
|
||||||
|
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
|
||||||
|
- MYSQL_DATABASE=${MYSQL_DATABASE}
|
||||||
|
- MYSQL_USER=${MYSQL_USER}
|
||||||
|
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
||||||
|
- HOST_UID=${HOST_UID:-1000}
|
||||||
networks:
|
networks:
|
||||||
- docker-network
|
- docker-network
|
||||||
volumes:
|
volumes:
|
||||||
- data_mariadb:/var/lib/mysql
|
- data_mariadb:/var/lib/mysql
|
||||||
secrets:
|
restart: unless-stopped
|
||||||
- mariadb_root_password
|
|
||||||
- mariadb_user_password
|
|
||||||
env_file:
|
|
||||||
- ./requirements/mariadb/.env
|
|
||||||
|
|
||||||
|
nginx:
|
||||||
|
container_name: nginx
|
||||||
|
build:
|
||||||
|
context: ./requirements/nginx
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
DOMAIN_NAME: ${DOMAIN_NAME}
|
||||||
|
depends_on:
|
||||||
|
wordpress:
|
||||||
|
condition: service_healthy
|
||||||
|
mailhog:
|
||||||
|
condition: service_healthy
|
||||||
|
adminer:
|
||||||
|
condition: service_healthy
|
||||||
|
environment:
|
||||||
|
- DOMAIN_NAME=${DOMAIN_NAME}
|
||||||
|
ports:
|
||||||
|
- '443:443'
|
||||||
|
networks:
|
||||||
|
- docker-network
|
||||||
|
volumes:
|
||||||
|
- data_wordpress:/var/www/html
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
# wordpress:
|
wordpress:
|
||||||
# container_name: wordpress
|
container_name: wordpress
|
||||||
# restart: always
|
build:
|
||||||
# build:
|
context: ./requirements/wordpress
|
||||||
# context: ./requirements/wordpress
|
dockerfile: Dockerfile
|
||||||
# dockerfile: Dockerfile
|
args:
|
||||||
# depends_on:
|
HOST_UID: ${HOST_UID:-1000}
|
||||||
# - mariadb
|
depends_on:
|
||||||
# ports:
|
mariadb:
|
||||||
# - '9000:9000'
|
condition: service_healthy
|
||||||
# networks:
|
redis:
|
||||||
# - docker-network
|
condition: service_healthy
|
||||||
# volumes:
|
mailhog:
|
||||||
# - data_wordpress:/var/www/html
|
condition: service_healthy
|
||||||
|
environment:
|
||||||
|
- DOMAIN_NAME=${DOMAIN_NAME}
|
||||||
|
|
||||||
# nginx:
|
- DB_HOST=${DB_HOST}
|
||||||
# container_name: nginx
|
- DB_PORT=${DB_PORT}
|
||||||
# restart: always
|
|
||||||
# build:
|
- MYSQL_DATABASE=${MYSQL_DATABASE}
|
||||||
# context: ./requirements/nginx
|
- MYSQL_USER=${MYSQL_USER}
|
||||||
# dockerfile: Dockerfile
|
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
||||||
# depends_on:
|
|
||||||
# - wordpress
|
- WP_TITLE=${WP_TITLE}
|
||||||
# ports:
|
- WP_DESCRIPTION=${WP_DESCRIPTION}
|
||||||
# - '443:443'
|
- WP_THEME=${WP_THEME}
|
||||||
# networks:
|
|
||||||
# - docker-network
|
- WP_ADMIN=${WP_ADMIN}
|
||||||
# volumes:
|
- WP_ADMIN_PASSWORD=${WP_ADMIN_PASSWORD}
|
||||||
# - data_wordpress:/var/www/html
|
- WP_ADMIN_EMAIL=${WP_ADMIN_EMAIL}
|
||||||
|
|
||||||
|
- WP_USER=${WP_USER}
|
||||||
|
- WP_USER_PASSWORD=${WP_USER_PASSWORD}
|
||||||
|
- WP_USER_EMAIL=${WP_USER_EMAIL}
|
||||||
|
networks:
|
||||||
|
- docker-network
|
||||||
|
volumes:
|
||||||
|
- data_wordpress:/var/www/html
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
redis:
|
||||||
|
container_name: redis
|
||||||
|
build:
|
||||||
|
context: ./requirements/redis
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
networks:
|
||||||
|
- docker-network
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
ftp:
|
||||||
|
container_name: ftp
|
||||||
|
build:
|
||||||
|
context: ./requirements/ftp
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
HOST_UID: ${HOST_UID:-1000}
|
||||||
|
depends_on:
|
||||||
|
wordpress:
|
||||||
|
condition: service_healthy
|
||||||
|
environment:
|
||||||
|
- FTP_USER=${FTP_USER}
|
||||||
|
- FTP_PASS=${FTP_PASS}
|
||||||
|
- FTP_PORT=${FTP_PORT}
|
||||||
|
- HOST_UID=${HOST_UID:-1000}
|
||||||
|
networks:
|
||||||
|
- docker-network
|
||||||
|
ports:
|
||||||
|
- '21:21'
|
||||||
|
- '30000-30009:30000-30009'
|
||||||
|
volumes:
|
||||||
|
- data_wordpress:/var/www/html
|
||||||
|
restart: unless-stopped
|
||||||
|
stop_grace_period: 2s
|
||||||
|
adminer:
|
||||||
|
container_name: adminer
|
||||||
|
build:
|
||||||
|
context: ./requirements/adminer
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
depends_on:
|
||||||
|
mariadb:
|
||||||
|
condition: service_healthy
|
||||||
|
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
|
||||||
|
|
||||||
|
static-site:
|
||||||
|
container_name: static-site
|
||||||
|
build:
|
||||||
|
context: ./requirements/static-site
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
environment:
|
||||||
|
- DOMAIN_NAME=${DOMAIN_NAME}
|
||||||
|
networks:
|
||||||
|
- docker-network
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
docker-network:
|
docker-network:
|
||||||
driver: bridge
|
name: docker-network
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
data_mariadb:
|
data_mariadb:
|
||||||
|
name: data_mariadb
|
||||||
driver: local
|
driver: local
|
||||||
# data_wordpress:
|
driver_opts:
|
||||||
# driver: local
|
type: none
|
||||||
|
device: /home/whaffman/data/mariadb
|
||||||
secrets:
|
o: bind
|
||||||
mariadb_root_password:
|
data_wordpress:
|
||||||
file: ../secrets/db_root_password.txt
|
name: data_wordpress
|
||||||
mariadb_user_password:
|
driver: local
|
||||||
file: ../secrets/db_password.txt
|
driver_opts:
|
||||||
# wordpress_admin_password:
|
type: none
|
||||||
# file: ./requirements/wordpress/.env
|
device: /home/whaffman/data/wordpress
|
||||||
# wordpress_user_password:
|
o: bind
|
||||||
# file: ./requirements/wordpress/.env
|
|
||||||
|
|||||||
29
srcs/requirements/adminer/Dockerfile
Normal file
29
srcs/requirements/adminer/Dockerfile
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
FROM alpine:3.20
|
||||||
|
|
||||||
|
ARG HOST_UID=1000
|
||||||
|
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
php83 \
|
||||||
|
php83-fpm \
|
||||||
|
php83-mysqli \
|
||||||
|
php83-mbstring \
|
||||||
|
php83-session \
|
||||||
|
php83-json \
|
||||||
|
mariadb-client \
|
||||||
|
netcat-openbsd \
|
||||||
|
curl && \
|
||||||
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
RUN addgroup -g ${HOST_UID} adminer && \
|
||||||
|
adduser -D -u ${HOST_UID} -G adminer 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
|
||||||
|
|
||||||
|
CMD ["php-fpm83", "-F"]
|
||||||
|
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
|
||||||
|
CMD nc -z 127.0.0.1 9000 || exit 1
|
||||||
|
|
||||||
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
|
||||||
19
srcs/requirements/ftp/Dockerfile
Normal file
19
srcs/requirements/ftp/Dockerfile
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
FROM alpine:3.20
|
||||||
|
|
||||||
|
|
||||||
|
ARG HOST_UID=1000
|
||||||
|
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
vsftpd \
|
||||||
|
netcat-openbsd \
|
||||||
|
&& rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
CMD ["/docker-entrypoint.sh"]
|
||||||
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||||
|
CMD nc -z localhost 21 || exit 1
|
||||||
22
srcs/requirements/ftp/conf/vsftpd.conf
Normal file
22
srcs/requirements/ftp/conf/vsftpd.conf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# Access settings
|
||||||
|
local_enable=YES
|
||||||
|
anonymous_enable=NO
|
||||||
|
|
||||||
|
# Write settings
|
||||||
|
write_enable=YES
|
||||||
|
allow_writeable_chroot=YES
|
||||||
|
|
||||||
|
# Chroot settings
|
||||||
|
chroot_local_user=YES
|
||||||
|
|
||||||
|
# Listen settings
|
||||||
|
listen=YES
|
||||||
|
background=NO
|
||||||
|
|
||||||
|
# Security settings
|
||||||
|
seccomp_sandbox=NO
|
||||||
|
|
||||||
|
# Passive mode settings
|
||||||
|
pasv_enable=YES
|
||||||
|
pasv_min_port=30000
|
||||||
|
pasv_max_port=30009
|
||||||
8
srcs/requirements/ftp/tools/docker-entrypoint.sh
Normal file
8
srcs/requirements/ftp/tools/docker-entrypoint.sh
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#!/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
|
||||||
|
echo "${FTP_USER}" > /etc/vsftpd.userlist
|
||||||
|
|
||||||
|
exec vsftpd /etc/vsftpd/vsftpd.conf
|
||||||
28
srcs/requirements/mailhog/Dockerfile
Normal file
28
srcs/requirements/mailhog/Dockerfile
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
FROM alpine:3.21 AS builder
|
||||||
|
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
go \
|
||||||
|
git \
|
||||||
|
netcat-openbsd \
|
||||||
|
&& 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
|
||||||
|
|
||||||
|
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 nc -z localhost 8025 || exit 1
|
||||||
@ -1,4 +0,0 @@
|
|||||||
MYSQL_ROOT_PASSWORD=123456
|
|
||||||
MYSQL_DATABASE=wordpress
|
|
||||||
MYSQL_USER=wordpress
|
|
||||||
MYSQL_PASSWORD=123456
|
|
||||||
@ -1,44 +1,31 @@
|
|||||||
|
|
||||||
FROM alpine:3.20
|
FROM alpine:3.20
|
||||||
|
|
||||||
RUN apk update && apk upgrade && \
|
RUN apk add --no-cache \
|
||||||
apk add --no-cache \
|
mariadb \
|
||||||
mariadb \
|
mariadb-client && \
|
||||||
mariadb-client \
|
rm -rf /var/cache/apk/*
|
||||||
mariadb-server-utils && \
|
|
||||||
rm -rf /var/cache/apk/*
|
ARG HOST_UID
|
||||||
|
|
||||||
|
RUN addgroup -S -g $HOST_UID mariadb && \
|
||||||
|
adduser -S -u $HOST_UID mariadb -G mariadb
|
||||||
|
|
||||||
# Create a new user and group
|
|
||||||
RUN addgroup -S mariadb && adduser -S mariadb -G mariadb
|
|
||||||
# Create the data directory
|
|
||||||
RUN mkdir -p /var/lib/mysql && \
|
|
||||||
chown -R mariadb:mariadb /var/lib/mysql && \
|
|
||||||
chmod 700 /var/lib/mysql
|
|
||||||
# Create the socket directory
|
|
||||||
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 && \
|
||||||
chmod 755 /var/run/mysqld
|
chown -R mariadb:mariadb /var/lib/mysql && \
|
||||||
# Create the configuration directory
|
chmod -R 750 /var/lib/mysql
|
||||||
# Set the working directory
|
|
||||||
WORKDIR /var/lib/mysql
|
|
||||||
# Expose the MySQL port
|
|
||||||
EXPOSE 3306
|
|
||||||
# Set the default environment variables
|
|
||||||
|
|
||||||
# Copy the configuration file
|
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
|
||||||
# Make the configuration file readable by the user
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||||
RUN chown mariadb:mariadb /etc/my.cnf
|
|
||||||
|
|
||||||
|
WORKDIR /var/lib/mysql
|
||||||
|
|
||||||
# Copy the entrypoint script
|
|
||||||
COPY ./tools/entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
||||||
# Make the entrypoint script executable
|
|
||||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
|
||||||
# Set the default user to run the container
|
|
||||||
USER mariadb
|
USER mariadb
|
||||||
|
|
||||||
# # Set the entrypoint script
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
||||||
# Set the default command to run when the container starts
|
CMD ["mysqld", "--datadir=/var/lib/mysql", "--user=mariadb"]
|
||||||
CMD ["mysqld", "--bind-address=0.0.0.0"]
|
HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=1 CMD mysqladmin ping -h localhost || exit 1
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
[mysqld]
|
[mysqld]
|
||||||
port = 3306
|
port=3306
|
||||||
datadir = /var/lib/mysql
|
bind-address=0.0.0.0
|
||||||
socket = /var/run/mysqld/mysqld.sock
|
datadir=/var/lib/mysql
|
||||||
skip-networking = false
|
pid-file=/var/run/mysqld/mysqld.pid
|
||||||
bind-address = 0.0.0.0
|
|
||||||
|
|||||||
19
srcs/requirements/mariadb/tools/docker-entrypoint.sh
Normal file
19
srcs/requirements/mariadb/tools/docker-entrypoint.sh
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$1" = 'mysqld' ] && [ ! -d "/var/lib/mysql/mysql" ]; then
|
||||||
|
mysql_install_db --user=mariadb --datadir=/var/lib/mysql --rpm
|
||||||
|
mysqld --user=mariadb --skip-networking &
|
||||||
|
pid=$!
|
||||||
|
while ! mysqladmin ping --silent; do sleep 1; done
|
||||||
|
mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}';"
|
||||||
|
[ "$MYSQL_DATABASE" ] && mysql -e "CREATE DATABASE IF NOT EXISTS \`${MYSQL_DATABASE}\`;"
|
||||||
|
[ "$MYSQL_USER" ] && [ "$MYSQL_PASSWORD" ] && \
|
||||||
|
mysql -e "CREATE USER '${MYSQL_USER}'@'%' IDENTIFIED BY '${MYSQL_PASSWORD}';" && \
|
||||||
|
mysql -e "GRANT ALL PRIVILEGES ON \`${MYSQL_DATABASE}\`.* TO '${MYSQL_USER}'@'%';"
|
||||||
|
mysql -e "FLUSH PRIVILEGES;"
|
||||||
|
# [ -f "/usr/bin/local/init.sql" ] && mysql "${MYSQL_DATABASE}" < /usr/bin/local/init.sql
|
||||||
|
kill "$pid" && wait "$pid"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
echo "Hello from mariadb entrypoint.sh"
|
|
||||||
echo db: $MYSQL_DATABASE
|
|
||||||
|
|
||||||
mysql_install_db
|
|
||||||
if [ -d "/var/lib/mysql/$MYSQL_DATABASE" ]
|
|
||||||
then
|
|
||||||
|
|
||||||
echo "Database already exists"
|
|
||||||
else
|
|
||||||
|
|
||||||
# Set root option so that connexion without root password is not possible
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Add a root user on 127.0.0.1 to allow remote connexion
|
|
||||||
#Flush privileges allow to your sql tables to be updated automatically when you modify it
|
|
||||||
#mysql -uroot launch mysql command line client
|
|
||||||
echo "GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY '$MYSQL_ROOT_PASSWORD'; FLUSH PRIVILEGES;" | mysql -uroot
|
|
||||||
|
|
||||||
#Create database and user in the database for wordpress
|
|
||||||
|
|
||||||
echo "CREATE DATABASE IF NOT EXISTS $MYSQL_DATABASE; GRANT ALL ON $MYSQL_DATABASE.* TO '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD'; FLUSH PRIVILEGES;" | mysql -u root
|
|
||||||
|
|
||||||
#Import database in the mysql command line
|
|
||||||
# mysql -uroot -p$MYSQL_ROOT_PASSWORD $MYSQL_DATABASE < /usr/local/bin/wordpress.sql
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
exec "$@"
|
|
||||||
@ -1,6 +1,21 @@
|
|||||||
FROM alpine:3.20
|
FROM alpine:3.20
|
||||||
|
|
||||||
RUN apk update && apk upgrade && \
|
RUN apk add --no-cache \
|
||||||
apk add --no-cache \
|
nginx \
|
||||||
nginx \
|
openssl \
|
||||||
openssl \
|
curl &&\
|
||||||
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
ARG DOMAIN_NAME
|
||||||
|
|
||||||
|
RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
|
||||||
|
-keyout /etc/ssl/private/nginx-selfsigned.key \
|
||||||
|
-out /etc/ssl/certs/nginx-selfsigned.crt \
|
||||||
|
-subj "/CN=*.${DOMAIN_NAME}"
|
||||||
|
|
||||||
|
COPY ./conf/nginx.conf /etc/nginx/nginx.conf
|
||||||
|
RUN sed -i "s/\${DOMAIN_NAME}/${DOMAIN_NAME}/g" /etc/nginx/nginx.conf
|
||||||
|
EXPOSE 443 8443
|
||||||
|
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
|
||||||
|
|||||||
88
srcs/requirements/nginx/conf/nginx.conf
Normal file
88
srcs/requirements/nginx/conf/nginx.conf
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
user nginx;
|
||||||
|
worker_processes 1;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name mail.${DOMAIN_NAME};
|
||||||
|
|
||||||
|
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
|
||||||
|
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name adminer.${DOMAIN_NAME};
|
||||||
|
|
||||||
|
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
|
||||||
|
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
|
||||||
|
|
||||||
|
location / {
|
||||||
|
fastcgi_pass adminer:9000;
|
||||||
|
fastcgi_param SCRIPT_FILENAME /var/www/html/adminer.php;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name static.${DOMAIN_NAME};
|
||||||
|
|
||||||
|
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
|
||||||
|
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://static-site:80;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name ${DOMAIN_NAME};
|
||||||
|
|
||||||
|
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
|
||||||
|
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
|
||||||
|
root /var/www/html;
|
||||||
|
|
||||||
|
index index.html index.htm index.php;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php$is_args$args;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
fastcgi_pass wordpress:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include fastcgi.conf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
srcs/requirements/redis/Dockerfile
Normal file
21
srcs/requirements/redis/Dockerfile
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
FROM alpine:3.20
|
||||||
|
|
||||||
|
# Install Redis and its dependencies
|
||||||
|
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
redis && \
|
||||||
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
# Set the working directory
|
||||||
|
WORKDIR /data
|
||||||
|
|
||||||
|
# Set Redis to run as a non-root user (optional)
|
||||||
|
|
||||||
|
RUN chown -R redis:redis /data
|
||||||
|
|
||||||
|
USER redis
|
||||||
|
|
||||||
|
# Start Redis server
|
||||||
|
CMD ["redis-server", "--protected-mode", "no"]
|
||||||
|
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
|
||||||
|
CMD redis-cli ping || exit 1
|
||||||
10
srcs/requirements/static-site/Dockerfile
Normal file
10
srcs/requirements/static-site/Dockerfile
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
FROM alpine:3.20
|
||||||
|
|
||||||
|
RUN apk add --no-cache lighttpd && \
|
||||||
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
# Copy your static site files into the web root
|
||||||
|
COPY site/ /var/www/localhost/htdocs/
|
||||||
|
|
||||||
|
# Run Lighttpd in the foreground
|
||||||
|
CMD ["lighttpd", "-D", "-f", "/etc/lighttpd/lighttpd.conf"]
|
||||||
8
srcs/requirements/static-site/site/42_Logo.svg
Normal file
8
srcs/requirements/static-site/site/42_Logo.svg
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 18.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg version="1.1" id="Calque_1" sodipodi:docname="42_logo.svg" inkscape:version="0.48.2 r9819" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 -200 960 960" enable-background="new 0 -200 960 960" xml:space="preserve">
|
||||||
|
<polygon id="polygon5" points="32,412.6 362.1,412.6 362.1,578 526.8,578 526.8,279.1 197.3,279.1 526.8,-51.1 362.1,-51.1 32,279.1 "/>
|
||||||
|
<polygon id="polygon7" points="597.9,114.2 762.7,-51.1 597.9,-51.1 "/>
|
||||||
|
<polygon id="polygon9" points="762.7,114.2 597.9,279.1 597.9,443.9 762.7,443.9 762.7,279.1 928,114.2 928,-51.1 762.7,-51.1 "/>
|
||||||
|
<polygon id="polygon11" points="928,279.1 762.7,443.9 928,443.9 "/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.1 KiB |
64
srcs/requirements/static-site/site/index.html
Normal file
64
srcs/requirements/static-site/site/index.html
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Welcome to WHAFFMAN</title>
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
background-color: #f4f4f4;
|
||||||
|
color: #333;
|
||||||
|
text-align: center;
|
||||||
|
padding: 50px;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
color: #2c3e50;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
.icon {
|
||||||
|
font-size: 100px;
|
||||||
|
color: #3498db;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.services-list {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
max-width: 400px;
|
||||||
|
margin: 30px auto 0 auto;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.services-list li {
|
||||||
|
background: #fff;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 2px 6px rgba(0,0,0,0.07);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 1.1em;
|
||||||
|
}
|
||||||
|
.services-list li i {
|
||||||
|
margin-right: 15px;
|
||||||
|
color: #3498db;
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<img src="./42_logo.svg" alt="42 Logo" style="height: 100px; margin-bottom: 20px;">
|
||||||
|
<h1>Welcome to whaffman.42.fr</h1>
|
||||||
|
<h2>Available Services</h2>
|
||||||
|
<ul class="services-list">
|
||||||
|
<li><i class="fas fa-database"></i> MariaDB</li>
|
||||||
|
<li><i class="fas fa-server"></i> Nginx</li>
|
||||||
|
<li><i class="fas fa-blog"></i> WordPress</li>
|
||||||
|
<li><i class="fas fa-cog"></i> Adminer</li>
|
||||||
|
<li><i class="fas fa-memory"></i> Redis</li>
|
||||||
|
<li><i class="fas fa-envelope"></i> Mailhog</li>
|
||||||
|
<li><i class="fas fa-globe"></i> Static Website</li>
|
||||||
|
<li><i class="fas fa-file-upload"></i> FTP</li>
|
||||||
|
<!-- Add or edit services as needed -->
|
||||||
|
</ul>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -1,3 +1,50 @@
|
|||||||
FROM alpine:3.20
|
FROM alpine:3.20
|
||||||
|
|
||||||
RUN apk update && apk upgrade
|
ARG HOST_UID
|
||||||
|
|
||||||
|
# Install WordPress and its dependencies
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
php83 \
|
||||||
|
php83-phar \
|
||||||
|
php83-fpm \
|
||||||
|
php83-mysqli \
|
||||||
|
php83-mbstring \
|
||||||
|
php83-json \
|
||||||
|
php83-curl \
|
||||||
|
php83-xml \
|
||||||
|
php83-zip \
|
||||||
|
php83-gd \
|
||||||
|
php83-session \
|
||||||
|
php83-tokenizer \
|
||||||
|
mariadb-client \
|
||||||
|
curl \
|
||||||
|
busybox-extras &&\
|
||||||
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
# Add a new user and group
|
||||||
|
# Create group with GID = HOST_UID, then user with UID = HOST_UID and GID = HOST_UID
|
||||||
|
RUN addgroup -g ${HOST_UID} wordpress && \
|
||||||
|
adduser -D -u ${HOST_UID} -G wordpress wordpress
|
||||||
|
|
||||||
|
# Set ownership of the working directory
|
||||||
|
RUN mkdir -p /var/www/html && \
|
||||||
|
chown -R wordpress:wordpress /var/www/html
|
||||||
|
|
||||||
|
# Install WP-CLI
|
||||||
|
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
|
||||||
|
chmod +x wp-cli.phar && \
|
||||||
|
mv wp-cli.phar /usr/local/bin/wp
|
||||||
|
|
||||||
|
COPY ./conf/www.conf /etc/php83/php-fpm.d/www.conf
|
||||||
|
|
||||||
|
RUN echo "memory_limit = 512M" >> /etc/php83/php.ini && \
|
||||||
|
echo 'sendmail_path = "/usr/sbin/sendmail -S mailhog:1025"' >> /etc/php83/php.ini
|
||||||
|
|
||||||
|
COPY ./tools/install.sh /usr/local/bin/install.sh
|
||||||
|
RUN chmod +x /usr/local/bin/install.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/local/bin/install.sh"]
|
||||||
|
|
||||||
|
CMD ["php-fpm83", "-F"]
|
||||||
|
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
|
||||||
|
CMD nc -z 127.0.0.1 9000 || exit 1
|
||||||
10
srcs/requirements/wordpress/conf/www.conf
Normal file
10
srcs/requirements/wordpress/conf/www.conf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[www]
|
||||||
|
listen = 0.0.0.0:9000
|
||||||
|
user = wordpress
|
||||||
|
group = wordpress
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 5
|
||||||
|
pm.start_servers = 2
|
||||||
|
pm.min_spare_servers = 1
|
||||||
|
pm.max_spare_servers = 3
|
||||||
|
catch_workers_output = yes
|
||||||
67
srcs/requirements/wordpress/tools/install.sh
Normal file
67
srcs/requirements/wordpress/tools/install.sh
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
|
if [ -f /var/www/html/wp-config.php ]; then
|
||||||
|
echo "WordPress is already installed."
|
||||||
|
exec "$@"
|
||||||
|
fi
|
||||||
|
echo "Installing WordPress..."
|
||||||
|
|
||||||
|
echo "wp core download --allow-root --path=/var/www/html"
|
||||||
|
wp core download --allow-root --path=/var/www/html
|
||||||
|
|
||||||
|
echo "wp config create --allow-root"
|
||||||
|
wp config create --allow-root \
|
||||||
|
--dbname=$MYSQL_DATABASE \
|
||||||
|
--dbuser=$MYSQL_USER \
|
||||||
|
--dbpass=$MYSQL_PASSWORD \
|
||||||
|
--dbhost=$DB_HOST \
|
||||||
|
--path=/var/www/html
|
||||||
|
|
||||||
|
echo "wp core install --allow-root"
|
||||||
|
wp core install --allow-root \
|
||||||
|
--url=$DOMAIN_NAME \
|
||||||
|
--title=$WP_TITLE \
|
||||||
|
--admin_user=$WP_ADMIN \
|
||||||
|
--admin_password=$WP_ADMIN_PASSWORD \
|
||||||
|
--admin_email=$WP_ADMIN_EMAIL \
|
||||||
|
--path=/var/www/html
|
||||||
|
|
||||||
|
echo "wp user create --allow-root"
|
||||||
|
wp user create --allow-root \
|
||||||
|
$WP_USER \
|
||||||
|
$WP_USER_EMAIL \
|
||||||
|
--role=author \
|
||||||
|
--user_pass=$WP_USER_PASSWORD \
|
||||||
|
--path=/var/www/html
|
||||||
|
|
||||||
|
echo "wp theme install --allow-root"
|
||||||
|
wp theme install --allow-root \
|
||||||
|
$WP_THEME \
|
||||||
|
--activate \
|
||||||
|
--path=/var/www/html
|
||||||
|
|
||||||
|
wp plugin install --allow-root \
|
||||||
|
redis-cache \
|
||||||
|
--activate \
|
||||||
|
--path=/var/www/html
|
||||||
|
wp config set --allow-root \
|
||||||
|
WP_REDIS_HOST \
|
||||||
|
"redis" \
|
||||||
|
--type=constant \
|
||||||
|
--path=/var/www/html
|
||||||
|
|
||||||
|
wp config set --allow-root \
|
||||||
|
WP_REDIS_PORT \
|
||||||
|
6379 \
|
||||||
|
--type=constant \
|
||||||
|
--path=/var/www/html
|
||||||
|
|
||||||
|
wp redis enable --allow-root \
|
||||||
|
--path=/var/www/html
|
||||||
|
|
||||||
|
echo "WordPress installation completed."
|
||||||
|
|
||||||
|
chown -R wordpress:wordpress /var/www/html
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
Loading…
Reference in New Issue
Block a user