1 class role::cryptoportfolio {
2 include "base_installation"
4 include "profile::postgresql"
6 $password_seed = lookup("base_installation::puppet_pass_seed") |$key| { {} }
8 postgresql::server::db { 'cryptoportfolio':
9 user => 'cryptoportfolio',
10 password => postgresql_password('cryptoportfolio', generate_password(24, $password_seed, "postgres_cryptoportfolio")),
13 postgresql::server::pg_hba_rule { 'allow localhost TCP access to cryptoportfolio user':
15 database => 'cryptoportfolio',
16 user => 'cryptoportfolio',
17 address => '127.0.0.1/32',
21 postgresql::server::pg_hba_rule { 'allow localhost ip6 TCP access to cryptoportfolio user':
23 database => 'cryptoportfolio',
24 user => 'cryptoportfolio',
32 nginx::resource::server { 'cryptoportfolio.immae.eu':
34 proxy => 'http://localhost:8000',
37 ensure_packages(["go", "npm", "nodejs", "yarn"])
39 user { "cryptoportfolio":
40 name => "cryptoportfolio",
43 home => "/opt/cryptoportfolio",
48 $front_version = lookup("cryptoportfolio::front_version") |$key| { {} }
49 $front_sha256 = lookup("cryptoportfolio::front_sha256") |$key| { {} }
51 unless empty($front_version) {
52 file { "/opt/cryptoportfolio/front":
55 owner => "cryptoportfolio",
56 group => "cryptoportfolio",
59 file { "/opt/cryptoportfolio/front/${front_version}":
62 owner => "cryptoportfolio",
63 group => "cryptoportfolio",
64 require => File["/opt/cryptoportfolio/front"],
67 archive { "/opt/cryptoportfolio/front/${front_version}.tar.gz":
68 path => "/opt/cryptoportfolio/front/${front_version}.tar.gz",
69 source => "https://git.immae.eu/releases/cryptoportfolio/front/front_${front_version}.tar.gz",
70 creates => "/opt/cryptoportfolio/front/${front_version}/README.md",
71 checksum_type => "sha256",
72 checksum => $front_sha256,
75 extract_path => "/opt/cryptoportfolio/front/${front_version}",
76 require => File["/opt/cryptoportfolio/front/${front_version}"],
79 file { "/opt/cryptoportfolio/front/current":
81 target => "/opt/cryptoportfolio/front/${front_version}",
82 require => Archive["/opt/cryptoportfolio/front/${front_version}.tar.gz"]