diff --git a/CHANGELOG.md b/CHANGELOG.md index 0120a81..06a95d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,20 @@ All notable changes to this project will be documented in this file. +## Release 0.1.3 + +**Bug fixes** + +- Change config dir location +- Fix Service file +- Fix command authorization request + +## Release 0.1.2 + +**Bug fixes** + +- Fix Unzip package forgot + ## Release 0.1.1 **Bug fixes** diff --git a/REFERENCE.md b/REFERENCE.md index c21e452..adb1367 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -106,7 +106,7 @@ Data type: `Stdlib::HTTPUrl` Base URL for storj. -Default value: 'https://github.com/storj/storj/releases' +Default value: 'https://github.com/storj/storj/releases/download' ##### `download_extension` @@ -132,6 +132,14 @@ Custom command passed to the archive resource to extract the downloaded archive. Default value: `undef` +##### `config_dir` + +Data type: `Stdlib::Absolutepath` + +Directory where configuration are located. + +Default value: "/etc/storj" + ##### `manage_user` Data type: `Boolean` @@ -164,14 +172,6 @@ Group under which storj is running. Default value: 'storj' -##### `home` - -Data type: `String` - -User's home running storj. - -Default value: '/home/storj' - ##### `usershell` Data type: `Stdlib::Absolutepath` @@ -188,14 +188,6 @@ Add other groups to the managed user. Default value: [] -##### `identity_dir` - -Data type: `Stdlib::Absolutepath` - -Storj identity node directory. See https://documentation.storj.io/dependencies/identity - -Default value: "${home}/.local/share/storj/identity" - ##### `service_ensure` Data type: `Variant[Stdlib::Ensure::Service, Enum['absent']]` @@ -270,13 +262,13 @@ Directory where binaries are located. Default value: $storj::bin_dir -##### `identity_dir` +##### `config_dir` Data type: `Stdlib::Absolutepath` -Storj identity node directory. See https://documentation.storj.io/dependencies/identity +Directory where configuration are located. -Default value: $storj::identity_dir +Default value: $storj::config_dir ##### `user` @@ -374,6 +366,14 @@ Custom command passed to the archive resource to extract the downloaded archive. Default value: $storj::extract_command +##### `config_dir` + +Data type: `Stdlib::Absolutepath` + +Directory where configuration are located. + +Default value: $storj::config_dir + ##### `manage_user` Data type: `Boolean` @@ -406,14 +406,6 @@ Group under which storj is running. Default value: $storj::group -##### `home` - -Data type: `String` - -User's home running storj. - -Default value: $storj::home - ##### `usershell` Data type: `Stdlib::Absolutepath` @@ -518,13 +510,13 @@ Amount of dedicated storage. Default value: $storj::storage -##### `identity_dir` +##### `config_dir` Data type: `Stdlib::Absolutepath` Storj identity node directory. See https://documentation.storj.io/dependencies/identity -Default value: $storj::identity_dir +Default value: $storj::config_dir ##### `storage_path` diff --git a/manifests/config.pp b/manifests/config.pp index fe70b54..59508db 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -4,8 +4,8 @@ # Received personal single-use authorization token. See https://documentation.storj.io/before-you-begin/auth-token # @param bin_dir # Directory where binaries are located. -# @param identity_dir -# Storj identity node directory. See https://documentation.storj.io/dependencies/identity +# @param config_dir +# Directory where configuration are located. # @param user # User running storj. # @param group @@ -15,21 +15,21 @@ class storj::config ( Storj::Authorization_token $authorization_token = $storj::authorization_token, Stdlib::Absolutepath $bin_dir = $storj::bin_dir, - Stdlib::Absolutepath $identity_dir = $storj::identity_dir, + Stdlib::Absolutepath $config_dir = $storj::config_dir, String $user = $storj::user, String $group = $storj::group, ) { exec { 'Request authorization command': - command => "${bin_dir}/idetntity authorize storagenode ${authorization_token} --identity-dir ${identity_dir}", - creates => "${identity_dir}/storagenode/identity.cert", + command => "${bin_dir}/identity authorize storagenode ${authorization_token} --identity-dir ${config_dir} --config-dir ${config_dir}", + onlyif => "/usr/bin/test `grep -c BEGIN ${config_dir}/storagenode/identity.cert` != 3", user => $group, group => $user, logoutput => true, notify => Service['storagenode'], } -> exec { 'Check certs integrity command': - command => "/usr/bin/test `grep -c BEGIN ${identity_dir}/storagenode/ca.cert` == 2 && - /usr/bin/test `grep -c BEGIN ${identity_dir}/storagenode/identity.cert` == 3", + command => "/usr/bin/test `grep -c BEGIN ${config_dir}/storagenode/ca.cert` == 2 && + /usr/bin/test `grep -c BEGIN ${config_dir}/storagenode/identity.cert` == 3", logoutput => true, returns => 0, } diff --git a/manifests/init.pp b/manifests/init.pp index 77c7237..5c2b60b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -30,6 +30,8 @@ # Complete URL corresponding to the Storj release, default to undef. # @param extract_command # Custom command passed to the archive resource to extract the downloaded archive. +# @param config_dir +# Directory where configuration are located. # @param manage_user # Whether to create user for storj or rely on external code for that. # @param manage_group @@ -38,14 +40,10 @@ # User running storj. # @param group # Group under which storj is running. -# @param home -# User's home running storj. # @param usershell # if requested, we create a user for storj. The default shell is false. It can be overwritten to any valid path. # @param extra_groups # Add other groups to the managed user. -# @param identity_dir -# Storj identity node directory. See https://documentation.storj.io/dependencies/identity # @param service_ensure # State ensured from storagenode service. # @param docker_tag @@ -77,19 +75,16 @@ String $download_extension = 'zip', Optional[Stdlib::HTTPUrl] $download_url = undef, Optional[String] $extract_command = undef, + Stdlib::Absolutepath $config_dir = "/etc/storj", # User Management Boolean $manage_user = true, Boolean $manage_group = true, String $user = 'storj', String $group = 'storj', - String $home = '/home/storj', Stdlib::Absolutepath $usershell = '/bin/false', Array[String] $extra_groups = [], - # Configuration - Stdlib::Absolutepath $identity_dir = "${home}/.local/share/storj/identity", - # Service Variant[Stdlib::Ensure::Service, Enum['absent']] $service_ensure = 'running', String $docker_tag = 'beta', diff --git a/manifests/install.pp b/manifests/install.pp index 0a41083..7830880 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -16,6 +16,8 @@ # Complete URL corresponding to the Storj release, default to undef. # @param extract_command # Custom command passed to the archive resource to extract the downloaded archive. +# @param config_dir +# Directory where configuration are located. # @param manage_user # Whether to create user for storj or rely on external code for that. # @param manage_group @@ -24,8 +26,6 @@ # User running storj. # @param group # Group under which storj is running. -# @param home -# User's home running storj. # @param usershell # if requested, we create a user for storj. The default shell is false. It can be overwritten to any valid path. # @param extra_groups @@ -41,13 +41,13 @@ String $download_extension = $storj::download_extension, Stdlib::HTTPUrl $download_url = $storj::real_download_url, Optional[String] $extract_command = $storj::extract_command, + Stdlib::Absolutepath $config_dir = $storj::config_dir, # User Management Boolean $manage_user = $storj::manage_user, Boolean $manage_group = $storj::manage_group, String $user = $storj::user, String $group = $storj::group, - String $home = $storj::home, Stdlib::Absolutepath $usershell = $storj::usershell, Array[String] $extra_groups = $storj::extra_groups, ) { @@ -84,27 +84,26 @@ ensure_resource('user', [ $user ], { ensure => 'present', system => true, - home => $home, groups => concat([$group, 'docker'], $extra_groups), shell => $usershell, }) - file { $home: - ensure => 'directory', - owner => $user, - group => $group, - } - - User[$user] -> File[$home] + User[$user] -> File[$config_dir] if $manage_group { Group[$group] -> User[$user] } } if $manage_group { - ensure_resource('group', [ $group ],{ + ensure_resource('group', [ $group ], { ensure => 'present', system => true, }) } + + file { $config_dir: + ensure => 'directory', + owner => $user, + group => $group, + } } diff --git a/manifests/service.pp b/manifests/service.pp index 5f00c8f..ae50e4c 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -18,7 +18,7 @@ # Your node hostname / DNS altname (required to be accessible). See https://documentation.storj.io/dependencies/port-forwarding # @param storage # Amount of dedicated storage. -# @param identity_dir +# @param config_dir # Storj identity node directory. See https://documentation.storj.io/dependencies/identity # @param storage_path # Mounted device location. @@ -37,7 +37,7 @@ String $mail = $storj::mail, Stdlib::Host $host = $storj::host, String $storage = $storj::storage, - Stdlib::Absolutepath $identity_dir = $storj::identity_dir, + Stdlib::Absolutepath $config_dir = $storj::config_dir, Stdlib::Absolutepath $storage_path = $storj::storage_path, String $docker_tag = $storj::docker_tag, ) { diff --git a/metadata.json b/metadata.json index e2a7f55..bfe2534 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "maeq-storj", - "version": "0.1.1", + "version": "0.1.3", "author": "maeq", "summary": "This module install and configure Storj storagenode", "license": "Apache-2.0", diff --git a/templates/service.erb b/templates/service.erb index 352c47f..b14d5c0 100644 --- a/templates/service.erb +++ b/templates/service.erb @@ -18,9 +18,9 @@ ExecStart=/usr/bin/docker run --name ${NAME} \ -p <%= @dashboard_port %>:14002 \ -e WALLET="<%= @wallet %>" \ -e EMAIL="<%= @mail %>" \ --e ADDRESS="<%= @host %>" \ +-e ADDRESS="<%= @host %>:<%= @port %>" \ -e STORAGE="<%= @storage %>" \ ---mount type=bind,source="<%= @identity_dir %>/storagenode",destination=/app/identity \ +--mount type=bind,source="<%= @config_dir %>/storagenode",destination=/app/identity \ --mount type=bind,source="<%= @storage_path %>",destination=/app/config \ storjlabs/storagenode:<%= @docker_tag %> ExecStop=/usr/bin/docker stop ${NAME}