- exec { "go-cryptoportfolio-app":
- cwd => $cf_front_app_api_workdir,
- user => $cf_user,
- environment => ["HOME=${cf_home}"],
- creates => $cf_front_app_api_bin,
- command => "/usr/bin/make build",
- require => Exec["go-cryptoportfolio-dependencies"],
+ cron { "py-cryptoportfolio-after":
+ ensure => present,
+ command => "cd $cf_bot_app ; python main.py --config $cf_bot_app_conf --after",
+ user => $user,
+ weekday => 1, # Monday
+ hour => 1,
+ minute => 0,
+ environment => ["HOME=${home}","PATH=/usr/bin/"],
+ require => [
+ File[$cf_bot_app_conf],
+ Archive["${home}/trader_${bot_version}.tar.gz"]
+ ],
+ }
+
+ unless empty($webhook_url) {
+ exec { "bot-slack-notify":
+ refreshonly => true,
+ environment => [
+ "P_PROJECT=Trader",
+ "P_WEBHOOK=${webhook_url}",
+ "P_VERSION=${bot_version}",
+ "P_HOST=${web_host}",
+ "P_HTTPS=${web_ssl}",
+ ],
+ command => "/usr/local/bin/slack-notify",
+ require => File["/usr/local/bin/slack-notify"],
+ subscribe => Exec["py-cryptoportfolio-dependencies"],
+ }
+ }
+ }
+
+ # FIXME: restore backup
+ unless empty($front_version) {
+ ensure_packages(["go", "npm", "nodejs", "yarn"])
+
+ file { [
+ "${home}/go/",
+ "${home}/go/src",
+ "${home}/go/src/immae.eu",
+ "${home}/go/src/immae.eu/Immae",
+ "${home}/go/src/immae.eu/Immae/Projets",
+ "${home}/go/src/immae.eu/Immae/Projets/Cryptomonnaies",
+ "${home}/go/src/immae.eu/Immae/Projets/Cryptomonnaies/Cryptoportfolio",
+ $cf_front_app]:
+ ensure => "directory",
+ mode => "0700",
+ owner => $user,
+ group => $group,
+ require => User["$user:"],
+ }
+
+ file { "${home}/front":
+ ensure => "link",
+ target => $cf_front_app,
+ before => File[$cf_front_app],