Skip to content

Commit 61856bf

Browse files
committed
Adding wordmove to the development environment
Is very useful when you wanna deploy your database.
1 parent 61f4657 commit 61856bf

File tree

4 files changed

+126
-21
lines changed

4 files changed

+126
-21
lines changed

README.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Dev environment WordPress with Docker _**TIPS**_
2-
1+
# Dev environment WordPress with Docker _**TIPS**_
32

43
#### 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`.
54

@@ -17,23 +16,25 @@ For be able to manipulate easily the files of wordpress you need to:
1716
1. Create the user using phpmyadmin
1817
- allow conection from any host
1918
- create a database with the same name with all priviledges
20-
2. Download the WordPress core using
19+
2. Download the WordPress core using
2120
- `docker exec wp_server wp core download`
22-
3. Create your `wp-config` file
21+
3. Create your `wp-config` file
2322
- `docker exec -ti wp_server wp core config --prompt`
2423
- 1/12 --dbname=<**dbname**>: `YOUR_DB_NAME`
2524
- 2/12 --dbuser=<**dbuser**>: `USER_CREATED_AT_1`
2625
- 3/12 [--dbpass=<**dbpass**>]: `PASS_CREATED_AT_1`
2726
- 4/12 [--dbhost=<**dbhost**>]: `wp_mariadb`
2827
- 5...12 - Default values set by enter
29-
4. Install WordPress site
28+
4. Install WordPress site
3029
- `docker exec -ti wp_server wp core install --prompt`
3130
- 1/6 --url=<**url**>: `localhost`
3231
- 2...6 - Your personal configuration
3332

33+
------------------
34+
3435
## Changing the PHP version
3536

36-
1. stop everything with
37+
1. stop everything with
3738
- `docker-compose stop`
3839

3940
2. On the `docker-compose.yml` file, on service `wp_server` on the section `args` leave uncommented the php version that you want
@@ -53,25 +54,25 @@ For be able to manipulate easily the files of wordpress you need to:
5354

5455
------------------
5556

56-
## DB useful commands
57-
### Log into
58-
`docker exec -ti wp_mariadb mysql -h localhost -u root -pPASSWORD`
57+
## Deploying your database
58+
59+
We recommend to have a repo for your WordPress site, so the themes and plugins should be deployed by a `git pull` command.
60+
61+
> 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
62+
63+
### Login in to the container
64+
65+
`docker-compose run --rm wp_wordmove /bin/bash`
5966

60-
### Create db
61-
`docker exec -ti wp_mariadb mysql -h localhost -u root -pPASSWORD`
67+
### Deploying `uploads` folder
6268

63-
```
64-
Welcome to the MariaDB monitor. Commands end with ; or \g.
65-
Your MariaDB connection id is 19
66-
Server version: 10.2.7-MariaDB-10.2.7+maria~jessie mariadb.org binary distribution
69+
`wordmove push --uploads`
6770

68-
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
71+
### Deploying your database
6972

70-
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
73+
`wordmove push --db`
7174

72-
MariaDB [(none)]> CREATE DATABASE test CHARACTER SET utf8 COLLATE utf8_bin;
75+
> #### 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
7376

74-
MariaDB [(none)]> SHOW DATABASES;
75-
```
7677

7778
> Written with [StackEdit](https://stackedit.io/).

docker-compose.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,16 @@ services:
4646
links:
4747
- wp_mariadb
4848
ports:
49-
- "8888:80"
49+
- "8888:80"
50+
51+
wp_wordmove:
52+
build:
53+
context: ./docker-images/wordmove/
54+
command: 'echo "Hello From Wordmove"'
55+
volumes:
56+
- ./www/wp_files/:/www:ro
57+
# Movefile
58+
- ./www/wordmove/:/home:ro
59+
- ${HOME}/.ssh/:/root/.ssh:ro
60+
links:
61+
- wp_mariadb

docker-images/wordmove/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# Wordmove Dockerfile
3+
#
4+
5+
# Pull base image.
6+
FROM ubuntu:14.04
7+
8+
MAINTAINER bikecoders <bikecoders@gmail.com>
9+
10+
RUN apt-get update \
11+
apt-get install -y \
12+
openssh-server \
13+
curl \
14+
rsync \
15+
mysql-client-5.5 \
16+
sshpass
17+
18+
RUN \gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
19+
RUN \curl -sSL https://get.rvm.io | bash -s latest
20+
RUN echo "source /etc/profile.d/rvm.sh" >> /etc/bash.bashrc
21+
RUN /bin/bash -c "source /etc/profile.d/rvm.sh \
22+
&& rvm install 2.4.1 \
23+
&& gem install wordmove"
24+
ENV RUBYOPT="-KU -E utf-8:utf-8"
25+
26+
WORKDIR /home
27+
CMD ["/bin/bash"]

www/wordmove/Movefile

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
global:
2+
sql_adapter: "default"
3+
4+
local:
5+
vhost: "http://vhost.local"
6+
wordpress_path: "/www/" # use an absolute path here
7+
8+
database:
9+
name: "database_name"
10+
user: "user"
11+
password: "password"
12+
host: "127.0.0.1"
13+
14+
production:
15+
vhost: "http://example.com"
16+
wordpress_path: "/var/www/your_site" # use an absolute path here
17+
18+
database:
19+
name: "database_name"
20+
user: "user"
21+
password: "password"
22+
host: "wp_mariadb"
23+
# port: "3308" # Use just in case you have exotic server config
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+
- "wp-config.php"
36+
- "wp-content/*.sql.gz"
37+
38+
# paths: # you can customize wordpress internal paths
39+
# wp_content: "wp-content"
40+
# uploads: "wp-content/uploads"
41+
# plugins: "wp-content/plugins"
42+
# mu_plugins: "wp-content/mu-plugins"
43+
# themes: "wp-content/themes"
44+
# languages: "wp-content/languages"
45+
46+
ssh:
47+
host: "host"
48+
user: "user"
49+
# password: "password" # password is optional, will use public keys if available.
50+
# port: 22 # Port is optional
51+
# rsync_options: "--verbose" # Additional rsync options, optional
52+
# gateway: # Gateway is optional
53+
# host: "host"
54+
# user: "user"
55+
# password: "password" # password is optional, will use public keys if available.
56+
57+
# ftp:
58+
# user: "user"
59+
# password: "password"
60+
# host: "host"
61+
# passive: true
62+
# scheme: "ftps" # default "ftp"
63+
64+
# staging: # multiple environments can be specified
65+
# [...]

0 commit comments

Comments
 (0)