Update readme, modify deployment, add skeleton of update

master
Dylan DiGeronimo 2020-04-15 20:25:46 -04:00
parent 65974043f7
commit 5d88dda155
3 changed files with 48 additions and 3 deletions

View File

@ -13,9 +13,21 @@ To deploy, run the `setup-frontend-prod` playbook from within the directory cont
$ ansible-playbook -i hosts setup-frontend-prod.yml --key-file="/path/to/key/on/your/machine"
```
### Updating
Once new changes have been added to the master branch of the [frontend repo](https://github.com/EbookFoundation/cce-search-prototype), run `update-frontend-prod` playbook:
```
$ ansible-playbook -i hosts update-frontend-prod.yml --key-file="/path/to/key/on/your/machine"
```
### Manually renewing HTTPS cert
If Certbot does not automatically renew the HTTPS certificate, run the `refresh-frontend-cert` playbook:
```
$ ansible-playbook -i hosts refresh-frontend-cert.yml --key-file="/path/to/key/on/your/machine"
```
### TODO
1. Complete todos from setup-frontend-prod.yml
2. Complete refresh-frontend-cert.yml
2. Automate installation of Python 3.7 and pip3
3. Create playbook to renew HTTPS cert
4. Setup Ansible Vault to handle keys
3. Complete update-frontend-prod.yml
4. Automate installation of Python 3.7 and pip3
5. Setup Ansible Vault to handle keys

View File

@ -42,6 +42,7 @@
git:
accept_hostkey: yes
force: yes
update: yes
repo: "{{ frontend_git_repo }}"
dest: "{{ frontend_project_path }}"
version: "{{ frontend_git_branch }}"

32
update-frontend-prod.yml Normal file
View File

@ -0,0 +1,32 @@
- hosts: cce_frontend_prod
tasks:
# - name: 'CD to project dir'
# chdir: '{{ frontend_project_path }}'
- name: Bring down current instance
command: 'killall python'
- name: Pull from GitHub
git:
accept_hostkey: yes
force: yes
update: yes
repo: "{{ frontend_git_repo }}"
dest: "{{ frontend_project_path }}"
version: "{{ frontend_git_branch }}"
# Source: https://github.com/pypa/pipenv/issues/363#issuecomment-421310544
- name: Check for venv
ignore_errors: true
command: "pipenv --venv"
args:
chdir: "{{ frontend_project_path }}"
register: pipenv_venv_check_cmd
changed_when:
- ('No virtualenv' not in pipenv_venv_check_cmd.stderr)
- name: Run pipenv install
command: "pipenv install"
args:
chdir: "{{ project_root }}"
when:
- ('No virtualenv' in pipenv_venv_check_cmd.stderr)