subspace 3.0.23 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +9 -0
- data/README.md +3 -0
- data/ansible/roles/common/tasks/main.yml +11 -40
- data/ansible/roles/common/tasks/swap.yml +26 -2
- data/ansible/roles/letsencrypt/tasks/main.yml +1 -1
- data/ansible/roles/newrelic-infra/tasks/main.yml +16 -10
- data/ansible/roles/nginx/tasks/main.yml +30 -8
- data/ansible/roles/nodejs/tasks/main.yml +27 -19
- data/ansible/roles/postgresql/tasks/main.yml +18 -28
- data/ansible/roles/postgresql-client/tasks/main.yml +18 -42
- data/ansible/roles/puma/templates/puma-systemd.service +6 -0
- data/ansible/roles/rails/tasks/main.yml +10 -2
- data/ansible/roles/redis/tasks/main.yml +12 -16
- data/ansible/roles/tailscale/tasks/main.yml +13 -16
- data/ansible/roles/yarn/tasks/main.yml +12 -33
- data/lib/subspace/commands/init.rb +0 -2
- data/lib/subspace/commands/terraform.rb +29 -23
- data/lib/subspace/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 92372341b56686763302a83a53e47282c4430fd0758ff138ef36bbe40e8f4383
|
|
4
|
+
data.tar.gz: 873c03813d5af419310332278e214df4f9436aa2ac553b978201984d9f769efe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c51ea140a593c5658bb4c37af86b8b676d73caf2587075d7c3a5260d74428dd357296a6b53727be2191dc2db48540cb91869496cc4f17d43e751d2e756937385
|
|
7
|
+
data.tar.gz: f9707efd34f8eaaf0f378301bbced87c8b20c32708ae28b6a689b77319b3c6408a513539f124826e9641c552c0525b0c1c47df07e68959891d6f38ebe851ed13
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.4.10
|
data/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,15 @@ This project attempts to follow [semantic versioning](https://semver.org/).
|
|
|
12
12
|
|
|
13
13
|
## Unreleased
|
|
14
14
|
|
|
15
|
+
|
|
16
|
+
## 3.1.0
|
|
17
|
+
* BREAKING: No longer manually removes the ppa:ondrej/ngnix repo from the machine. This will break if you upgrade from pre-3.0.22 directly to 3.1
|
|
18
|
+
* BREAKING: Removed support for Python2 on remote hosts, Python3 is required
|
|
19
|
+
* Changes to newer ansible.buildtin.deb822_repository calls to fix deprecation warnings
|
|
20
|
+
|
|
21
|
+
## 3.0.24
|
|
22
|
+
* Update certbot url
|
|
23
|
+
|
|
15
24
|
## 3.0.23
|
|
16
25
|
* Add cache_valid_time to apt update_cache calls across roles to avoid redundant apt updates during provision
|
|
17
26
|
|
data/README.md
CHANGED
|
@@ -414,6 +414,9 @@ This role will generate a reasonable `puma.rb` and configure it to be controlled
|
|
|
414
414
|
puma_min_threads: 4 # Min threads/process
|
|
415
415
|
puma_max_threads: 16 # Max threads/process
|
|
416
416
|
|
|
417
|
+
puma_max_memory: 1.5G # Use cgroups via systemd to limit memory
|
|
418
|
+
puma_max_cpu: 80% # Use cgroups via systemd to set a CPU quota
|
|
419
|
+
|
|
417
420
|
## rails
|
|
418
421
|
|
|
419
422
|
Provisions for a rails app. This one is probably pretty important.
|
|
@@ -62,46 +62,6 @@
|
|
|
62
62
|
tags:
|
|
63
63
|
- maintenance
|
|
64
64
|
|
|
65
|
-
- name: Remove ppa:ondrej/nginx apt repository
|
|
66
|
-
apt_repository:
|
|
67
|
-
repo: ppa:ondrej/nginx
|
|
68
|
-
state: absent
|
|
69
|
-
become: true
|
|
70
|
-
|
|
71
|
-
- name: Install nginx repo prerequisites
|
|
72
|
-
apt:
|
|
73
|
-
pkg:
|
|
74
|
-
- curl
|
|
75
|
-
- gnupg2
|
|
76
|
-
- ca-certificates
|
|
77
|
-
- lsb-release
|
|
78
|
-
- ubuntu-keyring
|
|
79
|
-
state: present
|
|
80
|
-
become: true
|
|
81
|
-
|
|
82
|
-
- name: Import official nginx signing key
|
|
83
|
-
shell: curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor > /usr/share/keyrings/nginx-archive-keyring.gpg
|
|
84
|
-
args:
|
|
85
|
-
creates: /usr/share/keyrings/nginx-archive-keyring.gpg
|
|
86
|
-
become: true
|
|
87
|
-
|
|
88
|
-
- name: Add official nginx.org stable apt repository
|
|
89
|
-
apt_repository:
|
|
90
|
-
repo: "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] https://nginx.org/packages/ubuntu {{ ansible_distribution_release }} nginx"
|
|
91
|
-
filename: nginx
|
|
92
|
-
state: present
|
|
93
|
-
become: true
|
|
94
|
-
|
|
95
|
-
- name: Pin nginx.org packages over distribution packages
|
|
96
|
-
copy:
|
|
97
|
-
content: |
|
|
98
|
-
Package: *
|
|
99
|
-
Pin: origin nginx.org
|
|
100
|
-
Pin: release o=nginx
|
|
101
|
-
Pin-Priority: 900
|
|
102
|
-
dest: /etc/apt/preferences.d/99nginx
|
|
103
|
-
become: true
|
|
104
|
-
|
|
105
65
|
- name: apt-get update
|
|
106
66
|
apt: update_cache=yes cache_valid_time=3600
|
|
107
67
|
become: true
|
|
@@ -125,6 +85,17 @@
|
|
|
125
85
|
update_cache: yes
|
|
126
86
|
cache_valid_time: 3600
|
|
127
87
|
|
|
88
|
+
- name: Install custom apt repo prerequisites
|
|
89
|
+
apt:
|
|
90
|
+
pkg:
|
|
91
|
+
- curl
|
|
92
|
+
- gnupg2
|
|
93
|
+
- ca-certificates
|
|
94
|
+
- lsb-release
|
|
95
|
+
- ubuntu-keyring
|
|
96
|
+
state: present
|
|
97
|
+
become: true
|
|
98
|
+
|
|
128
99
|
- name: /usr/lib/update-notifier/apt-check --human-readable
|
|
129
100
|
command: /usr/lib/update-notifier/apt-check --human-readable
|
|
130
101
|
tags:
|
|
@@ -9,21 +9,45 @@
|
|
|
9
9
|
path: /swapfile
|
|
10
10
|
register: swap_file_check
|
|
11
11
|
|
|
12
|
+
- name: Check if size changed
|
|
13
|
+
set_fact:
|
|
14
|
+
swap_size_changed: "{{ ( swap_file_check.stat.exists and (swap_space | human_to_bytes) != swap_file_check.stat.size ) | bool }}"
|
|
15
|
+
|
|
16
|
+
- debug:
|
|
17
|
+
msg: "Swap file size changed! Current: {{swap_file_check.stat.size}}, requested: {{swap_space}} ({{ swap_space | human_to_bytes }})"
|
|
18
|
+
when: swap_size_changed
|
|
19
|
+
|
|
20
|
+
- name: (Swap Size Changed) Turn off swap
|
|
21
|
+
become: true
|
|
22
|
+
command: swapoff -a
|
|
23
|
+
when: swap_size_changed
|
|
24
|
+
|
|
25
|
+
- name: (Swap Size Changed) delete old swap file
|
|
26
|
+
become: true
|
|
27
|
+
file:
|
|
28
|
+
path: /swapfile
|
|
29
|
+
state: absent
|
|
30
|
+
when: swap_size_changed
|
|
31
|
+
|
|
32
|
+
- set_fact:
|
|
33
|
+
create_new_swap: "{{ not swap_file_check.stat.exists or swap_size_changed }}"
|
|
34
|
+
|
|
12
35
|
- name: create swap file
|
|
13
36
|
become: true
|
|
14
37
|
command: fallocate -l {{ swap_space }} /swapfile
|
|
15
|
-
when:
|
|
38
|
+
when: create_new_swap
|
|
16
39
|
|
|
17
40
|
- name: set permissions on swap file
|
|
18
41
|
become: true
|
|
19
42
|
file:
|
|
20
43
|
path: /swapfile
|
|
21
44
|
mode: 0600
|
|
45
|
+
when: create_new_swap
|
|
22
46
|
|
|
23
47
|
- name: format swap file
|
|
24
48
|
become: true
|
|
25
49
|
command: mkswap /swapfile
|
|
26
|
-
when:
|
|
50
|
+
when: create_new_swap
|
|
27
51
|
|
|
28
52
|
- name: add to fstab
|
|
29
53
|
become: true
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
- name: Update nginx default options
|
|
65
65
|
when: "'nginx' in role_names"
|
|
66
66
|
get_url:
|
|
67
|
-
url: https://raw.githubusercontent.com/certbot/certbot/
|
|
67
|
+
url: https://raw.githubusercontent.com/certbot/certbot/main/certbot/src/certbot/_internal/plugins/nginx/tls_configs/options-ssl-nginx.conf
|
|
68
68
|
dest: /etc/letsencrypt/options-ssl-nginx.conf
|
|
69
69
|
|
|
70
70
|
- name: start webserver after standalone mode
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
---
|
|
2
|
-
- name: Add
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
- name: Add NewRelic official APT repository
|
|
3
|
+
ansible.builtin.deb822_repository:
|
|
4
|
+
name: newrelic
|
|
5
|
+
types: [deb]
|
|
6
|
+
uris: "https://download.newrelic.com/infrastructure_agent/linux/apt/"
|
|
7
|
+
components: [main]
|
|
8
|
+
suites: [ "{{ ansible_facts['distribution_release'] }}" ]
|
|
9
|
+
signed_by: https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg
|
|
5
10
|
state: present
|
|
6
|
-
|
|
11
|
+
enabled: true
|
|
12
|
+
register: newrelic_apt
|
|
13
|
+
|
|
14
|
+
- name: Update package cache if nginx repo was added
|
|
15
|
+
become: yes
|
|
16
|
+
when: newrelic_apt.changed
|
|
17
|
+
apt:
|
|
18
|
+
update_cache: yes
|
|
7
19
|
|
|
8
20
|
- name: create license key
|
|
9
21
|
copy:
|
|
@@ -11,12 +23,6 @@
|
|
|
11
23
|
content: |
|
|
12
24
|
license_key: {{newrelic_license}}
|
|
13
25
|
|
|
14
|
-
- name: Add New Relic apt repo
|
|
15
|
-
apt_repository:
|
|
16
|
-
repo: deb [arch=amd64] https://download.newrelic.com/infrastructure_agent/linux/apt focal main
|
|
17
|
-
state: present
|
|
18
|
-
become: true
|
|
19
|
-
|
|
20
26
|
- name: Install New Relic server agent
|
|
21
27
|
apt:
|
|
22
28
|
pkg: newrelic-infra
|
|
@@ -1,12 +1,34 @@
|
|
|
1
|
-
- name: Remove
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
- nginx
|
|
5
|
-
- nginx-common
|
|
6
|
-
- nginx-core
|
|
7
|
-
- nginx-full
|
|
1
|
+
- name: Remove old nginx repo if prseent (Pre subspace-3.1)
|
|
2
|
+
ansible.builtin.file:
|
|
3
|
+
path: /etc/apt/sources.d/nginx.list
|
|
8
4
|
state: absent
|
|
9
|
-
|
|
5
|
+
|
|
6
|
+
- name: Add official Nginx repo
|
|
7
|
+
ansible.builtin.deb822_repository:
|
|
8
|
+
name: nginx
|
|
9
|
+
types: [deb]
|
|
10
|
+
uris: "https://nginx.org/packages/ubuntu"
|
|
11
|
+
components: [nginx]
|
|
12
|
+
suites: [ "{{ ansible_facts['distribution_release'] }}" ]
|
|
13
|
+
signed_by: https://nginx.org/keys/nginx_signing.key
|
|
14
|
+
state: present
|
|
15
|
+
enabled: true
|
|
16
|
+
register: nginx_apt
|
|
17
|
+
|
|
18
|
+
- name: Update package cache if nginx repo was added
|
|
19
|
+
become: yes
|
|
20
|
+
when: nginx_apt.changed
|
|
21
|
+
apt:
|
|
22
|
+
update_cache: yes
|
|
23
|
+
|
|
24
|
+
- name: Pin nginx.org packages over distribution packages
|
|
25
|
+
copy:
|
|
26
|
+
content: |
|
|
27
|
+
Package: *
|
|
28
|
+
Pin: origin nginx.org
|
|
29
|
+
Pin: release o=nginx
|
|
30
|
+
Pin-Priority: 900
|
|
31
|
+
dest: /etc/apt/preferences.d/99nginx
|
|
10
32
|
become: true
|
|
11
33
|
|
|
12
34
|
- name: Install nginx from official repo
|
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
---
|
|
2
|
-
- name: Ensure apt-transport-https is installed.
|
|
3
|
-
apt: name=apt-transport-https state=present
|
|
4
|
-
|
|
5
|
-
- name: Add Nodesource apt key.
|
|
6
|
-
apt_key:
|
|
7
|
-
url: https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key
|
|
8
|
-
id: "9B1BE0B4"
|
|
9
|
-
state: present
|
|
10
|
-
|
|
11
2
|
- name: Add NodeSource repositories for Node.js.
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
ansible.builtin.deb822_repository:
|
|
4
|
+
name: node_repo
|
|
5
|
+
types: [deb]
|
|
6
|
+
uris: "https://deb.nodesource.com/node_{{ nodejs_version }}/"
|
|
7
|
+
components: [main]
|
|
8
|
+
suites: [nodistro]
|
|
9
|
+
signed_by: https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key
|
|
14
10
|
state: present
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
enabled: true
|
|
12
|
+
|
|
13
|
+
# - name: Add Nodesource apt key.
|
|
14
|
+
# apt_key:
|
|
15
|
+
# url: https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key
|
|
16
|
+
# id: "9B1BE0B4"
|
|
17
|
+
# state: present
|
|
18
|
+
|
|
19
|
+
# - name: Add NodeSource repositories for Node.js.
|
|
20
|
+
# apt_repository:
|
|
21
|
+
# repo: "{{ item }}"
|
|
22
|
+
# state: present
|
|
23
|
+
# with_items:
|
|
24
|
+
# - "deb https://deb.nodesource.com/node_{{ nodejs_version }} nodistro main"
|
|
25
|
+
# - "deb-src https://deb.nodesource.com/node_{{ nodejs_version }} nodistro main"
|
|
26
|
+
# register: node_repo
|
|
19
27
|
|
|
20
|
-
- name: Update apt cache if repo was added.
|
|
21
|
-
apt: update_cache=yes cache_valid_time=3600
|
|
22
|
-
when: node_repo.changed
|
|
23
28
|
|
|
24
29
|
- name: Ensure Node.js and npm are installed.
|
|
25
|
-
apt:
|
|
30
|
+
apt:
|
|
31
|
+
update_cache: yes
|
|
32
|
+
name: nodejs={{ nodejs_version|regex_replace('x', '') }}*
|
|
33
|
+
state: present
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
---
|
|
2
2
|
- set_fact: postgresql_installed="true"
|
|
3
3
|
|
|
4
|
-
- name: Adding APT repository key
|
|
5
|
-
become: yes
|
|
6
|
-
apt_key:
|
|
7
|
-
id: ACCC4CF8
|
|
8
|
-
url: https://www.postgresql.org/media/keys/ACCC4CF8.asc
|
|
9
|
-
tags:
|
|
10
|
-
- postgresql
|
|
11
|
-
- db
|
|
12
|
-
- repo
|
|
13
|
-
|
|
14
4
|
- name: Add PostgreSQL official APT repository
|
|
5
|
+
ansible.builtin.deb822_repository:
|
|
6
|
+
name: postgresql
|
|
7
|
+
types: [deb]
|
|
8
|
+
uris: "http://apt.postgresql.org/pub/repos/apt/"
|
|
9
|
+
suites: [ "{{ ansible_facts['distribution_release'] }}-pgdg" ]
|
|
10
|
+
components: [main]
|
|
11
|
+
signed_by: https://www.postgresql.org/media/keys/ACCC4CF8.asc
|
|
12
|
+
state: present
|
|
13
|
+
enabled: true
|
|
14
|
+
register: pg_apt
|
|
15
|
+
|
|
16
|
+
- name: Update package cache if PG repo was added
|
|
15
17
|
become: yes
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- postgresql
|
|
20
|
-
- db
|
|
21
|
-
- repo
|
|
18
|
+
when: pg_apt.changed
|
|
19
|
+
apt:
|
|
20
|
+
update_cache: yes
|
|
22
21
|
|
|
23
22
|
- name: Install PostgreSQL
|
|
24
23
|
become: yes
|
|
25
24
|
apt:
|
|
26
25
|
name: "{{item}}"
|
|
27
|
-
state:
|
|
26
|
+
state: latest
|
|
28
27
|
update_cache: yes
|
|
29
28
|
cache_valid_time: 3600
|
|
30
29
|
with_items:
|
|
@@ -40,28 +39,19 @@
|
|
|
40
39
|
shell: "which python3"
|
|
41
40
|
register: is_python3
|
|
42
41
|
|
|
43
|
-
- name: Ensure pip is installed
|
|
44
|
-
when: is_python3 is succeeded
|
|
42
|
+
- name: Ensure pip is installed
|
|
45
43
|
apt:
|
|
46
44
|
name: python3-pip
|
|
47
45
|
state: present
|
|
48
46
|
update_cache: yes
|
|
49
47
|
cache_valid_time: 3600
|
|
50
48
|
|
|
51
|
-
- name: Install psycopg2
|
|
52
|
-
when: is_python3 is succeeded
|
|
49
|
+
- name: Install psycopg2
|
|
53
50
|
become: yes
|
|
54
51
|
pip:
|
|
55
52
|
name: psycopg2
|
|
56
53
|
break_system_packages: true
|
|
57
54
|
|
|
58
|
-
- name: Install psycopg2 (python2)
|
|
59
|
-
when: is_python3 is failed
|
|
60
|
-
become: yes
|
|
61
|
-
apt:
|
|
62
|
-
name: python-psycopg2
|
|
63
|
-
state: latest
|
|
64
|
-
|
|
65
55
|
- name: Create postgresql user
|
|
66
56
|
postgresql_user:
|
|
67
57
|
name: "{{database_user}}"
|
|
@@ -1,29 +1,23 @@
|
|
|
1
1
|
---
|
|
2
|
-
# Official PostgreSQL [repository] for debian-based distributions
|
|
3
|
-
# [repository]: http://www.postgresql.org/download/
|
|
4
|
-
- name: Adding APT repository key
|
|
5
|
-
when: ansible_facts["os_family"] == 'Debian'
|
|
6
|
-
become: yes
|
|
7
|
-
apt_key:
|
|
8
|
-
id: ACCC4CF8
|
|
9
|
-
url: https://www.postgresql.org/media/keys/ACCC4CF8.asc
|
|
10
|
-
tags:
|
|
11
|
-
- postgresql
|
|
12
|
-
- db
|
|
13
|
-
- repo
|
|
14
|
-
|
|
15
2
|
- name: Add PostgreSQL official APT repository
|
|
16
|
-
|
|
3
|
+
ansible.builtin.deb822_repository:
|
|
4
|
+
name: postgresql
|
|
5
|
+
types: [deb]
|
|
6
|
+
uris: "http://apt.postgresql.org/pub/repos/apt/"
|
|
7
|
+
suites: [ "{{ ansible_facts['distribution_release'] }}-pgdg" ]
|
|
8
|
+
components: [main]
|
|
9
|
+
signed_by: https://www.postgresql.org/media/keys/ACCC4CF8.asc
|
|
10
|
+
state: present
|
|
11
|
+
enabled: true
|
|
12
|
+
register: pg_apt
|
|
13
|
+
|
|
14
|
+
- name: Update package cache if PG repo was added
|
|
17
15
|
become: yes
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- postgresql
|
|
22
|
-
- db
|
|
23
|
-
- repo
|
|
16
|
+
when: pg_apt.changed
|
|
17
|
+
apt:
|
|
18
|
+
update_cache: yes
|
|
24
19
|
|
|
25
|
-
- name: Install PostgreSQL
|
|
26
|
-
when: ansible_facts["os_family"] == 'Debian'
|
|
20
|
+
- name: Install PostgreSQL Client
|
|
27
21
|
become: yes
|
|
28
22
|
apt:
|
|
29
23
|
name: "postgresql-client-{{postgresql_version}}"
|
|
@@ -36,7 +30,6 @@
|
|
|
36
30
|
- deps
|
|
37
31
|
|
|
38
32
|
- name: Install libpq-dev
|
|
39
|
-
when: ansible_facts["os_family"] == 'Debian'
|
|
40
33
|
become: yes
|
|
41
34
|
apt:
|
|
42
35
|
name: "libpq-dev"
|
|
@@ -48,12 +41,7 @@
|
|
|
48
41
|
- db
|
|
49
42
|
- deps
|
|
50
43
|
|
|
51
|
-
- name:
|
|
52
|
-
shell: "which python3"
|
|
53
|
-
register: is_python3
|
|
54
|
-
|
|
55
|
-
- name: Ensure pip is installed (python3)
|
|
56
|
-
when: is_python3 is succeeded
|
|
44
|
+
- name: Ensure pip is installed
|
|
57
45
|
apt:
|
|
58
46
|
name: python3-pip
|
|
59
47
|
state: present
|
|
@@ -64,8 +52,7 @@
|
|
|
64
52
|
- db
|
|
65
53
|
- deps
|
|
66
54
|
|
|
67
|
-
- name: Install psycopg2
|
|
68
|
-
when: is_python3 is succeeded
|
|
55
|
+
- name: Install psycopg2
|
|
69
56
|
become: yes
|
|
70
57
|
pip:
|
|
71
58
|
name: psycopg2
|
|
@@ -75,17 +62,6 @@
|
|
|
75
62
|
- db
|
|
76
63
|
- deps
|
|
77
64
|
|
|
78
|
-
- name: Install psycopg2 (python2)
|
|
79
|
-
when: is_python3 is failed
|
|
80
|
-
become: yes
|
|
81
|
-
apt:
|
|
82
|
-
name: python-psycopg2
|
|
83
|
-
state: latest
|
|
84
|
-
tags:
|
|
85
|
-
- postgresql
|
|
86
|
-
- db
|
|
87
|
-
- deps
|
|
88
|
-
|
|
89
65
|
- name: Grab PostgreSQL database version
|
|
90
66
|
shell: psql -h "{{database_host}}" -U "{{database_user}}" -d "{{database_name}}" -t -c "SELECT version();" | awk '{print $2}'
|
|
91
67
|
register: stats_psql_version
|
|
@@ -12,6 +12,12 @@ After=network.target
|
|
|
12
12
|
# On earlier versions of Puma or JRuby, change this to `Type=simple` and remove
|
|
13
13
|
# the `WatchdogSec` line.
|
|
14
14
|
Type=simple
|
|
15
|
+
{% if puma_max_memory is defined %}
|
|
16
|
+
MemoryMax={{puma_max_memory}}
|
|
17
|
+
{% endif %}
|
|
18
|
+
{% if puma_max_cpu is defined %}
|
|
19
|
+
CPUQuota={{puma_max_cpu}}
|
|
20
|
+
{% endif %}
|
|
15
21
|
|
|
16
22
|
# If your Puma process locks up, systemd's watchdog will restart it within seconds.
|
|
17
23
|
# WatchdogSec=10
|
|
@@ -16,9 +16,17 @@
|
|
|
16
16
|
- imagemagick
|
|
17
17
|
when: ('Ubuntu' in ansible_facts["distribution"])
|
|
18
18
|
|
|
19
|
+
- name: Find ImageMagick config directory
|
|
20
|
+
stat:
|
|
21
|
+
path: /etc/ImageMagick-7/policy.xml
|
|
22
|
+
tags:
|
|
23
|
+
- maintenance
|
|
24
|
+
- imagemagick
|
|
25
|
+
register: imagemagick7
|
|
26
|
+
|
|
19
27
|
- name: Update ImageMagick policy to enable reading PDF files
|
|
20
28
|
lineinfile:
|
|
21
|
-
path: /etc/ImageMagick-6/policy.xml
|
|
29
|
+
path: /etc/ImageMagick-{{ imagemagick7.stat.exists | ternary('7', '6') }}/policy.xml
|
|
22
30
|
regexp: '<policy domain="coder" rights="none" pattern="PDF" />'
|
|
23
31
|
line: ' <policy domain="coder" rights="read" pattern="PDF" />'
|
|
24
32
|
backrefs: yes
|
|
@@ -26,7 +34,7 @@
|
|
|
26
34
|
tags:
|
|
27
35
|
- maintenance
|
|
28
36
|
- imagemagick
|
|
29
|
-
|
|
37
|
+
|
|
30
38
|
|
|
31
39
|
- name: Create /u/apps/{{project_name}}/shared/config
|
|
32
40
|
file:
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
- name:
|
|
3
|
-
ansible.builtin.
|
|
4
|
-
|
|
5
|
-
state: present
|
|
6
|
-
|
|
7
|
-
- name: Add redis repository into sources list
|
|
8
|
-
ansible.builtin.apt_repository:
|
|
9
|
-
repo: deb https://packages.redis.io/deb {{ ansible_facts["distribution_release"] }} main
|
|
10
|
-
state: present
|
|
11
|
-
register: redis_apt_repo
|
|
12
|
-
|
|
13
|
-
- name: Purge distro redis package
|
|
14
|
-
apt:
|
|
15
|
-
name: redis-server
|
|
2
|
+
- name: Remove old redis repo if present (Pre subspace 3.1)
|
|
3
|
+
ansible.builtin.file:
|
|
4
|
+
path: /etc/apt/sources.list.d/packages_redis_io_deb.list
|
|
16
5
|
state: absent
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
|
|
7
|
+
- name: Add official redis repo
|
|
8
|
+
ansible.builtin.deb822_repository:
|
|
9
|
+
name: redis
|
|
10
|
+
types: [deb]
|
|
11
|
+
uris: "https://packages.redis.io/deb"
|
|
12
|
+
components: [main]
|
|
13
|
+
suites: [ "{{ ansible_facts['distribution_release'] }}" ]
|
|
14
|
+
signed_by: https://packages.redis.io/gpg
|
|
19
15
|
|
|
20
16
|
- name: Install Redis from official repo
|
|
21
17
|
become: true
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
---
|
|
2
|
-
- name:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
- name: Remove old redis repo if present (Pre subspace 3.1)
|
|
3
|
+
ansible.builtin.file:
|
|
4
|
+
path: /etc/apt/sources.list.d/pkgs_tailscale_com_stable_ubuntu.list
|
|
5
|
+
state: absent
|
|
6
|
+
|
|
7
|
+
- name: Add official tailscale apt repo
|
|
8
|
+
ansible.builtin.deb822_repository:
|
|
9
|
+
name: tailscale
|
|
10
|
+
types: [deb]
|
|
11
|
+
uris: "https://pkgs.tailscale.com/stable/ubuntu"
|
|
12
|
+
components: [main]
|
|
13
|
+
suites: [ "{{ ansible_facts['distribution_release'] }}" ]
|
|
14
|
+
signed_by: https://pkgs.tailscale.com/stable/ubuntu/{{ansible_facts["distribution_release"]}}.gpg
|
|
10
15
|
|
|
11
|
-
- name: "Add Tailscale apt repos"
|
|
12
|
-
become: true
|
|
13
|
-
apt_repository:
|
|
14
|
-
repo: "deb https://pkgs.tailscale.com/stable/ubuntu {{ansible_facts[\"distribution_release\"]}} main"
|
|
15
|
-
state: present
|
|
16
|
-
tags:
|
|
17
|
-
- maintenance
|
|
18
|
-
- tailscale_reauth
|
|
19
16
|
|
|
20
17
|
- name: "Allow tailscale to be installed"
|
|
21
18
|
ignore_errors: yes
|
|
@@ -1,40 +1,19 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
- name: "Yarn | Ensure Debian sources list file exists"
|
|
11
|
-
become: yes
|
|
12
|
-
become_user: root
|
|
13
|
-
file:
|
|
14
|
-
path: /etc/apt/sources.list.d/yarn.list
|
|
15
|
-
owner: root
|
|
16
|
-
mode: 0644
|
|
17
|
-
state: touch
|
|
18
|
-
|
|
19
|
-
- name: "Yarn | Ensure Debian package is in sources list"
|
|
20
|
-
become: yes
|
|
21
|
-
become_user: root
|
|
22
|
-
lineinfile:
|
|
23
|
-
dest: /etc/apt/sources.list.d/yarn.list
|
|
24
|
-
regexp: 'deb http://dl.yarnpkg.com/debian/ stable main'
|
|
25
|
-
line: 'deb http://dl.yarnpkg.com/debian/ stable main'
|
|
2
|
+
- name: Add Yarn official APT repository
|
|
3
|
+
ansible.builtin.deb822_repository:
|
|
4
|
+
name: yarn
|
|
5
|
+
types: [deb]
|
|
6
|
+
uris: "http://dl.yarnpkg.com/debian/"
|
|
7
|
+
components: [main]
|
|
8
|
+
suites: [stable]
|
|
9
|
+
signed_by: https://dl.yarnpkg.com/debian/pubkey.gpg
|
|
26
10
|
state: present
|
|
11
|
+
enabled: true
|
|
27
12
|
|
|
28
|
-
- name: "
|
|
13
|
+
- name: "Install yarn from official repo"
|
|
29
14
|
become: yes
|
|
30
15
|
become_user: root
|
|
31
16
|
apt:
|
|
32
|
-
|
|
33
|
-
cache_valid_time: 3600
|
|
34
|
-
|
|
35
|
-
- name: "Yarn | Install"
|
|
36
|
-
become: yes
|
|
37
|
-
become_user: root
|
|
38
|
-
package:
|
|
39
|
-
name: yarn
|
|
17
|
+
pkg: yarn
|
|
40
18
|
state: latest
|
|
19
|
+
update_cache: yes
|
|
@@ -104,8 +104,6 @@ class Subspace::Commands::Init < Subspace::Commands::Base
|
|
|
104
104
|
|
|
105
105
|
def init_terraform
|
|
106
106
|
Subspace::Commands::Terraform.ensure_terraform
|
|
107
|
-
Subspace::Commands::Terraform.check_aws_credentials(project_name)
|
|
108
|
-
|
|
109
107
|
FileUtils.mkdir_p File.join dest_dir, "terraform", @env
|
|
110
108
|
|
|
111
109
|
set_latest_ami
|
|
@@ -2,28 +2,6 @@ require 'json'
|
|
|
2
2
|
module Subspace
|
|
3
3
|
module Commands
|
|
4
4
|
class Terraform < Subspace::Commands::Base
|
|
5
|
-
|
|
6
|
-
def self.check_aws_credentials(project_name)
|
|
7
|
-
ENV["AWS_ACCESS_KEY_ID"] = nil
|
|
8
|
-
ENV["AWS_SECRET_ACCESS_KEY"] = nil
|
|
9
|
-
|
|
10
|
-
profile = "subspace-#{project_name}"
|
|
11
|
-
|
|
12
|
-
system("aws --profile #{profile} configure list &> /dev/null ")
|
|
13
|
-
if $? != 0
|
|
14
|
-
puts "No AWS Profile '#{profile}' configured. Please enter your credentials."
|
|
15
|
-
system("aws --profile #{profile} configure")
|
|
16
|
-
system("aws --profile #{profile} configure list &> /dev/null ")
|
|
17
|
-
if $? != 0
|
|
18
|
-
puts "FATAL: could not configure aws. Please try again"
|
|
19
|
-
exit
|
|
20
|
-
end
|
|
21
|
-
else
|
|
22
|
-
puts "Using AWS Profile #{profile}"
|
|
23
|
-
end
|
|
24
|
-
true
|
|
25
|
-
end
|
|
26
|
-
|
|
27
5
|
def self.ensure_terraform
|
|
28
6
|
if `terraform -v --json | jq -r .terraform_version` =~ /1\.\d+/
|
|
29
7
|
puts "Terraform found."
|
|
@@ -42,8 +20,8 @@ module Subspace
|
|
|
42
20
|
end
|
|
43
21
|
|
|
44
22
|
def run
|
|
45
|
-
self.class.check_aws_credentials(project_name) or exit
|
|
46
23
|
self.class.ensure_terraform or exit
|
|
24
|
+
check_aws_credentials or exit
|
|
47
25
|
if @args.any?
|
|
48
26
|
terraform_command(@args.shift, *@args)
|
|
49
27
|
else
|
|
@@ -78,6 +56,34 @@ module Subspace
|
|
|
78
56
|
inventory.merge(@output)
|
|
79
57
|
inventory.write
|
|
80
58
|
end
|
|
59
|
+
|
|
60
|
+
def check_aws_credentials
|
|
61
|
+
Dir.chdir "config/subspace/terraform/#{@env}" do
|
|
62
|
+
if File.read("./main.tf") =~ /^\s+cloud {$/
|
|
63
|
+
puts "Detected terraform cloud, skipping credential check"
|
|
64
|
+
return true
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
ENV["AWS_ACCESS_KEY_ID"] = nil
|
|
69
|
+
ENV["AWS_SECRET_ACCESS_KEY"] = nil
|
|
70
|
+
|
|
71
|
+
profile = "subspace-#{project_name}"
|
|
72
|
+
|
|
73
|
+
system("aws --profile #{profile} configure list &> /dev/null ")
|
|
74
|
+
if $? != 0
|
|
75
|
+
puts "No AWS Profile '#{profile}' configured. Please enter your credentials."
|
|
76
|
+
system("aws --profile #{profile} configure")
|
|
77
|
+
system("aws --profile #{profile} configure list &> /dev/null ")
|
|
78
|
+
if $? != 0
|
|
79
|
+
puts "FATAL: could not configure aws. Please try again"
|
|
80
|
+
exit
|
|
81
|
+
end
|
|
82
|
+
else
|
|
83
|
+
puts "Using AWS Profile #{profile}"
|
|
84
|
+
end
|
|
85
|
+
true
|
|
86
|
+
end
|
|
81
87
|
end
|
|
82
88
|
end
|
|
83
89
|
end
|
data/lib/subspace/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: subspace
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0
|
|
4
|
+
version: 3.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brian Samson
|
|
@@ -331,7 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
331
331
|
- !ruby/object:Gem::Version
|
|
332
332
|
version: '0'
|
|
333
333
|
requirements: []
|
|
334
|
-
rubygems_version:
|
|
334
|
+
rubygems_version: 3.6.9
|
|
335
335
|
specification_version: 4
|
|
336
336
|
summary: Ansible-based server provisioning for rails projects
|
|
337
337
|
test_files: []
|