am i done
This commit is contained in:
parent
8deb1c3223
commit
b647c5f014
15
setup.sh
Executable file
15
setup.sh
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SUBDOMAINS=(
|
||||||
|
"whaffman.42.fr" "mail.whaffman.42.fr" "adminer.whaffman.42.fr" "ftp.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
|
||||||
@ -18,6 +18,7 @@ services:
|
|||||||
- data_mariadb:/var/lib/mysql
|
- data_mariadb:/var/lib/mysql
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
container_name: nginx
|
container_name: nginx
|
||||||
build:
|
build:
|
||||||
@ -26,18 +27,25 @@ services:
|
|||||||
args:
|
args:
|
||||||
DOMAIN_NAME: ${DOMAIN_NAME}
|
DOMAIN_NAME: ${DOMAIN_NAME}
|
||||||
depends_on:
|
depends_on:
|
||||||
- wordpress
|
wordpress:
|
||||||
|
condition: service_healthy
|
||||||
|
mailhog:
|
||||||
|
condition: service_healthy
|
||||||
|
adminer:
|
||||||
|
condition: service_healthy
|
||||||
environment:
|
environment:
|
||||||
- DOMAIN_NAME=${DOMAIN_NAME}
|
- DOMAIN_NAME=${DOMAIN_NAME}
|
||||||
ports:
|
ports:
|
||||||
- '443:443'
|
- '443:443'
|
||||||
- '8443:8443'
|
- '8443:8443'
|
||||||
|
- '8080:8080'
|
||||||
networks:
|
networks:
|
||||||
- docker-network
|
- docker-network
|
||||||
volumes:
|
volumes:
|
||||||
- data_wordpress:/var/www/html
|
- data_wordpress:/var/www/html
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
|
||||||
wordpress:
|
wordpress:
|
||||||
container_name: wordpress
|
container_name: wordpress
|
||||||
build:
|
build:
|
||||||
@ -46,7 +54,12 @@ services:
|
|||||||
args:
|
args:
|
||||||
HOST_UID: ${HOST_UID:-1000}
|
HOST_UID: ${HOST_UID:-1000}
|
||||||
depends_on:
|
depends_on:
|
||||||
- mariadb
|
mariadb:
|
||||||
|
condition: service_healthy
|
||||||
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
|
mailhog:
|
||||||
|
condition: service_healthy
|
||||||
environment:
|
environment:
|
||||||
- DOMAIN_NAME=${DOMAIN_NAME}
|
- DOMAIN_NAME=${DOMAIN_NAME}
|
||||||
|
|
||||||
@ -91,7 +104,8 @@ services:
|
|||||||
args:
|
args:
|
||||||
HOST_UID: ${HOST_UID:-1000}
|
HOST_UID: ${HOST_UID:-1000}
|
||||||
depends_on:
|
depends_on:
|
||||||
- wordpress
|
wordpress:
|
||||||
|
condition: service_healthy
|
||||||
environment:
|
environment:
|
||||||
- FTP_USER=${FTP_USER}
|
- FTP_USER=${FTP_USER}
|
||||||
- FTP_PASS=${FTP_PASS}
|
- FTP_PASS=${FTP_PASS}
|
||||||
@ -112,7 +126,8 @@ services:
|
|||||||
context: ./requirements/adminer
|
context: ./requirements/adminer
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
depends_on:
|
depends_on:
|
||||||
- mariadb
|
mariadb:
|
||||||
|
condition: service_healthy
|
||||||
environment:
|
environment:
|
||||||
- ADMINER_DEFAULT_SERVER=mariadb
|
- ADMINER_DEFAULT_SERVER=mariadb
|
||||||
networks:
|
networks:
|
||||||
@ -130,7 +145,16 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- HOST_UID=${HOST_UID:-1000}=value
|
- 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:
|
||||||
|
|||||||
@ -10,6 +10,7 @@ RUN apk add --no-cache \
|
|||||||
php83-session \
|
php83-session \
|
||||||
php83-json \
|
php83-json \
|
||||||
mariadb-client \
|
mariadb-client \
|
||||||
|
netcat-openbsd \
|
||||||
curl && \
|
curl && \
|
||||||
rm -rf /var/cache/apk/*
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ RUN mkdir -p /var/www/html && \
|
|||||||
|
|
||||||
COPY ./conf/www.conf /etc/php83/php-fpm.d/www.conf
|
COPY ./conf/www.conf /etc/php83/php-fpm.d/www.conf
|
||||||
|
|
||||||
EXPOSE 9000
|
|
||||||
|
|
||||||
CMD ["php-fpm83", "-F"]
|
CMD ["php-fpm83", "-F"]
|
||||||
|
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
|
||||||
|
CMD nc -z 127.0.0.1 9000 || exit 1
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ ARG HOST_UID=1000
|
|||||||
|
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
vsftpd \
|
vsftpd \
|
||||||
|
netcat-openbsd \
|
||||||
&& rm -rf /var/cache/apk/*
|
&& rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
COPY ./conf/vsftpd.conf /etc/vsftpd/vsftpd.conf
|
COPY ./conf/vsftpd.conf /etc/vsftpd/vsftpd.conf
|
||||||
@ -14,5 +15,5 @@ RUN chmod +x /docker-entrypoint.sh
|
|||||||
EXPOSE 20 21 30000-30009
|
EXPOSE 20 21 30000-30009
|
||||||
|
|
||||||
CMD ["/docker-entrypoint.sh"]
|
CMD ["/docker-entrypoint.sh"]
|
||||||
# HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||||
# CMD nc -z localhost 21 || exit 1
|
CMD nc -z localhost 21 || exit 1
|
||||||
@ -3,6 +3,7 @@ FROM alpine:3.21 AS builder
|
|||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
go \
|
go \
|
||||||
git \
|
git \
|
||||||
|
netcat-openbsd \
|
||||||
&& rm -rf /var/cache/apk/*
|
&& rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
ENV GOROOT /usr/lib/go
|
ENV GOROOT /usr/lib/go
|
||||||
@ -26,4 +27,4 @@ COPY --from=builder /go/bin/MailHog /usr/local/bin/MailHog
|
|||||||
CMD ["MailHog"]
|
CMD ["MailHog"]
|
||||||
|
|
||||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||||
CMD curl --silent --fail http://localhost:8025/ || exit 1
|
CMD nc -z localhost 8025 || exit 1
|
||||||
@ -9,11 +9,12 @@ RUN apk add --no-cache \
|
|||||||
ARG DOMAIN_NAME
|
ARG DOMAIN_NAME
|
||||||
|
|
||||||
RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
|
RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
|
||||||
-keyout /etc/ssl/private/nginx-selfsigned.key \
|
-keyout /etc/ssl/private/nginx-selfsigned.key \
|
||||||
-out /etc/ssl/certs/nginx-selfsigned.crt \
|
-out /etc/ssl/certs/nginx-selfsigned.crt \
|
||||||
-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 8443
|
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
|
||||||
|
|||||||
@ -5,6 +5,7 @@ events {
|
|||||||
worker_connections 1024;
|
worker_connections 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
http {
|
http {
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
default_type application/octet-stream;
|
default_type application/octet-stream;
|
||||||
@ -32,6 +33,7 @@ http {
|
|||||||
fastcgi_index adminer.php;
|
fastcgi_index adminer.php;
|
||||||
include fastcgi.conf;
|
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;
|
||||||
@ -41,6 +43,14 @@ http {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 8080;
|
||||||
|
server_name ${DOMAIN_NAME};
|
||||||
|
location / {
|
||||||
|
proxy_pass http://static-site:80;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 8443 ssl;
|
listen 8443 ssl;
|
||||||
server_name ${DOMAIN_NAME};
|
server_name ${DOMAIN_NAME};
|
||||||
|
|||||||
@ -16,4 +16,6 @@ RUN chown -R redis:redis /data
|
|||||||
USER redis
|
USER redis
|
||||||
|
|
||||||
# Start Redis server
|
# Start Redis server
|
||||||
CMD ["redis-server", "--protected-mode", "no"]
|
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>
|
||||||
@ -6,7 +6,7 @@ if [ -f /var/www/html/wp-config.php ]; then
|
|||||||
exec "$@"
|
exec "$@"
|
||||||
fi
|
fi
|
||||||
echo "Installing WordPress..."
|
echo "Installing WordPress..."
|
||||||
sleep 10
|
|
||||||
echo "wp core download --allow-root --path=/var/www/html"
|
echo "wp core download --allow-root --path=/var/www/html"
|
||||||
wp core download --allow-root --path=/var/www/html
|
wp core download --allow-root --path=/var/www/html
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user