-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathmain.yml
More file actions
100 lines (85 loc) · 2.54 KB
/
Copy pathmain.yml
File metadata and controls
100 lines (85 loc) · 2.54 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
{% raw %}---
- name: Download latest code from {{ project_repo_url }}, branch {{ repo_version }}
git: repo={{ project_repo_url }} dest={{ project_path }} version={{ repo_version }} accept_hostkey=true
become: false
register: gitresult
tags: ['always']
- debug: msg="Git SHA-1 before={{ gitresult.before }} after={{ gitresult.after }}"
tags: ['always']
- name: Ensure poetry is installed
command: python3 -m pip install poetry
become: false
tags: ['always']
- name: Install binaries for postgres postgis
apt:
pkg:
- gdal-bin
state: present
cache_valid_time: 300
when: pg_gis
- name: Install python dependencies with Poetry
command: "poetry install"
args:
chdir: "{{ project_path }}"
become: false
tags: ['deploy']
- name: Copy env configuration, if it doesn't exist
template: src=env.env.j2 dest={{ project_path }}/.env force=no
become: false
tags: ['configure']
- name: Ensure gettext package is installed for translations
apt:
pkg: gettext
state: present
- name: Run Django collectstatic
command: "poetry run python manage.py collectstatic --no-input"
args:
chdir: "{{ project_path }}"
become: false
tags: ['deploy']
- name: Run Django database migrations
command: "poetry run python manage.py migrate"
args:
chdir: "{{ project_path }}"
become: false
tags: ['deploy']
- name: Run compilemessages for static translations
command: "poetry run python manage.py compilemessages"
args:
chdir: "{{ project_path }}"
become: false
tags: ['deploy']
{% endraw %}
{%- if cookiecutter.add_asgi.lower() == 'y' %}
- import_tasks: asgi-setup.yml
- name: Reload asgi processes
{% raw %}
systemd: state=restarted name=asgi-{{ project_namespace }}
{% endraw %}
{%- else %}
- import_tasks: uwsgi-setup.yml
{% raw %}
- name: Reload uwsgi processes
command: uwsgi --reload {{ uwsgi_pid_file }}
become: true
when: not uwsgiconf.changed
{% endraw %}
{%- endif %}
tags: ['deploy']
{%- if cookiecutter.add_celery.lower() == 'y' %}
notify: reload celery # reload celery everytime uwsgi conf changes
{%- endif %}
{% raw %}- name: apt_get install graphviz for db schema generation
apt: pkg=graphviz state=present
- name: Generate DB Schema for documentation
command: "poetry run python bin/generate_db_schema.py"
args:
chdir: "{{ project_path }}"
become: false
tags: ['deploy', 'documentation']
- name: Build documentation for "/docs" url.
command: "poetry run mkdocs build"
args:
chdir: "{{ project_path }}"
become: false
tags: ['deploy', 'documentation']{% endraw %}