deploy/README.md
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--
Add a command to dump the database
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    16
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    17
## Database deploy
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    18
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    19
- `deploy_db.sh [CONFIG] [DB_FILE_PATH] [ORIGIN_URL]`
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    20
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    21
With:
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    22
- `CONFIG`: test or prod
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    23
- `DB_FILE_PATH`: The database definition file (SQL)
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    24
- `ORIGIN_URL`: The site base URL matching the database file
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    25
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    26
This script call the `deploy_db.yml` ansible script and perform the following operations
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    27
- copy the sql file to the server
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    28
- apply the sql file with wp-cli `db` command
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    29
- search and replace the origin url (wp-cli search-replace)
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    30
- set `template_root` option (wp-cli option)
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    31
- delete _site_transient_update_themes and _site_transient_theme_roots options (wp-cli option)
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    32
- update admin password (wp-cli user update)
30f2ac9a7656 Add command to deploy batabase
ymh <ymh.work@gmail.com>
parents: 12
diff changeset
    33
- flush cache (wp-cli cache flush)
23
5249c3c623a6 Add a command to dump the database
ymh <ymh.work@gmail.com>
parents: 14
diff changeset
    34
5249c3c623a6 Add a command to dump the database
ymh <ymh.work@gmail.com>
parents: 14
diff changeset
    35
5249c3c623a6 Add a command to dump the database
ymh <ymh.work@gmail.com>
parents: 14
diff changeset
    36
## Database dump
5249c3c623a6 Add a command to dump the database
ymh <ymh.work@gmail.com>
parents: 14
diff changeset
    37
5249c3c623a6 Add a command to dump the database
ymh <ymh.work@gmail.com>
parents: 14
diff changeset
    38
- `dump_db.sh [CONFIG] [DB_FILE_PATH]`
5249c3c623a6 Add a command to dump the database
ymh <ymh.work@gmail.com>
parents: 14
diff changeset
    39
5249c3c623a6 Add a command to dump the database
ymh <ymh.work@gmail.com>
parents: 14
diff changeset
    40
With:
5249c3c623a6 Add a command to dump the database
ymh <ymh.work@gmail.com>
parents: 14
diff changeset
    41
- `CONFIG`: test or prod
5249c3c623a6 Add a command to dump the database
ymh <ymh.work@gmail.com>
parents: 14
diff changeset
    42
- `DB_FILE_PATH`: The database definition file (SQL)
5249c3c623a6 Add a command to dump the database
ymh <ymh.work@gmail.com>
parents: 14
diff changeset
    43
5249c3c623a6 Add a command to dump the database
ymh <ymh.work@gmail.com>
parents: 14
diff changeset
    44
This script call the `dump_db.sql` ansible script and perform the following operation
5249c3c623a6 Add a command to dump the database
ymh <ymh.work@gmail.com>
parents: 14
diff changeset
    45
- create a temporary file on the remote host
5249c3c623a6 Add a command to dump the database
ymh <ymh.work@gmail.com>
parents: 14
diff changeset
    46
- dump the content of the database into this file (wp-cli db export)
5249c3c623a6 Add a command to dump the database
ymh <ymh.work@gmail.com>
parents: 14
diff changeset
    47
- fetch the file and write it to the givent path
5249c3c623a6 Add a command to dump the database
ymh <ymh.work@gmail.com>
parents: 14
diff changeset
    48
- delete the temporary file
5249c3c623a6 Add a command to dump the database
ymh <ymh.work@gmail.com>
parents: 14
diff changeset
    49
5249c3c623a6 Add a command to dump the database
ymh <ymh.work@gmail.com>
parents: 14
diff changeset
    50
**WARNING** : This command write to the destination file and replace it without warning