Skip to content

Commit

Permalink
Introducing v4 features - v3.8.0 (#104)
Browse files Browse the repository at this point in the history
* Added new v4 entrypoints

* Updates

* Introduced use_v4 option. Started refactoring.

* New functions and works on tp::install::file

* Started refactored code in parallel for full compatibility

* More works

* tp::install v4 (package, image, source, file) and more

* Fix tests and others

* Using vars from main tp class, instaead of tp::cli

* Fixing tests

* No autoprereq by default

* Removed tp_dir and tp_path params from tp class (they are derived from tp_params)

* Updated tests

* Do not enable cli by default + tests fixing

* Chasing tests

* tests

* ..

* Added chatgpt generated unit test (no changes)

* Preconditions

* ..

* Removed spec test

* Do not symlink tp on mac

* Fix test

* .

* ..

* V4 general entrypoints available by default
  • Loading branch information
alvagante authored Jan 4, 2023
1 parent 3e65339 commit 059c474
Show file tree
Hide file tree
Showing 58 changed files with 4,202 additions and 586 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# CHANGELOG

## 3.8.0

- Added tp::use_v4 setting to use Puppet 4 compatible code
- Added v4 code for tp, tp::install
- Added tp::cli class to manage tp command in v4
- Added tp::install::package to manage apps from packages
- Added tp::install::file to download apps from release urls
- Added tp::fail function and data type and on_missing_data setting
- Added tp::url_replace and tp::create_everything functions
- Separated all old code, files and templaes from v4 specific
- Added tp::install::source to download apps from source repos
- Added tp::install::image to download and install app container image
- Params tp::tp_dir and tp::tp_path have been replaced by tp::tp_params and derived from identify fact
- Added v4 entrypoints for Hiera data driven tp resources: tp::<resource>s and tp::osfamily_resources
- Deprecated the corresponding tp::<resource>_hash and tp::osfamily_<resource>_hash

## 3.7.0

- tp desktop noapply command renamed to tp desktop preview
Expand Down
82 changes: 59 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,43 @@

## Module description

Example42's tp (short for Tiny Puppet) module can manage **every application** on **every Operating System** (Linux flavours, Solaris, macOS, Windows).
Example42's tp (short for Tiny Puppet) module can manage **every application** (relevant tinydata is needed) on **every Operating System** (Linux flavours, Solaris, macOS, Windows) using different **methods** (native packages, packages from upstream repos, release tarballs, git source, docker container).

It provides Puppet user defined types to:
It permits allows this as **code**, via Puppet user defined types:

- Install applications' packages and manage their services (`tp::install`)
- Install applications' packages and manage their services (`tp::install`) using different methods
- Handle eventual relevant repos, allowing to choose between native distro repos or the ones from upstream developer (`tp::repo`)
- Manage applications configuration files (`tp::conf`)
- Manage whole directories (`tp::dir`), also from an SCM source.
- Add custom test and debug options (`tp::test`, `tp::debug`)
- Download app's source code (`tp::source`)

via the **command line** tool `tp`, that allows to:

- Install applications with single command (`tp install <app>`)
- Test if they are working correctly (`tp test [app]`)
- Get information about them (`tp info [app]`)
- Troubleshoot them (`tp debug [app]`)
- See their version (`tp version [app]`)
- Show their logs (`tp log [app]`)
- Manage desktop configurations as code without a Puppet server (`tp desktop`)

via **Bolt tasks**, that permits to orchestrate the above operations on remote nodes.

### Features

The main features of tp module are:

- Quick, easy to use, standard, coherent, powerful interface to applications installation and their config files management.
- Multiple installation options
- Out of the box and easily expandable support for most common Operating Systems.
- Modular data source design. Support for an easily growing [set of applications](https://github.com/example42/tinydata/tree/master/data).
- Smooth coexistence with any existing Puppet modules setup: it's up to the user to decide when to use tp and when to use a dedicated module.
- Application data stored in a configurable separated module ([tinydata](https://github.com/example42/tinydata) is the default source for applications data).
- Optional CLI command (`tp`) which can be used to install, test, query for logs any tp managed application.
- Optional CLI command (`tp`) which can be used to install, test, get info, troubleshoot and query for logs any tp managed application.
- Optional Bolt tasks to perform the above actions on remote nodes.
- Usable both by total beginners and experienced sysadmins: interface is simple but allows powerful customisations


### Use cases

Expand All @@ -82,8 +100,8 @@ To see real-world usage of tp defines give a look to:

- The [profiles](https://github.com/example42/puppet-psick/tree/master/manifests) in the psick module where tp is used widely.
- Usage samples in [hieradata](https://github.com/example42/psick-hieradata/search?q=%27tp%3A%3A%27).
- The [tp_profile](https://github.com/example42/puppet-tp_profile) module which contains standard classes for different applications which rely entirely on tp resources. (DEPRECATED)
- The [psick_profile](https://github.com/example42/psick_profile) module which is contains more profiles for common applications.
- The [tp-desktop](https://github.com/example42/tp-desktop) repository, used to mabage desktop configurations as code using puppet apply (serverless).

## Setup

Expand All @@ -96,7 +114,7 @@ TP can be installed as any other module:
- From the forge, adding to Puppetfile and entry like

mod 'example42-tp', 'latest' # For latest version
mod 'example42-tp', '3.0.0' # For a specific version (recommended)
mod 'example42-tp', '3.8.0' # For a specific version (recommended)

- From the forge, initializing a new Bolt project with this module:

Expand Down Expand Up @@ -125,6 +143,12 @@ Once tp module is added to the modulepath the (optional) tp command can be insta

### Getting started with tp

Starting from version 3.8.0, a technology preview of tp 4 features is available by specifying the use_v4 parameter:

tp::use_v4: true



Here follows an example of tp resources used inside a custom profile where the content of a configuration file is based on a template with custom values.

class profile::openssh (
Expand Down Expand Up @@ -647,22 +671,29 @@ Starting from version 2.3.0 (with tinydata version > 0.3.0) tp can even install

Tiny Puppet adds the tp command to Puppet. Just have it in your modulepath and install the tp command with:

puppet tp setup
sudo puppet module install example42-tp
sudo puppet tp setup

With the tp command you can install on the local OS the given application, taking care of naming differences, additional repos or prerequisites.

tp install <application>
tp uninstall <application>

tp test # Test all the applications installed by tp
tp test <application> # Test the specified application

tp log # Tail all the logs of all the applications installed by tp
tp log <application> # Tail the log of the specified application

Each of these commands can be invoked also via the tp puppet face:

puppet tp <command> <arguments>
tp install <application> # Install an application
tp uninstall <application> # Uninstall an application
tp test [application] # Test one or all the applications
tp log [application] # Tail the logs of one or all applications
tp info [application] # Show info on one or all applications
tp debug [application] # Troubleshoot one or all applications
tp version [application] # Show version of one or all applications
tp source <application> # Clone the source of an applications
tp version [application] # Show version of one or all applications

tp desktop # Show tp desktop options
tp desktop init # Initialise a new tp desktop repostiory
tp desktop list # List the available desktops
tp desktop show <desktop> # Show the details of a desktop
tp desktop prevew <desktop> # Preview what desktop apply would do
tp desktop apply <desktop> # Apply a desktop configuration

Check this [![asciicast](https://asciinema.org/a/uYLSvQL5AQwqzalLq9Gi353W1.svg)](https://asciinema.org/a/uYLSvQL5AQwqzalLq9Gi353W1) to see tp cli in action.

## Reference

Expand All @@ -677,10 +708,10 @@ The tp module provides the following resources.
- `tp::install`. It installs an application and starts its service, by default.
- `tp::conf`. It allows to manage configuration files.
- `tp::dir`. It manages the content of directories.
- `tp::stdmod`. It manages the installation of an application using StdMod compliant parameters.
- `tp::stdmod`. It manages the installation of an application using StdMod compliant parameters. LEGACY
- `tp::test`. It allows quick and easy (acceptance) testing of an application.
- `tp::repo`. It manages extra repositories for the supported applications.
- `tp::puppi`. Puppi integration (Don't worry, fully optional).
- `tp::puppi`. Puppi integration (Don't worry, fully optional). LEGACY

### Types

Expand All @@ -690,9 +721,14 @@ The tp module provides the following resources.

- `tp::content`, manages content for files based on supplied (erb) template, epp, and content
- `tp::ensure2bool`, converts ensure values to boolean
- `tp::ensure2dir`, converts ensure values to esnure values to be used for directories
- `tp::ensure2dir`, converts ensure values to ensure values to be used for directories
- `tp::ensure2file`, converts ensure values to ensure values to be used for files
- `tp::ensure2service`, converts ensure values to ensure and enable values to be used for services
- `tp::install`, wrapper around the tp::install define, it tries to avoid eventual duplicated resources issues
- `tp::is_something`, returna true if input of any type exists and is not empty
- `tp::is_something`, returns true if input of any type exists and is not empty
- `tp::fail`, handles errors or unexpected conditions in the desired way (via a notify resource, via server side notification functions, or just silently ignoring)
- `tp::create_everything`, runs create_resources on the specified hash of resources types
- `tp::url_replace`, gets as input an URL with variables are replaces them with actual values

### Tasks

Expand Down
Loading

0 comments on commit 059c474

Please sign in to comment.