[submodule "modules/cron"]
path = modules/cron
url = git://git.immae.eu/github/voxpupuli/puppet-cron
+[submodule "modules/redis"]
+ path = modules/redis
+ url = git://git.immae.eu/github/arioch/puppet-redis
--- /dev/null
+[Service]
+ExecStop=
+ExecStop=/usr/bin/redis-cli -s /run/redis/redis.sock shutdown
--- /dev/null
+class profile::redis {
+ file { '/etc/systemd/system/redis.service.d/':
+ ensure => "directory",
+ path => "/etc/systemd/system/redis.service.d/",
+ mode => "0755",
+ owner => "root",
+ group => "root"
+ } ->
+ file { '/etc/systemd/system/redis.service.d/socket_shutdown.conf':
+ ensure => "present",
+ path => "/etc/systemd/system/redis.service.d/noclear.conf",
+ source => 'puppet:///modules/profile/redis/socket_shutdown_override.conf',
+ recurse => true,
+ mode => "0644",
+ owner => "root",
+ group => "root",
+ notify => Service["redis"],
+ }
+
+ package { "ruby-augeas":
+ ensure => installed,
+ } ->
+ class { '::redis':
+ unixsocket => "/run/redis/redis.sock",
+ unixsocketperm => "777",
+ ulimit => false,
+ daemonize => false,
+ config_file => "/etc/redis.conf",
+ config_file_orig => "/etc/redis.conf.puppet",
+ port => 0,
+ require => File["/etc/systemd/system/redis.service.d/socket_shutdown.conf"],
+ }
+
+}
--- /dev/null
+Subproject commit bfcc2120f7b83342b03241d1429028a6defdd0da
String $pg_db,
Optional[String] $pg_hostname = "localhost",
Optional[String] $pg_port = "5432",
+ Optional[String] $redis_host = "/run/redis/redis.sock",
Optional[String] $web_host = undef,
Optional[String] $web_port = "",
Optional[Boolean] $web_ssl = true,
contain "role::cryptoportfolio::notify"
unless empty($trader_version) {
+ if versioncmp($trader_version, "v1.3") >= 0 {
+ include "profile::redis"
+ }
contain "role::cryptoportfolio::bot"
}
$cf_bot_app = "${home}/bot"
$cf_bot_app_conf = "${home}/bot_config.ini"
+ $cf_bot_app_conf_hourly = "${home}/bot_config_hourly.ini"
$cf_bot_app_reports = "${home}/bot_reports"
ensure_packages(["python", "python-pip"])
],
}
+ if versioncmp($trader_version, "v1.3") >= 0 {
+ file { $cf_bot_app_conf_hourly:
+ owner => $user,
+ group => $group,
+ mode => "0600",
+ content => template("role/cryptoportfolio/bot_config_hourly.ini.erb"),
+ require => [
+ User["$user:"],
+ Archive["${home}/trader_${trader_version}.tar.gz"],
+ ],
+ }
+
+ cron::job::multiple { "py-cryptoportfolio-hourly":
+ ensure => present,
+ environment => ["HOME=${home}","PATH=/usr/bin/"],
+ require => [
+ File[$cf_bot_app_conf_hourly],
+ Archive["${home}/trader_${trader_version}.tar.gz"]
+ ],
+ jobs => [
+ {
+ command => "cd $cf_bot_app ; python main.py --config $cf_bot_app_conf_hourly",
+ user => $user,
+ minute => 30,
+ description => "Print the current state to redis",
+ },
+ ],
+ }
+ }
+
unless empty($webhook_url) {
exec { "bot-slack-notify":
refreshonly => true,
--- /dev/null
+[postgresql]
+db-host = <%= @pg_hostname %>
+db-port = <%= @pg_port %>
+db-user = <%= @pg_user %>
+db-password = <%= @pg_password %>
+db-database = <%= @pg_db %>
+
+[redis]
+redis-host = <%= @redis_host %>
+
+[app]
+action = print_balances
+report-redis
+no-report-path
+no-report-db
+quiet
+debug