-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
363d3bb
commit 3207316
Showing
11 changed files
with
224 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
DATA_PATH = /home/dkarhan/data | ||
|
||
up: makeFolder | ||
cd srcs && docker-compose up -d | ||
|
||
build: makeFolder | ||
cd srcs && docker-compose build | ||
|
||
start: | ||
cd srcs && docker-compose start | ||
|
||
stop: | ||
cd srcs && docker-compose stop | ||
|
||
down: | ||
cd srcs && docker-compose down | ||
|
||
makeFolder: | ||
@mkdir -p ${DATA_PATH} | ||
@mkdir -p ${DATA_PATH}/wordpress | ||
@mkdir -p ${DATA_PATH}/db | ||
|
||
clean: down | ||
sudo rm -rf ${DATA_PATH} | ||
docker system prune -af | ||
|
||
re: clean up | ||
|
||
.PHONY: run clean stop reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
version: '3' | ||
services: | ||
mariadb: | ||
build: requirements/mariadb/ | ||
container_name: mariadb | ||
restart: always | ||
volumes: | ||
- DB:/var/lib/mysql | ||
env_file: | ||
- .env | ||
ports: | ||
- "3306" | ||
networks: | ||
- inception-network | ||
wordpress: | ||
build: requirements/wordpress/ | ||
depends_on: | ||
- mariadb | ||
container_name: wordpress | ||
restart: always | ||
volumes: | ||
- WordPress:/var/www/wordpress | ||
ports: | ||
- "9000" | ||
networks: | ||
- inception-network | ||
env_file: | ||
- .env | ||
nginx: | ||
build: requirements/nginx/ | ||
container_name: nginx | ||
ports: | ||
- "443:443" | ||
restart: always | ||
volumes: | ||
- WordPress:/var/www/wordpress | ||
networks: | ||
- inception-network | ||
depends_on: | ||
- wordpress | ||
env_file: | ||
- .env | ||
networks: | ||
inception-network: | ||
driver: bridge | ||
volumes: | ||
WordPress: | ||
driver: local | ||
driver_opts: | ||
type: 'none' | ||
o: 'bind' | ||
device: '/home/dkarhan/data/wordpress' | ||
DB: | ||
driver: local | ||
driver_opts: | ||
type: 'none' | ||
o: 'bind' | ||
device: '/home/dkarhan/data/db' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM debian:10.12 | ||
|
||
RUN apt-get update && apt-get upgrade -y && apt-get install mariadb-server -y | ||
|
||
COPY conf/50-server.cnf /etc/mysql/mariadb.conf.d/50-server.cnf | ||
COPY tools/start.sh /start.sh | ||
|
||
EXPOSE 3306 | ||
|
||
ENTRYPOINT ["sh", "start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[mysql] | ||
default-character-set=utf8 | ||
|
||
[mysqld] | ||
datadir = /var/lib/mysql | ||
socket = /run/mysqld/mysqld.sock | ||
bind_address = * | ||
port = 3306 | ||
user = mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
service mysql start; | ||
mysql -e "CREATE DATABASE IF NOT EXISTS \`${DATABASE_NAME}\`;" | ||
mysql -e "CREATE USER IF NOT EXISTS \`${DATABASE_USER}\`@'localhost' IDENTIFIED BY '${DATABASE_PASSWORD}';" | ||
mysql -e "GRANT ALL PRIVILEGES ON \`${DATABASE_NAME}\`.* TO \`${DATABASE_USER}\`@'%' IDENTIFIED BY '${DATABASE_PASSWORD}';" | ||
mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '${DATABASE_ROOT_PASSWORD}';" | ||
mysql -e "FLUSH PRIVILEGES;" | ||
mysqladmin -u root -p$DATABASE_ROOT_PASSWORD shutdown | ||
exec mysqld_safe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM debian:10.12 | ||
|
||
RUN apt-get update && apt-get upgrade -y && apt install nginx openssl -y | ||
RUN mkdir -p /etc/nginx/ssl && openssl req -newkey rsa:4096 -x509 -days 365 -nodes \ | ||
-out /etc/ssl/MyCert.crt \ | ||
-keyout /etc/ssl/MyKey.key \ | ||
-subj "/C=FR/ST=PACA/L=NICE/O=42/OU=42/CN=dkarhan.42.fr/UID=dkarhan" | ||
|
||
COPY conf/nginx.conf /etc/nginx/nginx.conf | ||
COPY tools/start.sh . | ||
|
||
RUN chmod 777 /var/www/html | ||
RUN chown -R www-data:www-data /var/www/html | ||
RUN chmod +x start.sh | ||
|
||
ENTRYPOINT [ "sh", "start.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
events {} | ||
|
||
http{ | ||
include /etc/nginx/mime.types; | ||
server { | ||
listen 443 ssl; | ||
listen [::]:443 ssl; | ||
server_name DOMAINE_NAME; | ||
ssl on; | ||
ssl_protocols TLSv1.2 TLSv1.3; | ||
ssl_certificate /etc/ssl/MyCert.crt; | ||
ssl_certificate_key /etc/ssl/MyKey.key; | ||
|
||
if ($scheme = http) { | ||
return 301 https://$server_name$request_uri; | ||
} | ||
root /var/www/wordpress; | ||
index index.php; | ||
location / { | ||
try_files $uri $uri/ =404; | ||
} | ||
location ~ \.php$ { | ||
include snippets/fastcgi-php.conf; | ||
fastcgi_pass wordpress:9000; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
sed -i.bak "s/DOMAINE_NAME/$DOMAINE_NAME/g" /etc/nginx/nginx.conf | ||
rm /etc/nginx/nginx.conf.bak | ||
nginx -g 'daemon off;' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM debian:10.12 | ||
|
||
RUN apt-get update && apt-get upgrade -y && apt-get -y install wget | ||
RUN apt-get install -y php7.3 \ | ||
php-fpm \ | ||
php-mysql \ | ||
mariadb-client | ||
|
||
RUN wget https://tr.wordpress.org/wordpress-6.1-tr_TR.tar.gz -P /var/www | ||
RUN cd /var/www && tar -xzf wordpress-6.1-tr_TR.tar.gz && rm wordpress-6.1-tr_TR.tar.gz | ||
RUN chown -R root:root /var/www/wordpress | ||
RUN wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | ||
RUN chmod +x wp-cli.phar | ||
RUN mv wp-cli.phar /usr/local/bin/wp | ||
COPY ./conf/php.conf /etc/php/7.3/fpm/pool.d/www.conf | ||
COPY conf/wordpress_config.sh wordpress_config.sh | ||
|
||
EXPOSE 9000 | ||
|
||
RUN chmod +x wordpress_config.sh | ||
|
||
ENTRYPOINT ["sh", "wordpress_config.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[www] | ||
user = www-data | ||
group = www-data | ||
listen = wordpress:9000 | ||
listen.owner = www-data | ||
listen.group = www-data | ||
pm = dynamic | ||
pm.max_children = 5 | ||
pm.start_servers = 2 | ||
pm.min_spare_servers = 1 | ||
pm.max_spare_servers = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
nfig.sh | ||
#!bin/bash | ||
sleep 10 | ||
if [ ! -e /var/www/wordpress/wp-config.php ]; then | ||
wp config create --allow-root \ | ||
--dbname=$DATABASE_NAME \ | ||
--dbuser=$DATABASE_USER \ | ||
--dbpass=$DATABASE_PASSWORD \ | ||
--dbhost=mariadb:3306 \ | ||
--path='/var/www/wordpress' | ||
|
||
sleep 10 | ||
wp core install --url=$DOMAINE_NAME \ | ||
--title=$SITE_NAME \ | ||
--admin_user=$ADMIN_NAME \ | ||
--admin_password=$ADMIN_PASSWORD \ | ||
--admin_email=$ADMIN_MAIL \ | ||
--allow-root \ | ||
--path='/var/www/wordpress' | ||
wp user create --allow-root \ | ||
--role=author $USER_NAME $USER_MAIL \ | ||
--user_pass=$USER_PASSWORD \ | ||
--path='/var/www/wordpress' >> /log.txt | ||
fi | ||
|
||
if [ ! -d /run/php ]; then | ||
mkdir ./run/php | ||
fi | ||
|
||
# launchin php, daemon | ||
/usr/sbin/php-fpm7.3 -F |