bla
This commit is contained in:
parent
8b40da9fd2
commit
2bce8efb23
14
Makefile
14
Makefile
@ -2,15 +2,11 @@ all: up
|
|||||||
|
|
||||||
build:
|
build:
|
||||||
sudo docker network create --subnet=172.20.30.0/24 wordpress
|
sudo docker network create --subnet=172.20.30.0/24 wordpress
|
||||||
sudo mkdir -p ./build /home/djonker/data/adminer
|
sudo mkdir -p ./build /home/djonker/data/adminer /home/djonker/data/wordpress
|
||||||
sudo curl -f https://wordpress.org/latest.tar.gz --output /home/djonker/data/latest.tar.gz
|
sudo cp srcs/requirements/wordpress/srcs/wordpress.conf /home/djonker/data/wordpress/wp-config.php.temp
|
||||||
sudo tar -xvf /home/djonker/data/latest.tar.gz
|
sudo curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||||
sudo mv wordpress /home/djonker/data/wordpress
|
sudo mv wp-cli.phar /home/djonker/data/wordpress/wp-cli.phar
|
||||||
sudo cp srcs/requirements/wordpress/srcs/wordpress.conf /home/djonker/data/wordpress/wp-config.php
|
sudo chmod +x /home/djonker/data/wordpress/wp-cli.phar
|
||||||
sudo curl -f https://downloads.wordpress.org/plugin/w3-total-cache.2.4.1.zip --output /home/djonker/data/rediscache.zip
|
|
||||||
sudo unzip /home/djonker/data/rediscache.zip
|
|
||||||
sudo mv w3-total-cache /home/djonker/data/wordpress/wp-content/plugins/w3-total-cache
|
|
||||||
sudo chown -R 33:33 /home/djonker/data/wordpress
|
|
||||||
sudo curl -L https://github.com/vrana/adminer/releases/download/v4.8.1/adminer-4.8.1.php --output /home/djonker/data/adminer/adminer.php
|
sudo curl -L https://github.com/vrana/adminer/releases/download/v4.8.1/adminer-4.8.1.php --output /home/djonker/data/adminer/adminer.php
|
||||||
|
|
||||||
up: build
|
up: build
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
WORDPRESSDATABASEPASSWD=password
|
WORDPRESSDATABASEPASSWD=password
|
||||||
WORDPRESSDATABASEUSER=wordpress
|
WORDPRESSDATABASEUSER=wordpress
|
||||||
WORDPRESSDATABASE=wordpress
|
WORDPRESSDATABASE=wordpress
|
||||||
|
WPADMINUSER=djonker
|
||||||
|
WPADMINPASSWD=password
|
||||||
|
WPADMINEMAIL=danny@houtworm.email
|
||||||
|
WPUSERUSER=user42
|
||||||
|
WPUSERPASSWD=password
|
||||||
|
WPUSEREMAIL=user42@houtworm.email
|
||||||
|
@ -33,6 +33,17 @@ services:
|
|||||||
ipv4_address: 172.20.30.20
|
ipv4_address: 172.20.30.20
|
||||||
wordpress:
|
wordpress:
|
||||||
build: ./requirements/wordpress
|
build: ./requirements/wordpress
|
||||||
|
environment:
|
||||||
|
- WORDPRESSDATABASE=${WORDPRESSDATABASE}
|
||||||
|
- WORDPRESSDATABASEUSER=${WORDPRESSDATABASEUSER}
|
||||||
|
- WORDPRESSDATABASEPASSWD=${WORDPRESSDATABASEPASSWD}
|
||||||
|
- WPADMINUSER=${WPADMINUSER}
|
||||||
|
- WPADMINPASSWD=${WPADMINPASSWD}
|
||||||
|
- WPADMINEMAIL=${WPADMINEMAIL}
|
||||||
|
- WPUSERUSER=${WPUSERUSER}
|
||||||
|
- WPUSERPASSWD=${WPUSERPASSWD}
|
||||||
|
- WPUSEREMAIL=${WPUSEREMAIL}
|
||||||
|
init: true
|
||||||
container_name: wordpress
|
container_name: wordpress
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -6,7 +6,7 @@ else
|
|||||||
mysql_install_db --user=mysql --datadir=/var/lib/mysql
|
mysql_install_db --user=mysql --datadir=/var/lib/mysql
|
||||||
mysqld & sleep 10
|
mysqld & sleep 10
|
||||||
mysql -e "CREATE DATABASE $WORDPRESSDATABASE"
|
mysql -e "CREATE DATABASE $WORDPRESSDATABASE"
|
||||||
mysql wordpress < wordpress.sql
|
#mysql wordpress < wordpress.sql
|
||||||
mysql -e "GRANT ALL PRIVILEGES ON $WORDPRESSDATABASE.* TO $WORDPRESSDATABASEUSER@172.20.30.30 IDENTIFIED BY '$WORDPRESSDATABASEPASSWD'"
|
mysql -e "GRANT ALL PRIVILEGES ON $WORDPRESSDATABASE.* TO $WORDPRESSDATABASEUSER@172.20.30.30 IDENTIFIED BY '$WORDPRESSDATABASEPASSWD'"
|
||||||
mysql -e "GRANT ALL PRIVILEGES ON $WORDPRESSDATABASE.* TO $WORDPRESSDATABASEUSER@172.20.30.40 IDENTIFIED BY '$WORDPRESSDATABASEPASSWD'"
|
mysql -e "GRANT ALL PRIVILEGES ON $WORDPRESSDATABASE.* TO $WORDPRESSDATABASEUSER@172.20.30.40 IDENTIFIED BY '$WORDPRESSDATABASEPASSWD'"
|
||||||
killall mysqld
|
killall mysqld
|
||||||
|
@ -3,4 +3,5 @@ RUN sleep 10
|
|||||||
RUN apk update
|
RUN apk update
|
||||||
RUN apk add redis
|
RUN apk add redis
|
||||||
WORKDIR /root/
|
WORKDIR /root/
|
||||||
CMD sh redis-server
|
CMD redis-server --protected-mode no
|
||||||
|
EXPOSE 6379/tcp
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
FROM alpine
|
FROM alpine
|
||||||
|
ARG WORDPRESSDATABASE=${WORDPRESSDATABASE}
|
||||||
|
ARG WORDPRESSDATABASEUSER=${WORDPRESSDATABASEUSER}
|
||||||
|
ARG WORDPRESSDATABASEPASSWD=${WORDPRESSDATABASEPASSWD}
|
||||||
|
ARG WPADMINUSER=${WPADMINUSER}
|
||||||
|
ARG WPADMINPASSWD=$(WPADMINPASSWD)
|
||||||
|
ARG WPADMINEMAIL=$(WPADMINEMAIL)
|
||||||
RUN sleep 10
|
RUN sleep 10
|
||||||
RUN apk update
|
RUN apk update
|
||||||
RUN apk add openssl
|
RUN apk add openssl
|
||||||
@ -11,8 +17,10 @@ RUN apk add php-curl
|
|||||||
RUN apk add php-json
|
RUN apk add php-json
|
||||||
RUN apk add php-xml
|
RUN apk add php-xml
|
||||||
RUN apk add php-zip
|
RUN apk add php-zip
|
||||||
|
RUN apk add php-phar
|
||||||
|
COPY srcs/start.sh /root/start.sh
|
||||||
COPY srcs/www.conf /etc/php81/php-fpm.d/www.conf
|
COPY srcs/www.conf /etc/php81/php-fpm.d/www.conf
|
||||||
COPY srcs/wordpress.conf /var/www/wordpress/wp-config.php
|
COPY srcs/wordpress.conf /var/www/wordpress/wp-config.php
|
||||||
WORKDIR /root/
|
WORKDIR /root/
|
||||||
CMD php-fpm81 -F -R
|
CMD sh start.sh
|
||||||
EXPOSE 9000/tcp
|
EXPOSE 9000/tcp
|
||||||
|
20
srcs/requirements/wordpress/srcs/start.sh
Normal file
20
srcs/requirements/wordpress/srcs/start.sh
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
if cat /var/www/wordpress/wp-config.php
|
||||||
|
then
|
||||||
|
touch /var/www/wordpress/wp-config.php
|
||||||
|
else
|
||||||
|
sleep 15
|
||||||
|
cd /var/www/wordpress
|
||||||
|
mv wp-cli.phar /usr/bin/wpcli
|
||||||
|
mv wp-config.php.temp wp-config.php
|
||||||
|
sed -i "23i define( 'DB_NAME', '${WORDPRESSDATABASE}' );" wp-config.php
|
||||||
|
sed -i "26i define( 'DB_USER', '${WORDPRESSDATABASEUSER}' );" wp-config.php
|
||||||
|
sed -i "29i define( 'DB_PASSWORD', '${WORDPRESSDATABASEPASSWD}' );" wp-config.php
|
||||||
|
wpcli core download
|
||||||
|
wpcli core install --url=https://djonker.42.fr --title=Wordpress --admin_user=${WPADMINUSER} --admin_password=${WPADMINPASSWD} --admin_email=${WPADMINEMAIL}
|
||||||
|
wpcli user create ${WPUSERUSER} ${WPUSEREMAIL} --user_pass=${WPUSERPASSWD} --role=subscriber
|
||||||
|
wpcli plugin install redis-cache --activate
|
||||||
|
chown -R 1000:1000 /var/www/wordpress
|
||||||
|
fi
|
||||||
|
wpcli redis enable
|
||||||
|
php-fpm81 -F -R
|
@ -20,13 +20,10 @@
|
|||||||
|
|
||||||
// ** MySQL settings - You can get this info from your web host ** //
|
// ** MySQL settings - You can get this info from your web host ** //
|
||||||
/** The name of the database for WordPress */
|
/** The name of the database for WordPress */
|
||||||
define( 'DB_NAME', 'wordpress' );
|
|
||||||
|
|
||||||
/** MySQL database username */
|
/** MySQL database username */
|
||||||
define( 'DB_USER', 'wordpress' );
|
|
||||||
|
|
||||||
/** MySQL database password */
|
/** MySQL database password */
|
||||||
define( 'DB_PASSWORD', 'password' );
|
|
||||||
|
|
||||||
/** MySQL hostname */
|
/** MySQL hostname */
|
||||||
define( 'DB_HOST', '172.20.30.20' );
|
define( 'DB_HOST', '172.20.30.20' );
|
||||||
@ -81,6 +78,11 @@ $table_prefix = 'wp_';
|
|||||||
* @link https://wordpress.org/support/article/debugging-in-wordpress/
|
* @link https://wordpress.org/support/article/debugging-in-wordpress/
|
||||||
*/
|
*/
|
||||||
define( 'WP_DEBUG', false );
|
define( 'WP_DEBUG', false );
|
||||||
|
define( 'WP_REDIS_HOST', '172.20.30.50' );
|
||||||
|
define( 'WP_REDIS_PORT', 6379 );
|
||||||
|
define( 'WP_REDIS_TIMEOUT', 1 );
|
||||||
|
define( 'WP_REDIS_READ_TIMEOUT', 1 );
|
||||||
|
define( 'WP_REDIS_DATABASE', 0 );
|
||||||
/* That's all, stop editing! Happy publishing. */
|
/* That's all, stop editing! Happy publishing. */
|
||||||
|
|
||||||
/** Absolute path to the WordPress directory. */
|
/** Absolute path to the WordPress directory. */
|
||||||
|
Loading…
Reference in New Issue
Block a user