|
|
@@ -9,47 +9,39 @@ Vue.js for sanity
|
|
9
|
9
|
|
|
10
|
10
|
:tools: Requirements
|
|
11
|
11
|
--------------------
|
|
12
|
|
-### Backup commands
|
|
13
|
|
-
|
|
14
|
|
-#### Uploads Directories
|
|
15
|
|
-1. On your development machine: `rsync -av <user>@<host>:/opt/vue-wp/uploads/ <local directory>`
|
|
16
|
12
|
|
|
17
|
|
-#### mysql Dump
|
|
18
|
|
-1. On the production machine:
|
|
19
|
|
-```
|
|
20
|
|
-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
|
|
21
|
|
-```
|
|
22
|
|
-2. On your development machine: `rsync -av <user>@<host>:/home/<user>/<date>-craftdb-backup.sql.gz <local directory>`
|
|
23
|
|
-
|
|
24
|
|
--------------------------------
|
|
25
|
|
-
|
|
26
|
|
-### Node.js 12+
|
|
|
13
|
+### Node.js 14+
|
|
27
|
14
|
|
|
28
|
15
|
* OSX: `brew install node` using [Homebrew](http://brew.sh/)
|
|
29
|
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)
|
|
30
|
17
|
* Windows: [Install](https://nodejs.org/en/download/)
|
|
31
|
18
|
|
|
|
19
|
+### Docker & docker-compose
|
|
|
20
|
+
|
|
|
21
|
+ * OSX: TBD
|
|
|
22
|
+ * Linux: TBD
|
|
|
23
|
+ * Windows: TBD
|
|
|
24
|
+
|
|
32
|
25
|
:gear: Installation
|
|
33
|
26
|
-------------------
|
|
34
|
27
|
|
|
35
|
28
|
1. Clone repo: `git clone ssh://git@gitea.yvvas.com:4022/craft-in-america/vue-wp.git`
|
|
36
|
29
|
2. Get into the directory with `cd vue-wp`
|
|
37
|
|
-3. Spin up those containers with `docker-compose up -d`
|
|
38
|
|
-4. Navigate to the theme directory with `cd vue-theme`
|
|
39
|
|
-5. Install dependencies: `npm install`
|
|
40
|
|
-6. Verify it runs: `npm run dev`, then check [http://localhost:8081](http://localhost:8081)
|
|
|
30
|
+3. Copy the `sample.env` file to `.env` and substitute the variables with your own
|
|
|
31
|
+4. Spin up the database and Wordpress containers with `docker-compose up -d`
|
|
|
32
|
+5. Use a web-browser to navigate to `http://localhost:8080` and complete the Wordpress installer
|
|
|
33
|
+6. After Wordpress installation is complete, with your terminal navigate to the theme directory `cd vue-theme`
|
|
|
34
|
+7. Install the theme dependencies: `npm install`
|
|
41
|
35
|
|
|
42
|
|
-After Installation Gotchas
|
|
43
|
|
---------------------------
|
|
|
36
|
+### Post-Installation Configuration
|
|
44
|
37
|
|
|
45
|
|
-1. Wordpress starts completely without any data so you'll have to install it, name your dev site, create a login, etc.
|
|
46
|
|
-2. The vue-theme is NOT enabled. Please enable it in the wp-admin page under Appearance > Themes
|
|
47
|
|
-3. Wordpress' API is NOT turned on by default, so the vue-theme won't display anything.
|
|
48
|
|
-4. Navigation, footers, and submenus are API driven. Navigate to the [customize page](http://localhost:8080/wp-admin/customize.php?theme=vue-theme) and create `main_nav`, `footer`, and `sub_nav_<insert-custom-type-here>`
|
|
|
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.
|
|
49
|
39
|
|
|
|
40
|
+1. The vue-theme is NOT enabled. Please enable it in the wp-admin page under `Appearance > Themes`
|
|
|
41
|
+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`
|
|
|
42
|
+3. Wordpress' `API` is NOT turned on by default, so the vue-theme won't have anything to display. You will need to start the `API` with the instructions below.
|
|
50
|
43
|
|
|
51
|
|
-Activate Wordpress API
|
|
52
|
|
-----------------------
|
|
|
44
|
+### Activate Wordpress API
|
|
53
|
45
|
|
|
54
|
46
|
1. Navigate to Settings > [Permalinks](http://localhost:8080/wp-admin/options-permalink.php)
|
|
55
|
47
|
2. Click the 'Custom Structure' radio button
|
|
|
@@ -57,39 +49,46 @@ Activate Wordpress API
|
|
57
|
49
|
4. Click 'Save Changes'
|
|
58
|
50
|
5. Verify the API by [visiting the API endpoint](http://localhost:8080/wp-json/wp/v2/)
|
|
59
|
51
|
|
|
60
|
|
-
|
|
61
|
52
|
:construction_site: Development
|
|
62
|
|
-------------------------------------
|
|
63
|
|
-
|
|
64
|
|
-Setup a staging server and initialize a bare git repo in the `/opt` directoru
|
|
|
53
|
+-------------------------------
|
|
65
|
54
|
|
|
|
55
|
+After the `API` is active double check your settings in the `.env` file like so..
|
|
66
|
56
|
```
|
|
67
|
|
-git init --bare /opt/vue-wp.git
|
|
|
57
|
+DB_PASSWORD=<change_me>
|
|
|
58
|
+WORDPRESS_DB_USER=<default_user>
|
|
|
59
|
+WORDPRESS_DB_PASSWORD=<change_me>
|
|
|
60
|
+DB_NAME=<current_db>
|
|
|
61
|
+IS_DEV=true
|
|
|
62
|
+
|
|
68
|
63
|
```
|
|
69
|
64
|
|
|
70
|
|
-Copy over the `post-receive` script from `./deployment` to `/opt/vue-wp.git/hooks` and make it executable with the command `chmod ug+x /opt/vue-wp.git/hooks/post-receive`
|
|
|
65
|
+Make sure `IS_DEV` is set to `true`. This is important.
|
|
71
|
66
|
|
|
72
|
|
-On your development machine, add the staging server as a remote...
|
|
|
67
|
+Currently the API uses `localhost`. This should be changed in production.
|
|
73
|
68
|
|
|
74
|
|
-```
|
|
75
|
|
-git remote add staging <user>@<server_ip>:/opt/staging/vue-wp.git
|
|
76
|
|
-```
|
|
|
69
|
+Set your directory owner to `www-data` with `docker exec -it craft-vue chown -R www-data:www-data ./wp-content` so your Wordpress container can write files
|
|
|
70
|
+
|
|
|
71
|
+Lastly, run `npm run dev` to start the development server.
|
|
|
72
|
+
|
|
|
73
|
+If successful, it will tell you that it is running on `http://localhost:8081`
|
|
77
|
74
|
|
|
78
|
75
|
:electric_plug: Deployment
|
|
79
|
76
|
--------------------------
|
|
|
77
|
+Setup a staging server and initialize a bare git repo in the `/opt` directory
|
|
80
|
78
|
|
|
81
|
|
-When you get ready to deploy your app to an actual server, run `git push && git push staging` and things will get pulled and built on the staging server. Sweet!
|
|
82
|
|
-
|
|
83
|
|
-Currently the API uses localhost. This should be changed in production.
|
|
84
|
|
-Set your passwords in the `.env` file like so..
|
|
85
|
79
|
```
|
|
86
|
|
-DB_PASSWORD=<changeme>
|
|
87
|
|
-WORDPRESS_DB_USER=root
|
|
88
|
|
-IS_DEV=false
|
|
|
80
|
+git init --bare /opt/staging/craft-vue.git
|
|
89
|
81
|
```
|
|
90
|
82
|
|
|
91
|
|
-Lastly set your directory owner to `www-data` with `docker exec -it vue-wp chown -R www-data:www-data ./wp-content`
|
|
|
83
|
+Copy over the `post-receive` script from `./deployment` to `/opt/staging/craft-vue.git/hooks` and make it executable with the command `chmod ug+x /opt/staging/craft-vue.git/hooks/post-receive`
|
|
92
|
84
|
|
|
|
85
|
+On your development machine, add the staging server as a remote...
|
|
|
86
|
+
|
|
|
87
|
+```
|
|
|
88
|
+git remote add staging <user>@<server_ip>:/opt/staging/craft-vue.git
|
|
|
89
|
+```
|
|
|
90
|
+
|
|
|
91
|
+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!
|
|
93
|
92
|
|
|
94
|
93
|
:robot: CI/CD
|
|
95
|
94
|
-------------
|
|
|
@@ -101,6 +100,21 @@ Included is a drone config, and some recommended steps to build.
|
|
101
|
100
|
|
|
102
|
101
|
You also need to setup a `post-receive` hook on the host server.
|
|
103
|
102
|
|
|
104
|
|
-* On your *development* machine, add the target host as a remote `git remote add </opt/staging/js-vue.git> staging master`
|
|
105
|
|
-* Login to the *remote* machine and setup a bare git repo on `git init --bare </opt/staging/js-vue.git>`
|
|
106
|
|
-* Copy the `post-receive` hook file into the `</opt/staging/js-vue.git/hooks/>` directory
|
|
|
103
|
+* On your *development* machine, add the target host as a remote `git remote add </opt/staging/craf-vue.git> staging master`
|
|
|
104
|
+* Login to the *remote* machine and setup a bare git repo on `git init --bare </opt/staging/craf-vue.git>`
|
|
|
105
|
+* Copy the `post-receive` hook file into the `</opt/staging/craf-vue.git/hooks/>` directory
|
|
|
106
|
+
|
|
|
107
|
+:question_mark: Misc
|
|
|
108
|
+--------------------
|
|
|
109
|
+
|
|
|
110
|
+### Backup commands
|
|
|
111
|
+
|
|
|
112
|
+#### Uploads Directories
|
|
|
113
|
+1. On your development machine: `rsync -av <user>@<host>:/opt/vue-wp/uploads/ <local directory>`
|
|
|
114
|
+
|
|
|
115
|
+#### mysql Dump
|
|
|
116
|
+1. On the production machine:
|
|
|
117
|
+```
|
|
|
118
|
+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
|
|
|
119
|
+```
|
|
|
120
|
+2. On your development machine: `rsync -av <user>@<host>:/home/<user>/<date>-craftdb-backup.sql.gz <local directory>`
|