Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker #1

Merged
merged 9 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/pupp

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash",
}
}
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"puppet.puppet-vscode",
"rebornix.Ruby"
]
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [],
Expand Down
7 changes: 6 additions & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@
---
fixtures:
forge_modules:
# stdlib: "puppetlabs/stdlib"
stdlib: "puppetlabs/stdlib"
docker: "puppetlabs/docker"
apt: "puppetlabs/apt"
yumrepo: "puppetlabs/yumrepo_core"
vcsrepo: "puppetlabs/vcsrepo"
systemd: "puppet/systemd"
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require:
- rubocop-rspec
AllCops:
DisplayCopNames: true
TargetRubyVersion: '2.4'
TargetRubyVersion: '2.5'
Include:
- "**/*.rb"
Exclude:
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ group :development do
gem "puppet-module-posix-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "voxpupuli-puppet-lint-plugins", '>= 3.0', require: false
end
group :system_tests do
gem "puppet-module-posix-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby]
Expand Down
247 changes: 247 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
# Reference

<!-- DO NOT EDIT: This document was generated by Puppet Strings -->

## Table of Contents

### Classes

#### Public Classes

* [`hdm`](#hdm): HDM installation main class

#### Private Classes

* `hdm::docker`: A short summary of the purpose of this class
* `hdm::puppet_ruby`: A short summary of the purpose of this class

## Classes

### <a name="hdm"></a>`hdm`

This class controls the installation of HDM

#### Examples

#####

```puppet
include hdm
```

#### Parameters

The following parameters are available in the `hdm` class:

* [`method`](#method)
* [`manage_docker`](#manage_docker)
* [`version`](#version)
* [`port`](#port)
* [`bind_ip`](#bind_ip)
* [`hdm_path`](#hdm_path)
* [`git_url`](#git_url)
* [`user`](#user)
* [`group`](#group)
* [`puppetdb_settings`](#puppetdb_settings)
* [`puppet_code_dir`](#puppet_code_dir)
* [`allow_encryption`](#allow_encryption)
* [`read_only`](#read_only)
* [`git_data`](#git_data)
* [`ldap_settings`](#ldap_settings)
* [`hdm_hiera_config_file`](#hdm_hiera_config_file)

##### <a name="method"></a>`method`

Data type: `Enum['docker', 'puppet-ruby']`

Select the installation method.
Avalable methods: docker or puppet-ruby
When using puppet-ruby we install bundler gem into
the puppet-agent ruby installation.

Default value: `'docker'`

##### <a name="manage_docker"></a>`manage_docker`

Data type: `Boolean`

Set to false if this module should NOT
also include the docker class (without any arguments)
Please note that the docker module only works on Debian,
RedHat and windows systems.
SLES users must install and start docker via puppet package
and service resource.

Default value: ``true``

##### <a name="version"></a>`version`

Data type: `String[1]`

Select the version to deploy.
Version is the image tag name when using docker and
the git tag when using puppet-ruby

Default value: `'main'`

##### <a name="port"></a>`port`

Data type: `Stdlib::Port`

The port where HDM should run on

Default value: `3000`

##### <a name="bind_ip"></a>`bind_ip`

Data type: `String[1]`

The ip address to bind the process to

Default value: `'0.0.0.0'`

##### <a name="hdm_path"></a>`hdm_path`

Data type: `Stdlib::Unixpath`

Path where one wants to install and configure hdm

Default value: `'/etc/hdm'`

##### <a name="git_url"></a>`git_url`

Data type: `String[1]`

The git URL to clone the hdm repo from

Default value: `'https://github.com/betadots/hdm.git'`

##### <a name="user"></a>`user`

Data type: `String[1]`

The hdm user name

Default value: `'hdm'`

##### <a name="group"></a>`group`

Data type: `String[1]`

The hdm group name

Default value: `'hdm'`

##### <a name="puppetdb_settings"></a>`puppetdb_settings`

Data type: `Hash`

A hash to provide information on how
HDM can connect to puppetdb
The following options are possible:
Plain text (default)
```
{
'server' => 'http://localhost:8080',
}
```
Using PE token:
```
{
'server' => 'https://localhost:8081',
'token' => '/etc/hdm/puppetdb.token',
}
```
Using SSL cert:
```
{
'server' => 'http://localhost:8081',
'pem' => {
'key' => '/etc/hdm/ssl.key',
'cert' => '/etc/hdm/ssl.cert',
'ca_file' => '/etc/hdm/ssl.ca',
},
}
```

Default value: `{ 'server' => 'http://localhost:8080', }`

##### <a name="puppet_code_dir"></a>`puppet_code_dir`

Data type: `Stdlib::Unixpath`

The path where HDM can find deployed
Puppet environments (similar to puppet config code_dir)
defaults to '/etc/puppetlabs/code'

Default value: `'/etc/puppetlabs/code'`

##### <a name="allow_encryption"></a>`allow_encryption`

Data type: `Boolean`

Specify if HDM should use EYAML
Needs HDM access to EYAML keys (public and private)
Values for keys are taken from hiera.yaml file and can
not be set individually.

Default value: ``false``

##### <a name="read_only"></a>`read_only`

Data type: `Boolean`

Set to false if you want the ability to
change data via HDM webfrontend. WARNING!! untested!!!
Changes are stored via GIT.
Setting this to true also needs the git_data Array parameter

Default value: ``true``

##### <a name="git_data"></a>`git_data`

Data type: `Array`

Configure several settings related to the option
to modify data via Webfrontend. WARNING!! untested!!
Required Array of hash data:
```
[
{
'datadir' => 'modules/hieradata/data',
'git_url' => 'git@server:path/repo.git',
'path_in_repo' => 'data',
'ssh_priv_key' => '.ssh/id_rsa',
}
]
```

Default value: `[]`

##### <a name="ldap_settings"></a>`ldap_settings`

Data type: `Hash`

Config for LDAP integration
Needs the following Hash:
```
{
'host' => 'localhost',
'port' => 389,
'base_dn' => 'ou=hdm,dc=nodomain',
'bind_dn' => 'cn=admin,dc=nodomain',
'bind_dn_password' => 'openldap',
}
```

Default value: `{}`

##### <a name="hdm_hiera_config_file"></a>`hdm_hiera_config_file`

Data type: `String[1]`

Set to another file if you
want HDM to not use hiera.yaml.

Default value: `'hiera.yaml'`

48 changes: 48 additions & 0 deletions manifests/docker.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,53 @@
#
# @example
# include hdm::docker
#
# @api private
#
class hdm::docker {
if $hdm::manage_docker {
include docker
}

$directories = [
$hdm::hdm_path,
"${hdm::hdm_path}/certs",
"${hdm::hdm_path}/db",
]
file { $directories:
ensure => directory,
}
file { "${hdm::hdm_path}/hdm.yml":
tuxmea marked this conversation as resolved.
Show resolved Hide resolved
ensure => file,
content => epp('hdm/hdm.yml.epp'),
}
file { "${hdm::hdm_path}/database.yml":
ensure => file,
content => epp('hdm/database.yml'),
}
file { "${hdm::hdm_path}/db/development.sqlite3":
ensure => file,
}

docker::image { 'ghcr.io/betadots/hdm':
image_tag => $hdm::version,
}

docker::run { 'hdm':
image => "ghcr.io/betadots/hdm:${hdm::version}",
env => [
"TZ=${facts['timezone']}",
"RAILS_DEVELOPMENT_HOSTS=${facts['networking']['fqdn']}",
tuxmea marked this conversation as resolved.
Show resolved Hide resolved
],
volumes => [
"${hdm::hdm_path}:${hdm::hdm_path}",
"${hdm::puppet_code_dir}:${hdm::puppet_code_dir}:ro",
"${hdm::hdm_path}/hdm.yml:/hdm/config/hdm.yml:ro",
"${hdm::hdm_path}/database.yml:/hdm/config/database.yml:ro",
tuxmea marked this conversation as resolved.
Show resolved Hide resolved
],
hostname => $facts['networking']['fqdn'],
ports => [$hdm::port],
net => 'host',
extra_parameters => ["--user ${hdm::user}:${hdm::group}"],
}
}
Loading