Skip to content

Commit 5019858

Browse files
committed
Merge branch 'develop'
2 parents 4705abf + 4d0ac28 commit 5019858

15 files changed

+73
-192
lines changed

Makefile

+1-8
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ upd:
2727
$(ENV_INIT) $(t)
2828
docker-compose up --build $(s)
2929

30-
# Root .env file concatenation and docker-compose up with nginx-proxy options
31-
.PHONY: upp
32-
upp:
33-
$(ENV_INIT) $(t)
34-
docker-compose -f docker-compose.yml -f docker-compose.proxy.yml up -d --build $(s)
35-
36-
3730
######## Special modes ########
3831
# Root .env file concatenation and docker-compose up. Stage mode
3932
.PHONY: up-stage
@@ -45,7 +38,7 @@ up-stage:
4538
.PHONY: up-prod
4639
up-prod:
4740
$(ENV_INIT) prod
48-
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d --build $(s)
41+
docker-compose up -d --build $(s)
4942
######## Special modes ########
5043

5144

README.MD

+6-60
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,11 @@
3434
</a>
3535

3636
<a href="https://hub.docker.com/_/wordpress">
37-
<img alt="WordPress" src="https://img.shields.io/badge/WordPress-5.8-lightgrey">
37+
<img alt="WordPress" src="https://img.shields.io/badge/WordPress-5.8.3-lightgrey">
3838
</a>
3939

4040
<a href="https://hub.docker.com/_/nginx">
41-
<img alt="Nginx" src="https://img.shields.io/badge/Nginx-1.20-00a652">
42-
</a>
43-
44-
<a href="https://hub.docker.com/_/redis">
45-
<img alt="Redis" src="https://img.shields.io/badge/Redis-6.2-d82c20">
41+
<img alt="Nginx" src="https://img.shields.io/badge/Nginx-1.21-00a652">
4642
</a>
4743

4844
<a href="https://hub.docker.com/_/phpmyadmin">
@@ -54,9 +50,8 @@
5450
## Requirements
5551

5652
1. [Docker Engine](https://docs.docker.com/engine/install/) v20.10+
57-
and [Docker Compose](https://docs.docker.com/compose/install/) v1.29+
58-
2. To run few instances on port 80 need [Nginx-proxy](https://hub.docker.com/r/jwilder/nginx-proxy) (optional), or you can
59-
use [Traefik](https://traefik.io/) (optional)
53+
2. [Docker Compose](https://docs.docker.com/compose/install/) v1.29+
54+
6055

6156
## How to use
6257

@@ -114,54 +109,6 @@ You can add secret variables names there without secret data, just for structure
114109

115110
:warning: **WARNING Do not define secrets (private keys, passwords, tokens, etc.) in committed files, it's not secure!**
116111

117-
### Launch in proxy mode
118-
A proxy mode is useful when you are launching multiply web applications on port 80.
119-
120-
1. Start the nginx-proxy container
121-
122-
<details>
123-
<summary>Nginx-proxy docker-compose.yml file</summary>
124-
125-
```
126-
version: '3.9'
127-
services:
128-
nginx-proxy:
129-
image: jwilder/nginx-proxy:alpine
130-
container_name: nginx-proxy
131-
environment:
132-
DISABLE_ACCESS_LOGS: 1
133-
ports:
134-
- "80:80"
135-
- "443:443"
136-
volumes:
137-
- /var/run/docker.sock:/tmp/docker.sock:ro
138-
- ./logs:/var/log/nginx
139-
restart: always
140-
141-
networks:
142-
default:
143-
external:
144-
name: nginx-proxy
145-
146-
```
147-
</details>
148-
149-
[Docker hub Nginx-proxy details](https://hub.docker.com/r/jwilder/nginx-proxy)
150-
151-
2. [Install](#installation) and use the Makefile command to run the proxy mode:
152-
153-
``` bash
154-
make [t=<environment_type>] upp
155-
```
156-
157-
**Examples:**
158-
159-
```bash
160-
make upp
161-
make t=stage upp
162-
make t=prod upp
163-
```
164-
165112
### Production Launch with HTTPS
166113

167114
1. Put your certificate files in `./config/nginx/ssl/` with names <your-app-domain.com>.crt and <your-app-domain.com>.key
@@ -171,14 +118,13 @@ make t=prod upp
171118
```bash
172119
make up-prod
173120
```
174-
It will up special file `docker-compose.prod.yml` with 80 and your port (most likely 443). The configuration file `/config/nginx/templates/partials/https.conf.template` will also be used instead of `/config/nginx/templates/partials/http.conf.template`
121+
The configuration file `/config/nginx/templates/partials/https.conf.template` will be used instead of `/config/nginx/templates/partials/http.conf.template`
175122

176123
### Makefile commands
177124

178125
- `make secret`
179126
- `make [t=<environment_type>] [s=<command>] up`
180127
- `make [t=<environment_type>] [s=<command>] upd`
181-
- `make [t=<environment_type>] [s=<command>] upp` - `make t=stage s=--build upp`
182128
- `make [s=<command>] up-prod` - production launch with http > https redirect
183129
- `make down` - `docker-compose down -v`
184130
- `make start` - `docker-compose start`
@@ -276,5 +222,5 @@ To activate backups:
276222

277223
3. If you have more than one database (maybe custom databases), check `mysqldump` command parameters in `./docker/cron/start-backup.sh`
278224

279-
Backups will appear in the `./backups` folder, logs in docker cron container logs
225+
Backups will appear in the `./backups` folder, logs in the docker cron container logs
280226

config/environment/.env.main

-6
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ WP_MAX_MEMORY_LIMIT=512M
3737
WP_DISABLE_WP_CRON=1
3838

3939

40-
# Redis
41-
WP_REDIS_HOST=redis
42-
WP_REDIS_PORT=6379
43-
WP_REDIS_PREFIX=wp_redis_6379
44-
45-
4640
# SSH tunnel options
4741
# You can use an SSH tunnel to connect to database from an external app (for example HeidiSQL)
4842
# Uncomment ports directive in database service in docker-compose.yml and use this constant to set up an external app port

config/environment/.env.type.dev

+7-9
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@ WP_ENVIRONMENT_TYPE=development
1414
# App info
1515
APP_PROTOCOL=http
1616
APP_DOMAIN=your-app-domain.loc
17-
APP_PORT=80
18-
# Use 80 (or 443) port with proxy or if your app is single on server
19-
# Use another unique port if you want URL like http://your-app-domain.com:8080
17+
APP_HTTP_PORT=80
18+
APP_HTTPS_PORT=443
19+
# Use 80 and 443 port if your app is single on server
20+
# For multiply instances use another unique port. Your URL will be like http://your-app-domain.com:8080
21+
# Change only APP_HTTP_PORT if you use `http`, or APP_HTTPS_PORT if you use `https`
2022
#
2123
# If port != 80 and port != 443 WordPress Home url will be with port
2224
# Result URL will be
23-
# if (APP_PORT != 80 && APP_PORT != 443 ) {
24-
# URL = $APP_PROTOCOL://$APP_DOMAIN:$APP_PORT
25+
# if (APP_HTTP(S)_PORT != 80 && APP_HTTP(S)_PORT != 443 ) {
26+
# URL = $APP_PROTOCOL://$APP_DOMAIN:$APP_HTTP(S)_PORT
2527
# } else {
2628
# URL = $APP_PROTOCOL://$APP_DOMAIN
2729
# }
@@ -35,10 +37,6 @@ WP_DEBUG_LOG=/var/log/wordpress/debug.log
3537
#AQ_RESIZE_DEBUG
3638

3739

38-
# Redis
39-
WP_REDIS_MAXTTL=1
40-
41-
4240
# Backup database and media files cron job
4341
# Edit file in ./config/crontabs folder to setup backup time
4442
APP_WP_BACKUP_ENABLE=0

config/environment/.env.type.prod

+7-9
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@ WP_ENVIRONMENT_TYPE=production
1414
# App info
1515
APP_PROTOCOL=https
1616
APP_DOMAIN=your-app-domain.com
17-
APP_PORT=443
18-
# Use 80 (or 443) port with proxy or if your app is single on server
19-
# Use another unique port if you want URL like http://your-app-domain.com:8080
17+
APP_HTTP_PORT=80
18+
APP_HTTPS_PORT=443
19+
# Use 80 and 443 port if your app is single on server
20+
# For multiply instances use another unique port. Your URL will be like http://your-app-domain.com:8080
21+
# Change only APP_HTTP_PORT if you use `http`, or APP_HTTPS_PORT if you use `https`
2022
#
2123
# If port != 80 and port != 443 WordPress Home url will be with port
2224
# Result URL will be
23-
# if (APP_PORT != 80 && APP_PORT != 443 ) {
24-
# URL = $APP_PROTOCOL://$APP_DOMAIN:$APP_PORT
25+
# if (APP_HTTP(S)_PORT != 80 && APP_HTTP(S)_PORT != 443 ) {
26+
# URL = $APP_PROTOCOL://$APP_DOMAIN:$APP_HTTP(S)_PORT
2527
# } else {
2628
# URL = $APP_PROTOCOL://$APP_DOMAIN
2729
# }
@@ -35,10 +37,6 @@ WP_DEBUG_LOG=/var/log/wordpress/debug.log
3537
#AQ_RESIZE_DEBUG
3638

3739

38-
# Redis
39-
WP_REDIS_MAXTTL=3600
40-
41-
4240
# Backup database and media files cron job
4341
# Edit file in ./config/crontabs folder to setup backup time
4442
APP_WP_BACKUP_ENABLE=1

config/environment/.env.type.stage

+7-9
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@ WP_ENVIRONMENT_TYPE=staging
1414
# App info
1515
APP_PROTOCOL=http
1616
APP_DOMAIN=stage.your-app-domain.com
17-
APP_PORT=80
18-
# Use 80 (or 443) port with proxy or if your app is single on server
19-
# Use another unique port if you want URL like http://your-app-domain.com:8080
17+
APP_HTTP_PORT=80
18+
APP_HTTPS_PORT=443
19+
# Use 80 and 443 port if your app is single on server
20+
# For multiply instances use another unique port. Your URL will be like http://your-app-domain.com:8080
21+
# Change only APP_HTTP_PORT if you use `http`, or APP_HTTPS_PORT if you use `https`
2022
#
2123
# If port != 80 and port != 443 WordPress Home url will be with port
2224
# Result URL will be
23-
# if (APP_PORT != 80 && APP_PORT != 443 ) {
24-
# URL = $APP_PROTOCOL://$APP_DOMAIN:$APP_PORT
25+
# if (APP_HTTP(S)_PORT != 80 && APP_HTTP(S)_PORT != 443 ) {
26+
# URL = $APP_PROTOCOL://$APP_DOMAIN:$APP_HTTP(S)_PORT
2527
# } else {
2628
# URL = $APP_PROTOCOL://$APP_DOMAIN
2729
# }
@@ -35,10 +37,6 @@ WP_DEBUG_LOG=/var/log/wordpress/debug.log
3537
#AQ_RESIZE_DEBUG
3638

3739

38-
# Redis
39-
WP_REDIS_MAXTTL=3600
40-
41-
4240
# Backup database and media files cron job
4341
# Edit file in ./config/crontabs folder to setup backup time
4442
APP_WP_BACKUP_ENABLE=1

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
# http://www > http://non-www redirect
77
server {
8-
listen ${APP_PORT};
9-
listen [::]:${APP_PORT};
8+
listen ${APP_HTTP_PORT};
9+
listen [::]:${APP_HTTP_PORT};
1010
server_name www.${APP_DOMAIN};
1111

1212
include /etc/nginx/conf.d/partials/logs.conf;
@@ -15,8 +15,8 @@ server {
1515
}
1616

1717
server {
18-
listen ${APP_PORT};
19-
listen [::]:${APP_PORT};
18+
listen ${APP_HTTP_PORT};
19+
listen [::]:${APP_HTTP_PORT};
2020
server_name ${APP_DOMAIN};
2121

2222
root /var/www/html;

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
# http > https redirect. 80 port should be open
77
# http://www > https://non-www redirect
88
server {
9-
listen 80;
10-
listen [::]:80;
9+
listen ${APP_HTTP_PORT};
10+
listen [::]:${APP_HTTP_PORT};
1111
server_name ${APP_DOMAIN} www.${APP_DOMAIN};
1212

1313
include /etc/nginx/conf.d/partials/logs.conf;
@@ -17,8 +17,8 @@ server {
1717

1818
# https://www > https://non-www redirect
1919
server {
20-
listen ${APP_PORT} ssl http2;
21-
listen [::]:${APP_PORT} ssl http2;
20+
listen ${APP_HTTPS_PORT} ssl http2;
21+
listen [::]:${APP_HTTPS_PORT} ssl http2;
2222
server_name www.${APP_DOMAIN};
2323

2424
include /etc/nginx/conf.d/partials/ssl.conf;
@@ -30,8 +30,8 @@ server {
3030

3131
# Main directive
3232
server {
33-
listen ${APP_PORT} ssl http2;
34-
listen [::]:${APP_PORT} ssl http2;
33+
listen ${APP_HTTPS_PORT} ssl http2;
34+
listen [::]:${APP_HTTPS_PORT} ssl http2;
3535
server_name ${APP_DOMAIN};
3636

3737
root /var/www/html;

docker-compose.override.yml

-5
This file was deleted.

docker-compose.prod.yml

-6
This file was deleted.

docker-compose.proxy.yml

-18
This file was deleted.

docker-compose.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ services:
4444
- database
4545
- wordpress
4646
env_file: .env
47+
ports:
48+
- "${APP_HTTP_PORT}:${APP_HTTP_PORT}"
49+
- "${APP_HTTPS_PORT}:${APP_HTTPS_PORT}"
4750
volumes:
4851
- ./config/nginx/templates:/etc/nginx/templates
4952
- ./config/nginx/ssl:/etc/nginx/ssl:ro
@@ -53,11 +56,6 @@ services:
5356
# WordPress wp-content folder
5457
- ./wp-content:/var/www/html/wp-content
5558

56-
redis:
57-
image: redis:6.2-alpine
58-
container_name: "${APP_NAME}_redis"
59-
restart: unless-stopped
60-
6159
cron:
6260
build: ./docker/cron
6361
container_name: "${APP_NAME}_cron"

docker/nginx/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# Supplement to original file
33
#
4-
FROM nginx:1.20-alpine
4+
FROM nginx:1.21-alpine
55

66
RUN apk add --no-cache openssl
77

0 commit comments

Comments
 (0)