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" $ 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 ### TODO
1. Complete todos from setup-frontend-prod.yml 1. Complete todos from setup-frontend-prod.yml
2. Complete refresh-frontend-cert.yml 2. Complete refresh-frontend-cert.yml
2. Automate installation of Python 3.7 and pip3 3. Complete update-frontend-prod.yml
3. Create playbook to renew HTTPS cert 4. Automate installation of Python 3.7 and pip3
4. Setup Ansible Vault to handle keys 5. Setup Ansible Vault to handle keys

View File

@ -42,6 +42,7 @@
git: git:
accept_hostkey: yes accept_hostkey: yes
force: yes force: yes
update: yes
repo: "{{ frontend_git_repo }}" repo: "{{ frontend_git_repo }}"
dest: "{{ frontend_project_path }}" dest: "{{ frontend_project_path }}"
version: "{{ frontend_git_branch }}" 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)