From 055ccdc1df2a1e00c21ddef20ec85dc12feda670 Mon Sep 17 00:00:00 2001 From: keyzox Date: Wed, 5 Mar 2025 20:17:37 +0100 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=8F=97=EF=B8=8F=E3=80=8D=20wip:?= =?UTF-8?q?=20Need=20to=20fix=20fileEnv=20func=20to=20rm=20newline=20at=20?= =?UTF-8?q?the=20env?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 1 + srcs/configs/wordpress/entry/configure-wp.sh | 14 +++++++------- srcs/docker-compose.yml | 12 ++++++------ srcs/docker/bonus/vsftpd/Dockerfile | 2 +- srcs/docker/mariadb/Dockerfile | 4 +++- srcs/internal/env/env_util.go | 4 ++++ 6 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 1a8db1f..236a7f2 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,7 @@ clean: stop docker system prune -f fclean: clean + sudo rm -Rf /home/adjoly/data/*/* docker system prune -af docker volume prune -af diff --git a/srcs/configs/wordpress/entry/configure-wp.sh b/srcs/configs/wordpress/entry/configure-wp.sh index 444d8b4..0d46878 100755 --- a/srcs/configs/wordpress/entry/configure-wp.sh +++ b/srcs/configs/wordpress/entry/configure-wp.sh @@ -1,14 +1,14 @@ #!/bin/sh WP_DIR="/var/www/wordpress" -#WP_VERSION="6.7.2" +WP_VERSION="6.7.2" -#if [ -f "$WP_DIR/index.php" ]; then -# echo "Already downloaded wordpress, skipping..." -#else -# echo "Downloading Wordpress ${WP_VERSION}" -# wp --allow-root core download --version=${WP_VERSION} --path=${WP_DIR} -#fi +if [ -f "$WP_DIR/index.php" ]; then + echo "Already downloaded wordpress, skipping..." +else + echo "Downloading Wordpress ${WP_VERSION}" + wp --allow-root core download --version=${WP_VERSION} --path=${WP_DIR} +fi if [ -f "${WP_DIR}/wp-config.php" ]; then diff --git a/srcs/docker-compose.yml b/srcs/docker-compose.yml index 21b0f34..94f982b 100644 --- a/srcs/docker-compose.yml +++ b/srcs/docker-compose.yml @@ -65,7 +65,7 @@ services: - ./configs/nginx/entry:/docker-entrypoint.d - nginx-certs:/etc/nginx/ssl ports: - - "8443:443" + - "443:443" restart: unless-stopped wordpress-php: @@ -110,10 +110,10 @@ services: networks: - inception environment: - - MYSQL_ROOT_PASSWORD=alpine - - MYSQL_PASSWORD=alpine - - MYSQL_USER=kanel - - MYSQL_DATABASE=knl + - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/root-db-pass + - MYSQL_PASSWORD_FILE=/run/secrets/user-db-pass + - MYSQL_USER=${DB_USER} + - MYSQL_DATABASE=${DB_NAME} volumes: - wp-db:/var/lib/mysql secrets: @@ -196,7 +196,7 @@ services: volumes: - wp-site:/var/ftp ports: - - 2100:21 + - 21:21 - 30000-30100:30000-30100 secrets: - ftp-pass diff --git a/srcs/docker/bonus/vsftpd/Dockerfile b/srcs/docker/bonus/vsftpd/Dockerfile index 13d5e0e..1551398 100644 --- a/srcs/docker/bonus/vsftpd/Dockerfile +++ b/srcs/docker/bonus/vsftpd/Dockerfile @@ -27,7 +27,7 @@ EXPOSE 21 EXPOSE 30000-30100 VOLUME /var/ftp -STOPSIGNAL SIGTERM +STOPSIGNAL SIGKILL ENTRYPOINT [ "/docker-entrypoint" ] diff --git a/srcs/docker/mariadb/Dockerfile b/srcs/docker/mariadb/Dockerfile index e7c3f71..54ff97f 100644 --- a/srcs/docker/mariadb/Dockerfile +++ b/srcs/docker/mariadb/Dockerfile @@ -11,7 +11,8 @@ COPY internal /build/internal RUN cd /build \ && go build git.keyzox.me/42_adjoly/inception/cmd/mariadb/entrypoint \ - && go build git.keyzox.me/42_adjoly/inception/cmd/mariadb/healthcheck + && go build git.keyzox.me/42_adjoly/inception/cmd/mariadb/healthcheck \ + && go build git.keyzox.me/42_adjoly/inception/cmd/getFileEnv FROM scratch ADD docker/alpine/alpine-minirootfs-3.21.2-x86_64.tar.gz / @@ -24,6 +25,7 @@ RUN addgroup mysql \ COPY --from=builder /build/entrypoint /docker-entrypoint COPY --from=builder /build/healthcheck /docker-healthcheck +COPY --from=builder /build/getFileEnv /bin/getFileEnv RUN apk add --no-cache mariadb tzdata mariadb-client \ && chmod +x /docker-healthcheck \ diff --git a/srcs/internal/env/env_util.go b/srcs/internal/env/env_util.go index 350a648..9131c36 100644 --- a/srcs/internal/env/env_util.go +++ b/srcs/internal/env/env_util.go @@ -7,6 +7,10 @@ import ( "git.keyzox.me/42_adjoly/inception/internal/log" ) +func removeNl(in string) string { + +} + // Check if the "Value" exist in the env if not check if a "Value_FILE" exist and if still not just return default value func FileEnv(Value, Default string) string { val, is := os.LookupEnv(Value)