This commit is contained in:
ekazak
2022-10-04 12:26:42 +02:00
parent 4c70a541d2
commit 584ae2182d
12 changed files with 115 additions and 156 deletions

30
devops/Dockerfile Normal file
View File

@@ -0,0 +1,30 @@
FROM wordpress:4.9-fpm
ENV TMP /tmp/nginx-php/
RUN apt-get update && apt-get install -y --no-install-recommends \
libjpeg-dev \
libpng-dev \
libfreetype6-dev \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr --with-freetype-dir=/usr/include \
&& docker-php-ext-install gd
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- \
--filename=composer \
--install-dir=/usr/local/bin && \
echo "alias composer='composer'" >> /root/.bashrc && \
composer
# php configs
COPY www.conf /usr/local/etc/php-fpm.d/www.conf
COPY docker-php.ini /usr/local/etc/php/conf.d/docker-php.ini
RUN apt-get install -y nginx
# nginx configs
COPY nginx /etc/nginx
WORKDIR /var/www
EXPOSE 80

View File

@@ -1,45 +0,0 @@
version: '3'
services:
mysql:
image: mysql:5.7
volumes:
- "./storage/mysql:/var/lib/mysql"
- "./storage/logs/mysql:/var/log/mysql"
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-pass4dev}
- MYSQL_DATABASE=${MYSQL_DATABASE:-db4dev}
- MYSQL_USER=${MYSQL_USER:-user4dev}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-pass4dev}
restart: always
php_fpm:
build:
context: ./php_fpm
depends_on:
- mysql
volumes:
- "../htdocs/wp-content:/var/www/html/wp-content"
- "../htdocs/wp-config.php:/var/www/html/wp-config.php"
- "htdocs:/var/www/html"
environment:
- DB_NAME=${DB_NAME:-db4dev}
- DB_USER=${DB_USER:-user4dev}
- DB_PASSWORD=${DB_PASSWORD:-pass4dev}
- DB_HOST=${DB_HOST:-mysql}
restart: always
nginx:
image: nginx:1.15-alpine
depends_on:
- php_fpm
volumes:
- "./nginx/nginx.conf:/etc/nginx/nginx.conf:ro"
- "./storage/logs/nginx:/var/log/nginx"
- "../htdocs/wp-content:/var/www/html/wp-content"
- "../htdocs/wp-config.php:/var/www/html/wp-config.php:ro"
- "htdocs:/var/www/html"
restart: always
volumes:
htdocs:

1
devops/docker-php.ini Normal file
View File

@@ -0,0 +1 @@
memory_limit = 512M

View File

@@ -0,0 +1,3 @@
upstream php-upstream {
server 127.0.0.1:9000;
}

View File

@@ -1,70 +0,0 @@
server {
server_name dev1.lawcarta.com dev1.livecarta.com;
root /var/www/WordPress/htdocs/;
index index.html index.php;
error_log /var/log/nginx/wordpress-error.log;
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
fastcgi_read_timeout 300;
}
location ~ /\.ht {
deny all;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/dev1.lawcarta.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/dev1.lawcarta.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
}
server {
if ($host = dev1.livecarta.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = dev1.lawcarta.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name dev1.lawcarta.com dev1.livecarta.com;
return 404; # managed by Certbot
}

View File

@@ -1,5 +1,5 @@
user nginx; user www-data;
worker_processes 1; worker_processes 1;
error_log /var/log/nginx/error.log warn; error_log /var/log/nginx/error.log warn;
@@ -10,7 +10,6 @@ events {
worker_connections 1024; worker_connections 1024;
} }
http { http {
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type application/octet-stream; default_type application/octet-stream;
@@ -30,34 +29,6 @@ http {
client_max_body_size 10m; client_max_body_size 10m;
server { include /etc/nginx/conf.d/*.conf;
listen 80; include /etc/nginx/sites-available/*.conf;
server_name lawcarta.loc livecarta.loc;
root /var/www/html;
index index.php;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
#fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass php_fpm:9000;
}
}
} }

View File

@@ -0,0 +1,30 @@
server {
listen 80;
server_name lawcarta.loc livecarta.loc localhost;
root /var/www;
index index.php;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
#fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass localhost:9000;
}
}

View File

@@ -1,8 +0,0 @@
FROM wordpress:4.9-fpm
RUN apt-get update && apt-get install -y --no-install-recommends \
libjpeg-dev \
libpng-dev \
libfreetype6-dev \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr --with-freetype-dir=/usr/include \
&& docker-php-ext-install gd

10
devops/www.conf Normal file
View File

@@ -0,0 +1,10 @@
[www]
user = www-data
group = www-data
pm = dynamic
pm.max_children = 50
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

View File

@@ -0,0 +1,14 @@
######FOR TEST DEV ENV
update wp_options set option_value = "https://doc-dev.lawcarta.com" where option_id = 1 limit 1;
update wp_options set option_value = "https://doc-dev.lawcarta.com" where option_id = 2 limit 1;
update wp_2_options set option_value = "https://doc-dev.livecarta.com" where option_id = 1 limit 1;
update wp_2_options set option_value = "https://doc-dev.lawcarta.com/livecarta" where option_id = 2 limit 1;
update wp_blogs set domain = "doc-dev.lawcarta.com" where blog_id = 1 limit 1;
update wp_blogs set domain = "doc-dev.lawcarta.com" where blog_id = 2 limit 1;
update wp_domain_mapping set domain = "doc-dev.livecarta.com" where blog_id = 2 limit 1;
update wp_site set domain = "doc-dev.lawcarta.com" where id =1 limit 1;

View File

@@ -0,0 +1,2 @@
User-agent: *
Disallow: /

View File

@@ -0,0 +1,21 @@
<?php
define( 'DB_NAME', '@lcWpMySqlDbnameDev@' );
define( 'DB_USER', '@lcWpMySqlUsernameDev@' );
define( 'DB_PASSWORD', '@lcWpMySqlPasswordDev@' );
define( 'DB_HOST', '@lcWpMySqlHostDev@' );
define('DOMAIN_CURRENT_SITE', 'doc-dev.lawcarta.com');
define('LAWCARTA_SUBDOMAIN', 'app-dev');
define('LAWCARTA_PORT', '');
define('LAWCARTA_WP_REST_API_REQUEST_URL', 'https://app-dev.lawcarta.com/v1/event/request');
define('LAWCARTA_WP_REST_API_RESPONSE_URL', 'https://app-dev.lawcarta.com/v1/event/response');
define('LAWCARTA_ENVIRONMENT_NAME', 'dev');
define('LC_ALLOW_COOKIE_POPUP', true);
define('LC_GTM', 'GTM-KXTRR4Q');
$_SERVER['HTTPS'] = 'On';