浏览代码

:pencil: tweaking directions for better backups and push deploy description

tags/0.9.0
J 5 年前
父节点
当前提交
e050348cf2
共有 2 个文件被更改,包括 52 次插入26 次删除
  1. 20
    26
      README.md
  2. 32
    0
      deployment/post-receive

+ 20
- 26
README.md 查看文件

14
 #### Uploads Directories
14
 #### Uploads Directories
15
 1. On your development machine: `rsync -av <user>@<host>:/opt/vue-wp/uploads/ <local directory>`
15
 1. On your development machine: `rsync -av <user>@<host>:/opt/vue-wp/uploads/ <local directory>`
16
 
16
 
17
-#### MariaDb Container
18
-1. On the production machine: `docker commit -p d3346eb32de0 <snapshot_name>`
19
-2. On the production machine: `docker save -o ~/<snapshot_name>.tar <snapshot_name>`
20
-3. On your development machine: `rsync -av <user>@<host>:/home/<user>/<snapshot_name> <local directory>`
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>`
21
 
23
 
22
 -------------------------------
24
 -------------------------------
23
 
25
 
24
-### Node.js 10+
26
+### Node.js 12+
25
 
27
 
26
  * OSX: `brew install node` using [Homebrew](http://brew.sh/)
28
  * OSX: `brew install node` using [Homebrew](http://brew.sh/)
27
  * 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)
29
  * 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)
31
 -------------------
33
 -------------------
32
 
34
 
33
 1. Clone repo: `git clone ssh://git@gitea.yvvas.com:4022/craft-in-america/vue-wp.git`
35
 1. Clone repo: `git clone ssh://git@gitea.yvvas.com:4022/craft-in-america/vue-wp.git`
34
-2. Get into the directory with `cd craft-vue`
36
+2. Get into the directory with `cd vue-wp`
35
 3. Spin up those containers with `docker-compose up -d`
37
 3. Spin up those containers with `docker-compose up -d`
36
-4. Navigate to the theme directory with `cd cia-vue-theme`
38
+4. Navigate to the theme directory with `cd vue-theme`
37
 5. Install dependencies: `npm install`
39
 5. Install dependencies: `npm install`
38
 6. Verify it runs: `npm run dev`, then check [http://localhost:8081](http://localhost:8081)
40
 6. Verify it runs: `npm run dev`, then check [http://localhost:8081](http://localhost:8081)
39
 
41
 
56
 5. Verify the API by [visiting the API endpoint](http://localhost:8080/wp-json/wp/v2/)
58
 5. Verify the API by [visiting the API endpoint](http://localhost:8080/wp-json/wp/v2/)
57
 
59
 
58
 
60
 
59
-:construction_site: Where from here?
61
+:construction_site: Development
60
 ------------------------------------
62
 ------------------------------------
61
 
63
 
62
-Now that your pipeline is in place, you can start writing your application. Start by modifying the entry point `main.js` and creating new `.js` files to store your other modules (which you'll import from `main.js`).
63
-
64
-A really great library to quickly prototype is [Vue.js](https://github.com/vuejs/vue).
65
-
66
-### Directory Structure
67
-
68
-In the `src` folder there will already be a base HTML page. Any other assets can be put in `src` or just create subfolders where you will import from (E.G. `styles`, `scripts`, `assets`, `fonts`, `images`, etc.). The structure is up to you.
64
+Setup a staging server and initialize a bare git repo in the `/opt` directoru
69
 
65
 
70
-### Installing Dependencies
71
-
72
-Search for packages:
73
-`npm search <query>`
66
+```
67
+git init --bare /opt/vue-wp.git
68
+```
74
 
69
 
75
-Install packages (for production dependencies like d3, three.js, etc.):
76
-`npm install <package> --save`
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`
77
 
71
 
78
-Install packages(for dev dependencies like Jasmin, Protractor, etc.)
79
-`npm install <package> --save-dev`
72
+On your development machine, add the staging server as a remote...
80
 
73
 
81
-Uninstall packages:
82
-`npm uninstall <package>`
74
+```
75
+git remote add staging <user>@<server_ip>:/opt/staging/vue-wp.git 
76
+```
83
 
77
 
84
 :electric_plug: Deployment
78
 :electric_plug: Deployment
85
 --------------------------
79
 --------------------------
86
 
80
 
87
-When you get ready to deploy your app to an actual server, run `npm run build` and things get compressed and tidied up into a `public` directory. Sweet!
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!
88
 
82
 
89
 Currently the API uses localhost. This should be changed in production. 
83
 Currently the API uses localhost. This should be changed in production. 
90
 Set your passwords in the `.env` file like so..
84
 Set your passwords in the `.env` file like so..

+ 32
- 0
deployment/post-receive 查看文件

1
+#!/bin/sh
2
+
3
+printf "\n\nStarting post-receive…\n"
4
+printf "===============================\n"
5
+
6
+cd /opt/staging/vue-wp.git
7
+
8
+printf "\n*------------------------------\n"
9
+printf "* POST-RECEIVE: git checkout… -\n"
10
+printf "*------------------------------\n"
11
+printf "Step 1 of 3\n\n"
12
+
13
+git --git-dir=/opt/staging/vue-wp.git --work-tree=/opt/staging/vue-wp.git checkout master -f
14
+
15
+printf "\n*------------------------------\n"
16
+printf "* POST-RECEIVE: npm install… --\n"
17
+printf "*------------------------------\n"
18
+printf "Step 2 of 3\n\n"
19
+
20
+cd /opt/staging/vue-wp.git/vue-theme && npm install
21
+
22
+printf "\n*------------------------------\n"
23
+printf "* POST-RECEIVE: building… -----\n"
24
+printf "*------------------------------\n"
25
+printf "Step 3 of 3\n\n"
26
+
27
+npm run build
28
+
29
+printf "\n*-----------------------------\n"
30
+printf "* POST-RECEIVE: → SUCCESS ----\n"
31
+printf "*-----------------------------\n"
32
+printf "==============================\n\n"

正在加载...
取消
保存