TRY 00
This commit is contained in:
commit
f189d44da2
21 changed files with 758 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
__*
|
||||||
|
.__*
|
||||||
|
/.env
|
128
Makefile
Normal file
128
Makefile
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
BUILD_PATH=__build/
|
||||||
|
|
||||||
|
DOCKER=docker
|
||||||
|
MKTEMP=mktemp
|
||||||
|
|
||||||
|
include .env
|
||||||
|
export DATABASE_PWD
|
||||||
|
export DATABASE_PWD_ROOT
|
||||||
|
export VOLUMES_PATH
|
||||||
|
|
||||||
|
SRC_COMPOSE=srcs/
|
||||||
|
CERT_PATH=srcs/__cert/
|
||||||
|
CERT_PATH_FILES=$(addprefix $(CERT_PATH), ca.pem cert.key cert.crt )
|
||||||
|
|
||||||
|
.ONESHELL :
|
||||||
|
.SHELLFLAGS = -eu -c
|
||||||
|
.PHONY : run reset re cert_reset cert_re help
|
||||||
|
|
||||||
|
### pretty logs ####
|
||||||
|
|
||||||
|
_ECHO = echoo(){ \
|
||||||
|
if [ -t 1 ]; then \
|
||||||
|
echo "\e[30;47;1m$$*\e[0m"; \
|
||||||
|
else \
|
||||||
|
echo "$$*"; \
|
||||||
|
fi; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## Run the compose.
|
||||||
|
run : $(CERT_PATH_FILES)
|
||||||
|
@$(_ECHO)
|
||||||
|
|
||||||
|
echoo "Running '$(SRC_COMPOSE)'..."
|
||||||
|
cd -- $(SRC_COMPOSE)
|
||||||
|
mkdir -p $(VOLUMES_PATH)/www
|
||||||
|
mkdir -p $(VOLUMES_PATH)/db
|
||||||
|
$(DOCKER) compose up --build
|
||||||
|
>/dev/null cd -
|
||||||
|
|
||||||
|
|
||||||
|
## Remove all content of the website.
|
||||||
|
reset :
|
||||||
|
@$(_ECHO)
|
||||||
|
|
||||||
|
echoo "Resetting data..."
|
||||||
|
rm -f $(VOLUMES_PATH)/www/.installed
|
||||||
|
rm -f $(VOLUMES_PATH)/db/.installed
|
||||||
|
cd -- $(SRC_COMPOSE)
|
||||||
|
docker compose down -v
|
||||||
|
>/dev/null cd -
|
||||||
|
|
||||||
|
|
||||||
|
## 'reset' then 'run'
|
||||||
|
re : reset run
|
||||||
|
@$(_ECHO)
|
||||||
|
echo
|
||||||
|
echo "run \`make\` or \`make run\` to run the docker."
|
||||||
|
|
||||||
|
|
||||||
|
## Create the SSL certificate.
|
||||||
|
cert : $(CERT_PATH_FILES)
|
||||||
|
|
||||||
|
$(CERT_PATH_FILES) :
|
||||||
|
@$(_ECHO)
|
||||||
|
|
||||||
|
echoo "Creating SSL certificate files..."
|
||||||
|
mkdir -p $(CERT_PATH)
|
||||||
|
cd $(CERT_PATH)
|
||||||
|
|
||||||
|
echoo " -> Creating CA..."
|
||||||
|
# Create local CA
|
||||||
|
TMP_CA_KEY=$$($(MKTEMP))
|
||||||
|
openssl genrsa -out $$TMP_CA_KEY 2048
|
||||||
|
openssl req -x509 -new -nodes -key $$TMP_CA_KEY -sha256 -days 1825 -out ca.pem
|
||||||
|
|
||||||
|
echoo " -> Creating certificate for $(DOMAIN)..."
|
||||||
|
# Create certificate for $(DOMAIN)
|
||||||
|
openssl genrsa -out "cert.key" 2048
|
||||||
|
TMP_CA_CSR=$$($(MKTEMP))
|
||||||
|
openssl req -new -key cert.key -out $$TMP_CA_CSR
|
||||||
|
TMP_EXT=$$($(MKTEMP))
|
||||||
|
>>$$TMP_EXT echo "authorityKeyIdentifier=keyid,issuer"
|
||||||
|
>>$$TMP_EXT echo "basicConstraints=CA:FALSE"
|
||||||
|
>>$$TMP_EXT echo "keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment"
|
||||||
|
>>$$TMP_EXT echo "subjectAltName = @alt_names"
|
||||||
|
>>$$TMP_EXT echo ""
|
||||||
|
>>$$TMP_EXT echo "[alt_names]"
|
||||||
|
>>$$TMP_EXT echo "DNS.1 = $(DOMAIN)"
|
||||||
|
openssl x509 -req -in $$TMP_CA_CSR -CA ca.pem -CAkey $$TMP_CA_KEY \
|
||||||
|
-CAcreateserial -out cert.crt -days 825 -sha256 -extfile $$TMP_EXT
|
||||||
|
|
||||||
|
rm $$TMP_CA_KEY $$TMP_CA_CSR $$TMP_EXT
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "====="
|
||||||
|
echo "to avoid \"this website was self-signed\" warnings,"
|
||||||
|
echo "install $(CERT_PATH)/ca.pem on whatever you need i guess"
|
||||||
|
echo "====="
|
||||||
|
echo
|
||||||
|
|
||||||
|
>/dev/null cd -
|
||||||
|
|
||||||
|
|
||||||
|
## Remove the SSL certificate.
|
||||||
|
cert_reset :
|
||||||
|
@$(_ECHO)
|
||||||
|
echoo "Removing SSL certificate files..."
|
||||||
|
rm -rf $(CERT_PATH)
|
||||||
|
|
||||||
|
|
||||||
|
## 'cert_reset' then 'cert'
|
||||||
|
cert_re : cert_reset $(CERT_PATH_FILES)
|
||||||
|
|
||||||
|
|
||||||
|
## Show help
|
||||||
|
help :
|
||||||
|
@$(_ECHO)
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "run Run the compose."
|
||||||
|
echo "reset Remove all content of the website."
|
||||||
|
echo "re 'reset' then 'run'."
|
||||||
|
echo
|
||||||
|
echo "cert Create the SSL certificate."
|
||||||
|
echo "cert_reset Remove the SSL certificate."
|
||||||
|
echo "cert_re 'cert_reset' then 'cert'."
|
||||||
|
echo
|
4
env_template
Normal file
4
env_template
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
DOMAIN=mcolonna.42.fr
|
||||||
|
DATABASE_PWD=[insert_cool_password_here]
|
||||||
|
DATABASE_PWD_ROOT=[insert_other_cool_password_here]
|
||||||
|
VOLUMES_PATH=[insert_absolute_path]
|
65
srcs/docker-compose.yml
Normal file
65
srcs/docker-compose.yml
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
name: my-awesome-compose
|
||||||
|
|
||||||
|
services:
|
||||||
|
nginx:
|
||||||
|
build: ./requirements/nginx/
|
||||||
|
ports:
|
||||||
|
- 4433:443
|
||||||
|
depends_on:
|
||||||
|
wordpress:
|
||||||
|
condition: service_healthy
|
||||||
|
volumes:
|
||||||
|
- www:/www:ro
|
||||||
|
- ./__cert:/cert:ro
|
||||||
|
- ./__logs:/var/log/nginx:rw
|
||||||
|
networks:
|
||||||
|
- network
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
wordpress:
|
||||||
|
build: ./requirements/wordpress
|
||||||
|
volumes:
|
||||||
|
- www:/www:rw
|
||||||
|
depends_on:
|
||||||
|
mariadb:
|
||||||
|
condition: service_healthy
|
||||||
|
secrets:
|
||||||
|
- database-pwd
|
||||||
|
networks:
|
||||||
|
- network
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
mariadb:
|
||||||
|
build: ./requirements/mariadb
|
||||||
|
volumes:
|
||||||
|
- db:/db:rw
|
||||||
|
secrets:
|
||||||
|
- database-pwd
|
||||||
|
- database-pwd-root
|
||||||
|
networks:
|
||||||
|
- network
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
www:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
device: "${VOLUMES_PATH:?error}/www"
|
||||||
|
o: bind
|
||||||
|
db:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
device: "${VOLUMES_PATH:?error}/db"
|
||||||
|
o: bind
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
database-pwd:
|
||||||
|
environment: "DATABASE_PWD"
|
||||||
|
database-pwd-root:
|
||||||
|
environment: "DATABASE_PWD_ROOT"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
network:
|
||||||
|
driver: bridge
|
22
srcs/requirements/mariadb/Dockerfile
Normal file
22
srcs/requirements/mariadb/Dockerfile
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
FROM alpine:3.21.3
|
||||||
|
|
||||||
|
RUN apk update
|
||||||
|
RUN apk add mariadb mariadb-client
|
||||||
|
RUN apk fix
|
||||||
|
|
||||||
|
RUN rm -rf /etc/my.cnf.d/
|
||||||
|
RUN mkdir -p /etc/my.cnf.d/
|
||||||
|
COPY conf/mariadb-server.cnf /etc/my.cnf.d/mariadb-server.cnf
|
||||||
|
COPY run.sh /run.sh
|
||||||
|
COPY ismariadbrunning.sh /ismariadbrunning.sh
|
||||||
|
COPY healthcheck.sh /healthcheck.sh
|
||||||
|
|
||||||
|
RUN addgroup -S db && adduser -S db db
|
||||||
|
RUN mkdir /db
|
||||||
|
|
||||||
|
EXPOSE 3306
|
||||||
|
|
||||||
|
# start
|
||||||
|
CMD ["/run.sh"]
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=1s --timeout=10s --start-period=600s --retries=1 CMD [ "/healthcheck.sh" ]
|
6
srcs/requirements/mariadb/conf/mariadb-server.cnf
Normal file
6
srcs/requirements/mariadb/conf/mariadb-server.cnf
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[client-server]
|
||||||
|
socket=/run/mysql.sock
|
||||||
|
port=3306
|
||||||
|
|
||||||
|
[mariadb]
|
||||||
|
datadir=/db
|
5
srcs/requirements/mariadb/healthcheck.sh
Executable file
5
srcs/requirements/mariadb/healthcheck.sh
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
/ismariadbrunning.sh && [ -f /db/.dockerhealthcheck ]
|
||||||
|
exit $?
|
5
srcs/requirements/mariadb/ismariadbrunning.sh
Executable file
5
srcs/requirements/mariadb/ismariadbrunning.sh
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
! [ -z "$(netstat -tuln | grep :3306)" ]
|
||||||
|
exit $?
|
68
srcs/requirements/mariadb/run.sh
Executable file
68
srcs/requirements/mariadb/run.sh
Executable file
|
@ -0,0 +1,68 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
chmod -R +rwX /db
|
||||||
|
|
||||||
|
sql_quote()
|
||||||
|
{
|
||||||
|
echo "SELECT QUOTE(FROM_BASE64('$( echo -n "$1" | base64 )'));" | mariadb -u root -N
|
||||||
|
}
|
||||||
|
|
||||||
|
rm -f /db/.dockerhealthcheck
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
# install database if doesn't exist
|
||||||
|
if ! [ -f /db/.installed ]
|
||||||
|
then
|
||||||
|
echo "database doesn't exist."
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo ">>> clean..."
|
||||||
|
rm -rf -- $(find /db -mindepth 1 -maxdepth 1)
|
||||||
|
|
||||||
|
echo ">>> creating database..."
|
||||||
|
chmod -R 777 /db
|
||||||
|
mariadb-install-db --user=db --datadir=/db
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo ">>> running mariadbd..."
|
||||||
|
DATABASE_PWD="$(cat /run/secrets/database-pwd)"
|
||||||
|
DATABASE_PWD_ROOT="$(cat /run/secrets/database-pwd-root)"
|
||||||
|
# run mariadbd and wait for it to be working
|
||||||
|
mariadbd -u root &
|
||||||
|
while ! /ismariadbrunning.sh && kill -0 $!
|
||||||
|
do sleep 1; done
|
||||||
|
if ! kill -0 $!
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "failed when running mariadbd :("
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo ">>> configure..."
|
||||||
|
echo "
|
||||||
|
FLUSH PRIVILEGES;
|
||||||
|
CREATE DATABASE wp;
|
||||||
|
GRANT ALL PRIVILEGES ON wp.* TO db IDENTIFIED BY $( sql_quote "$DATABASE_PWD" );
|
||||||
|
ALTER USER root@localhost IDENTIFIED BY $( sql_quote "$DATABASE_PWD_ROOT" );
|
||||||
|
FLUSH PRIVILEGES;
|
||||||
|
" | mariadb -u root
|
||||||
|
kill $!
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo ">>> kill mariadbd..."
|
||||||
|
>/db/.installed echo "if this file exists, that means the database is entirely installed."
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "database created!"
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "to recreate a new database, remove the db volume of this compose."
|
||||||
|
echo
|
||||||
|
|
||||||
|
# run mariadb
|
||||||
|
touch /db/.dockerhealthcheck
|
||||||
|
mariadbd -u root
|
30
srcs/requirements/nginx/Dockerfile
Normal file
30
srcs/requirements/nginx/Dockerfile
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
FROM alpine:3.21.3
|
||||||
|
|
||||||
|
EXPOSE 443
|
||||||
|
|
||||||
|
# install curl
|
||||||
|
RUN apk update
|
||||||
|
RUN apk add curl
|
||||||
|
RUN apk fix
|
||||||
|
|
||||||
|
# install nginx
|
||||||
|
RUN printf "%s%s%s%s\n" \
|
||||||
|
"@nginx " \
|
||||||
|
"http://nginx.org/packages/alpine/v" \
|
||||||
|
`egrep -o '^[0-9]+\.[0-9]+' /etc/alpine-release` \
|
||||||
|
"/main" \
|
||||||
|
| tee -a /etc/apk/repositories
|
||||||
|
RUN curl -o /tmp/nginx_signing.rsa.pub https://nginx.org/keys/nginx_signing.rsa.pub
|
||||||
|
RUN mv /tmp/nginx_signing.rsa.pub /etc/apk/keys/
|
||||||
|
RUN apk update
|
||||||
|
RUN apk add nginx@nginx mysql-client
|
||||||
|
RUN apk fix
|
||||||
|
|
||||||
|
# add config
|
||||||
|
RUN rm /etc/nginx/nginx.conf
|
||||||
|
COPY conf/ /etc/nginx/
|
||||||
|
|
||||||
|
# start
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=1s --timeout=10s --start-period=60s --retries=1 CMD [ "/ismariarunning.sh" ]
|
48
srcs/requirements/nginx/conf/nginx.conf
Normal file
48
srcs/requirements/nginx/conf/nginx.conf
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
user nginx;
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
error_log /var/log/nginx/error.log notice;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log main;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
ssl_certificate /cert/cert.crt;
|
||||||
|
ssl_certificate_key /cert/cert.key;
|
||||||
|
ssl_protocols TLSv1.3;
|
||||||
|
error_page 497 =301 /497.php;
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log main;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /www;
|
||||||
|
index index.php;
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
include snippets/fastcgi-php.conf;
|
||||||
|
fastcgi_pass wordpress:9000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 404 /404.php;
|
||||||
|
}
|
||||||
|
}
|
15
srcs/requirements/nginx/conf/snippets/fastcgi-php.conf
Normal file
15
srcs/requirements/nginx/conf/snippets/fastcgi-php.conf
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# from https://exampleconfig.com/view/nginx-ubuntu20-04-etc-nginx-snippets-fastcgi-php-conf
|
||||||
|
|
||||||
|
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
|
||||||
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
|
|
||||||
|
# Check that the PHP script exists before passing it
|
||||||
|
try_files $fastcgi_script_name =404;
|
||||||
|
|
||||||
|
# Bypass the fact that try_files resets $fastcgi_path_info
|
||||||
|
# see: http://trac.nginx.org/nginx/ticket/321
|
||||||
|
set $path_info $fastcgi_path_info;
|
||||||
|
fastcgi_param PATH_INFO $path_info;
|
||||||
|
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include fastcgi.conf;
|
37
srcs/requirements/nginx/more/ca.pem
Normal file
37
srcs/requirements/nginx/more/ca.pem
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIGXzCCBEegAwIBAgIUSCUe1jmf7CeAOl7Er2tsvB90u3EwDQYJKoZIhvcNAQEL
|
||||||
|
BQAwgb0xCzAJBgNVBAYTAjozMQ4wDAYDVQQIDAVlYXJ0aDEVMBMGA1UEBwwMc29s
|
||||||
|
YXIgc3lzdGVtMRMwEQYDVQQKDApteWxhbiBjb3JwMS0wKwYDVQQLDCR0aGUgbWFp
|
||||||
|
biBhbmQgb25seSB1bml0IG9mIG15bGFuIGNvcnAxFTATBgNVBAMMDG15bGFuIChj
|
||||||
|
b3JwKTEsMCoGCSqGSIb3DQEJARYdbXlsYW5AbWNvbG9ubmEuNDIuZnIgcHJvYmFi
|
||||||
|
bHkwIBcNMjUwNDAyMTUxMTQwWhgPMjEyNTAzMDkxNTExNDBaMIG9MQswCQYDVQQG
|
||||||
|
EwI6MzEOMAwGA1UECAwFZWFydGgxFTATBgNVBAcMDHNvbGFyIHN5c3RlbTETMBEG
|
||||||
|
A1UECgwKbXlsYW4gY29ycDEtMCsGA1UECwwkdGhlIG1haW4gYW5kIG9ubHkgdW5p
|
||||||
|
dCBvZiBteWxhbiBjb3JwMRUwEwYDVQQDDAxteWxhbiAoY29ycCkxLDAqBgkqhkiG
|
||||||
|
9w0BCQEWHW15bGFuQG1jb2xvbm5hLjQyLmZyIHByb2JhYmx5MIICIjANBgkqhkiG
|
||||||
|
9w0BAQEFAAOCAg8AMIICCgKCAgEAtTDajPzwjjzdLnPXSAhjJKNcWJbHwMYztUQJ
|
||||||
|
1FHPA6wrLMXpjxptbSlwtJCFExpnKZDJmYPK5hA07r6jYVqL1XVXREjEUbJzJ2H7
|
||||||
|
JdAu+0/RT85WfImENqDGlVkogH4Mcp/rq/0vcrmHsUfi/dKVlb2ESVuO2cDoDfaQ
|
||||||
|
6GNDTLLlCMPBkdUkeLgABTQJNFiOTeI1hkcNoZWI0FV5LB+QlTYnJoRkUQEdV73F
|
||||||
|
rKqENRKqBMr5d5EzpDUxpiYF8Y0S3GURwBXYnFz4nzInCw8ukn+deVlh7iZzHevj
|
||||||
|
lqQqDfN47dYyG5XaPZpFoSBl6lyDiKpg+1zH54WlBxjVnBqdadsQOwbzvdMLDebp
|
||||||
|
fP2rhAuurizIQpjsuD2QCdAka8XQwuv7GH19N3ZOjcoV47jMCZBTF2PhB1S+a4Ud
|
||||||
|
oAOkOSyCJ8B8crzPGa3+7a06NMhGnEFSX4mxgw2RJM42atF/Zd3ERlds8hUcQsar
|
||||||
|
QbX4HJ8+7da47mrVcKbVWux6fM4GamRUyBP80XM0BhN2Esdz8LXSH9+Lueh3cmle
|
||||||
|
BSNMZI1T2BQBWi+Z/hrxT3Qsufc1o/yL6WR6hecH+jM6/p5Q0TzCeB2cZr3gO1eB
|
||||||
|
r4dZ/NwYy05cwZSRAFD8zxduRBGgCbRTamFTkuTJbAymthnNvJ3Xm0VdwB8W4q5p
|
||||||
|
XtoFaNUCAwEAAaNTMFEwHQYDVR0OBBYEFPpKGyjeoaBrRvUK7DGX91sfsC8aMB8G
|
||||||
|
A1UdIwQYMBaAFPpKGyjeoaBrRvUK7DGX91sfsC8aMA8GA1UdEwEB/wQFMAMBAf8w
|
||||||
|
DQYJKoZIhvcNAQELBQADggIBAAo/jDALZz0VbafsC/PTNE9jP3IofCcBmSDmjBub
|
||||||
|
RR9gArgKhlBORXQCE3phFpKGBrYy28LShykHBf6ZXsKFmdgjGkAqL0ouVsBSzgZU
|
||||||
|
tGjQrnY4sh1jCYi3Qe7L/bkgXi8Oyhi0u54dslsnN9Nr5BujJXauDRiiO5o8ZjUz
|
||||||
|
JJCJZk9OmbzyEXwm9JhgRUAzG7D8FKTsy7s8AWkj+ibb/0WasSwaDJkgQo6ndUv7
|
||||||
|
mMYxS/2Gc1HF8R5wkmGXiaU1SIIPIgNUj4E5weCcGqwBkiQ9I8TwW8d4MbSSeIoK
|
||||||
|
o6PS85cZsDYrEbm0qShpbhBdKUSdzoxDgAv0ZbQ7j7CbkuuB6Ad007NhGxogkTIy
|
||||||
|
uC5eoUdrEJ2zelC7PX4d51EvIPjXhD+YAtrgmub1dkmApEUP/yDojY9GdQpEm58P
|
||||||
|
x+NF548BK7U2PxIKPqWqEwymTkd0X4haBV7JZXgwcGulSdVpcSBVYLVQHOF3AzvP
|
||||||
|
/c7q66YodFvsUBWvjCAgVc2vRYmhchogGm1wuk4g1EO8MPnui4ySMy7d81pqS0rm
|
||||||
|
3183PN+nGtl+yTsjtcp/qrWc/CyP2V7EpcUQrLHiqzpTYJeYZPmSsfVZdfZlfef0
|
||||||
|
hVhO47vIOLGDXsCM1ymZYm/Y+dk5Rjfin7prMf0ZK9YqH7magqWH9yE+JbV6nZG8
|
||||||
|
N7cI
|
||||||
|
-----END CERTIFICATE-----
|
22
srcs/requirements/wordpress/Dockerfile
Normal file
22
srcs/requirements/wordpress/Dockerfile
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
FROM alpine:3.21.3
|
||||||
|
|
||||||
|
# EXPOSE
|
||||||
|
EXPOSE 9000
|
||||||
|
|
||||||
|
# install packages
|
||||||
|
RUN apk update
|
||||||
|
RUN apk add php-fpm php-mysqli
|
||||||
|
RUN apk fix
|
||||||
|
|
||||||
|
RUN addgroup -S www
|
||||||
|
RUN adduser -D -S -G www www
|
||||||
|
|
||||||
|
# add config
|
||||||
|
COPY /conf/ /etc/php83/
|
||||||
|
COPY /conf/wwwmore/ /conf/wwwmore/
|
||||||
|
COPY /run.sh /run.sh
|
||||||
|
|
||||||
|
# start
|
||||||
|
CMD ["/run.sh"]
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=1s --timeout=10s --start-period=3600s --retries=1 CMD [ "sh", "-c", "! [ -z \"$(netstat -tuln | grep :9000)\" ]" ]
|
1
srcs/requirements/wordpress/conf/php-fpm.conf
Normal file
1
srcs/requirements/wordpress/conf/php-fpm.conf
Normal file
|
@ -0,0 +1 @@
|
||||||
|
include=/etc/php83/php-fpm.d/*.conf
|
11
srcs/requirements/wordpress/conf/php-fpm.d/www.conf
Normal file
11
srcs/requirements/wordpress/conf/php-fpm.d/www.conf
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[www]
|
||||||
|
|
||||||
|
user = www
|
||||||
|
group = www
|
||||||
|
listen = wordpress:9000
|
||||||
|
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 5
|
||||||
|
pm.start_servers = 2
|
||||||
|
pm.min_spare_servers = 1
|
||||||
|
pm.max_spare_servers = 3
|
143
srcs/requirements/wordpress/conf/wwwmore/404.php
Normal file
143
srcs/requirements/wordpress/conf/wwwmore/404.php
Normal file
|
@ -0,0 +1,143 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>yippee</title>
|
||||||
|
<style>
|
||||||
|
|
||||||
|
* {
|
||||||
|
animation-play-state: paused;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face
|
||||||
|
{
|
||||||
|
font-family: "Varela Round";
|
||||||
|
src: url("/VarelaRound.ttf");
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.yippee {
|
||||||
|
font-size: 3em;
|
||||||
|
font-family: "Varela Round";
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes rotationoeoeoe {
|
||||||
|
0% { transform: rotate(0); }
|
||||||
|
100% { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulseyayaya {
|
||||||
|
0% { transform: scale(1); }
|
||||||
|
50% { transform: scale(1.4); }
|
||||||
|
100% { transform: scale(1); }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes rainbow {
|
||||||
|
0% { color: #f00; }
|
||||||
|
17% { color: #f00; }
|
||||||
|
17% { color: #ff0; }
|
||||||
|
33% { color: #ff0; }
|
||||||
|
33% { color: #0f0; }
|
||||||
|
50% { color: #0f0; }
|
||||||
|
50% { color: #0ff; }
|
||||||
|
67% { color: #0ff; }
|
||||||
|
67% { color: #00f; }
|
||||||
|
83% { color: #00f; }
|
||||||
|
83% { color: #f0f; }
|
||||||
|
100% { color: #f0f; }
|
||||||
|
100% { color: #f00; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.yippee {
|
||||||
|
animation-name: rotationoeoeoe;
|
||||||
|
animation-duration: 1s;
|
||||||
|
animation-timing-function: linear;
|
||||||
|
animation-iteration-count: infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.yippee > .yippeeinner {
|
||||||
|
animation-name: pulseyayaya;
|
||||||
|
animation-duration: .8s;
|
||||||
|
animation-timing-function: ease-in-out;
|
||||||
|
animation-iteration-count: infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
#one, #two, #three {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
animation-name: rainbow;
|
||||||
|
animation-duration: 1s;
|
||||||
|
animation-iteration-count: infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
#one {
|
||||||
|
z-index: 3;
|
||||||
|
color: #f00;
|
||||||
|
animation-delay: .0s;
|
||||||
|
}
|
||||||
|
|
||||||
|
#one > .yippee {
|
||||||
|
animation-delay: .0s;
|
||||||
|
}
|
||||||
|
|
||||||
|
#one > .yippee > .yippeeinner {
|
||||||
|
animation-delay: .0s;
|
||||||
|
}
|
||||||
|
|
||||||
|
#two {
|
||||||
|
z-index: 2;
|
||||||
|
color: #0f0;
|
||||||
|
opacity: .50;
|
||||||
|
animation-delay: .1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
#two > .yippee {
|
||||||
|
animation-delay: .05s;
|
||||||
|
}
|
||||||
|
|
||||||
|
#two > .yippee > .yippeeinner {
|
||||||
|
animation-delay: .05s;
|
||||||
|
}
|
||||||
|
|
||||||
|
#three {
|
||||||
|
z-index: 1;
|
||||||
|
color: #00f;
|
||||||
|
opacity: .33;
|
||||||
|
animation-delay: .2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
#three > .yippee {
|
||||||
|
animation-delay: .1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
#three > .yippee > .yippeeinner {
|
||||||
|
animation-delay: .1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
animation-play-state: running;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="one"><div class="yippee"><div class="yippeeinner">4 0 4</div></div></div>
|
||||||
|
<div id="two"><div class="yippee"><div class="yippeeinner">4 0 4</div></div></div>
|
||||||
|
<div id="three"><div class="yippee"><div class="yippeeinner">4 0 4</div></div></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
3
srcs/requirements/wordpress/conf/wwwmore/497.php
Normal file
3
srcs/requirements/wordpress/conf/wwwmore/497.php
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<?php
|
||||||
|
http_response_code(301);
|
||||||
|
header("Location: https://" . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI']);
|
BIN
srcs/requirements/wordpress/conf/wwwmore/VarelaRound.ttf
Normal file
BIN
srcs/requirements/wordpress/conf/wwwmore/VarelaRound.ttf
Normal file
Binary file not shown.
102
srcs/requirements/wordpress/conf/wwwmore/wp-config.php
Normal file
102
srcs/requirements/wordpress/conf/wwwmore/wp-config.php
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The base configuration for WordPress
|
||||||
|
*
|
||||||
|
* The wp-config.php creation script uses this file during the installation.
|
||||||
|
* You don't have to use the website, you can copy this file to "wp-config.php"
|
||||||
|
* and fill in the values.
|
||||||
|
*
|
||||||
|
* This file contains the following configurations:
|
||||||
|
*
|
||||||
|
* * Database settings
|
||||||
|
* * Secret keys
|
||||||
|
* * Database table prefix
|
||||||
|
* * ABSPATH
|
||||||
|
*
|
||||||
|
* @link https://developer.wordpress.org/advanced-administration/wordpress/wp-config/
|
||||||
|
*
|
||||||
|
* @package WordPress
|
||||||
|
*/
|
||||||
|
|
||||||
|
// ** Database settings - You can get this info from your web host ** //
|
||||||
|
/** The name of the database for WordPress */
|
||||||
|
define( 'DB_NAME', 'wp' );
|
||||||
|
|
||||||
|
/** Database username */
|
||||||
|
define( 'DB_USER', 'db' );
|
||||||
|
|
||||||
|
/** Database password */
|
||||||
|
define( 'DB_PASSWORD', `cat /run/secrets/database-pwd` );
|
||||||
|
|
||||||
|
/** Database hostname */
|
||||||
|
define( 'DB_HOST', 'mariadb:3306' );
|
||||||
|
|
||||||
|
/** Database charset to use in creating database tables. */
|
||||||
|
define( 'DB_CHARSET', 'utf8' );
|
||||||
|
|
||||||
|
/** The database collate type. Don't change this if in doubt. */
|
||||||
|
define( 'DB_COLLATE', '' );
|
||||||
|
|
||||||
|
/**#@+
|
||||||
|
* Authentication unique keys and salts.
|
||||||
|
*
|
||||||
|
* Change these to different unique phrases! You can generate these using
|
||||||
|
* the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
|
||||||
|
*
|
||||||
|
* You can change these at any point in time to invalidate all existing cookies.
|
||||||
|
* This will force all users to have to log in again.
|
||||||
|
*
|
||||||
|
* @since 2.6.0
|
||||||
|
*/
|
||||||
|
define('AUTH_KEY', 'Uy[FLsUl1v7j]g;Wki6Wm`Bj-eaN(U-7Bi:*?V^kw4AGljWA{0@7_5f$$ziS;OiP');
|
||||||
|
define('SECURE_AUTH_KEY', '_$gvxQP0M4okT|-`/r$np!2zmdb[|YMo@7.kY.N![6SD.-U#[]<)ErHH-p2}nzh<');
|
||||||
|
define('LOGGED_IN_KEY', 'F~X|uM-i4asv*i>c]EE<+5<X;L0D@W+,:$^g]V1$T|V2>BAo{3/)5Oc|(U30#2An');
|
||||||
|
define('NONCE_KEY', 'EwQ+Jo#/Zr-I_,nJu|)i1.Bfzm:b!5d.ku%%+Ihw.)l-]0y 2^;=4HR1XB$B!;m66');
|
||||||
|
define('AUTH_SALT', 'p_&.BA.mTs]RQEM(Q@F0yB`.@INfW@6L-<%%cd*@I-w iOlEqC@[I0aLbuYNLk}O9');
|
||||||
|
define('SECURE_AUTH_SALT', '$H?b*kvJ:uA6DyPLwAJsh8:n}P.:[-N<,$/zl?,|`Vu++qC}F,{YKw&8CM`@@d*t');
|
||||||
|
define('LOGGED_IN_SALT', ',6~y7[-Z}Hj/d&C!M[_|FD]R0>YMTO)s}xD`?.{ Ich:>5j!W`T9~~wef-WLJ:U#');
|
||||||
|
define('NONCE_SALT', '%%-8d||zvI0s,giZmR7Lk(nhG|uH8c~U{kdB|2.v?Z+@3hr&nlk<@V22;.Ef8chSv');
|
||||||
|
|
||||||
|
/**#@-*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WordPress database table prefix.
|
||||||
|
*
|
||||||
|
* You can have multiple installations in one database if you give each
|
||||||
|
* a unique prefix. Only numbers, letters, and underscores please!
|
||||||
|
*
|
||||||
|
* At the installation time, database tables are created with the specified prefix.
|
||||||
|
* Changing this value after WordPress is installed will make your site think
|
||||||
|
* it has not been installed.
|
||||||
|
*
|
||||||
|
* @link https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#table-prefix
|
||||||
|
*/
|
||||||
|
$table_prefix = 'wp_';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For developers: WordPress debugging mode.
|
||||||
|
*
|
||||||
|
* Change this to true to enable the display of notices during development.
|
||||||
|
* It is strongly recommended that plugin and theme developers use WP_DEBUG
|
||||||
|
* in their development environments.
|
||||||
|
*
|
||||||
|
* For information on other constants that can be used for debugging,
|
||||||
|
* visit the documentation.
|
||||||
|
*
|
||||||
|
* @link https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/
|
||||||
|
*/
|
||||||
|
define( 'WP_DEBUG', false );
|
||||||
|
|
||||||
|
/* Add any custom values between this line and the "stop editing" line. */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* That's all, stop editing! Happy publishing. */
|
||||||
|
|
||||||
|
/** Absolute path to the WordPress directory. */
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
define( 'ABSPATH', __DIR__ . '/' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sets up WordPress vars and included files. */
|
||||||
|
require_once ABSPATH . 'wp-settings.php';
|
40
srcs/requirements/wordpress/run.sh
Executable file
40
srcs/requirements/wordpress/run.sh
Executable file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
dirisempty()
|
||||||
|
{
|
||||||
|
[ -z "$( ls -A "$1" )" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
chmod -R +rwX /www
|
||||||
|
|
||||||
|
if ! [ -f /www/.installed ]
|
||||||
|
then
|
||||||
|
echo "clean..."
|
||||||
|
rm -rf -- $(find /www -mindepth 1 -maxdepth 1)
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "download and uncompress wordpress release..."
|
||||||
|
apk add curl
|
||||||
|
apk fix
|
||||||
|
rm -rf /build
|
||||||
|
mkdir -p "/build/www/"
|
||||||
|
curl https://wordpress.org/latest.tar.gz | tar zx -C /build/www
|
||||||
|
chmod -R 777 /www
|
||||||
|
mv $(find /build/www/wordpress -maxdepth 1 -mindepth 1) /www
|
||||||
|
rm -rf /build
|
||||||
|
echo
|
||||||
|
echo "add files from /conf/wwwmore/"
|
||||||
|
echo
|
||||||
|
cp -p -r /conf/wwwmore/. /www
|
||||||
|
>/www/.installed echo "if this file exists, that means the database is entirely installed."
|
||||||
|
echo "www directory created!"
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "to recreate the www directory, remove the www volume of this compose."
|
||||||
|
echo
|
||||||
|
|
||||||
|
php-fpm83 -F
|
Loading…
Add table
Reference in a new issue