| author | ymh <ymh.work@gmail.com> |
| Mon, 17 Jun 2019 12:56:05 +0200 | |
| changeset 23 | 5249c3c623a6 |
| parent 14 | 30f2ac9a7656 |
| child 28 | 1150866741ec |
| permissions | -rw-r--r-- |
|
12
d9d75b93e132
Add deploy files. Prepare first version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
# Recherchecontributive deployment |
|
d9d75b93e132
Add deploy files. Prepare first version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
|
|
d9d75b93e132
Add deploy files. Prepare first version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
The deployment is done with ansible. |
|
d9d75b93e132
Add deploy files. Prepare first version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
A pipfile is available to set it up. |
|
d9d75b93e132
Add deploy files. Prepare first version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
This deployment take |
|
d9d75b93e132
Add deploy files. Prepare first version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
|
|
d9d75b93e132
Add deploy files. Prepare first version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
7 |
## Start the deploy |
|
d9d75b93e132
Add deploy files. Prepare first version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
8 |
|
|
d9d75b93e132
Add deploy files. Prepare first version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
9 |
- `deploy.sh <profile> <hg tag>`. Example: `deploy.sh test tip` |
|
d9d75b93e132
Add deploy files. Prepare first version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
10 |
|
|
d9d75b93e132
Add deploy files. Prepare first version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
11 |
## configuration file: |
|
d9d75b93e132
Add deploy files. Prepare first version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
|
|
d9d75b93e132
Add deploy files. Prepare first version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
13 |
- `hosts/hosts.<profile>` |
|
d9d75b93e132
Add deploy files. Prepare first version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
- `group_vars/<profile>.yml` |
|
d9d75b93e132
Add deploy files. Prepare first version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
- `host_vars/<hostname>/base.yml` base `host_vars/base.yml.tmpl` |
| 14 | 16 |
|
17 |
## Database deploy |
|
18 |
||
19 |
- `deploy_db.sh [CONFIG] [DB_FILE_PATH] [ORIGIN_URL]` |
|
20 |
||
21 |
With: |
|
22 |
- `CONFIG`: test or prod |
|
23 |
- `DB_FILE_PATH`: The database definition file (SQL) |
|
24 |
- `ORIGIN_URL`: The site base URL matching the database file |
|
25 |
||
26 |
This script call the `deploy_db.yml` ansible script and perform the following operations |
|
27 |
- copy the sql file to the server |
|
28 |
- apply the sql file with wp-cli `db` command |
|
29 |
- search and replace the origin url (wp-cli search-replace) |
|
30 |
- set `template_root` option (wp-cli option) |
|
31 |
- delete _site_transient_update_themes and _site_transient_theme_roots options (wp-cli option) |
|
32 |
- update admin password (wp-cli user update) |
|
33 |
- flush cache (wp-cli cache flush) |
|
| 23 | 34 |
|
35 |
||
36 |
## Database dump |
|
37 |
||
38 |
- `dump_db.sh [CONFIG] [DB_FILE_PATH]` |
|
39 |
||
40 |
With: |
|
41 |
- `CONFIG`: test or prod |
|
42 |
- `DB_FILE_PATH`: The database definition file (SQL) |
|
43 |
||
44 |
This script call the `dump_db.sql` ansible script and perform the following operation |
|
45 |
- create a temporary file on the remote host |
|
46 |
- dump the content of the database into this file (wp-cli db export) |
|
47 |
- fetch the file and write it to the givent path |
|
48 |
- delete the temporary file |
|
49 |
||
50 |
**WARNING** : This command write to the destination file and replace it without warning |