From 236d7e6de849b1ee41e9ec1c81e670918a83264e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sat, 24 Feb 2018 23:31:16 +0100 Subject: Add bot package --- environments/production/data/nodes/vps494082.yaml | 2 ++ modules/role/manifests/cryptoportfolio.pp | 39 +++++++++++++++++++++++ 2 files changed, 41 insertions(+) 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 @@ base_installation::system_hostname: cryptoportfolio.immae.eu cryptoportfolio::front_version: v0.0.1-2-g989fb5c cryptoportfolio::front_sha256: 1e82044b6a40b415913658bb1b896087d8c2c43d64c5862cd84f60804f5854dc +cryptoportfolio::bot_version: v0.1 +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 { $cf_front_app_static_conf = "${cf_front_app}/cmd/web/env/prod.env" + $cf_bot_app = "${cf_home}/bot" + file { "/var/lib/postgres/data/certs": ensure => directory, mode => "0700", @@ -176,6 +178,43 @@ class role::cryptoportfolio { $front_version = lookup("cryptoportfolio::front_version") |$key| { {} } $front_sha256 = lookup("cryptoportfolio::front_sha256") |$key| { {} } + $bot_version = lookup("cryptoportfolio::bot_version") |$key| { {} } + $bot_sha256 = lookup("cryptoportfolio::bot_sha256") |$key| { {} } + + unless empty($bot_version) { + ensure_packages(["python", "python-pip"]) + + file { $cf_bot_app: + ensure => "directory", + mode => "0700", + owner => $cf_user, + group => $cf_group, + require => User[$cf_user], + } + + archive { "${cf_home}/${bot_version}.tar.gz": + path => "${cf_home}/${bot_version}.tar.gz", + source => "https://git.immae.eu/releases/cryptoportfolio/trader/trader_${bot_version}.tar.gz", + checksum_type => "sha256", + checksum => $bot_sha256, + cleanup => false, + extract => true, + user => "cryptoportfolio", + username => $facts["ec2_metadata"]["hostname"], + password => generate_password(24, $password_seed, "ldap"), + extract_path => $cf_bot_app, + require => [User[$cf_user], File[$cf_bot_app]], + } ~> + exec { "py-cryptoportfolio-dependencies": + cwd => $cf_bot_app, + user => $cf_user, + environment => ["HOME=${cf_home}"], + command => "/usr/bin/make install", + require => User[$cf_user], + refreshonly => true, + } + } + unless empty($front_version) { ensure_packages(["go", "npm", "nodejs", "yarn"]) -- cgit v1.2.3