Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize how tilde is used for templating in core plans #986

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion consul/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exec 2>&1
SERVERMODE={{cfg.server.mode}}

if [ "$SERVERMODE" = true ] ; then
exec consul agent {{~#if cfg.website}} -ui {{~/if}} -server -bootstrap-expect {{cfg.bootstrap.expect}} -config-file={{pkg.svc_config_path}}/basic_config.json
exec consul agent {{#if cfg.website ~}} -ui {{/if ~}} -server -bootstrap-expect {{cfg.bootstrap.expect}} -config-file={{pkg.svc_config_path}}/basic_config.json
else
exec consul agent -dev
fi
14 changes: 7 additions & 7 deletions foulkon/config/environment.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/bin/bash

{{#if bind.database}}
{{~#eachAlive bind.database.members as |member|}}
{{#if bind.database ~}}
{{#eachAlive bind.database.members as |member| ~}}
PGPORT="{{member.cfg.port}}"
PGHOST="{{member.sys.ip}}"
PG_SUPERUSER="{{member.cfg.superuser_name}}"
PG_SUPERUSER_PASSWORD="{{member.cfg.superuser_password}}"
PG_SUPERUSER_URI="postgres://{{member.cfg.superuser_name}}:{{member.cfg.superuser_password}}@{{member.sys.ip}}:{{member.cfg.port}}/postgres"
{{~/eachAlive}}
{{else}}
{{#with cfg}}
{{/eachAlive ~}}
{{else ~}}
{{#with cfg ~}}
PGPORT="{{storage.port}}"
PGHOST="{{storage.host}}"
PG_SUPERUSER="{{storage.superuser_name}}"
PG_SUPERUSER_PASSWORD="{{storage.superuser_password}}"
PG_SUPERUSER_URI="postgres://{{storage.superuser_name}}:{{storage.superuser_password}}@{{storage.host}}:{{storage.port}}/postgres"
{{/with}}
{{/if}}
{{/with ~}}
{{/if ~}}
10 changes: 5 additions & 5 deletions foulkon/config/proxy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ level = "{{cfg.log_level}}"
type = "postgres"

[database.postgres]
{{#if bind.database}}
{{~#eachAlive bind.backend.members as |database|}}
{{#if bind.database ~}}
{{#eachAlive bind.backend.members as |database| ~}}
datasourcename = "postgres://{{cfg.storage.user}}:{{cfg.storage.password}}@{{database.sys.ip}}:{{database.cfg.port}}/{{cfg.storage.database}}?sslmode={{cfg.storage.ssl_mode}}"
{{~/eachAlive}}
{{else}}
{{/eachAlive ~}}
{{else ~}}
datasourcename = "postgres://{{cfg.storage.user}}:{{cfg.storage.password}}@{{cfg.storage.host}}:{{cfg.storage.port}}/{{cfg.storage.database}}?sslmode={{cfg.storage.ssl_mode}}"
{{/if}}
{{/if ~}}
14 changes: 7 additions & 7 deletions foulkon/config/worker.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ password = "{{cfg.admin.password}}"
type = "postgres"

[database.postgres]
{{#if bind.database}}
{{~#eachAlive bind.database.members as |member|}}
{{#if bind.database ~}}
{{#eachAlive bind.database.members as |member| ~}}
datasourcename = "postgres://{{cfg.storage.user}}:{{cfg.storage.password}}@{{member.sys.ip}}:{{member.cfg.port}}/{{cfg.storage.database}}?sslmode={{cfg.storage.ssl_mode}}"
{{~/eachAlive}}
{{else}}
{{#with cfg.storage}}
{{/eachAlive ~}}
{{else ~}}
{{#with cfg.storage ~}}
datasourcename = "postgres://{{user}}:{{password}}@{{host}}:{{port}}/{{database}}?sslmode={{ssl_mode}}"
{{/with}}
{{~/if}}
{{/with ~}}
{{/if ~}}

[authenticator]
type = "{{cfg.authenticator.type}}"
20 changes: 10 additions & 10 deletions grafana/config/grafana.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
# change

# hack to get the hooks to run again (for api calls) when the bind membership changes
{{~#if bind.prom}}
{{#with bind.prom.first as |member| }}
{{#if bind.prom ~}}
{{#with bind.prom.first as |member| ~}}
# api calls made to add prometheus data source {{member.sys.ip}}:{{member.cfg.prom_ds_http}}
{{/with}}
{{/if}}
{{/with ~}}
{{/if ~}}

# possible values : production, development
; app_mode = production
Expand Down Expand Up @@ -63,13 +63,13 @@ http_port = {{cfg.listening_port}}
;enable_gzip = false

# https certs & key file
{{~#if cfg.cert_file}}
{{#if cfg.cert_file ~}}
cert_file = {{cfg.cert_file}}
{{~/if}}
{{/if ~}}

{{~#if cfg.cert_file}}
{{#if cfg.cert_file ~}}
cert_key = {{cfg.cert_key}}
{{~/if}}
{{/if ~}}

#################################### Database ####################################
[database]
Expand Down Expand Up @@ -150,10 +150,10 @@ http_port = {{cfg.listening_port}}
#################################### Security ####################################
[security]
# default admin user, created on startup
admin_user = {{ cfg.admin_user }}
admin_user = {{cfg.admin_user}}

# default admin password, can be changed before first start of grafana, or in profile settings
admin_password = {{ cfg.admin_pass }}
admin_password = {{cfg.admin_pass}}

# used for signing
;secret_key = SW2YcwTIb9zpOOhoPsMm
Expand Down
10 changes: 4 additions & 6 deletions grafana/hooks/post-run
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
# haaaaaaaaaaaaack. Grafana takes about 5s to come up.
sleep 10

{{~#if bind.prom}}

{{#if bind.prom ~}}
if has_prom="$(curl -s http://{{cfg.admin_user}}:{{cfg.admin_pass}}@localhost:{{cfg.listening_port}}/api/datasources | grep Prometheus)"; then
echo "Prometheus Datasource already installed"
else
curl -s http://{{cfg.admin_user}}:{{cfg.admin_pass}}@localhost:{{cfg.listening_port}}/api/datasources \
-X POST -H 'Content-Type: application/json;charset=UTF-8' \
{{~#with bind.prom.first as |ds| }}
{{#with bind.prom.first as |ds| ~}}
--data-binary '{"name":"Prometheus","type":"prometheus","url":"http://{{ds.sys.ip}}:{{ds.cfg.prom_ds_http}}","access":"proxy","isDefault":true}'
{{~/with}}
{{/with ~}}
fi

echo "I saw bind.prom in post-run and tried to connect to port {{cfg.listening_port}}."

# now cp the rendered dashboards to the var/dashboards/ dir
cp {{pkg.svc_config_path}}/*.json {{pkg.svc_var_path}}/dashboards/

{{~/if}}
{{/if ~}}
12 changes: 6 additions & 6 deletions haproxy/config/haproxy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ frontend http-in
default_backend default

backend default
{{#if cfg.httpchk}}
{{#if cfg.httpchk ~}}
option httpchk {{cfg.httpchk}}
{{~/if}}
{{~#eachAlive bind.backend.members as |member|}}
{{/if ~}}
{{#eachAlive bind.backend.members as |member| ~}}
server {{member.sys.ip}} {{member.sys.ip}}:{{member.cfg.port}}
{{~/eachAlive}}
{{/eachAlive ~}}

{{#if cfg.status.enabled}}
{{#if cfg.status.enabled ~}}
listen stats
bind {{cfg.status.listen}}:{{cfg.status.port}}
mode http
Expand All @@ -31,4 +31,4 @@ listen stats
stats show-node
stats auth {{cfg.status.user}}:{{cfg.status.password}}
stats uri {{cfg.status.uri}}
{{~/if}}
{{/if ~}}
30 changes: 15 additions & 15 deletions kibana/config/kibana.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
server.port: {{cfg.server.port}}
server.host: {{cfg.server.host}}

{{~#if cfg.server.basePath}}
{{#if cfg.server.basePath ~}}
server.basePath: {{cfg.server.basePath}}
{{~/if}}
{{/if ~}}

server.maxPayloadBytes: {{cfg.server.maxPayloadBytes}}

{{~#if bind.elasticsearch}}
{{#if bind.elasticsearch ~}}
# Kibana only takes on ES host in it's config
elasticsearch.url: "http://{{bind.elasticsearch.members.[0].sys.ip}}:{{bind.elasticsearch.members.[0].cfg.http-port}}"
{{else}}
{{else ~}}
elasticsearch.url: {{cfg.elasticsearch.url}}:{{cfg.elasticsearch.port}}
{{~/if}}
{{/if ~}}

elasticsearch.preserveHost: {{cfg.elasticsearch.preserveHost}}
kibana.index: {{cfg.kibana.index}}
kibana.defaultAppId: {{cfg.kibana.defaultAppId}}

{{~#if cfg.elasticsearch.password }}
{{#if cfg.elasticsearch.password ~}}
elasticsearch.username: {{cfg.elasticsearch.username}}
elasticsearch.password: {{cfg.elasticsearch.password}}
{{~/if}}
{{/if ~}}

{{~#if cfg.server.ssl.key}}
{{#if cfg.server.ssl.key ~}}
server.ssl.enabled: {{cfg.server.ssl.enabled}}
server.ssl.certificate: {{cfg.server.ssl.certificate}}
server.ssl.key: {{cfg.server.ssl.key}}
{{~/if}}
{{/if ~}}

{{~#if cfg.elasticsearch.ssl.key}}
{{#if cfg.elasticsearch.ssl.key ~}}
elasticsearch.ssl.certificate: {{cfg.elasticsearch.ssl.certficate}}
elasticsearch.ssl.key: {{cfg.elasticsearch.ssl.key}}
{{~/if}}
{{/if ~}}

{{~#if cfg.elasticsearch.ssl.ca}}
{{#if cfg.elasticsearch.ssl.ca ~}}
elasticsearch.ssl.ca: {{cfg.elasticsearch.ssl.ca}}
{{~/if}}
{{/if ~}}

{{~#if cfg.elasticsearch.ssl.verificationMode}}
{{#if cfg.elasticsearch.ssl.verificationMode ~}}
elasticsearch.ssl.verificationMode: {{cfg.elasticsearch.ssl.verificationMode}}
{{~/if}}
{{/if ~}}

elasticsearch.pingTimeout: {{cfg.elasticsearch.pingTimeout}}
elasticsearch.requestTimeout: {{cfg.elasticsearch.requestTimeout}}
Expand Down
10 changes: 5 additions & 5 deletions mariadb/config/my.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ log-isam = mysqld-isam.log
log-tc = mysqld-tc.log
aria-log-dir-path = {{pkg.svc_data_path}}/mysqld-aria
master-info-file = mysqld-master.info
{{~#if cfg.general_log}}
{{#if cfg.general_log ~}}
general-log = TRUE
general-log-file = {{pkg.svc_var_path}}/mysqld.log
{{~/if}}
{{~#if cfg.bind_address}}
{{/if ~}}
{{#if cfg.bind_address ~}}
bind-address = {{cfg.bind_address}}
{{~/if}}
init-file = {{pkg.svc_config_path}}/init.sql
{{/if ~}}
init-file = {{pkg.svc_config_path}}/init.sql
Loading