aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-02-25 18:14:36 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-02-25 18:28:29 +0100
commitc49d00da1d9f0fca3eafa907862681baa0bacec2 (patch)
tree05cc2e8cd0269e95ae7324f5ef6277ff3eda980d
parent3b48b3a5cc357ca861a2b388dde40a0109ca900f (diff)
downloadPuppet-c49d00da1d9f0fca3eafa907862681baa0bacec2.tar.gz
Puppet-c49d00da1d9f0fca3eafa907862681baa0bacec2.tar.zst
Puppet-c49d00da1d9f0fca3eafa907862681baa0bacec2.zip
Update bot and add database connection
-rw-r--r--environments/production/data/nodes/vps494082.yaml4
-rw-r--r--modules/role/manifests/cryptoportfolio.pp13
-rw-r--r--modules/role/templates/cryptoportfolio/bot_config.ini.erb9
3 files changed, 23 insertions, 3 deletions
diff --git a/environments/production/data/nodes/vps494082.yaml b/environments/production/data/nodes/vps494082.yaml
index 59b2447..8cba9a2 100644
--- a/environments/production/data/nodes/vps494082.yaml
+++ b/environments/production/data/nodes/vps494082.yaml
@@ -1,5 +1,5 @@
1base_installation::system_hostname: cryptoportfolio.immae.eu 1base_installation::system_hostname: cryptoportfolio.immae.eu
2cryptoportfolio::front_version: v0.0.1-2-g989fb5c 2cryptoportfolio::front_version: v0.0.1-2-g989fb5c
3cryptoportfolio::front_sha256: 1e82044b6a40b415913658bb1b896087d8c2c43d64c5862cd84f60804f5854dc 3cryptoportfolio::front_sha256: 1e82044b6a40b415913658bb1b896087d8c2c43d64c5862cd84f60804f5854dc
4cryptoportfolio::bot_version: v0.1 4cryptoportfolio::bot_version: v0.2
5cryptoportfolio::bot_sha256: bb974d6b42714929b80262979e026813cfdad1f49de23fa789acb3aef8a2e315 5cryptoportfolio::bot_sha256: b2eb00cc520e2c25b7cfa7fb8e5f8cdb25fbb98da8f4a2ff75ad2eb76bc78e9d
diff --git a/modules/role/manifests/cryptoportfolio.pp b/modules/role/manifests/cryptoportfolio.pp
index 9ed3375..32b4391 100644
--- a/modules/role/manifests/cryptoportfolio.pp
+++ b/modules/role/manifests/cryptoportfolio.pp
@@ -18,7 +18,9 @@ class role::cryptoportfolio {
18 $cf_pg_db = "cryptoportfolio" 18 $cf_pg_db = "cryptoportfolio"
19 $cf_pg_password = generate_password(24, $password_seed, "postgres_cryptoportfolio") 19 $cf_pg_password = generate_password(24, $password_seed, "postgres_cryptoportfolio")
20 $cf_pg_replication_password = generate_password(24, $password_seed, "postgres_cryptoportfolio_replication") 20 $cf_pg_replication_password = generate_password(24, $password_seed, "postgres_cryptoportfolio_replication")
21 $cf_pg_host = "localhost:5432" 21 $cf_pg_hostname = "localhost"
22 $cf_pg_port = "5432"
23 $cf_pg_host = "${cf_pg_hostname}:${cf_pg_port}"
22 24
23 $cf_user = "cryptoportfolio" 25 $cf_user = "cryptoportfolio"
24 $cf_group = "cryptoportfolio" 26 $cf_group = "cryptoportfolio"
@@ -36,6 +38,8 @@ class role::cryptoportfolio {
36 $cf_front_app_static_conf = "${cf_front_app}/cmd/web/env/prod.env" 38 $cf_front_app_static_conf = "${cf_front_app}/cmd/web/env/prod.env"
37 39
38 $cf_bot_app = "${cf_home}/bot" 40 $cf_bot_app = "${cf_home}/bot"
41 $cf_bot_app_conf = "${cf_home}/bot_config.ini"
42 $cf_bot_app_reports = "${cf_home}/bot_reports"
39 43
40 file { "/var/lib/postgres/data/certs": 44 file { "/var/lib/postgres/data/certs":
41 ensure => directory, 45 ensure => directory,
@@ -213,6 +217,13 @@ class role::cryptoportfolio {
213 require => User[$cf_user], 217 require => User[$cf_user],
214 refreshonly => true, 218 refreshonly => true,
215 } 219 }
220
221 file { $cf_bot_app_conf:
222 owner => $cf_user,
223 group => $cf_group,
224 mode => "0600",
225 content => template("role/cryptoportfolio/bot_config.ini.erb")
226 }
216 } 227 }
217 228
218 unless empty($front_version) { 229 unless empty($front_version) {
diff --git a/modules/role/templates/cryptoportfolio/bot_config.ini.erb b/modules/role/templates/cryptoportfolio/bot_config.ini.erb
new file mode 100644
index 0000000..30298eb
--- /dev/null
+++ b/modules/role/templates/cryptoportfolio/bot_config.ini.erb
@@ -0,0 +1,9 @@
1[postgresql]
2host = <%= @cf_pg_hostname %>
3port = <%= @cf_pg_port %>
4user = <%= @cf_pg_user %>
5password = <%= @cf_pg_password %>
6database = <%= @cf_pg_db %>
7
8[app]
9report_path = <%= @cf_bot_app_reports %>