wip trying to launch worpdress

This commit is contained in:
hugo gogo
2022-09-20 21:10:45 +02:00
parent 334092253f
commit ef8ce69dad
16 changed files with 105 additions and 158 deletions

View File

@@ -15,7 +15,7 @@ services:
- inception
ports:
- "443:443"
- "80:80"
# - "80:80"
build: ./requirements/nginx
image: nginx
container_name: nginx_container
@@ -44,8 +44,8 @@ services:
env_file: ./.env
networks:
- inception
volumes:
- wp_volume:/var/www/html
# volumes:
# - wp_volume:/var/www/html
build:
context: ./requirements/wordpress
args:

View File

@@ -2,9 +2,11 @@
# FROM debian:buster
#
# # vim and bash for debug
# RUN apt update && apt install -y \
# mariadb-client \
# mariadb-server \
# vim bash \
# && \
# rm -rf /var/lib/apt/lists/*
#

View File

@@ -23,8 +23,8 @@
# * Basic Settings
#
user = mysql
pid-file = /run/mysqld/mysqld.pid
socket = /run/mysqld/mysqld.sock
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql

View File

@@ -2,6 +2,10 @@
# inception modifications :
#
# [mysqld] :
# < socket=/run/mysqld/mysqld.sock
# >
#
# [mysqld] :
# < skip-networking = false
# > skip-networking
# ---
@@ -11,7 +15,7 @@
# < port = 3306
# >
# ---
# < socket=/var/lib/mysql/mysql.sock
# < socket=/run/mysqld/mysqld.sock
# >
#
@@ -20,6 +24,7 @@
# this is read by the standalone daemon and embedded servers
[server]
socket=/run/mysqld/mysqld.sock
# this is only for the mysqld standalone daemon
[mysqld]
@@ -28,6 +33,10 @@ datadir = /var/lib/mysql
port = 3306
socket=/run/mysqld/mysqld.sock
# sock was in : /run/mysqld/mysqld.sock
# mariadb thought it was in : /var/lib/mysql/mysql.sock
# so I made : ln -s /run/mysqld/mysqld.sock /var/lib/mysql/mysql.sock
# Galera-related settings
[galera]
# Mandatory settings

View File

@@ -1,39 +1,43 @@
# debian (~ 180s) --------------------------------------------
# FROM debian:buster
#
# # vim for debug
# RUN apt update && apt install -y \
# nginx openssl \
# vim \
# && \
# rm -rf /var/lib/apt/lists/*
#
# # nginx conf
# COPY ./conf/nginx.conf.debian /etc/nginx/nginx.conf
# COPY ./conf/inception_nginx.conf /etc/nginx/conf.d/
FROM debian:buster
# vim for debug
RUN apt update && apt install -y \
nginx openssl \
vim \
&& \
rm -rf /var/lib/apt/lists/*
# nginx conf
COPY ./conf/nginx.conf.debian /etc/nginx/nginx.conf
COPY ./conf/inception_nginx.conf /etc/nginx/conf.d/
# alpine (~ 45s) ---------------------------------------------
FROM alpine:3.15
# vim and bash for debug
RUN apk update && apk add \
nginx openssl \
vim bash \
&& \
rm -rf /var/cache/apk*
# nginx conf
COPY ./conf/nginx.conf.alpine /etc/nginx/nginx.conf
COPY ./conf/inception_nginx.conf /etc/nginx/http.d/
# create user www-data and assign it to group www-data
RUN adduser -S www-data && \
adduser www-data www-data
# FROM alpine:3.15
#
# # vim and bash for debug
# RUN apk update && apk add \
# nginx openssl \
# vim bash \
# && \
# rm -rf /var/cache/apk*
#
# # nginx conf
# COPY ./conf/nginx.conf.alpine /etc/nginx/nginx.conf
# COPY ./conf/inception_nginx.conf /etc/nginx/http.d/
#
# # create user www-data and assign it to group www-data
# RUN adduser -S www-data && \
# adduser www-data www-data
#
# RUN mkdir -p /var/www/html
# common -----------------------------------------------------
RUN rm -rf /var/www/html/*
# personalized index.html
COPY ./conf/index.html /data/www/

View File

@@ -1,12 +1,12 @@
# doc : https://nginx.org/en/docs/dirindex.html
# WIP redirect http to https
server {
listen 80;
listen [::]:80;
server_name _;
return 301 https://$host$request_uri;
}
#server {
# listen 80;
# listen [::]:80;
# server_name _;
# return 301 https://$host$request_uri;
#}
server {
listen 443 ssl; # for ipv4, on port 443, specifying that accepted connections should works in ssl mode
@@ -20,18 +20,15 @@ server {
location / {
try_files $uri $uri/ =404; # from /etc/nginx/sites-enabled/default : First attempt to serve request as file, then as directory, then fall back to displaying a 404
root /data/www/;
}
# pass PHP scripts to FastCGI (PHP-FPM) server
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
include /etc/nginx/fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_pass wordpress:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_pass wordpress:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $uri =404;
}
}

View File

@@ -1,51 +0,0 @@
# find official images : https://hub.docker.com/search
#FROM ubuntu:18.04
#FROM alpine:3.16.1
#FROM debian:buster
# basic test
# build with : sudo docker build --tag test .
# run with : sudo docker run test
# 'hello' in assembly found here : http://timelessname.com/elfbin/
FROM scratch
COPY tools/hello /
CMD [ "/hello" ]
## working
#FROM scratch
#WORKDIR /
#COPY hello /
#CMD [ "/hello" ]
## working, when WORKDIR is absent, it's default is set to "/"
#FROM scratch
#COPY hello /
#CMD [ "/hello" ]
## not working, when CMD execute in shell form, instead of exec form []
#FROM scratch
#COPY hello /
#CMD /hello
## not working, because c executable need library <unistd.h>
#FROM scratch
#COPY hello_c /
#CMD [ "/hello_c" ]
## not working, when executable is copied to ".", because WORKDIR value is not "." but "/" since we gave it a relativ path so it was build in top of the implicit absolut path "/"
#FROM scratch
#WORKDIR .
#COPY hello .
#CMD [ "hello" ]
## not working, when WORKDIR is set to the present directory and executable is not copied, because the workdir is not the present directory but a directory in the file system of docker : executable need to be copied there to function
#FROM scratch
#WORKDIR /home/simplonco/Desktop/42/14_inception/inception/srcs/requirements/mariadb
#CMD [ "hello" ]
## working, because "hello" is copied to "/" and execute from "/"
#FROM scratch
#WORKDIR .
#COPY hello /
#CMD [ "/hello" ]

Binary file not shown.

View File

@@ -1,16 +0,0 @@
SECTION .data
msg: db "Hi World",10
len: equ $-msg
SECTION .text
global main
main:
mov edx,len
mov ecx,msg
mov ebx,1
mov eax,4
int 0x80
mov ebx,0
mov eax,1
int 0x80

View File

@@ -1,50 +1,50 @@
# debian -----------------------------------------------------
# FROM debian:buster
#
# # bash and vim for debug
# RUN apt update && apt install -y \
# php7.3 \
# php7.3-fpm \
# php7.3-mysqli \
# curl \
# bash vim
# RUN rm -rf /var/lib/apt/lists/*
#
# # fpm config
# COPY ./conf/www.conf /etc/php/7.3/fpm/pool.d/
# RUN mkdir /run/php/
#
# ENV PHP_VERSION="php-fpm7.3"
# alpine -----------------------------------------------------
FROM alpine:3.15
FROM debian:buster
# bash and vim for debug
RUN apk update && apk add \
php7 \
php7-fpm \
php7-mysqli \
php7-phar \
php7-json \
RUN apt update && apt install -y \
php7.3 \
php7.3-fpm \
php7.3-mysqli \
curl \
bash vim
RUN rm -rf /var/lib/apt/lists/*
# fpm config
COPY ./conf/www.conf /etc/php7/php-fpm.d/
COPY ./conf/www.conf /etc/php/7.3/fpm/pool.d/
RUN mkdir /run/php/
# create wp directory
ARG WP_DIR
RUN mkdir -p ${WP_DIR}
ENV PHP_VERSION="php-fpm7.3"
# create www-data user and add to group
RUN adduser -S www-data && \
adduser www-data www-data
# alpine -----------------------------------------------------
ENV PHP_VERSION="php-fpm7"
# FROM alpine:3.15
#
# # bash and vim for debug
# RUN apk update && apk add \
# php7 \
# php7-fpm \
# php7-mysqli \
# php7-phar \
# php7-json \
# curl \
# bash vim
# RUN rm -rf /var/lib/apt/lists/*
#
# # fpm config
# COPY ./conf/www.conf /etc/php7/php-fpm.d/
# RUN mkdir /run/php/
#
# # create wp directory
# ARG WP_DIR
# RUN mkdir -p ${WP_DIR}
#
# # create www-data user and add to group
# RUN adduser -S www-data && \
# adduser www-data www-data
#
# ENV PHP_VERSION="php-fpm7"
# common -----------------------------------------------------

View File

@@ -1,10 +1,10 @@
#!/bin/sh
## install wordpress with cli : https://make.wordpress.org/cli/handbook/how-to-install/
# install wordpress with cli : https://make.wordpress.org/cli/handbook/how-to-install/
mkdir -p ${WP_DIR}
wp core download --path="${WP_DIR}" --allow-root
## create config file :
# create config file :
wp config create \
--dbhost=mariadb \
--dbname="${DB_NAME}" \
@@ -12,7 +12,7 @@ wp config create \
--dbpass="${DB_PASS}" \
--path="${WP_DIR}" --allow-root
## install wordpress :
# install wordpress :
wp core install \
--url="${WP_URL}" \
--title="${WP_TITLE}" \
@@ -22,11 +22,13 @@ wp core install \
--skip-email \
--path="${WP_DIR}" --allow-root
## create user :
# create user :
wp user create \
"${WP_USER}" "${WP_USER_EMAIL}" \
--user_pass="${WP_USER_PSWD}" \
--path="${WP_DIR}" --allow-root
# change owner and permissions to wp files
chown -R www-data:www-data /var/www/*
chmod 755 -R /var/www/*