Skip to content

Commit 0d816c3

Browse files
committed
Merge branch 'develop'
2 parents 5019858 + d7443c1 commit 0d816c3

19 files changed

+82
-30
lines changed

Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.SILENT:
22
# Default values
33
t?=
4-
ENV_INIT=bash sh/env/init.sh
4+
INIT_SH=bash sh/init.sh
55

66
# Go!
77
# Generate .env.secret file
@@ -12,32 +12,32 @@ secret:
1212
# docker-compose build with root .env file concatenation
1313
.PHONY: build
1414
build:
15-
$(ENV_INIT) $(t)
15+
$(INIT_SH) $(t)
1616
docker-compose build $(s)
1717

1818
# Regular docker-compose up with root .env file concatenation
1919
.PHONY: up
2020
up:
21-
$(ENV_INIT) $(t)
21+
$(INIT_SH) $(t)
2222
docker-compose up -d --build $(s)
2323

2424
# docker-compose up with root .env file concatenation without `-d`
2525
.PHONY: upd
2626
upd:
27-
$(ENV_INIT) $(t)
27+
$(INIT_SH) $(t)
2828
docker-compose up --build $(s)
2929

3030
######## Special modes ########
3131
# Root .env file concatenation and docker-compose up. Stage mode
3232
.PHONY: up-stage
3333
up-stage:
34-
$(ENV_INIT) stage
34+
$(INIT_SH) stage
3535
docker-compose up -d --build $(s)
3636

3737
# Root .env file concatenation and docker-compose up with http > https redirect options. Production mode
3838
.PHONY: up-prod
3939
up-prod:
40-
$(ENV_INIT) prod
40+
$(INIT_SH) prod
4141
docker-compose up -d --build $(s)
4242
######## Special modes ########
4343

README.MD

+7-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ make secret
8282

8383
<a name="footnote_fhs"></a>[1]: We recommend to use `/srv` folder instead `/var/www`. Create `/srv/apps` folder for your web apps. See [FHS](https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s17.html).
8484

85-
### Launch
85+
### Launch 🚀
8686

8787
1. Build the root `.env` file and run docker-compose:
8888

@@ -102,12 +102,12 @@ make t=prod up
102102

103103
Do not edit the automatically concatenated root `.env` file. It will be overwritten every time the app run.
104104

105-
After the installation, you can add your custom secrets to `.env.secret`, but keep in mind that your secrets will not appear in the repository and will not be visible to other users. There is a `./sh/env/.env.secret.template` file for this. It has a template of secrets, without secret data.
105+
After the installation, you can add your custom secrets 🔑 to `.env.secret`, but keep in mind that your secrets will not appear in the repository and will not be visible to other users. There is a `./sh/env/.env.secret.template` file for this. It has a template of secrets, without secret data.
106106

107107
You can add secret variables names there without secret data, just for structure. A password generator will replace the special word `generatethispass` with the real password when you run `make secret` (`bash sh/env/secret-gen.sh`).
108108

109109

110-
:warning: **WARNING Do not define secrets (private keys, passwords, tokens, etc.) in committed files, it's not secure!**
110+
⚠️ **WARNING 📣 Do not define secrets (private keys, passwords, tokens, etc.) in committed files, it's not secure!**
111111

112112
### Production Launch with HTTPS
113113

@@ -199,7 +199,7 @@ make pma-up
199199
3. Open the `your-app-domain.com:PMA_EXT_PORT` URL in the browser to access phpMyadmin. For example, we use `PMA_EXT_PORT=8801`. Open `your-app-domain.com:8801`
200200

201201

202-
:warning: **WARNING Do not use phpMyadmin on public (production or open stage), it's not secure!**
202+
⚠️ **WARNING 📣 Do not use phpMyadmin on public (production or open stage), it's not secure!**
203203

204204

205205
To stop the phpMyadmin container run command:
@@ -224,3 +224,6 @@ To activate backups:
224224

225225
Backups will appear in the `./backups` folder, logs in the docker cron container logs
226226

227+
## Contributing
228+
229+
Contributions are welcome from everyone. Developing with ❤️.

config/nginx/templates/default.conf.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Do not edit .conf file, it will override by script.
2-
# Edit .template file to change settings
2+
# Edit .conf.template file to change settings
33
#
44
# Bootstrap project nginx config file
55

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Do not edit .conf file, it will override by script.
2-
# Edit .template file to change settings
2+
# Edit .conf.template file to change settings
33

44
# Basic Auth disabled. Nothing to include
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Do not edit .conf file, it will override by script.
2-
# Edit .template file to change settings
2+
# Edit .conf.template file to change settings
33

44
auth_basic "Restricted Area";
55
auth_basic_user_file /etc/nginx/auth/.wplogin;
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Do not edit .conf file, it will override by script.
2-
# Edit .template file to change settings
2+
# Edit .conf.template file to change settings
33

44
# Basic Auth disabled. Nothing to include

config/nginx/templates/partials/ba_wp_login_enable.conf.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Do not edit .conf file, it will override by script.
2-
# Edit .template file to change settings
2+
# Edit .conf.template file to change settings
33

44
location ^~ /wp-login.php {
55
auth_basic "Restricted Area";

config/nginx/templates/partials/http.conf.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Do not edit .conf file, it will override by script.
2-
# Edit .template file to change settings
2+
# Edit .conf.template file to change settings
33

44
# Special config for HTTP
55

config/nginx/templates/partials/https.conf.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Do not edit .conf file, it will override by script.
2-
# Edit .template file to change settings
2+
# Edit .conf.template file to change settings
33

44
# Special config for HTTPS
55

config/nginx/templates/partials/logs.conf.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Do not edit .conf file, it will override by script.
2-
# Edit .template file to change settings
2+
# Edit .conf.template file to change settings
33

44
error_log /var/log/nginx/error.log;
55
#access_log /var/log/nginx/access.log;

config/nginx/templates/partials/php.conf.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Do not edit .conf file, it will override by script.
2-
# Edit .template file to change settings
2+
# Edit .conf.template file to change settings
33

44
location ~ \.php$ {
55
try_files $uri =404;

config/nginx/templates/partials/ssl.conf.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Do not edit .conf file, it will override by script.
2-
# Edit .template file to change settings
2+
# Edit .conf.template file to change settings
33

44
ssl_certificate /etc/nginx/ssl/${APP_DOMAIN}.crt;
55
ssl_certificate_key /etc/nginx/ssl/${APP_DOMAIN}.key;

config/nginx/templates/partials/static.conf.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Do not edit .conf file, it will override by script.
2-
# Edit .template file to change settings
2+
# Edit .conf.template file to change settings
33

44
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
55
expires max;
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
# Do not edit .conf file, it will override by script.
2-
# Edit .template file to change settings
2+
# Edit .conf.template file to change settings
33

44
location / {
55
# This is cool because no php is touched for static content.
66
# include the "?$args" part so non-default permalinks doesn't break when using query string
77
try_files $uri $uri/ /index.php?$args;
88
}
9+
10+
# Special directives for wp-admin area
11+
# If you have media upload error:
12+
# "Post-processing of the image failed likely because the server is busy or does not have enough resources. Uploading a smaller image may help. Suggested maximum size is 2500 pixels".
13+
# Uncomment this rule. Generally, we are not recommend to upload large files. In most cases this is not necessary. Think twice
14+
#location ^~ /wp-admin/ {
15+
#client_max_body_size 6M;
16+
17+
#include /etc/nginx/conf.d/partials/php.conf;
18+
#}
19+
20+
# Deny all php scripts in uploads folder
21+
location ~* (.*/wp-content/uploads)/(.+\.php)$ {
22+
return 403;
23+
}

docker-compose.phpmyadmin.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ version: "3.9"
33
services:
44
phpmyadmin:
55
image: phpmyadmin:5.1-apache
6+
container_name: "${APP_NAME}_phpmyadmin"
67
restart: unless-stopped
78
ports:
89
- ${PMA_EXT_PORT}:80

docker/wordpress/Dockerfile

+13-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ RUN set -eux; \
2525
# Need envsubst for operate with env variables in config files
2626
gettext \
2727
; \
28-
2928
# Fix www-data UID from 82 to ${WWW_DATA_UID} (Permission denied error)
3029
deluser www-data; \
3130
addgroup -g $WWW_DATA_GID www-data; \
@@ -115,6 +114,19 @@ RUN set -eux; \
115114
#echo 'sendmail_path = /usr/sbin/ssmtp -t -i'; \
116115
echo 'sendmail_path = /usr/sbin/sendmail -t'; \
117116
} > /usr/local/etc/php/conf.d/sendmail.ini; \
117+
##
118+
## set custom PHP.ini settings
119+
{ \
120+
# Resource Limits
121+
echo 'max_execution_time = 30'; \
122+
# Memory limits works across WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT constants that comes from .env file
123+
# echo 'memory_limit = 128M'; \
124+
# Data Handling
125+
echo 'post_max_size = 8M'; \
126+
# File uploads
127+
echo 'upload_max_filesize = 6M'; \
128+
echo 'max_file_uploads = 20'; \
129+
} > /usr/local/etc/php/conf.d/custom-php.ini; \
118130
##
119131
set -eux; \
120132
## ToDo WordPress version to .env

docker/wordpress/config/ssmtp.conf.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Do not edit .conf file, it will override by script.
2-
# Edit .template file to change settings
2+
# Edit .conf.template file to change settings
33
#
44
#
55
# Configuartion file for sSMTP sendmail

sh/env/init.sh

-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
#!/bin/bash
22

3-
# Stop when error
4-
set -e
5-
6-
# Colors
7-
source ./sh/utils/colors
8-
93
# Default values
104
ENVIRONMENT_TYPE=dev
115

sh/init.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
# Stop when error
4+
set -e
5+
6+
# Colors
7+
source ./sh/utils/colors
8+
9+
echo '
10+
:::::::: ::::::::::: ::: ::::::::: ::::::::::: :::::::::: :::::::::
11+
:+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+:
12+
+:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+
13+
+#++:++#++ +#+ +#++:++#++: +#++:++#: +#+ +#++:++# +#++:++#:
14+
+#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+
15+
#+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+#
16+
######## ### ### ### ### ### ### ########## ### ###
17+
18+
__ __ _______ _______
19+
| |/ ||_ _||_ _|
20+
| < _| |_ | |
21+
|__|\__||_______| |___|
22+
_
23+
_|_ _ ._ _| _. _|_ o _ ._
24+
| (_) |_| | | (_| (_| |_ | (_) | |
25+
'
26+
27+
source sh/env/init.sh "$1"

0 commit comments

Comments
 (0)