-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlocal.yml
93 lines (92 loc) · 2.69 KB
/
local.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
---
- hosts: localhost
remote_user: root
tasks:
- name: Ensure git is at the latest version
apt:
name: git
state: latest
- name: Ensure apt can grok https (wtf)
apt:
name: apt-transport-https
state: latest
- name: Add nodesource repository key
shell: curl --silent https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
- name: Ensure we have nodesource repository
apt_repository:
repo: "deb https://deb.nodesource.com/node_9.x xenial main"
- name: Ensure nodejs is at the latest version
apt:
name: nodejs
state: latest
- name: Ensure certbot PPA is present
apt_repository:
repo: "ppa:certbot/certbot"
- name: Ensure certbot is at latest
apt:
name: python-certbot-nginx
state: latest
- name: Ensure certbot cron job
cron:
name: "Renew Let's Encrypt certificate"
minute: 17
hour: 7
job: "certbot renew --post-hook 'systemctl reload nginx'"
- name: Ensure nginx it at the latest version
apt:
name: nginx
state: latest
- name: Disable default site
file:
dest: /etc/nginx/sites-enabled/default
state: absent
- name: Install Site config
template:
src: ./nginx/site.conf
dest: /etc/nginx/sites-available/supertasball.amos.me
owner: root
group: root
- name: Enable Site config
file:
src: /etc/nginx/sites-available/supertasball.amos.me
dest: /etc/nginx/sites-enabled/supertasball.amos.me
state: link
- name: Download sources
git:
repo: "https://github.com/supertasball/supertasball.git"
dest: "/srv/apps/supertasball"
accept_hostkey: yes
force: yes
ssh_opts: "-o StrictHostKeyChecking=no"
- name: Install dependencies
shell: npm i
args:
chdir: /srv/apps/supertasball
- name: Run tests
shell: npm t
args:
chdir: /srv/apps/supertasball
- name: Set version info
shell: npm run set-version
args:
chdir: /srv/apps/supertasball
- name: Clean previous bundle
shell: rm -rf dist
args:
chdir: /srv/apps/supertasball
environment:
NODE_ENV: "production"
- name: Build bundle
shell: node fuse.js
args:
chdir: /srv/apps/supertasball
environment:
NODE_ENV: "production"
- name: Merge bundle with server root
shell: mkdir -p prod-dist && cp -rf dist/* prod-dist/
args:
chdir: /srv/apps/supertasball
environment:
NODE_ENV: "production"
- name: Reload Nginx
service: name=nginx state=reloaded