From 1b48f4b6d30d5a63fe6b4ef85c4581275d9822d8 Mon Sep 17 00:00:00 2001 From: hugo gogo Date: Fri, 9 Sep 2022 13:59:35 +0200 Subject: [PATCH] trying to install wordpress with cli --- NetrwTreeListing 9 | 0 README.md | 23 +++++++++-------- srcs/requirements/mariadb/Dockerfile | 19 +++++++++----- srcs/requirements/mariadb/secret.txt | 1 - srcs/requirements/nginx/Dockerfile | 4 ++- srcs/requirements/wordpress/Dockerfile | 34 ++++++++++++-------------- 6 files changed, 45 insertions(+), 36 deletions(-) create mode 100644 NetrwTreeListing 9 delete mode 100644 srcs/requirements/mariadb/secret.txt diff --git a/NetrwTreeListing 9 b/NetrwTreeListing 9 new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md index 109f787..33f9fd3 100644 --- a/README.md +++ b/README.md @@ -136,20 +136,13 @@ - [conf file in conf.d or sites-available ?](https://serverfault.com/questions/527630/difference-in-sites-available-vs-sites-enabled-vs-conf-d-directories-nginx#answer-870709) - [command line parameters](https://nginx.org/en/docs/switches.html) - `sudo nginx -t` will launch a test to evaluate config file +- [configuring nginx with php-fpm](https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/#connecting-nginx-to-php-fpm) #### openssl - [openssl faq](https://www.openssl.org/docs/faq.html) - [openssl req man](https://www.openssl.org/docs/man1.0.2/man1/openssl-req.html) - [SO discussion about ssl self signed certificate and becoming a CA](https://stackoverflow.com/questions/10175812/how-to-generate-a-self-signed-ssl-certificate-using-openssl) -#### wordpress -- [install wp](https://wordpress.org/support/article/how-to-install-wordpress/#detailed-instructions) -- [install wp with wp-cli](https://make.wordpress.org/cli/handbook/how-to-install/) - - ###### install wp - - wget https://wordpress.org/latest.tar.gz - - tar -xzvf latest.tar.gz - #### mariadb - [mariadb tutorial](https://www.mariadbtutorial.com/) - server vs client : @@ -193,6 +186,16 @@ ``` -#### php-fpm -- [](https://en.wikipedia.org/wiki/FastCGI) +#### wordpress +- [install wp](https://wordpress.org/support/article/how-to-install-wordpress/#detailed-instructions) + + ###### install wp + - wget https://wordpress.org/latest.tar.gz + - tar -xzvf latest.tar.gz + +- [install wp with wp-cli](https://make.wordpress.org/cli/handbook/how-to-install/) +- [php-fpm : Fastcgi Process Manager](https://en.wikipedia.org/wiki/FastCGI) +- [install wp-cli](https://make.wordpress.org/cli/handbook/guides/installing/) +- [cli commands](https://developer.wordpress.org/cli/commands/) +- [cli install wordpress](https://make.wordpress.org/cli/handbook/how-to-install/) diff --git a/srcs/requirements/mariadb/Dockerfile b/srcs/requirements/mariadb/Dockerfile index 9b0034a..4b104b8 100644 --- a/srcs/requirements/mariadb/Dockerfile +++ b/srcs/requirements/mariadb/Dockerfile @@ -4,14 +4,21 @@ ARG DB_NAME ARG DB_USER ARG DB_PSWD -RUN apt update && \ - apt install -y mariadb-client mariadb-server && \ - rm -rf /var/lib/apt/lists/* && \ - \ - service mysql start && \ +RUN apt update && apt install -y \ + mariadb-client \ + mariadb-server \ + && \ + rm -rf /var/lib/apt/lists/* + +# configure wp database +RUN service mysql start && \ mariadb --execute="CREATE DATABASE ${DB_NAME};" && \ mariadb --execute="CREATE USER '${DB_USER}'@'localhost' IDENTIFIED BY '${DB_PSWD}';" && \ - mariadb --execute="GRANT ALL PRIVILEGES ON *.* TO '${DB_USER}'@'localhost' with grant option;" + mariadb --execute="GRANT ALL PRIVILEGES ON &{DB_NAME}.* TO '${DB_USER}'@'localhost' with grant option;" + +# alternative : (https://mariadb.com/resources/blog/how-to-install-and-run-wordpress-with-mariadb/) +# create database new_wp; +# grant all privileges on new_wp.* to wpuser@localhost identified by 'myp@Ssw0Rd'; CMD [ "mysqld" ] diff --git a/srcs/requirements/mariadb/secret.txt b/srcs/requirements/mariadb/secret.txt deleted file mode 100644 index 1b01264..0000000 --- a/srcs/requirements/mariadb/secret.txt +++ /dev/null @@ -1 +0,0 @@ -mon_super_mot_de_passe diff --git a/srcs/requirements/nginx/Dockerfile b/srcs/requirements/nginx/Dockerfile index b6be10c..e8d86e6 100644 --- a/srcs/requirements/nginx/Dockerfile +++ b/srcs/requirements/nginx/Dockerfile @@ -1,6 +1,8 @@ FROM debian:buster -RUN apt update && apt install -y nginx openssl && rm -rf /var/lib/apt/lists/* +RUN apt update && \ + apt install -y nginx openssl && \ + rm -rf /var/lib/apt/lists/* # for debug #RUN apt install -y procps vim diff --git a/srcs/requirements/wordpress/Dockerfile b/srcs/requirements/wordpress/Dockerfile index f37198b..7a0cbd8 100644 --- a/srcs/requirements/wordpress/Dockerfile +++ b/srcs/requirements/wordpress/Dockerfile @@ -1,22 +1,20 @@ FROM debian:buster -#RUN wget https://wordpress.org/latest.tar.gz ; tar -xzvf latest.tar.gz +RUN apt update && apt install -y \ + php7.3 \ + curl -## for debug -#RUN apt install -y procps vim -# -## create ssl certificate -#RUN openssl req -newkey rsa:2048 -nodes -x509 \ -# -keyout /etc/ssl/private/hulamy.42.fr.key -out /etc/ssl/certs/hulamy.42.fr.crt \ -# -subj "/C=fr/ST=ile-de-france/L=paris/O=42/OU=inception/CN=hulamy.42.fr" -# -## import sites conf files -#COPY ./conf/nginx.conf /etc/nginx/ -#COPY ./conf/inception_nginx.conf /etc/nginx/conf.d/ -# -## for test -#COPY ./conf/index.html /data/www/ -#COPY ./conf/https/index.html /data/wwws/ -# -#CMD [ "nginx", "-g", "daemon off;" ] +# install wp-cli : https://make.wordpress.org/cli/handbook/guides/installing/ +#RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar &&\ +# chmod +x wp-cli.phar && \ +# sudo mv wp-cli.phar /usr/local/bin/wp + +# install wordpress with cli : https://make.wordpress.org/cli/handbook/how-to-install/ +#RUN wp core download --path=${WP_DIR} +# create config file : +#RUN wp config create --dbname=${DB_NAME} --dbuser=${DB_USER} --dbpass=${DB_PASS} --path=${WP_DIR} +# create db : +#RUN wp db create --path=${WP_DIR} +# install wordpress : +#RUN wp core install --url=${WP_URL} --title=${WP_TITLE} --admin_user=${WP_ADMIN} --admin_password=${WP_ADMIN_PSWD} --admin_email=${WP_ADMIN_EMAIL} --path=${WP_DIR}