|
|
@@ -1,5 +1,4 @@
|
|
1
|
|
-Container Based Wordpress
|
|
2
|
|
-=========================
|
|
|
1
|
+# Container Based Wordpress
|
|
3
|
2
|
|
|
4
|
3
|
[](http://gitea.yvvas.com:8000/craft-in-america/vue-wp)
|
|
5
|
4
|
|
|
|
@@ -7,23 +6,21 @@ Docker + Wordpress for SPEED
|
|
7
|
6
|
|
|
8
|
7
|
Vue.js for sanity
|
|
9
|
8
|
|
|
10
|
|
-:tools: Requirements
|
|
11
|
|
---------------------
|
|
|
9
|
+## :tools: Requirements
|
|
12
|
10
|
|
|
13
|
11
|
### Node.js 19+
|
|
14
|
12
|
|
|
15
|
|
- * OSX: `brew install node` using [Homebrew](http://brew.sh/)
|
|
16
|
|
- * Linux: `apt install nodejs` ([see Ubuntu/Debian specific instructions](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions)) or `pacman -S nodejs` (Arch Linux)
|
|
17
|
|
- * Windows: [Install](https://nodejs.org/en/download/)
|
|
|
13
|
+- OSX: `brew install node` using [Homebrew](http://brew.sh/)
|
|
|
14
|
+- Linux: `apt install nodejs` ([see Ubuntu/Debian specific instructions](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions)) or `pacman -S nodejs` (Arch Linux)
|
|
|
15
|
+- Windows: [Install](https://nodejs.org/en/download/)
|
|
18
|
16
|
|
|
19
|
17
|
### Docker & docker-compose
|
|
20
|
18
|
|
|
21
|
|
- * OSX: TBD
|
|
22
|
|
- * Linux: TBD
|
|
23
|
|
- * Windows: TBD
|
|
24
|
|
-
|
|
25
|
|
-:gear: Installation
|
|
26
|
|
--------------------
|
|
|
19
|
+- OSX: TBD
|
|
|
20
|
+- Linux: TBD
|
|
|
21
|
+- Windows: TBD
|
|
|
22
|
+
|
|
|
23
|
+## :gear: Installation
|
|
27
|
24
|
|
|
28
|
25
|
1. Clone repo: `git clone ssh://git@gitea.yvvas.com:4022/craft-in-america/vue-wp.git`
|
|
29
|
26
|
2. Get into the directory with `cd vue-wp`
|
|
|
@@ -35,7 +32,7 @@ Vue.js for sanity
|
|
35
|
32
|
|
|
36
|
33
|
### Post-Installation Configuration
|
|
37
|
34
|
|
|
38
|
|
-The initial Wordpress installation does *not* include any content or user data beyond the default, so we'll need to adjust some settings before we can use our custom theme.
|
|
|
35
|
+The initial Wordpress installation does _not_ include any content or user data beyond the default, so we'll need to adjust some settings before we can use our custom theme.
|
|
39
|
36
|
|
|
40
|
37
|
1. The vue-theme is NOT enabled. Please enable it in the wp-admin page under `Appearance > Themes`
|
|
41
|
38
|
2. The custom plugins must be enabled for our theme to work. Please activate them in the wp-admin page under `Plugins`. You should activate `craft-endpoints`, `craft-post-types`, and `posts-to-posts`
|
|
|
@@ -49,10 +46,10 @@ The initial Wordpress installation does *not* include any content or user data b
|
|
49
|
46
|
4. Click 'Save Changes'
|
|
50
|
47
|
5. Verify the API by [visiting the API endpoint](http://localhost:8080/wp-json/wp/v2/)
|
|
51
|
48
|
|
|
52
|
|
-:construction_site: Development
|
|
53
|
|
--------------------------------
|
|
|
49
|
+## :construction_site: Development
|
|
54
|
50
|
|
|
55
|
51
|
After the `API` is active double check your settings in the `.env` file like so..
|
|
|
52
|
+
|
|
56
|
53
|
```
|
|
57
|
54
|
DB_PASSWORD=<change_me>
|
|
58
|
55
|
WORDPRESS_DB_USER=<default_user>
|
|
|
@@ -64,16 +61,16 @@ IS_DEV=true
|
|
64
|
61
|
|
|
65
|
62
|
Make sure `IS_DEV` is set to `true`. This is important.
|
|
66
|
63
|
|
|
67
|
|
-Currently the API uses `localhost`. This should be changed in production.
|
|
|
64
|
+Currently the API uses `localhost`. This should be changed in production.
|
|
68
|
65
|
|
|
69
|
66
|
Set your directory owner to `www-data` with `docker exec -it craft-wp chown -R www-data:www-data ./wp-content` so your Wordpress container can write files
|
|
70
|
67
|
|
|
71
|
|
-Lastly, run `npm run dev` to start the development server.
|
|
|
68
|
+Lastly, run `npm run dev` to start the development server.
|
|
72
|
69
|
|
|
73
|
70
|
If successful, it will tell you that it is running on `http://localhost:8081`
|
|
74
|
71
|
|
|
75
|
|
-:electric_plug: Deployment
|
|
76
|
|
---------------------------
|
|
|
72
|
+## :electric_plug: Deployment
|
|
|
73
|
+
|
|
77
|
74
|
Setup a staging server and initialize a bare git repo in the `/opt` directory
|
|
78
|
75
|
|
|
79
|
76
|
```
|
|
|
@@ -85,42 +82,46 @@ Copy over the `post-receive` script from `./deployment` to `/opt/staging/vue-wp.
|
|
85
|
82
|
On your development machine, add the staging server as a remote...
|
|
86
|
83
|
|
|
87
|
84
|
```
|
|
88
|
|
-git remote add staging <user>@<server_ip>:/opt/staging/vue-wp.git
|
|
|
85
|
+git remote add staging <user>@<server_ip>:/opt/staging/vue-wp.git
|
|
89
|
86
|
```
|
|
90
|
87
|
|
|
91
|
88
|
When you are ready to get your app to the new server, run `git push && git push staging` and things will get pulled and built on the staging server. Sweet!
|
|
92
|
89
|
|
|
93
|
|
-:robot: CI/CD
|
|
94
|
|
--------------
|
|
|
90
|
+## :robot: CI/CD
|
|
95
|
91
|
|
|
96
|
|
-Included is a drone config, and some recommended steps to build.
|
|
|
92
|
+Included is a drone config, and some recommended steps to build.
|
|
97
|
93
|
|
|
98
|
|
-* You MUST activate the pipeline
|
|
99
|
|
-* Add the `id_rsa` of the drone host to appropriate key in the pipeline secrets under the name `push_deploy_key`
|
|
|
94
|
+- You MUST activate the pipeline
|
|
|
95
|
+- Add the `id_rsa` of the drone host to appropriate key in the pipeline secrets under the name `push_deploy_key`
|
|
100
|
96
|
|
|
101
|
97
|
You also need to setup a `post-receive` hook on the host server.
|
|
102
|
98
|
|
|
103
|
|
-* On your *development* machine, add the target host as a remote `git remote add </opt/staging/vue-wp.git> staging master`
|
|
104
|
|
-* Login to the *remote* machine and setup a bare git repo on `git init --bare </opt/staging/vue-wp.git>`
|
|
105
|
|
-* Copy the `post-receive` hook file into the `</opt/staging/vue-wp.git/hooks/>` directory
|
|
|
99
|
+- On your _development_ machine, add the target host as a remote `git remote add </opt/staging/vue-wp.git> staging master`
|
|
|
100
|
+- Login to the _remote_ machine and setup a bare git repo on `git init --bare </opt/staging/vue-wp.git>`
|
|
|
101
|
+- Copy the `post-receive` hook file into the `</opt/staging/vue-wp.git/hooks/>` directory
|
|
106
|
102
|
|
|
107
|
|
-:question_mark: Misc
|
|
108
|
|
---------------------
|
|
|
103
|
+## :question_mark: Misc
|
|
109
|
104
|
|
|
110
|
105
|
### Backup commands
|
|
111
|
106
|
|
|
112
|
107
|
#### Uploads Directories
|
|
|
108
|
+
|
|
113
|
109
|
1. Download to development machine: `rsync -av <user>@<host>:/opt/vue-wp/uploads/ <local directory>`
|
|
114
|
110
|
2. Upload from development machine: `rsync -azP <file-path-to>/uploads/* <user>@<host>:/opt/staging/vue-wp.git/uploads/`
|
|
115
|
111
|
|
|
116
|
112
|
#### mysql Dump
|
|
|
113
|
+
|
|
117
|
114
|
1. On the production machine:
|
|
|
115
|
+
|
|
118
|
116
|
```
|
|
119
|
117
|
docker-compose exec -T craft-db mysqldump -u root -p current_cia | gzip > /home/<user_name>/backups/"`date +"%Y-%m-%d"`"-craftdb-backup.sql.gz
|
|
120
|
118
|
```
|
|
|
119
|
+
|
|
121
|
120
|
2. On your development machine: `rsync -av <user>@<host>:/home/<user>/<date>-craftdb-backup.sql.gz <local directory>`
|
|
122
|
121
|
|
|
123
|
122
|
```mysql
|
|
124
|
123
|
update wp_posts
|
|
125
|
124
|
set guid = replace(guid, 'http://old', 'http://143.110.234.41:8080/');
|
|
126
|
125
|
```
|
|
|
126
|
+
|
|
|
127
|
+testing drone
|