subspace 0.1.1 → 3.1.2

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.
Files changed (210) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -0
  3. data/.ruby-version +1 -1
  4. data/.travis.yml +1 -1
  5. data/CHANGELOG.md +380 -0
  6. data/README.md +511 -9
  7. data/TODO +34 -0
  8. data/UPGRADING.md +10 -0
  9. data/ansible/playbooks/local_template.yml +13 -0
  10. data/ansible/playbooks/maintenance_mode.yml +5 -0
  11. data/ansible/roles/alienvault/tasks/main.yml +29 -0
  12. data/ansible/roles/apache/defaults/main.yml +2 -5
  13. data/ansible/roles/apache/handlers/main.yml +9 -1
  14. data/ansible/roles/apache/tasks/main.yml +37 -9
  15. data/ansible/roles/apache/templates/server_status.conf +6 -0
  16. data/ansible/roles/apache-rails/tasks/main.yml +26 -0
  17. data/ansible/roles/apache-rails/templates/_canonical_domain.conf +10 -0
  18. data/ansible/roles/apache-rails/templates/_rails.conf +23 -0
  19. data/ansible/roles/apache-rails/templates/project-ssl.conf +23 -0
  20. data/ansible/roles/apache-rails/templates/project.conf +5 -0
  21. data/ansible/roles/collectd/defaults/main.yml +3 -0
  22. data/ansible/roles/collectd/handlers/main.yml +3 -0
  23. data/ansible/roles/collectd/tasks/main.yml +82 -0
  24. data/ansible/roles/collectd/templates/apache2.conf +6 -0
  25. data/ansible/roles/collectd/templates/delayed_job_postgres.conf +21 -0
  26. data/ansible/roles/collectd/templates/df.conf +16 -0
  27. data/ansible/roles/collectd/templates/graphite.conf +14 -0
  28. data/ansible/roles/collectd/templates/hostname.conf +2 -0
  29. data/ansible/roles/collectd/templates/nginx.conf +28 -0
  30. data/ansible/roles/collectd/templates/nodejs-process.conf +3 -0
  31. data/ansible/roles/collectd/templates/puma-process.conf +3 -0
  32. data/ansible/roles/collectd/templates/rails_lograge.conf +31 -0
  33. data/ansible/roles/common/defaults/main.yml +2 -1
  34. data/ansible/roles/common/files/sudoers-service +1 -0
  35. data/ansible/roles/common/tasks/main.yml +307 -19
  36. data/ansible/roles/common/tasks/no_swap.yml +26 -0
  37. data/ansible/roles/common/tasks/swap.yml +34 -8
  38. data/ansible/roles/common/templates/motd +13 -0
  39. data/ansible/roles/common/templates/motd2 +24 -0
  40. data/ansible/roles/common/templates/terminalcolor +25 -0
  41. data/ansible/roles/delayed_job/README.md +2 -4
  42. data/ansible/roles/delayed_job/defaults/main.yml +0 -2
  43. data/ansible/roles/delayed_job/handlers/main.yml +1 -1
  44. data/ansible/roles/delayed_job/tasks/main.yml +22 -29
  45. data/ansible/roles/delayed_job/templates/delayed-job-monit-rc +6 -5
  46. data/ansible/roles/delayed_job/templates/delayed-job-systemd.service +33 -0
  47. data/ansible/roles/gem-patch-report/README.md +137 -0
  48. data/ansible/roles/gem-patch-report/defaults/main.yml +2 -0
  49. data/ansible/roles/gem-patch-report/tasks/main.yml +89 -0
  50. data/ansible/roles/gem-patch-report/templates/gem-patch-report.sh.j2 +114 -0
  51. data/ansible/roles/letsencrypt/defaults/main.yml +11 -1
  52. data/ansible/roles/letsencrypt/tasks/legacy.yml +44 -0
  53. data/ansible/roles/letsencrypt/tasks/main.yml +72 -76
  54. data/ansible/roles/letsencrypt/tasks/modern.yml +39 -0
  55. data/ansible/roles/logrotate/LICENSE +27 -0
  56. data/ansible/roles/logrotate/README.md +70 -0
  57. data/ansible/roles/logrotate/defaults/main.yml +2 -0
  58. data/ansible/roles/logrotate/meta/main.yml +18 -0
  59. data/ansible/roles/logrotate/tasks/main.yml +15 -0
  60. data/ansible/roles/logrotate/templates/logrotate.d.j2 +16 -0
  61. data/ansible/roles/memcache/defaults/main.yml +2 -0
  62. data/ansible/roles/memcache/tasks/main.yml +16 -1
  63. data/ansible/roles/mysql/meta/main.yml +1 -1
  64. data/ansible/roles/mysql/tasks/main.yml +2 -2
  65. data/ansible/roles/mysql2_gem/meta/main.yml +1 -1
  66. data/ansible/roles/mysql2_gem/tasks/main.yml +1 -1
  67. data/ansible/roles/newrelic/tasks/main.yml +8 -1
  68. data/ansible/roles/newrelic-infra/defaults/main.yml +2 -0
  69. data/ansible/roles/newrelic-infra/handlers/main.yml +5 -0
  70. data/ansible/roles/newrelic-infra/tasks/main.yml +38 -0
  71. data/ansible/roles/newrelic-infra/templates/logs.yml.j2 +5 -0
  72. data/ansible/roles/newrelic-infra/templates/newrelic-infra.yml.j2 +2 -0
  73. data/ansible/roles/nginx/defaults/main.yml +4 -0
  74. data/ansible/roles/nginx/handlers/main.yml +12 -0
  75. data/ansible/roles/nginx/tasks/main.yml +113 -14
  76. data/ansible/roles/nginx/templates/nginx.conf +29 -0
  77. data/ansible/roles/nginx/templates/status +10 -0
  78. data/ansible/roles/nginx-maintenance/tasks/main.yml +33 -0
  79. data/ansible/roles/nginx-rails/defaults/main.yml +6 -0
  80. data/ansible/roles/nginx-rails/tasks/main.yml +54 -0
  81. data/ansible/roles/nginx-rails/templates/_asset_cors.conf +11 -0
  82. data/ansible/roles/nginx-rails/templates/_rails.conf +35 -0
  83. data/ansible/roles/nginx-rails/templates/_upstream.conf +11 -0
  84. data/ansible/roles/nginx-rails/templates/default_server +5 -0
  85. data/ansible/roles/nginx-rails/templates/nginx-project +9 -0
  86. data/ansible/roles/nginx-rails/templates/nginx-project-ssl +23 -0
  87. data/ansible/roles/nodejs/tasks/main.yml +33 -0
  88. data/ansible/roles/papertrail/tasks/main.yml +23 -4
  89. data/ansible/roles/papertrail/templates/log_files.yml +8 -1
  90. data/ansible/roles/postgis/.gitignore +3 -0
  91. data/ansible/roles/postgis/CHANGELOG.md +24 -0
  92. data/ansible/roles/postgis/LICENSE +202 -0
  93. data/ansible/roles/postgis/README.md +12 -0
  94. data/ansible/roles/postgis/meta/main.yml +15 -0
  95. data/ansible/roles/postgis/tasks/main.yml +20 -0
  96. data/ansible/roles/postgresql/README.md +15 -0
  97. data/ansible/roles/postgresql/defaults/main.yml +3 -0
  98. data/ansible/roles/postgresql/handlers/main.yml +1 -1
  99. data/ansible/roles/postgresql/meta/main.yml +1 -6
  100. data/ansible/roles/postgresql/tasks/backups.yml +8 -6
  101. data/ansible/roles/postgresql/tasks/main.yml +89 -9
  102. data/ansible/roles/postgresql/templates/backup.sh +17 -2
  103. data/ansible/roles/postgresql-client/tasks/main.yml +91 -0
  104. data/ansible/roles/puma/tasks/main.yml +38 -19
  105. data/ansible/roles/puma/templates/puma-monit-rc +5 -0
  106. data/ansible/roles/puma/templates/puma-systemd.service +43 -0
  107. data/ansible/roles/puma/templates/puma-systemd.socket +14 -0
  108. data/ansible/roles/puma/templates/puma.rb +24 -12
  109. data/ansible/roles/rails/defaults/main.yml +1 -3
  110. data/ansible/roles/rails/tasks/main.yml +76 -18
  111. data/ansible/roles/rails/templates/application.yml +1 -1
  112. data/ansible/roles/rails/templates/database.yml +3 -3
  113. data/ansible/roles/redis/defaults/main.yml +2 -0
  114. data/ansible/roles/redis/tasks/main.yml +45 -3
  115. data/ansible/roles/resque/tasks/main.yml +14 -0
  116. data/ansible/roles/resque/templates/resque-monit-rc +4 -0
  117. data/ansible/roles/resque/templates/resque-systemd.service +54 -0
  118. data/ansible/roles/ruby-common/README.md +1 -1
  119. data/ansible/roles/ruby-common/defaults/main.yml +1 -0
  120. data/ansible/roles/ruby-common/tasks/main.yml +55 -13
  121. data/ansible/roles/sidekiq/README.md +1 -0
  122. data/ansible/roles/sidekiq/defaults/main.yml +2 -0
  123. data/ansible/roles/sidekiq/tasks/main.yml +15 -0
  124. data/ansible/roles/sidekiq/templates/sidekiq-monit-rc +4 -0
  125. data/ansible/roles/sidekiq/templates/sidekiq-systemd.service +63 -0
  126. data/ansible/roles/tailscale/defaults/main.yml +2 -0
  127. data/ansible/roles/tailscale/tasks/main.yml +40 -0
  128. data/ansible/roles/yarn/tasks/main.yml +19 -0
  129. data/ansible/roles/zenoamaro.postgresql/.gitignore +1 -0
  130. data/ansible/roles/zenoamaro.postgresql/.travis.yml +28 -0
  131. data/ansible/roles/zenoamaro.postgresql/LICENSE.md +21 -0
  132. data/ansible/roles/zenoamaro.postgresql/README.md +117 -0
  133. data/ansible/roles/zenoamaro.postgresql/Vagrantfile +62 -0
  134. data/ansible/roles/zenoamaro.postgresql/boxed.yml +26 -0
  135. data/ansible/roles/zenoamaro.postgresql/defaults/main.yml +607 -0
  136. data/ansible/roles/zenoamaro.postgresql/handlers/main.yml +8 -0
  137. data/ansible/roles/zenoamaro.postgresql/inventory +19 -0
  138. data/ansible/roles/zenoamaro.postgresql/main.yml +19 -0
  139. data/ansible/roles/zenoamaro.postgresql/meta/.galaxy_install_info +1 -0
  140. data/ansible/roles/zenoamaro.postgresql/meta/main.yml +21 -0
  141. data/ansible/roles/zenoamaro.postgresql/tasks/configure.yml +55 -0
  142. data/ansible/roles/zenoamaro.postgresql/tasks/extensions.yml +49 -0
  143. data/ansible/roles/zenoamaro.postgresql/tasks/install.yml +51 -0
  144. data/ansible/roles/zenoamaro.postgresql/tasks/main.yml +5 -0
  145. data/ansible/roles/zenoamaro.postgresql/templates/environment +11 -0
  146. data/ansible/roles/zenoamaro.postgresql/templates/pg_ctl.conf +5 -0
  147. data/ansible/roles/zenoamaro.postgresql/templates/pg_hba.conf +112 -0
  148. data/ansible/roles/zenoamaro.postgresql/templates/pg_ident.conf +46 -0
  149. data/ansible/roles/zenoamaro.postgresql/templates/postgresql.conf +536 -0
  150. data/ansible/roles/zenoamaro.postgresql/test.yml +24 -0
  151. data/bin/console +0 -4
  152. data/exe/subspace +3 -84
  153. data/lib/subspace/cli.rb +168 -0
  154. data/lib/subspace/commands/ansible.rb +35 -0
  155. data/lib/subspace/commands/base.rb +94 -0
  156. data/lib/subspace/commands/bootstrap.rb +49 -0
  157. data/lib/subspace/commands/configure.rb +27 -0
  158. data/lib/subspace/commands/exec.rb +20 -0
  159. data/lib/subspace/commands/init.rb +144 -0
  160. data/lib/subspace/commands/inventory.rb +54 -0
  161. data/lib/subspace/commands/maintain.rb +16 -0
  162. data/lib/subspace/commands/maintenance_mode.rb +16 -0
  163. data/lib/subspace/commands/override.rb +21 -0
  164. data/lib/subspace/commands/provision.rb +14 -0
  165. data/lib/subspace/commands/secrets.rb +69 -0
  166. data/lib/subspace/commands/ssh.rb +33 -0
  167. data/lib/subspace/commands/terraform.rb +89 -0
  168. data/lib/subspace/configuration.rb +71 -0
  169. data/lib/subspace/inventory.rb +144 -0
  170. data/lib/subspace/version.rb +1 -1
  171. data/lib/subspace.rb +8 -1
  172. data/subspace.gemspec +14 -3
  173. data/template/provision.rb.erb +94 -0
  174. data/template/subspace/.gitignore +6 -0
  175. data/template/subspace/ansible.cfg.erb +17 -0
  176. data/template/subspace/group_vars/all.erb +28 -0
  177. data/template/subspace/group_vars/template.erb +26 -0
  178. data/template/subspace/inventory.yml.erb +12 -0
  179. data/template/subspace/playbook.yml.erb +18 -0
  180. data/template/subspace/secrets/template.erb +5 -0
  181. data/template/subspace/templates/application.yml.template +27 -0
  182. data/template/subspace/templates/authorized_keys.erb +1 -0
  183. data/template/subspace/terraform/.gitignore +2 -0
  184. data/template/subspace/terraform/template/main-oxenwagen.tf.erb +116 -0
  185. data/template/subspace/terraform/template/main-workhorse.tf.erb +41 -0
  186. data/template/subspace/terraformrc.erb +9 -0
  187. data/terraform/modules/s3_backend/README +2 -0
  188. data/terraform/modules/s3_backend/dynamodb.tf +1 -0
  189. data/terraform/modules/s3_backend/iam_user.tf +38 -0
  190. data/terraform/modules/s3_backend/main.tf +39 -0
  191. data/terraform/modules/s3_backend/state_bucket.tf +14 -0
  192. metadata +198 -29
  193. data/ansible/roles/apache/templates/project.conf +0 -25
  194. data/ansible/roles/aws/tasks/main.yml +0 -46
  195. data/ansible/roles/delayed_job/files/deploy-service +0 -2
  196. data/ansible/roles/delayed_job/files/monit-http.conf +0 -3
  197. data/ansible/roles/letsencrypt/templates/project-le-ssl.conf +0 -31
  198. data/ansible/roles/nginx/templates/nginx-project +0 -27
  199. data/ansible/roles/puma/templates/etc-init-puma-manager.conf +0 -31
  200. data/ansible/roles/puma/templates/etc-init-puma.conf +0 -69
  201. data/lib/subspace/railtie.rb +0 -9
  202. data/lib/tasks/provision.rake +0 -12
  203. data/template/provision/.gitignore +0 -1
  204. data/template/provision/ansible.cfg.erb +0 -5
  205. data/template/provision/group_vars/all.erb +0 -12
  206. data/template/provision/group_vars/template.erb +0 -14
  207. data/template/provision/host_vars/template.erb +0 -4
  208. data/template/provision/playbook.yml.erb +0 -26
  209. data/template/provision/vars/template.erb +0 -4
  210. /data/template/{provision → subspace}/hosts.erb +0 -0
@@ -0,0 +1,536 @@
1
+ # Memory units: kB = kilobytes Time units: ms = milliseconds
2
+ # MB = megabytes s = seconds
3
+ # GB = gigabytes min = minutes
4
+ # h = hours
5
+ # d = days
6
+
7
+
8
+ # File locations
9
+ # --------------
10
+
11
+ # The default values of these variables are driven from the -D command-line
12
+ # option or PGDATA environment variable, represented here as ConfigDir.
13
+
14
+ # use data in another directory (change requires restart)
15
+ data_directory = '{{postgresql_data_directory}}'
16
+
17
+ # host-based authentication file (change requires restart)
18
+ hba_file = '{{postgresql_hba_file}}'
19
+
20
+ # ident configuration file (change requires restart)
21
+ ident_file = '{{postgresql_ident_file}}'
22
+
23
+ # If external_pid_file is not explicitly set, no extra PID file is written.
24
+ # write an extra PID file (change requires restart)
25
+ external_pid_file = '{{postgresql_external_pid_file}}'
26
+
27
+
28
+ # Connections
29
+ # -----------
30
+
31
+ # What IP address(es) to listen on; comma-separated list of addresses.
32
+ listen_addresses = '{{postgresql_listen_addresses|join(', ')}}'
33
+ port = {{postgresql_port}}
34
+
35
+ # Note: Increasing max_connections costs ~400 bytes of shared memory per
36
+ # connection slot, plus lock space (see max_locks_per_transaction).
37
+ max_connections = {{postgresql_max_connections}}
38
+ superuser_reserved_connections = {{postgresql_superuser_reserved_connections}}
39
+
40
+ unix_socket_directories = '{{postgresql_unix_socket_directories|join(',')}}' # comma-separated list of directories
41
+ unix_socket_group = '{{postgresql_unix_socket_group}}'
42
+ unix_socket_permissions = {{postgresql_unix_socket_permissions}} # begin with 0 to use octal notation
43
+
44
+ bonjour = {{'on' if postgresql_bonjour else 'off'}} # advertise server via Bonjour
45
+ bonjour_name = '{{postgresql_bonjour_name}}' # defaults to the computer name
46
+
47
+
48
+ # Security and Authentication
49
+ # ---------------------------
50
+
51
+ authentication_timeout = {{postgresql_authentication_timeout}}
52
+ ssl = {{'on' if postgresql_ssl else 'off'}}
53
+ ssl_ciphers = '{{postgresql_ssl_ciphers|join(':')}}'
54
+ {% if postgresql_version < 9.5 %}
55
+ ssl_renegotiation_limit = {{postgresql_ssl_renegotiation_limit}}
56
+ {% endif %}
57
+ ssl_cert_file = '{{postgresql_ssl_cert_file}}'
58
+ ssl_key_file = '{{postgresql_ssl_key_file}}'
59
+ ssl_ca_file = '{{postgresql_ssl_ca_file}}'
60
+ ssl_crl_file = '{{postgresql_ssl_crl_file}}'
61
+ password_encryption = {{'on' if postgresql_password_encryption else 'off'}}
62
+ db_user_namespace = {{'on' if postgresql_db_user_namespace else 'off'}}
63
+
64
+ # Kerberos and GSSAPI
65
+ krb_server_keyfile = '{{postgresql_krb_server_keyfile}}'
66
+ krb_caseins_users = {{'on' if postgresql_db_user_namespace else 'off'}}
67
+
68
+ # TCP Keepalives, 0 selects the system default
69
+ tcp_keepalives_idle = {{postgresql_tcp_keepalives_idle}}
70
+ tcp_keepalives_interval = {{postgresql_tcp_keepalives_interval}}
71
+ tcp_keepalives_count = {{postgresql_tcp_keepalives_count}}
72
+
73
+
74
+ # Memory
75
+ # ------
76
+
77
+ shared_buffers = {{postgresql_shared_buffers}}
78
+ temp_buffers = {{postgresql_temp_buffers}}
79
+
80
+ # Note: Increasing max_prepared_transactions costs ~600 bytes of shared memory
81
+ # per transaction slot, plus lock space (see max_locks_per_transaction).
82
+ # It is not advisable to set max_prepared_transactions nonzero unless you
83
+ # actively intend to use prepared transactions.
84
+ max_prepared_transactions = {{postgresql_max_prepared_transactions}} # 0 disables the feature
85
+
86
+ work_mem = {{postgresql_work_mem}} # min 64kB
87
+ maintenance_work_mem = {{postgresql_maintenance_work_mem}} # min 1MB
88
+ max_stack_depth = {{postgresql_max_stack_depth}} # min 100kB
89
+
90
+ # Disk
91
+ # ----
92
+
93
+ # limits per-session temp file space in kB, or -1 for no limit
94
+ temp_file_limit = {{postgresql_temp_file_limit}}
95
+
96
+ # Kernel Resource Usage
97
+ # ---------------------
98
+
99
+ max_files_per_process = {{postgresql_max_files_per_process}} # min 25
100
+ shared_preload_libraries = '{{postgresql_shared_preload_libraries|join(',')}}'
101
+
102
+ # Cost-Based Vacuum Delay
103
+ # -----------------------
104
+
105
+ vacuum_cost_delay = {{postgresql_vacuum_cost_delay}} # 0-100 milliseconds
106
+ vacuum_cost_page_hit = {{postgresql_vacuum_cost_page_hit}} # 0-10000 credits
107
+ vacuum_cost_page_miss = {{postgresql_vacuum_cost_page_miss}} # 0-10000 credits
108
+ vacuum_cost_page_dirty = {{postgresql_vacuum_cost_page_dirty}} # 0-10000 credits
109
+ vacuum_cost_limit = {{postgresql_vacuum_cost_limit}} # 1-10000 credits
110
+
111
+ # Background Writer
112
+ # -----------------
113
+
114
+ bgwriter_delay = {{postgresql_bgwriter_delay}} # 10-10000ms between rounds
115
+ bgwriter_lru_maxpages = {{postgresql_bgwriter_lru_maxpages}} # 0-1000 max buffers written/round
116
+ bgwriter_lru_multiplier = {{postgresql_bgwriter_lru_multiplier}} # 0-10.0 multipler on buffers scanned/round
117
+
118
+ # Asynchronous Behavior
119
+ # ---------------------
120
+
121
+ effective_io_concurrency = {{postgresql_effective_io_concurrency}} # 1-1000; 0 disables prefetching
122
+
123
+
124
+ # Write Ahead Log
125
+ # ---------------
126
+
127
+ wal_level = {{postgresql_wal_level}} # minimal, archive, or hot_standby
128
+ fsync = {{'on' if postgresql_fsync else 'off'}} # turns forced synchronization on or off
129
+
130
+ # synchronization levels:
131
+ # - off
132
+ # - local
133
+ # - remote_write
134
+ # - on
135
+ {% if postgresql_synchronous_commit is string %}
136
+ synchronous_commit = {{postgresql_synchronous_commit}}
137
+ {% else %}
138
+ synchronous_commit = {{'on' if postgresql_synchronous_commit else 'off'}}
139
+ {% endif %}
140
+
141
+ # The default is the first option supported by the operating system:
142
+ # - open_datasync
143
+ # - fdatasync (default on Linux)
144
+ # - fsync
145
+ # - fsync_writethrough
146
+ # - open_sync
147
+ wal_sync_method = {{postgresql_wal_sync_method}}
148
+
149
+ # Recover from partial page writes
150
+ full_page_writes = {{'on' if postgresql_full_page_writes else 'off'}}
151
+
152
+ wal_buffers = {{postgresql_wal_buffers}} # min 32kB, -1 sets based on shared_buffers
153
+ wal_writer_delay = {{postgresql_wal_writer_delay}} # 1-10000 milliseconds
154
+ commit_delay = {{postgresql_commit_delay}} # range 0-100000, in microseconds
155
+ commit_siblings = {{postgresql_commit_siblings}} # range 1-1000
156
+
157
+ {% if postgresql_version < 9.5 %}
158
+ checkpoint_segments = {{postgresql_checkpoint_segments}} # in logfile segments, min 1, 16MB each
159
+ {% endif %}
160
+ checkpoint_timeout = {{postgresql_checkpoint_timeout}} # range 30s-1h
161
+ checkpoint_completion_target = {{postgresql_checkpoint_completion_target}} # checkpoint target duration, 0.0 - 1.0
162
+ checkpoint_warning = {{postgresql_checkpoint_warning}} # 0 disables
163
+
164
+ archive_mode = {{'on' if postgresql_archive_mode else 'off'}} # allows archiving to be done
165
+
166
+ # Command to use to archive a logfile segment.
167
+ # Placeholders: %p = path of file to archive
168
+ # %f = file name only
169
+ # e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'
170
+ archive_command = '{{postgresql_archive_command}}'
171
+
172
+ # force a logfile segment switch after this number of seconds
173
+ archive_timeout = {{postgresql_archive_timeout}} # 0 disables
174
+
175
+
176
+ # Replication
177
+ # -----------
178
+
179
+ # Set these on the master and on any standby that will send replication data.
180
+
181
+ max_wal_senders = {{postgresql_max_wal_senders}} # max number of walsender processes
182
+ wal_keep_segments = {{postgresql_wal_keep_segments}} # in logfile segments, 16MB each; 0 disables
183
+ wal_sender_timeout = {{postgresql_wal_sender_timeout}} # in milliseconds; 0 disables
184
+
185
+ # Replication (masters)
186
+ # ---------------------
187
+
188
+ # These settings are ignored on a standby server.
189
+
190
+ # Standby servers that provide sync rep.
191
+ # Comma-separated list of application_name from standby(s)
192
+ synchronous_standby_names = '{{postgresql_synchronous_standby_names|join(',')}}' # '*' means 'all'
193
+
194
+ # Number of xacts by which cleanup is delayed
195
+ vacuum_defer_cleanup_age = {{postgresql_vacuum_defer_cleanup_age}}
196
+
197
+ # Replication (standbys)
198
+ # ----------------------
199
+
200
+ # These settings are ignored on a master server.
201
+
202
+ # "on" allows queries during recovery
203
+ hot_standby = {{'on' if postgresql_hot_standby else 'off'}}
204
+ # max delay before canceling queries when reading WAL from archive
205
+ max_standby_archive_delay = {{postgresql_max_standby_archive_delay}} # -1 allows indefinite delay
206
+ # max delay before canceling queries when reading streaming WAL;
207
+ max_standby_streaming_delay = {{postgresql_max_standby_streaming_delay}} # -1 allows indefinite delay
208
+ # send replies at least this often
209
+ wal_receiver_status_interval = {{postgresql_wal_receiver_status_interval}} # 0 disables
210
+ # send info from standby to prevent query conflicts
211
+ hot_standby_feedback = {{'on' if postgresql_hot_standby_feedback or 'off'}}
212
+ #time that receiver waits for communication from master in milliseconds
213
+ wal_receiver_timeout = {{postgresql_wal_receiver_timeout}}
214
+
215
+
216
+ # Query Tuning (Planner)
217
+ # ----------------------
218
+
219
+ enable_bitmapscan = {{'on' if postgresql_enable_bitmapscan else 'off'}}
220
+ enable_hashagg = {{'on' if postgresql_enable_hashagg else 'off'}}
221
+ enable_hashjoin = {{'on' if postgresql_enable_hashjoin else 'off'}}
222
+ enable_indexscan = {{'on' if postgresql_enable_indexscan else 'off'}}
223
+ enable_indexonlyscan = {{'on' if postgresql_enable_indexonlyscan else 'off'}}
224
+ enable_material = {{'on' if postgresql_enable_material else 'off'}}
225
+ enable_mergejoin = {{'on' if postgresql_enable_mergejoin else 'off'}}
226
+ enable_nestloop = {{'on' if postgresql_enable_nestloop else 'off'}}
227
+ enable_seqscan = {{'on' if postgresql_enable_seqscan else 'off'}}
228
+ enable_sort = {{'on' if postgresql_enable_sort else 'off'}}
229
+ enable_tidscan = {{'on' if postgresql_enable_tidscan else 'off'}}
230
+
231
+ seq_page_cost = {{postgresql_seq_page_cost}} # measured on an arbitrary scale
232
+ random_page_cost = {{postgresql_random_page_cost}} # same scale as above
233
+ cpu_tuple_cost = {{postgresql_cpu_tuple_cost}} # same scale as above
234
+ cpu_index_tuple_cost = {{postgresql_cpu_index_tuple_cost}} # same scale as above
235
+ cpu_operator_cost = {{postgresql_cpu_operator_cost}} # same scale as above
236
+ effective_cache_size = {{postgresql_effective_cache_size}}
237
+
238
+ # Query Tuning (Genetic Query Optimizer)
239
+ # --------------------------------------
240
+
241
+ geqo = {{'on' if postgresql_enable_tidscan else 'off'}}
242
+ geqo_threshold = {{postgresql_geqo_threshold}}
243
+ geqo_effort = {{postgresql_geqo_effort}} # range 1-10
244
+ geqo_pool_size = {{postgresql_geqo_pool_size}} # selects default based on effort
245
+ geqo_generations = {{postgresql_geqo_generations}} # selects default based on effort
246
+ geqo_selection_bias = {{postgresql_geqo_selection_bias}} # range 1.5-2.0
247
+ geqo_seed = {{postgresql_geqo_seed}} # range 0.0-1.0
248
+
249
+ # Query Tuning (Other Planner Options)
250
+ # ------------------------------------
251
+
252
+ default_statistics_target = {{postgresql_default_statistics_target}} # range 1-10000
253
+ constraint_exclusion = {{postgresql_constraint_exclusion}} # on, off, or partition
254
+ cursor_tuple_fraction = {{postgresql_cursor_tuple_fraction}} # range 0.0-1.0
255
+ from_collapse_limit = {{postgresql_from_collapse_limit}}
256
+ join_collapse_limit = {{postgresql_join_collapse_limit}} # 1 disables collapsing of explicit JOIN clauses
257
+
258
+
259
+ # Error Reporting And Logging
260
+ # ---------------------------
261
+
262
+ # Valid values are combinations of stderr, csvlog, syslog, and eventlog.
263
+ # depending on platform. Csvlog requires logging_collector to be on.
264
+ log_destination = '{{postgresql_log_destination}}'
265
+
266
+ # Enable capturing of stderr and csvlog into log files.
267
+ # Required to be on for csvlogs.
268
+ logging_collector = {{'on' if postgresql_logging_collector else 'off'}}
269
+
270
+ # These are only used if logging_collector is on:
271
+
272
+ # Directory where log files are written, can be absolute or relative to PGDATA
273
+ log_directory = '{{postgresql_log_directory}}'
274
+ # Log file name pattern, can include strftime() escapes
275
+ log_filename = '{{postgresql_log_filename}}'
276
+ log_file_mode = {{postgresql_log_file_mode}} # begin with 0 to use octal notation
277
+ # If on, an existing log file with the same name as the new log file will be
278
+ # truncated rather than appended to. But such truncation only occurs on
279
+ # time-driven rotation, not on restarts or size-driven rotation. Default is
280
+ # off, meaning append to existing files in all cases.
281
+ log_truncate_on_rotation = {{'on' if postgresql_log_truncate_on_rotation else 'off'}}
282
+ # Automatic rotation of logfiles will happen after that time.
283
+ log_rotation_age = {{postgresql_log_rotation_age}} # 0 disables.
284
+ # Automatic rotation of logfiles will happen after that much log output.
285
+ log_rotation_size = {{postgresql_log_rotation_size}} # 0 disables.
286
+
287
+ # These are relevant when logging to syslog:
288
+ syslog_facility = '{{postgresql_syslog_facility}}'
289
+ syslog_ident = '{{postgresql_syslog_ident}}'
290
+
291
+ # This is only relevant when logging to eventlog (win32):
292
+ event_source = '{{postgresql_event_source}}'
293
+
294
+ # Values in order of decreasing detail:
295
+ # - debug5
296
+ # - debug4
297
+ # - debug3
298
+ # - debug2
299
+ # - debug1
300
+ # - log
301
+ # - notice
302
+ # - warning
303
+ # - error
304
+ client_min_messages = {{postgresql_client_min_messages}}
305
+
306
+ # Values in order of decreasing detail:
307
+ # - debug5
308
+ # - debug4
309
+ # - debug3
310
+ # - debug2
311
+ # - debug1
312
+ # - info
313
+ # - notice
314
+ # - warning
315
+ # - error
316
+ # - log
317
+ # - fatal
318
+ # - panic
319
+ log_min_messages = {{postgresql_log_min_messages}}
320
+
321
+ # Values in order of decreasing detail:
322
+ # - debug5
323
+ # - debug4
324
+ # - debug3
325
+ # - debug2
326
+ # - debug1
327
+ # - info
328
+ # - notice
329
+ # - warning
330
+ # - error
331
+ # - log
332
+ # - fatal
333
+ # - panic (effectively off)
334
+ log_min_error_statement = {{postgresql_log_min_error_statement}}
335
+
336
+ # -1 is disabled, 0 logs all statements and their durations, > 0 logs only
337
+ # statements running at least this number of milliseconds
338
+ log_min_duration_statement = {{postgresql_log_min_duration_statement}}
339
+
340
+ debug_print_parse = {{'on' if postgresql_debug_print_parse else 'off'}}
341
+ debug_print_rewritten = {{'on' if postgresql_debug_print_rewritten else 'off'}}
342
+ debug_print_plan = {{'on' if postgresql_debug_print_plan else 'off'}}
343
+ debug_pretty_print = {{'on' if postgresql_debug_pretty_print else 'off'}}
344
+ log_checkpoints = {{'on' if postgresql_log_checkpoints else 'off'}}
345
+ log_connections = {{'on' if postgresql_log_connections else 'off'}}
346
+ log_disconnections = {{'on' if postgresql_log_disconnections else 'off'}}
347
+ log_duration = {{'on' if postgresql_log_duration else 'off'}}
348
+ log_error_verbosity = {{postgresql_log_error_verbosity}} # terse, default, or verbose messages
349
+ log_hostname = {{'on' if postgresql_log_duration else 'off'}}
350
+
351
+ # special values:
352
+ # %a = application name
353
+ # %u = user name
354
+ # %d = database name
355
+ # %r = remote host and port
356
+ # %h = remote host
357
+ # %p = process ID
358
+ # %t = timestamp without milliseconds
359
+ # %m = timestamp with milliseconds
360
+ # %i = command tag
361
+ # %e = SQL state
362
+ # %c = session ID
363
+ # %l = session line number
364
+ # %s = session start timestamp
365
+ # %v = virtual transaction ID
366
+ # %x = transaction ID (0 if none)
367
+ # %q = stop here in non-session
368
+ # processes
369
+ # %% = '%'
370
+ log_line_prefix = '{{postgresql_log_line_prefix}}'
371
+
372
+ # log lock waits >= deadlock_timeout
373
+ log_lock_waits = {{'on' if postgresql_log_lock_waits else 'off'}}
374
+ log_statement = '{{postgresql_log_statement}}' # none, ddl, mod, all
375
+ # log temporary files equal or larger than the specified size in kilobytes
376
+ log_temp_files = {{postgresql_log_temp_files}} # -1 disables, 0 logs all temp files
377
+ log_timezone = '{{postgresql_log_timezone}}'
378
+
379
+
380
+ # Runtime statistics
381
+ # ------------------
382
+
383
+ track_activities = {{'on' if postgresql_track_activities else 'off'}}
384
+ track_counts = {{'on' if postgresql_track_counts else 'off'}}
385
+ track_io_timing = {{'on' if postgresql_track_io_timing else 'off'}}
386
+ track_functions = {{postgresql_track_functions}} # none, pl, all
387
+ track_activity_query_size = {{postgresql_track_activity_query_size}}
388
+ update_process_title = {{'on' if postgresql_update_process_title else 'off'}}
389
+ stats_temp_directory = '{{postgresql_stats_temp_directory}}'
390
+
391
+ log_parser_stats = {{'on' if postgresql_log_parser_stats else 'off'}}
392
+ log_planner_stats = {{'on' if postgresql_log_planner_stats else 'off'}}
393
+ log_executor_stats = {{'on' if postgresql_log_executor_stats else 'off'}}
394
+ log_statement_stats = {{'on' if postgresql_log_statement_stats else 'off'}}
395
+
396
+
397
+ # Autovacuum Parameters
398
+ # ---------------------
399
+
400
+ # Enable autovacuum subprocess? 'on' requires track_counts to also be on.
401
+ autovacuum = {{'on' if postgresql_autovacuum else 'off'}}
402
+ # -1 disables, 0 logs all actions and their durations, > 0 logs only
403
+ # actions running at least this number of milliseconds.
404
+ log_autovacuum_min_duration = {{postgresql_log_autovacuum_min_duration}}
405
+ # max number of autovacuum subprocesses
406
+ autovacuum_max_workers = {{postgresql_autovacuum_max_workers}}
407
+ # time between autovacuum runs
408
+ autovacuum_naptime = {{postgresql_autovacuum_naptime}}
409
+ # min number of row updates before vacuum
410
+ autovacuum_vacuum_threshold = {{postgresql_autovacuum_vacuum_threshold}}
411
+ # min number of row updates before analyze
412
+ autovacuum_analyze_threshold = {{postgresql_autovacuum_analyze_threshold}}
413
+ # fraction of table size before vacuum
414
+ autovacuum_vacuum_scale_factor = {{postgresql_autovacuum_vacuum_scale_factor}}
415
+ # fraction of table size before analyze
416
+ autovacuum_analyze_scale_factor = {{postgresql_autovacuum_analyze_scale_factor}}
417
+ # maximum XID age before forced vacuum
418
+ autovacuum_freeze_max_age = {{postgresql_autovacuum_freeze_max_age}}
419
+ # default vacuum cost delay for autovacuum, in milliseconds
420
+ autovacuum_vacuum_cost_delay = {{postgresql_autovacuum_vacuum_cost_delay}} # -1 means use vacuum_cost_delay
421
+ # default vacuum cost limit for autovacuum
422
+ autovacuum_vacuum_cost_limit = {{postgresql_autovacuum_vacuum_cost_limit}} # -1 means use vacuum_cost_limit
423
+
424
+
425
+ # Client Connection Defaults
426
+ # --------------------------
427
+
428
+ search_path = '{{postgresql_search_path|join(',')}}' # schema names
429
+ default_tablespace = '{{postgresql_default_tablespace}}' # '' uses the default
430
+ temp_tablespaces = '{{postgresql_temp_tablespaces|join(',')}}' # '' uses only default tablespace
431
+
432
+ check_function_bodies = {{'on' if postgresql_check_function_bodies else 'off'}}
433
+ default_transaction_isolation = '{{postgresql_default_transaction_isolation}}'
434
+ default_transaction_read_only = {{'on' if postgresql_default_transaction_read_only else 'off'}}
435
+ default_transaction_deferrable = {{'on' if postgresql_default_transaction_deferrable else 'off'}}
436
+ session_replication_role = '{{postgresql_session_replication_role}}'
437
+
438
+ statement_timeout = {{postgresql_statement_timeout}} # in milliseconds, 0 is disabled
439
+ lock_timeout = {{postgresql_lock_timeout}} # in milliseconds, 0 is disabled
440
+ vacuum_freeze_min_age = {{postgresql_vacuum_freeze_min_age}}
441
+ vacuum_freeze_table_age = {{postgresql_vacuum_freeze_table_age}}
442
+
443
+ bytea_output = '{{postgresql_bytea_output}}' # hex, escape
444
+ xmlbinary = '{{postgresql_xmlbinary}}'
445
+ xmloption = '{{postgresql_xmloption}}'
446
+
447
+ datestyle = '{{postgresql_datestyle|join(',')}}'
448
+ intervalstyle = '{{postgresql_intervalstyle}}'
449
+ timezone = '{{postgresql_timezone}}'
450
+
451
+ # Select the set of available time zone abbreviations. Currently, there are:
452
+ # - Default
453
+ # - Australia
454
+ # - India
455
+ # You can create your own file in `share/timezonesets/`.
456
+ timezone_abbreviations = '{{postgresql_timezone_abbreviations}}'
457
+
458
+ extra_float_digits = {{postgresql_extra_float_digits}} # min -15, max 3
459
+ client_encoding = {{postgresql_client_encoding}} # 'sql_ascii' actually defaults to database encoding
460
+
461
+ # These settings are initialized by initdb, but they can be changed.
462
+
463
+ # locale for system error message strings
464
+ lc_messages = '{{postgresql_lc_messages}}'
465
+ # locale for monetary formatting
466
+ lc_monetary = '{{postgresql_lc_monetary}}'
467
+ # locale for number formatting
468
+ lc_numeric = '{{postgresql_lc_numeric}}'
469
+ # locale for time formatting
470
+ lc_time = '{{postgresql_lc_time}}'
471
+
472
+ # default configuration for text search
473
+ default_text_search_config = '{{postgresql_default_text_search_config}}'
474
+
475
+ dynamic_library_path = '{{postgresql_dynamic_library_path}}'
476
+ local_preload_libraries = '{{postgresql_local_preload_libraries|join(',')}}'
477
+
478
+
479
+ # Lock Management
480
+ # ---------------
481
+
482
+ deadlock_timeout = {{postgresql_deadlock_timeout}}
483
+ max_locks_per_transaction = {{postgresql_max_locks_per_transaction}} # min 10
484
+
485
+ # Note: Each lock table slot uses ~270 bytes of shared memory, and there are
486
+ # max_locks_per_transaction * (max_connections + max_prepared_transactions)
487
+ # lock table slots.
488
+ max_pred_locks_per_transaction = {{postgresql_max_pred_locks_per_transaction}} # min 10
489
+
490
+
491
+ # Version/platform Compatibility
492
+ # ------------------------------
493
+
494
+ array_nulls = {{'on' if postgresql_array_nulls else 'off'}}
495
+ backslash_quote = {{postgresql_backslash_quote}} # on, off, or safe_encoding
496
+ default_with_oids = {{'on' if postgresql_default_with_oids else 'off'}}
497
+ escape_string_warning = {{'on' if postgresql_escape_string_warning else 'off'}}
498
+ lo_compat_privileges = {{'on' if postgresql_lo_compat_privileges else 'off'}}
499
+ quote_all_identifiers = {{'on' if postgresql_quote_all_identifiers else 'off'}}
500
+ {% if postgresql_version < 10 %}
501
+ sql_inheritance = {{'on' if postgresql_sql_inheritance else 'off'}}
502
+ {% endif %}
503
+ standard_conforming_strings = {{'on' if postgresql_standard_conforming_strings else 'off'}}
504
+ synchronize_seqscans = {{'on' if postgresql_synchronize_seqscans else 'off'}}
505
+ transform_null_equals = {{'on' if postgresql_transform_null_equals else 'off'}}
506
+
507
+
508
+ # Error Handling
509
+ # --------------
510
+
511
+ # Terminate session on any error?
512
+ exit_on_error = {{'on' if postgresql_exit_on_error else 'off'}}
513
+ # Reinitialize after backend crash?
514
+ restart_after_crash = {{'on' if postgresql_restart_after_crash else 'off'}}
515
+
516
+
517
+ # Config File Includes
518
+ # --------------------
519
+
520
+ # These options allow settings to be loaded from files other than the
521
+ # default postgresql.conf.
522
+
523
+ # include files ending in '.conf' from directory 'conf.d'
524
+ #include_dir = 'conf.d'
525
+
526
+ # include file only if it exists
527
+ #include_if_exists = 'exists.conf'
528
+
529
+ # include file
530
+ #include = 'special.conf'
531
+
532
+
533
+ # CUSTOMIZED OPTIONS
534
+ # ------------------
535
+
536
+ # Add settings for extensions here
@@ -0,0 +1,24 @@
1
+ # Integration testing playbook
2
+ # ----------------------------
3
+
4
+ # A playbook for testing and integration.
5
+
6
+ # It will provision the `test` hosts in the inventory,
7
+ # which will, by default, specify the provided vagrant VM.
8
+
9
+ # This playbook should aim to test the most extensive
10
+ # or comprehensive configuration possible for your role.
11
+
12
+
13
+ - name: 'Role integration tests'
14
+
15
+ hosts: test
16
+
17
+ vars:
18
+ postgresql_dev_headers: yes
19
+ postgresql_contrib: yes
20
+ postgresql_postgis: yes
21
+
22
+ roles:
23
+ - '.' # The current directory itself is the role
24
+
data/bin/console CHANGED
@@ -6,9 +6,5 @@ require "subspace"
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
8
8
 
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
9
  require "irb"
14
10
  IRB.start
data/exe/subspace CHANGED
@@ -1,85 +1,4 @@
1
- #!/usr/bin/env ruby
1
+ #!/usr/bin/env ruby_executable_hooks
2
2
 
3
- require 'fileutils'
4
- require 'erb'
5
-
6
- @provision_templatedir = File.join(File.dirname(__FILE__), '..', 'template', 'provision')
7
- @dest_dir = "config/provision"
8
-
9
- def gem_path
10
- File.expand_path '../..', __FILE__
11
- end
12
-
13
- def project_name
14
- File.basename(Dir.pwd)
15
- end
16
-
17
- def template(src, dest = nil)
18
- dest ||= src
19
- template = ERB.new File.read(File.join(@provision_templatedir, "#{src}.erb")), nil, '-'
20
- File.write File.join(@dest_dir, dest), template.result(binding)
21
- end
22
-
23
- def copy(src, dest = nil)
24
- dest ||= src
25
- FileUtils.cp File.join(@provision_templatedir, src), File.join(@dest_dir, dest)
26
- end
27
-
28
- def environments
29
- %w(production dev)
30
- end
31
-
32
- def hostname(env)
33
- "#{project_name.gsub('_', '-')}-#{env}"
34
- end
35
-
36
- def create_vault_pass
37
- File.write File.join(@dest_dir, ".vault_pass"), SecureRandom.base64
38
- end
39
-
40
- def create_vars_file_for_env(env)
41
- template "vars/template", "vars/#{env}.yml"
42
- Dir.chdir @dest_dir do
43
- `ansible-vault encrypt vars/#{env}.yml`
44
- end
45
- end
46
-
47
- if ARGV[0] == "init"
48
- FileUtils.mkdir_p File.join @dest_dir, "group_vars"
49
- FileUtils.mkdir_p File.join @dest_dir, "host_vars"
50
- FileUtils.mkdir_p File.join @dest_dir, "vars"
51
-
52
- copy ".gitignore"
53
- template "ansible.cfg"
54
- template "hosts"
55
- template "group_vars/all"
56
- create_vault_pass
57
- environments.each do |env|
58
- @env = env
59
- @hostname = hostname(env)
60
- template "group_vars/template", "group_vars/#{env}"
61
- template "host_vars/template", "host_vars/#{env}"
62
- create_vars_file_for_env env
63
- template "playbook.yml", "#{env}.yml"
64
- end
65
-
66
- puts """
67
- 1. Create a server.
68
-
69
- 2. Set your server's location:
70
-
71
- vim config/provision/host_vars/production
72
- vim config/provision/host_vars/dev
73
-
74
- 3. Set up your authorized_keys:
75
-
76
- vim config/provision/authorized_keys
77
-
78
- 4. Then provision your server:
79
-
80
- cd config/provision && ansible-playbook dev.yml
81
-
82
- """
83
- else
84
- puts "usage: subspace init"
85
- end
3
+ require 'subspace/cli'
4
+ Subspace::Cli.new.run