Skip to content

Commit e28baba

Browse files
committed
Update
1 parent 31113b9 commit e28baba

File tree

8 files changed

+58
-14
lines changed

8 files changed

+58
-14
lines changed

.github/dependabot.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
target-branch: master
6+
assignees:
7+
- oanhnn
8+
reviewers:
9+
- oanhnn
10+
schedule:
11+
interval: weekly
12+
day: monday
13+
time: "12:00"
14+
timezone: Asia/Ho_Chi_Minh
15+
labels:
16+
- dependencies
17+
18+
- package-ecosystem: docker
19+
directory: /docker/wordpress
20+
target-branch: master
21+
assignees:
22+
- oanhnn
23+
reviewers:
24+
- oanhnn
25+
schedule:
26+
interval: weekly
27+
day: monday
28+
time: "12:00"
29+
timezone: Asia/Ho_Chi_Minh
30+
labels:
31+
- dependencies

Dockerrun.aws.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
],
1717
"containerDefinitions": [
1818
{
19-
"name": "wp",
19+
"name": "wordpress",
2020
"image": "wordpress:php8.1-fpm-alpine",
2121
"essential": true,
2222
"environment": [
@@ -61,9 +61,15 @@
6161
"name": "web",
6262
"image": "nginx:stable-alpine",
6363
"essential": true,
64+
"environment": [
65+
{
66+
"name": "PHP_FPM_ENDPOINT",
67+
"value": "wordpress:9000"
68+
}
69+
],
6470
"memory": 256,
6571
"links": [
66-
"wp"
72+
"wordpress"
6773
],
6874
"mountPoints": [
6975
{

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ An example for developing Wordpress sites with Docker and deploy to AWS Elastic
66

77
- Bash shell
88
- Git
9-
- Docker Engine 19.03.0+
10-
- Docker Compose 1.27.0+
9+
- Docker
10+
- Docker Compose plugin
1111

1212
## Project organisation
1313

@@ -17,7 +17,7 @@ This is what each item is for:
1717
* `bin/` – Useful command-line scripts.
1818
* `data/` – MySQL dump files go here.
1919
* `docker/` – Files required by the Docker setup are in this directory.
20-
* `docker-compose.yml` – Development orchestration config file.
20+
* `compose.yml` – Development orchestration config file.
2121
* `Dockerrun.aws.json` - Elastic Beanstalk config file.
2222

2323
## Dev
@@ -29,7 +29,7 @@ $ git clone git@github.com:oanhnn/example-wordpress-with-docker.git project_dir
2929
$ cd project_dir
3030
$ cp .env.example .env
3131
$ mkdir app
32-
$ docker-compose up -d
32+
$ docker compose up -d
3333
```
3434

3535
#### Backup database

bin/backup-db.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ROOT_DIR="$( cd `dirname $0` ; cd .. ; pwd -P )"
77
file="$ROOT_DIR/${1:-data/dump-$(date +%Y%m%d-%H%M%S).sql}"
88

99
# Create dump file
10-
docker-compose exec mysql sh -c "MYSQL_PWD=\$MYSQL_PASSWORD mysqldump -u \$MYSQL_USER \$MYSQL_DATABASE" > $file
10+
docker compose exec mysql sh -c "MYSQL_PWD=\$MYSQL_PASSWORD mysqldump -u \$MYSQL_USER \$MYSQL_DATABASE" > $file
1111

1212
# Remove password warning from the file
1313
sed -i "/mysqldump: Error:/d" $file

bin/change-url.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ FROM_URL=$1
66
TO_URL=$2
77

88
# Replace LIVE_URL using WP-CLI in wp container
9-
docker-compose exec wp sh -c "wp --allow-root search-replace "$FROM_URL" "$TO_URL" --skip-columns=guid"
9+
docker compose exec wp sh -c "wp --allow-root search-replace "$FROM_URL" "$TO_URL" --skip-columns=guid"

bin/restore-db.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ if [[ $file == *.gz ]]; then
1919
fi
2020

2121
# Restore database to db container
22-
docker-compose exec -T mysql sh -c "MYSQL_PWD=\$MYSQL_PASSWORD mysql -u \$MYSQL_USER \$MYSQL_DATABASE" < $file
22+
docker compose exec -T mysql sh -c "MYSQL_PWD=\$MYSQL_PASSWORD mysql -u \$MYSQL_USER \$MYSQL_DATABASE" < $file

docker-compose.yml renamed to compose.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,32 @@ services:
1313
- mysqld
1414
- --character-set-server=utf8mb4
1515
- --collation-server=utf8mb4_unicode_ci
16+
container_name: mysql
1617
environment:
1718
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-rootpass}
1819
MYSQL_USER: ${MYSQL_USER}
1920
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
2021
MYSQL_DATABASE: ${MYSQL_DATABASE}
2122
networks:
2223
- mysql-net
24+
# # Mount port for dev tools
2325
# ports:
2426
# - 3306:3306
2527
restart: unless-stopped
2628
volumes:
2729
- mysql-vol:/var/lib/mysql
30+
# # For initial database
2831
# - ./initdb:/docker-entrypoint-initdb.d:ro
2932
healthcheck:
30-
test: MYSQL_PWD=$$MYSQL_PASSWORD mysqladmin -h $$HOSTNAME -P 3306 -u $$MYSQL_USER --silent ping
33+
test: ["CMD-SHELL", "MYSQL_PWD=$$MYSQL_ROOT_PASSWORD mysqladmin ping -h localhost -u root -s"]
3134
start_period: 15s
3235
interval: 3s
3336
timeout: 3s
3437
retries: 5
3538

36-
wp:
39+
wordpress:
3740
image: wordpress_app
41+
container_name: wordpress
3842
build:
3943
context: ./docker/wordpress
4044
dockerfile: Dockerfile
@@ -67,16 +71,19 @@ services:
6771

6872
web:
6973
image: nginx:stable-alpine
74+
container_name: web
7075
depends_on:
71-
- wp
76+
- wordpress
77+
environment:
78+
PHP_FPM_ENDPOINT: wordpress:9000
7279
networks:
7380
- proxy-net
7481
restart: unless-stopped
7582
ports:
7683
- 80:80
7784
volumes:
7885
- ./docker/nginx/default.conf:/etc/nginx/templates/default.conf.template:ro
79-
- ./app:/var/www/html
86+
- ./app:/var/www/html:ro
8087
healthcheck:
8188
test: ["CMD", "curl", "-fs", "-o", "/dev/null", "http://localhost:80/_health/nginx"]
8289
start_period: 15s

docker/nginx/default.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
upstream php-fpm {
2-
server wp:9000;
2+
server ${PHP_FPM_ENDPOINT};
33
}
44

55
server {

0 commit comments

Comments
 (0)