diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-02-24 23:40:02 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-02-24 23:40:02 +0100 |
commit | 4676a0182e6624700f753923b7a3286712568e34 (patch) | |
tree | 83932e6102a6d62d575d5a75bf323be32cf410ea | |
parent | 6d512d3fc73ece6aba5842e73b3b662cd904433d (diff) | |
parent | 236d7e6de849b1ee41e9ec1c81e670918a83264e (diff) | |
download | Puppet-4676a0182e6624700f753923b7a3286712568e34.tar.gz Puppet-4676a0182e6624700f753923b7a3286712568e34.tar.zst Puppet-4676a0182e6624700f753923b7a3286712568e34.zip |
Merge branch 'bot'
-rw-r--r-- | environments/production/data/nodes/vps494082.yaml | 2 | ||||
-rw-r--r-- | modules/role/manifests/cryptoportfolio.pp | 39 |
2 files changed, 41 insertions, 0 deletions
diff --git a/environments/production/data/nodes/vps494082.yaml b/environments/production/data/nodes/vps494082.yaml index 4b76ac6..59b2447 100644 --- a/environments/production/data/nodes/vps494082.yaml +++ b/environments/production/data/nodes/vps494082.yaml | |||
@@ -1,3 +1,5 @@ | |||
1 | base_installation::system_hostname: cryptoportfolio.immae.eu | 1 | base_installation::system_hostname: cryptoportfolio.immae.eu |
2 | cryptoportfolio::front_version: v0.0.1-2-g989fb5c | 2 | cryptoportfolio::front_version: v0.0.1-2-g989fb5c |
3 | cryptoportfolio::front_sha256: 1e82044b6a40b415913658bb1b896087d8c2c43d64c5862cd84f60804f5854dc | 3 | cryptoportfolio::front_sha256: 1e82044b6a40b415913658bb1b896087d8c2c43d64c5862cd84f60804f5854dc |
4 | cryptoportfolio::bot_version: v0.1 | ||
5 | cryptoportfolio::bot_sha256: bb974d6b42714929b80262979e026813cfdad1f49de23fa789acb3aef8a2e315 | ||
diff --git a/modules/role/manifests/cryptoportfolio.pp b/modules/role/manifests/cryptoportfolio.pp index d670486..9ed3375 100644 --- a/modules/role/manifests/cryptoportfolio.pp +++ b/modules/role/manifests/cryptoportfolio.pp | |||
@@ -35,6 +35,8 @@ class role::cryptoportfolio { | |||
35 | 35 | ||
36 | $cf_front_app_static_conf = "${cf_front_app}/cmd/web/env/prod.env" | 36 | $cf_front_app_static_conf = "${cf_front_app}/cmd/web/env/prod.env" |
37 | 37 | ||
38 | $cf_bot_app = "${cf_home}/bot" | ||
39 | |||
38 | file { "/var/lib/postgres/data/certs": | 40 | file { "/var/lib/postgres/data/certs": |
39 | ensure => directory, | 41 | ensure => directory, |
40 | mode => "0700", | 42 | mode => "0700", |
@@ -176,6 +178,43 @@ class role::cryptoportfolio { | |||
176 | $front_version = lookup("cryptoportfolio::front_version") |$key| { {} } | 178 | $front_version = lookup("cryptoportfolio::front_version") |$key| { {} } |
177 | $front_sha256 = lookup("cryptoportfolio::front_sha256") |$key| { {} } | 179 | $front_sha256 = lookup("cryptoportfolio::front_sha256") |$key| { {} } |
178 | 180 | ||
181 | $bot_version = lookup("cryptoportfolio::bot_version") |$key| { {} } | ||
182 | $bot_sha256 = lookup("cryptoportfolio::bot_sha256") |$key| { {} } | ||
183 | |||
184 | unless empty($bot_version) { | ||
185 | ensure_packages(["python", "python-pip"]) | ||
186 | |||
187 | file { $cf_bot_app: | ||
188 | ensure => "directory", | ||
189 | mode => "0700", | ||
190 | owner => $cf_user, | ||
191 | group => $cf_group, | ||
192 | require => User[$cf_user], | ||
193 | } | ||
194 | |||
195 | archive { "${cf_home}/${bot_version}.tar.gz": | ||
196 | path => "${cf_home}/${bot_version}.tar.gz", | ||
197 | source => "https://git.immae.eu/releases/cryptoportfolio/trader/trader_${bot_version}.tar.gz", | ||
198 | checksum_type => "sha256", | ||
199 | checksum => $bot_sha256, | ||
200 | cleanup => false, | ||
201 | extract => true, | ||
202 | user => "cryptoportfolio", | ||
203 | username => $facts["ec2_metadata"]["hostname"], | ||
204 | password => generate_password(24, $password_seed, "ldap"), | ||
205 | extract_path => $cf_bot_app, | ||
206 | require => [User[$cf_user], File[$cf_bot_app]], | ||
207 | } ~> | ||
208 | exec { "py-cryptoportfolio-dependencies": | ||
209 | cwd => $cf_bot_app, | ||
210 | user => $cf_user, | ||
211 | environment => ["HOME=${cf_home}"], | ||
212 | command => "/usr/bin/make install", | ||
213 | require => User[$cf_user], | ||
214 | refreshonly => true, | ||
215 | } | ||
216 | } | ||
217 | |||
179 | unless empty($front_version) { | 218 | unless empty($front_version) { |
180 | ensure_packages(["go", "npm", "nodejs", "yarn"]) | 219 | ensure_packages(["go", "npm", "nodejs", "yarn"]) |
181 | 220 | ||