forked from HashNuke/ansible-elixir-stack
/
release.yml
43 lines (32 loc) · 1.17 KB
/
release.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
---
- when: deploy_type == "restart"
name: stop app
command: bash -lc "sudo monit stop {{ app_name }}"
- when: deploy_type == "restart"
name: delete release
command: bash -lc "mix release.clean" chdir="{{ project_path }}"
remote_user: "{{ deployer }}"
- name: "compile and release"
command: bash -lc 'SERVER=1 mix do compile, release' chdir="{{ project_path }}"
remote_user: "{{ deployer }}"
environment:
MIX_ENV: "{{ mix_env }}"
PORT: "{{ app_port }}"
- when: deploy_type == "restart"
name: start app
command: bash -lc "sudo monit start {{ app_name }}"
- when: deploy_type == "upgrade"
name: get app version
command: bash -lc "mix run -e 'IO.puts Mix.Project.config[:version]'" chdir="{{ project_path }}"
remote_user: "{{ deployer }}"
register: app_version
- when: deploy_type == "upgrade"
name: set upgrade command
set_fact: upgrade_command='rel/{{ app_name }}/bin/{{ app_name }} upgrade "{{ app_version.stdout }}"'
- when: deploy_type == "upgrade"
name: upgrade app
command: bash -lc "{{ upgrade_command }}" chdir="{{ project_path }}"
remote_user: "{{ deployer }}"
environment:
MIX_ENV: "{{ mix_env }}"
PORT: "{{ app_port }}"