work well? no makefile

This commit is contained in:
kinou-p 2022-09-22 23:12:18 +02:00
parent 318680cfcf
commit 3dd1f9329f
13 changed files with 374 additions and 70 deletions

View File

@ -0,0 +1,15 @@
WP_URL=apommier.42.fr
WP_TITLE=wordpress
WP_DB_HOST=mariadb
WP_ADMIN_LOGIN=admin
WP_ADMIN_PASSWORD=admin
WP_ADMIN_EMAIL=admin@42.fr
WP_USER_LOGIN=apommier
WP_USER_PASSWORD=apommier
WP_USER_EMAIL=apommier@student.42.fr
MARIADB_DATABASE=wordpress
MARIADB_USER=apommier
MARIADB_PASSWORD=1234

View File

@ -3,62 +3,60 @@ version: '3.3'
services: services:
nginx: nginx:
build: ./requirements/nginx build: requirements/nginx/
#image: nginx:stable-alpine container_name: nginx
#container_name: nginx environment:
- DOMAIN_NAME=apommier.42.fr
- SSL_CERTIFICATE=/etc/ssl/certs/nginx-selfsigned.crt
- SSL_CERTIFICATE_KEY=/etc/ssl/private/nginx-selfsigned.key
depends_on: depends_on:
- php - wordpress
- mysql
ports: ports:
- 80:80
- 443:443 - 443:443
- 80:80
volumes: volumes:
#- wpfiles:/var/www/html
- ./wordpress:/var/www/html - ./wordpress:/var/www/html
- ./wordpress:/var/www/html3 restart: unless-stopped
- ./wordpress:/var/www/html2
#- ./requirements/nginx/conf/nginx.conf:/etc/nginx/conf.d/default.conf
networks: networks:
- wpnetwork - wpnetwork
restart: always
php: wordpress:
#build: ./requirements/wordpress build: ./requirements/wordpress
image: php:7.4-fpm-alpine
volumes: volumes:
# - wpfiles:/var/www/html # - wpfiles:/var/www/html
- ./wordpress:/var/www/html - ./wordpress:/var/www/html
depends_on: depends_on:
- mysql - mariadb
networks: networks:
- wpnetwork - wpnetwork
#restart: always restart: unless-stopped
mysql: mariadb:
#build: ./requirements/mariadb build: ./requirements/mariadb
image: mysql:latest container_name: mariadb
#image: mariadb:latest
#container_name: mariadb #container_name: mariadb
environment: #environment:
#MARIADB_DATABASE: wp # MARIADB_DATABASE: wp
#MARIADB_USER: wp # MARIADB_USER: wp
#MARIADB_PASSWORD: secret # MARIADB_PASSWORD: secret
#MARIADB_ROOT_PASSWORD: secret # MARIADB_ROOT_PASSWORD: secret
MYSQL_DATABASE: wp #mariadb_DATABASE: wp
MYSQL_USER: wp #mariadb_USER: wp
MYSQL_PASSWORD: secret #mariadb_PASSWORD: secret
MYSQL_ROOT_PASSWORD: secret #mariadb_ROOT_PASSWORD: secret
volumes: volumes:
#- ./requirements/mariadb:/var/lib/mysql #- ./requirements/mariadb:/var/lib/mariadb
#- wpfiles:/var/www/html #- wpfiles:/var/www/html
- ./wordpress:/var/www/html - ./wordpress:/var/www/html
networks: networks:
- wpnetwork - wpnetwork
#restart: always restart: unless-stopped
networks: networks:
wpnetwork: wpnetwork:
driver: bridge driver: bridge
#volumes: volumes:
# wpfiles: wpfiles:

View File

@ -11,7 +11,13 @@
# **************************************************************************** # # **************************************************************************** #
FROM debian:buster FROM debian:buster
RUN apt-get update -y
RUN apt-get install -y mariadb-client mariadb-common mariadb-server
RUN sed -i 's/bind-address/bind-address = 0.0.0.0 #/i' /etc/mysql/mariadb.conf.d/50-server.cnf
RUN mkdir /mysql_scripts
COPY ./tools/ /mysql_scripts/
#COPY ./conf/server.conf /etc/mysql/mariadb.conf.d/
RUN apt-get update RUN service mysql start && mysql < /mysql_scripts/mySqlScript.sql
RUN apt-get -y install mariadb-server
RUN apt-get -y install mariadb-client CMD ["mysqld"]

View File

@ -0,0 +1,133 @@
#
#These groups are read by MariaDB server.
#Use it for options that only the server (but not clients) should see
#
#See the examples of server my.cnf files in /usr/share/mysql
#this is read by the standalone daemon and embedded servers
[server]
#this is only for the mysqld standalone daemon
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /run/mysqld/mysqld.pid
socket = /run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
#skip-external-locking
#Instead of skip-networking the default is now to listen only on
#localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
#
# * Fine Tuning
#
#key_buffer_size = 16M
#max_allowed_packet = 16M
#thread_stack = 192K
#thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
#myisam_recover_options = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
#query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Enable the slow query log to see queries with especially long duration
#slow_query_log_file = /var/log/mysql/mariadb-slow.log
#long_query_time = 10
#log_slow_rate_limit = 1000
#log_slow_verbosity = query_plan
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
#max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = exclude_database_name
#
# * Security Features
#
# Read the manual, too, if you want chroot!
#chroot = /var/lib/mysql/
#
# For generating SSL certificates you can use for example the GUI tool "tinyca".
#
#ssl-ca = /etc/mysql/cacert.pem
#ssl-cert = /etc/mysql/server-cert.pem
#ssl-key = /etc/mysql/server-key.pem
#
# Accept only connections using the latest and most secure TLS protocol version.
# ..when MariaDB is compiled with OpenSSL:
#ssl-cipher = TLSv1.2
# ..when MariaDB is compiled with YaSSL (default in Debian):
#ssl = on
#
# * Character sets
#
# MySQL/MariaDB default is Latin1, but in Debian we rather default to the full
# utf8 4-byte character set. See also client.cnf
#
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Unix socket authentication plugin is built-in since 10.0.22-6
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/
# this is only for embedded server
[embedded]
# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]
# This group is only read by MariaDB-10.3 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.3]

View File

@ -0,0 +1,4 @@
create database if not exists wordpress;
create user apommier@'%' identified by '1234';
grant all privileges on *.* to apommier@'%';
flush privileges;

View File

@ -0,0 +1 @@
/usr/bin/mysqld_safe --datadir='/home/mariadb'

View File

@ -10,23 +10,15 @@
# # # #
# **************************************************************************** # # **************************************************************************** #
FROM debian:buster FROM debian:buster
RUN su RUN apt update -y
RUN apt update && apt upgrade -y RUN apt-get install -y nginx openssl
RUN apt install nginx sudo -y
#COPY /home/apommier/42/inception/srcs/wordpresse/ var/www/html
RUN ls var/www/ RUN mkdir -p /etc/ssl/private
#CMD ["echo","-----------new-----------"] RUN mkdir -p /etc/ssl/certs
#CMD ["ls","var/www/"] RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt -subj "/C=FR/ST=17/L=StJeanDeLiversay/O=42/CN=apommier"
#CMD ["echo","-----------new-----------"]
#CMD ["ls","var/www/html"] COPY conf/nginx2.conf /etc/nginx/conf.d/default.conf
#CMD ["echo","-----------new-----------"]
#CMD ["ls","var/www/html2"] ENTRYPOINT ["nginx", "-g", "daemon off;"]
#CMD ["echo","-----------new-----------"]
#CMD ["ls","var/www/html3"]
ENTRYPOINT ["nginx","-g","daemon off;"]
#RUN cd var/www/html && ls && cat index.php
#RUN ls var/www/
#RUN sudo service nginx restart

View File

@ -6,7 +6,7 @@ server {
root /var/www/html2; root /var/www/html2;
index index.php; index index.php index.html;
location / { location / {
autoindex on; autoindex on;

View File

@ -0,0 +1,26 @@
server {
listen 443 ssl;
listen 80;
server_name apommier.42.fr;
ssl_protocols TLSv1.3;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key //etc/ssl/private/nginx-selfsigned.key;
index index.php;
root /var/www/html;
autoindex on;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include fastcgi.conf;
fastcgi_pass wordpress:9000;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
}
}

View File

@ -13,24 +13,15 @@
FROM debian:buster FROM debian:buster
RUN apt-get update RUN apt-get update
RUN apt install -y php-fpm RUN apt-get -y install php7.3 php-mysqli php-fpm wget sendmail sudo
RUN apt install -y wget
RUN apt install -y tar
WORKDIR /var/www/html EXPOSE 9000
#RUN wget https://wordpress.org/latest.tar.gz #COPY ./conf/www.conf /etc/php/7.3/fpm/pool.d
#RUN tar -xzvf latest.tar.gz COPY ./tools /var/www/tools
#RUN ls
#RUN ls /var
#RUN mkdir /var/www
#RUN mv ./wordpress /var/www/html
RUN apt install -y php-mysql RUN chmod +x /var/www/tools/start.sh
RUN apt install -y php-gd
RUN apt install -y php-mysqli
#RUN service php restart ENTRYPOINT [ "/var/www/tools/start.sh" ]
CMD ["/usr/sbin/php-fpm7.3", "--nodaemonize"]
#RUN docker-php-ext-install mysqli pdo pdo_mysql && docker-php-ext-enable pdo_mysql

View File

@ -0,0 +1,9 @@
[www]
user = www-data
group = www-data
listen = wordpress:9000
pm = dynamic
pm.start_servers = 6
pm.max_children = 25
pm.min_spare_servers = 2
pm.max_spare_servers = 10

View File

@ -0,0 +1,31 @@
#!/bin/bash
sed -i "s/listen = \/run\/php\/php7.3-fpm.sock/listen = 9000/" "/etc/php/7.3/fpm/pool.d/www.conf";
# chown -R www-data:www-data /var/www/*;
# chown -R 755 /var/www/*;
mkdir -p /run/php/;
touch /run/php/php7.3-fpm.pid;
if [ ! -f /var/www/html/wp-config.php ]; then
echo "Wordpress: setting up..."
mkdir -p /var/www/html
wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar;
chmod +x wp-cli.phar;
mv wp-cli.phar /usr/local/bin/wp;
cd /var/www/html;
echo "Wordpress: downloading..."
wp core download --locale=fr_FR --allow-root;
#echo "Wordpress: creating users admin..."
echo "Wordpress: configuration..."
mv /var/www/tools/wp-config.php /var/www/html/
#wp config create --dbname=${MARIADB_DATABASE} --dbuser=${MARIADB_USER} --dbpass=${MARIADB_PASSWORD} --dbhost=${WP_DB_HOST} --allow-root;
echo "Wordpress: installation...";
wp core install --url=apommier.42.fr --title=CoUcoU --admin_user=admin --admin_password=admin --admin_email=admin@42.fr --skip-email --allow-root;
echo "Wordpress: create user...";
#wp user create --allow-root ${WP_USER_LOGIN} ${WP_USER_EMAIL} --user_pass=${WP_USER_PASSWORD};
wp user create apommier apommier@student.42.fr --user_pass=1234 --allow-root;
#sudo -u ${USER} -i -- wp user create ${WP_USER_LOGIN} apommier@student.42.fr --user_pass=${WP_USER_PASSWORD};
echo "Wordpress: set up!"
fi
exec "$@"

View File

@ -0,0 +1,98 @@
<?php
/**
* La configuration de base de votre installation WordPress.
*
* Ce fichier est utilisé par le script de création de wp-config.php pendant
* le processus dinstallation. Vous navez pas à utiliser le site web, vous
* pouvez simplement renommer ce fichier en « wp-config.php » et remplir les
* valeurs.
*
* Ce fichier contient les réglages de configuration suivants :
*
* Réglages MySQL
* Préfixe de table
* Clés secrètes
* Langue utilisée
* ABSPATH
*
* @link https://fr.wordpress.org/support/article/editing-wp-config-php/.
*
* @package WordPress
*/
// ** Réglages MySQL - Votre hébergeur doit vous fournir ces informations. ** //
/** Nom de la base de données de WordPress. */
define( 'DB_NAME', 'wordpress' );
/** Utilisateur de la base de données MySQL. */
define( 'DB_USER', 'apommier' );
/** Mot de passe de la base de données MySQL. */
define( 'DB_PASSWORD', '1234' );
/** Adresse de lhébergement MySQL. */
define( 'DB_HOST', 'mariadb' );
/** Jeu de caractères à utiliser par la base de données lors de la création des tables. */
define( 'DB_CHARSET', 'utf8mb4' );
/**
* Type de collation de la base de données.
* Ny touchez que si vous savez ce que vous faites.
*/
define( 'DB_COLLATE', '' );
/**#@+
* Clés uniques dauthentification et salage.
*
* Remplacez les valeurs par défaut par des phrases uniques !
* Vous pouvez générer des phrases aléatoires en utilisant
* {@link https://api.wordpress.org/secret-key/1.1/salt/ le service de clés secrètes de WordPress.org}.
* Vous pouvez modifier ces phrases à nimporte quel moment, afin dinvalider tous les cookies existants.
* Cela forcera également tous les utilisateurs à se reconnecter.
*
* @since 2.6.0
*/
define( 'AUTH_KEY', 'Vm(p!{}6_cxF rTYP`I=)!l&60xm9MR?^**D:>_=r2;(P}<-Qi ZnAL%G3n CQWA' );
define( 'SECURE_AUTH_KEY', 'T+2K-V&%Nb0+lvfRvom)BMt&aNXM:G`3!y>HwXk*tf=j:cR5!fccpWxAv5b&v`Qe' );
define( 'LOGGED_IN_KEY', '3FV[c{H<[z<~d=m{-;5#g&5iZk{,Ceke76tc%CTGbksQvT),i=PoVz}bet;(dD+5' );
define( 'NONCE_KEY', 'G>:_Ja?N<5ySFU?,g=[7?k~&tf)sFqElCa~Og.mpYhK* =eD4l6cLBa7O)m.yN)#' );
define( 'AUTH_SALT', 'O,[H`{.h 6<~YG XUkw}&B6>/o]}<@9I apmJ PQ(%WsTI>jWvKPAUS`m<cftLL:' );
define( 'SECURE_AUTH_SALT', 'H`i~!l[G(;U ,;Nq$SI-H5>4hdxy`Q$2kC3ZSLMrdFm^(W*xeG=lg/Xe%GKaIdX&' );
define( 'LOGGED_IN_SALT', '2!0~FjHbN9&*7)-hzL$l~xQ6alaEm|1T0e2A9 71LsUF(kc&Cx<R4Y/PXG8X|`9|' );
define( 'NONCE_SALT', 'k7:._><Zk<ZOTp+WOwXr!wuIOqdg6Z3!HYlBXx m20~lEhXQ`!|W(Qv^/p9mZ.ro' );
/**#@-*/
/**
* Préfixe de base de données pour les tables de WordPress.
*
* Vous pouvez installer plusieurs WordPress sur une seule base de données
* si vous leur donnez chacune un préfixe unique.
* Nutilisez que des chiffres, des lettres non-accentuées, et des caractères soulignés !
*/
$table_prefix = 'wp_';
/**
* Pour les développeurs : le mode déboguage de WordPress.
*
* En passant la valeur suivante à "true", vous activez laffichage des
* notifications derreurs pendant vos essais.
* Il est fortement recommandé que les développeurs dextensions et
* de thèmes se servent de WP_DEBUG dans leur environnement de
* développement.
*
* Pour plus dinformation sur les autres constantes qui peuvent être utilisées
* pour le déboguage, rendez-vous sur le Codex.
*
* @link https://fr.wordpress.org/support/article/debugging-in-wordpress/
*/
define( 'WP_DEBUG', false );
/* Cest tout, ne touchez pas à ce qui suit ! Bonne publication. */
/** Chemin absolu vers le dossier de WordPress. */
if ( ! defined( 'ABSPATH' ) )
define( 'ABSPATH', dirname( __FILE__ ) . '/' );
/** Réglage des variables de WordPress et de ses fichiers inclus. */
require_once( ABSPATH . 'wp-settings.php' );