forked from FluxNotes/flux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.yml
78 lines (66 loc) · 2.22 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
- hosts: pilot
remote_user: "{{ username }}"
become_method: sudo
vars:
app_dir: "/home/{{ username }}/flux"
datetime: "{{ lookup('pipe', 'date +%Y-%m-%d') }}"
backup_path: "{{ build_path }}/backup-{{ datetime }}"
should_keep_config: "{{ keep_config | default(false) }}"
tasks:
- name: Clone the desired version of flux
git:
repo: https://github.com/FluxNotes/flux
dest: "{{ app_dir }}"
version: "{{ release_version }}"
force: yes
register: git_finished
- name: Install Packages
yarn:
path: "{{ app_dir }}"
when: git_finished.changed
- name: Update Debra encounter dates
shell: yarn patient-date-update src/dataaccess/BreastMainTreatmentDebraV09.json 32
args:
chdir: "{{ app_dir }}"
- name: Update Ella encounter dates
shell: yarn patient-date-update src/dataaccess/BreastMainTreatmentTry3EllaV09.json 100
args:
chdir: "{{ app_dir }}"
- name: Update Ihanos encounter dates
shell: yarn patient-date-update src/dataaccess/GistAdjuvantIhanosV09.json 100
args:
chdir: "{{ app_dir }}"
- name: Update Jane encounter dates
shell: yarn patient-date-update src/dataaccess/BreastMainTreatmentDiabetesHypertensionJaneV09.json 33
args:
chdir: "{{ app_dir }}"
- name: Build the app
shell: yarn build
args:
chdir: "{{ app_dir }}"
register: build_finished
- name: Copy build folder into deployment directory
shell: cp -r {{ app_dir }}/build {{ build_path }}
become: yes
- name: Scan for public_html folder
stat:
path: "{{ build_path }}/public_html"
register: public_html_stat
become: yes
- name: Change current deployment to a backup
shell: mv {{ build_path }}/public_html {{ backup_path }}
when: public_html_stat.stat.exists
become: yes
- name: Update copied build files to be the new public_html
shell: mv {{ build_path }}/build {{ build_path }}/public_html
become: yes
- name: Copy old config.js
shell: cp {{ backup_path }}/config.js {{ build_path }}/public_html
when: public_html_stat.stat.exists and (should_keep_config | bool)
become: yes
- name: Restart Apache
service:
name: apache2
state: restarted
become: yes