Skip to content

Commit cf99b31

Browse files
committed
Improve Wordmove Service
2 parents 7ee7e29 + 7e3ade9 commit cf99b31

File tree

4 files changed

+113
-122
lines changed

4 files changed

+113
-122
lines changed

README.md

+3-106
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,5 @@
1-
# DEVELOPMENT WordPress environment with Docker
1+
### This docker compose is designed to have a modern development and production environment, easy to set up
22

3-
#### This docker compose was made to have a modern WP dev environment which can be portable, easy to set up and focused on the use of `wp`.
3+
![wordpress_docker - peque](https://user-images.githubusercontent.com/7026066/37237721-7a6f12e8-23e5-11e8-87d1-0b1386a693ae.png)
44

5-
## Start everything
6-
7-
You need to pass several arguments such as:
8-
- **DB_PASS** When the DB is raised this will be its root password
9-
10-
`export DB_PASS=YOUR_SUPER_SECURE_PASSWORD && export UID && docker-compose up`
11-
12-
> With `docker-compose up` it will run a phpmyadmin service, this is created with goal of facilitate the management of the DataBase (not all of us are command ninja). You can stop it when you are not using it with `docker-compose stop wp_phpmyadmin`
13-
14-
## Configuring Wordmove
15-
16-
Your `Movefile` must be inside `configs/wordmove/`.
17-
18-
## Deploying your database
19-
20-
We recommend to have a repo for your WordPress site, so the themes and plugins should be deployed by a `git pull` command.
21-
22-
> By the moment we don't expose the wordmove entrypoint in the container so you need to login to container and execute the following commands
23-
24-
25-
### Login in to the container
26-
27-
`docker-compose run --rm wp_wordmove /bin/bash`
28-
29-
### Creating Movefile
30-
31-
`wordmove init`
32-
33-
### Deploying `uploads` folder
34-
35-
`wordmove push --uploads`
36-
37-
### Deploying your database
38-
39-
`wordmove push --db`
40-
41-
> #### The database deploy will overwritte the database on the production site, each comment, post, subscriber that is not in your local database will be lost
42-
43-
----------------------------------
44-
45-
# PRODUCTION WordPress environment with Docker
46-
47-
#### This docker compose was made to have a modern WP dev environment which can be portable, easy to set up and with HTTPS with letsencrypt.
48-
49-
## Start everything
50-
51-
You need to pass several arguments such as:
52-
- **DB_PASS** When the DB is raised this will be its root password
53-
- **DOMAIN** Put your domain _your-domain.com_. This is needed to the https set up.
54-
- **EMAIL** Put your email domain _email@your-domain.com_. This is needed to the https set up.
55-
56-
`export DB_PASS=YOUR_SUPER_SECURE_PASSWORD && export DOMAIN=your-domain.com && export EMAIL=email@your-domain.com && docker-compose --file docker-compose-production.yml up -d && docker-compose --file docker-compose-production.yml stop wp_phpmyadmin`
57-
58-
> This will stop the phpmyadmin service for security reasons, if you want to run it just
59-
> `docker-compose --file docker-compose-production.yml start wp_phpmyadmin`
60-
61-
--------------------------
62-
63-
# Common features
64-
65-
In this section you will find development and production common features.
66-
67-
## Steps to begin with a new WP project
68-
69-
1. Create the user using phpmyadmin
70-
- allow connection from any host
71-
- create a database with the same name with all privileges
72-
2. Download the WordPress core using
73-
- `docker-compose run --rm --user=82 wp_server wp core download`
74-
3. Create your `wp-config` file
75-
- `docker-compose run --rm --user=82 wp_server wp core config --prompt`
76-
- 1/12 --dbname=<**dbname**>: `YOUR_DB_NAME`
77-
- 2/12 --dbuser=<**dbuser**>: `USER_CREATED_AT_1`
78-
- 3/12 [--dbpass=<**dbpass**>]: `PASS_CREATED_AT_1`
79-
- 4/12 [--dbhost=<**dbhost**>]: `wp_mariadb`
80-
- 5...12 - Default values set by enter
81-
4. Install WordPress site
82-
- `docker-compose run --rm --user=82 wp_server wp core install --prompt`
83-
- 1/6 --url=<**url**>: `localhost`
84-
- 2...6 - Your personal configuration
85-
86-
## Changing the PHP version
87-
88-
> Remember that if you are on production you must specify docker compose file using `--file docker-compose-production.yml`
89-
90-
1. stop everything with
91-
- `docker-compose stop`
92-
93-
2. On the `docker-compose.yml` file, on service `wp_server` on the section `args` leave uncommented the php version that you want
94-
```yml
95-
args:
96-
PHP_VERSION: 7.1
97-
# PHP_VERSION: 7.0
98-
# PHP_VERSION: 5.6
99-
```
100-
3. Then build the new image with:
101-
- `docker-compose build`
102-
4. Run everything again:
103-
- `export DB_PASS=YOUR_SUPER_SECURE_PASSWORD export DOMAIN=your-domain.com && export EMAIL=email@your-domain.com && docker-compose up`
104-
105-
5. To verify the version run
106-
- `docker-compose run --rm wp_server php --version`
107-
108-
> Written with [StackEdit](https://stackedit.io/).
5+
# The documentation is on the [WIKI 📚](https://github.com/bikecoders/docker-compose_wordpress/wiki)

configs/wordmove/movefile.yml

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
global:
2+
sql_adapter: default
3+
4+
local:
5+
vhost: http://localhost
6+
wordpress_path: /www/ # use an absolute path here -- DONT CHANGE --
7+
8+
database:
9+
name: DB_NAME_LOCAL
10+
user: DB_USERNAME_LOCAL
11+
password: "DB_PASSWORD_LOCAL" # could be blank, so always use quotes around
12+
host: mariadb # -- DONT CHANGE --
13+
14+
production:
15+
vhost: http://YOUR_DOMAIN
16+
wordpress_path: YOUR_CUSTOM_PATH/www/wp_files/ # use an absolute path here. SHOULD ALWAYS ENDS WITH '/www/wp_files/'
17+
18+
database:
19+
name: DB_NAME_PROD
20+
user: DB_USERNAME_PROD
21+
password: "DB_PASSWORD_PROD" # could be blank, so always use quotes around
22+
host: 127.0.0.1 # -- DONT CHANGE --
23+
port: "3306" # -- DONT CHANGE --
24+
# mysqldump_options: --max_allowed_packet=1G # Only available if using SSH
25+
26+
exclude:
27+
- '.git/'
28+
- '.gitignore'
29+
- '.sass-cache/'
30+
- 'node_modules/'
31+
- 'bin/'
32+
- 'tmp/*'
33+
- 'Gemfile*'
34+
- 'Movefile'
35+
- 'movefile'
36+
- 'movefile.yml'
37+
- 'movefile.yaml'
38+
- 'wp-config.php'
39+
- 'wp-content/*.sql.gz'
40+
- '*.orig'
41+
42+
# paths: # you can customize wordpress internal paths
43+
# wp_content: wp-content
44+
# uploads: wp-content/uploads
45+
# plugins: wp-content/plugins
46+
# mu_plugins: wp-content/mu-plugins
47+
# themes: wp-content/themes
48+
# languages: wp-content/languages
49+
50+
ssh:
51+
host: YOUR_DOMAIN
52+
user: SSH_USER
53+
# password: SSH_PASSWORD # password is optional, will use public keys if available.
54+
# port: 22 # Port is optional
55+
# rsync_options: --verbose --itemize-changes# Additional rsync options, optional
56+
# gateway: # Gateway is optional
57+
# host: host
58+
# user: user
59+
# password: password # password is optional, will use public keys if available.
60+
61+
# ftp:
62+
# user: user
63+
# password: password
64+
# host: host
65+
# passive: true
66+
# scheme: ftps # default ftp
67+
68+
# hooks: # Remote hooks won't work with FTP
69+
# push:
70+
# before:
71+
# local:
72+
# - 'echo "Do something locally before push"'
73+
# remote:
74+
# - 'echo "Do something remotely before push"'
75+
# after:
76+
# local:
77+
# - 'echo "Do something locally after push"'
78+
# remote:
79+
# - 'echo "Do something remotely after push"'
80+
# pull:
81+
# before:
82+
# local:
83+
# - 'echo "Do something locally before pull"'
84+
# remote:
85+
# - 'echo "Do something remotely before pull"'
86+
# after:
87+
# local:
88+
# - 'echo "Do something locally after pull"'
89+
# remote:
90+
# - 'echo "Do something remotely after pull"'
91+
92+
# staging: # multiple environments can be specified
93+
# [...]

docker-compose-production.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ services:
3030
restart: always
3131
# <<<<< Https
3232

33-
wp_http_server:
33+
http_server:
3434
image: nginx:1.13.3-alpine
3535
restart: always
3636
links:
@@ -63,9 +63,9 @@ services:
6363
- ./www/wp_files/:/www
6464
- ./configs/php/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
6565
links:
66-
- wp_mariadb
66+
- mariadb
6767

68-
wp_mariadb:
68+
mariadb:
6969
image: mariadb
7070
restart: always
7171
ports:
@@ -78,13 +78,13 @@ services:
7878
environment:
7979
- MYSQL_ROOT_PASSWORD=${DB_PASS}
8080

81-
wp_phpmyadmin:
81+
phpmyadmin:
8282
image: phpmyadmin/phpmyadmin
8383
restart: always
8484
environment:
85-
- PMA_HOST=wp_mariadb
85+
- PMA_HOST=mariadb
8686
links:
87-
- wp_mariadb
87+
- mariadb
8888
ports:
8989
- "8888:80"
9090

docker-compose.yml

+11-10
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ version: "2"
33

44
services:
55

6-
wp_http_server:
6+
http_server:
77
image: nginx:1.13.3-alpine
88
restart: always
99
ports:
1010
- "80:80"
11-
- 443:443
1211
volumes:
1312
- ./www/wp_files/:/www:ro
1413
- ./configs/nginx/conf/nginx.conf:/etc/nginx/conf/nginx.conf:ro
@@ -28,9 +27,9 @@ services:
2827
- ./www/wp_files/:/www
2928
- ./configs/php/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
3029
links:
31-
- wp_mariadb
30+
- mariadb
3231

33-
wp_mariadb:
32+
mariadb:
3433
image: mariadb
3534
restart: always
3635
ports:
@@ -40,24 +39,26 @@ services:
4039
environment:
4140
- MYSQL_ROOT_PASSWORD=${DB_PASS}
4241

43-
wp_phpmyadmin:
42+
phpmyadmin:
4443
image: phpmyadmin/phpmyadmin
4544
restart: always
4645
environment:
47-
- PMA_HOST=wp_mariadb
46+
- PMA_HOST=mariadb
4847
links:
49-
- wp_mariadb
48+
- mariadb
5049
ports:
5150
- "8888:80"
5251

53-
wp_wordmove:
52+
wordmove:
5453
build:
5554
context: ./docker-images/wordmove/
5655
command: 'echo "Hello From Wordmove"'
5756
volumes:
5857
- ./www/wp_files/:/www
5958
# Movefile
60-
- ./configs/wordmove/:/home/:ro
59+
- ./configs/wordmove/:/home/
60+
# For ssh
6161
- ${HOME}/.ssh/:/root/.ssh:ro
62+
- /etc/passwd:/etc/passwd:ro
6263
links:
63-
- wp_mariadb
64+
- mariadb

0 commit comments

Comments
 (0)