This commit is contained in:
djonker 2023-08-09 01:02:09 +02:00
parent ba9e246176
commit 91c7952d63
10 changed files with 24 additions and 32 deletions

View File

@ -12,4 +12,4 @@ down:
clean: down clean: down
yes | sudo docker system prune -a yes | sudo docker system prune -a
rm -rf ~/data ./build sudo rm -rf ./data ./build

View File

@ -3,23 +3,29 @@ nginx reverse proxy TLS 1.3 and 1.2 Only..
Wordpress served by php-fpm with 1 admin and 1 user and redis cache Wordpress served by php-fpm with 1 admin and 1 user and redis cache
Mariadb Mariadb
FTP Server pointing to the wordpress volume FTP Server pointing to the wordpress volume
Adminer
Redis # PID 1
init: true
# /etc/hosts
127.0.0.1 djonker.42.fr
# Volumes # Volumes
all in /home/user/data all in /home/user/data
mariadb database mariadb database
wordpress html wordpress html
# Read about # Variables
PID1 > use bash as pid1 the first process, and user it to spawn the target service so orphans get adopted.
.env .env
# Adminer # Adminer
create dockerfile create dockerfile
# Redis
create dockerfile
# Website # Website
I need to create a simple html website. copy simple website from nextcloud
# Extra service # Extra service
Nextcloud? Nextcloud?

View File

@ -0,0 +1 @@
MARIADBPASSWD=mariapassword

View File

@ -2,15 +2,13 @@ version: '3'
services: services:
nginx: nginx:
build: ./srcs/requirements/nginx build: ./requirements/nginx
container_name: nginx container_name: nginx
restart: always restart: always
volumes: volumes:
- ~/data/nginx/config:/etc/nginx - ../data/nginx/config:/etc/nginx
- ~/data/nginx/log/error.log:/var/log/error.log - ../data/nginx/log/error.log:/var/log/error.log
- ~/data/nginx/log/access.log:/var/log/access.log - ../data/nginx/log/access.log:/var/log/access.log
- /etc/letsencrypt/:/etc/letsencrypt/
- /etc/localtime:/etc/localtime:ro
ports: ports:
- 80:80 - 80:80
- 443:443 - 443:443
@ -18,24 +16,22 @@ services:
wordpress: wordpress:
ipv4_address: 172.20.30.10 ipv4_address: 172.20.30.10
mariadb: mariadb:
build: ./srcs/requirements/mariadb build: ./requirements/mariadb
container_name: mariadb container_name: mariadb
restart: always restart: always
volumes: volumes:
- ~/data/mariadb/data:/var/lib/mysql - ../data/mariadb/data:/var/lib/mysql
- ~/data/mariadb/config:/etc/mysql/conf.d - ../data/mariadb/config:/etc/mysql/conf.d
- ~/data/mariadb/logs:/var/log/mysql - ../data/mariadb/logs:/var/log/mysql
- /etc/localtime:/etc/localtime:ro
networks: networks:
wordpress: wordpress:
ipv4_address: 172.20.30.20 ipv4_address: 172.20.30.20
wordpress: wordpress:
build: ./srcs/requirements/wordpress build: ./requirements/wordpress
container_name: wordpress container_name: wordpress
restart: always restart: always
volumes: volumes:
- ~/data/wordpress:/var/www - ../data/wordpress:/var/www
- /etc/localtime:/etc/localtime:ro
networks: networks:
wordpress: wordpress:
ipv4_address: 172.20.30.30 ipv4_address: 172.20.30.30

View File

@ -3,7 +3,6 @@ RUN sleep 10
RUN apk update RUN apk update
RUN apk add mariadb RUN apk add mariadb
RUN apk add mariadb-client RUN apk add mariadb-client
RUN apk add telegraf
COPY srcs/start.sh /root/start.sh COPY srcs/start.sh /root/start.sh
COPY srcs/my.cnf /etc/my.cnf.d/mariadb-server.cnf COPY srcs/my.cnf /etc/my.cnf.d/mariadb-server.cnf
COPY srcs/maria.sql /root/maria.sql COPY srcs/maria.sql /root/maria.sql

View File

@ -1,5 +1,4 @@
#!/bin/sh #!/bin/sh
telegraf &
if cat /var/lib/mysql/initialized if cat /var/lib/mysql/initialized
then then
touch /var/lib/mysql/initialized touch /var/lib/mysql/initialized

View File

@ -1,10 +1,8 @@
FROM alpine FROM alpine
RUN sleep 10 RUN sleep 10
RUN apk update RUN apk update
RUN apk add openssh
RUN apk add openssl RUN apk add openssl
RUN apk add nginx RUN apk add nginx
RUN apk add telegraf
COPY srcs/start.sh /root/start.sh COPY srcs/start.sh /root/start.sh
COPY srcs/nginx.conf /etc/nginx/nginx.conf COPY srcs/nginx.conf /etc/nginx/nginx.conf
COPY srcs/index.html /var/www/index.html COPY srcs/index.html /var/www/index.html
@ -17,8 +15,6 @@ RUN openssl x509 -req -days 365 -in nginx.csr -signkey nginx.key -out nginx.crt
RUN mv nginx.crt /etc/ssl/certs/nginx.crt RUN mv nginx.crt /etc/ssl/certs/nginx.crt
RUN mv nginx.key /etc/ssl/private/nginx.key RUN mv nginx.key /etc/ssl/private/nginx.key
RUN chmod 600 /etc/ssl/certs/nginx.crt /etc/ssl/private/nginx.key RUN chmod 600 /etc/ssl/certs/nginx.crt /etc/ssl/private/nginx.key
RUN ssh-keygen -A
CMD sh start.sh CMD sh start.sh
EXPOSE 80/tcp EXPOSE 80/tcp
EXPOSE 443/tcp EXPOSE 443/tcp
EXPOSE 22/tcp

View File

@ -1,4 +1,2 @@
#!/bin/sh #!/bin/sh
/usr/sbin/sshd
telegraf &
nginx -g 'daemon off;' nginx -g 'daemon off;'

View File

@ -12,7 +12,6 @@ RUN apk add php-json
RUN apk add php-xml RUN apk add php-xml
RUN apk add php-zip RUN apk add php-zip
COPY srcs/start.sh /root/start.sh COPY srcs/start.sh /root/start.sh
COPY srcs/nginx.conf /etc/nginx/nginx.conf
COPY srcs/wordpress.conf /var/www/wordpress/wp-config.php COPY srcs/wordpress.conf /var/www/wordpress/wp-config.php
WORKDIR /root/ WORKDIR /root/
RUN wget https://wordpress.org/latest.tar.gz RUN wget https://wordpress.org/latest.tar.gz

View File

@ -1,4 +1,2 @@
#!/bin/sh #!/bin/sh
telegraf & php-fpm
php-fpm7 &
nginx -g 'daemon off;'