Skip to content

Commit db2b7a7

Browse files
committed
Adds repository management
1 parent b5661d7 commit db2b7a7

File tree

67 files changed

+3091
-264
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+3091
-264
lines changed

doc/07-Repository-Manager.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Repository Manager
2+
3+
Starting with Icinga for Windows v1.6.0, we provide a full feature-set to manage repositories for all components which are developed for Icinga for Windows. This includes all resources like framework, plugins the service binary and the Icinga Agent itself.
4+
5+
Below you will find a detailed description for core areas of the repository management, explaining on how to work with repositories.
6+
7+
## Basic Usage
8+
9+
* [Add existing repositories](repositorymanager/01-Add-Existing-Repositories.md)
10+
* [Sync repositories](repositorymanager/02-Sync-Repositories.md)
11+
* [Enable/Disable/Remove Repositories](repositorymanager/03-Enable-Disable-Remove-Repositories.md)
12+
* [Search Repository for Components](repositorymanager/04-Search-Repository-For-Components.md)
13+
* [Lock/Unlock Components](repositorymanager/05-Lock-Unlock-Components.md)
14+
* [Install Components](repositorymanager/06-Install-Components.md)
15+
* [Create Own Repositories](repositorymanager/07-Create-Own-Repositories.md)
16+
17+
## Example Configurations

doc/31-Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
2222
* [#303](https://github.com/Icinga/icinga-powershell-framework/pull/303) Adds support to parse arrays to Icinga Check thresholds functions like `WarnOutOfRange` and adds two new functions `WarnDateTime` and `CritDateTime`, for easier comparing of time stamps.
2323
* [#305](https://github.com/Icinga/icinga-powershell-framework/pull/305) Adds a new Cmdlet to test if functions with `Add-Type` are already present inside the current scope of the shell
2424
* [#306](https://github.com/Icinga/icinga-powershell-framework/pull/306) Adds new Cmdlet `Exit-IcingaThrowCritical` to throw critical exit with a custom message, either by force or by using string filtering and adds storing of plugin exit codes internally
25+
* [#310](https://github.com/Icinga/icinga-powershell-framework/pull/310) Adds repository management to install components very easily from one or multiple defined source locations
2526
* [#314](https://github.com/Icinga/icinga-powershell-framework/pull/314) Adds support to configure on which address TCP sockets are created on, defaults to `loopback` interface
2627
* [#316](https://github.com/Icinga/icinga-powershell-framework/pull/316) The reconfigure menu was previously present inside the Icinga Agent sub-menu and is now moved to the main installation menu for the Management Console
2728
* [#318](https://github.com/Icinga/icinga-powershell-framework/pull/318) We always enforce the Icinga Framework Code caching now and ship a plain file to build the cache on first loading

doc/knowledgebase/IWKB000009.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ if ($null -ne $IcingaService) {
3232
return;
3333
}
3434
35-
Uninstall-IcingaFrameworkService;
36-
Install-IcingaFrameworkService -Path $IfWPath -User $IfWUser;
35+
Uninstall-IcingaForWindowsService;
36+
Install-IcingaForWindowsService -Path $IfWPath -User $IfWUser;
3737
}
3838
```
3939

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Add Existing Repositories
2+
3+
The easiest way to extend the functionality of Icinga for Windows, is by installing new components. Components are delivered by repositories you can add to your environment. This includes external repositories but also internal ones.
4+
5+
Each repository inherits a file called `ifw.repo.json` on the root level, which contains all informations for available packages, versions and where they can be downloaded from.
6+
7+
**Note:** Each repository requires to use a unique name on the system. You can add multiple repositories, with different resources and components provided. The name has be unique and has no impact on the installation. It should be a short summary on where the repository is located.
8+
9+
## Adding Default Repositories
10+
11+
The best way to demonstrate on how to add new repositories, you can use the default Icinga for Windows repositories. To add an already existing repository, you can use `Add-IcingaRepository`
12+
13+
### Available Arguments
14+
15+
| Argument | Type | Description |
16+
| --- |--- | --- |
17+
| Name | String | The unique name of the repository. This name can only exist once on your system |
18+
| RemotePath | String | The path pointing to the location on where the repository is located at. It can either point to the root directory of the folder containing the `ifw.repo.json` or directly to this file. Accepts web, local or network share path. |
19+
20+
### Icinga for Windows Stable
21+
22+
The URL pointing to the stable releases is `http://packages.icinga.com/IcingaForWindows/stable`.
23+
24+
```powershell
25+
Add-IcingaRepository `
26+
-Name 'Icinga Stable' `
27+
-RemotePath 'http://packages.icinga.com/IcingaForWindows/stable';
28+
```
29+
30+
### Icinga for Windows Snapshot
31+
32+
The URL pointing to the snapshot releases is `http://packages.icinga.com/IcingaForWindows/snapshot`.
33+
34+
```powershell
35+
Add-IcingaRepository `
36+
-Name 'Icinga Snapshot' `
37+
-RemotePath 'http://packages.icinga.com/IcingaForWindows/snapshot';
38+
```
39+
40+
## Using Repositories
41+
42+
Once you added one or more repositories, they will be connected to once you want to install or update your components. The available components and versions will be accessed on runtime, during installation/updates and files downloaded directly when required.
43+
44+
In case you can only access the internet or some internal repositories on certain times only, you can also [sync existing repositories](02-Sync-Repositories.md).
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# Sync Repositories
2+
3+
In case you require local copies of repositories to frequently access them or to make a public repository available for systems unable to access public spaces, you can use `Sync-IcingaRepository`.
4+
5+
Like with [adding existing repositories](01-Add-Existing-Repositories.md), each synced repositories require a unique name you can set with `-Name`. The name will not interfere on how the sync works.
6+
7+
## Available Arguments
8+
9+
| Argument | Type | Description |
10+
| --- |--- | --- |
11+
| Name | String | The unique name of the repository. This name can only exist once on your system |
12+
| Path | String | The location on where the files from the remote repository will be synced to. This can either be a local path, a network share or a Linux path, including user and hostname like `[email protected]:/vaw/www/icingarepo/`
13+
| RemotePath | String | The path pointing to the location Icinga for Windows tries to lookup all your files. You can either replicate the `Path` variable for network shares for example, or use a web url which is made available based on `Path` to fetch and download files from. If left empty, it will default to the `Path` variable content |
14+
| Source | String | The source from where the repository will be synced from. This can either be pointing directly to the `ifw.repo.json` or the root directory, as long as the file is fetch able from this point. A source can be a web, local or network share |
15+
| UseSCP | Switch | If you set `Path` to a Linux path as mentioned in the first example, you will have to enable this switch to use SCP to copy files from the source to the Linux system. Requires `scp` and `ssh` being installed on the system |
16+
| Force | Switch | This will force the creation of the repository, even if the name of the repository is already assigned. Should be used with caution |
17+
| ForceTrust | Switch | By default repositories are validated with a hash, based on all files present inside the repository. If a repository is not providing a hash, it will be disabled after the sync for security reasons. In case the hash does not match with all files synced afterwards, the repository files will be deleted and the sync aborted. You can use this flag to ignore both states and always add the repository, regardless if the hash matches or the hash is not given |
18+
19+
## Sync Public Repository
20+
21+
You can use the sync command to clone an existing public repository for example and fetch all files to a local space.
22+
23+
### Local Disk Example
24+
25+
```powershell
26+
Sync-IcingaRepository `
27+
-Name 'Icinga Stable Local' `
28+
-Path 'C:\icinga\icinga_stable' `
29+
-Source 'http://packages.icinga.com/IcingaForWindows/stable';
30+
```
31+
32+
This will sync all files from the public Icinga repository into `C:\icinga\icinga_stable`. As `RemotePath` is not set, it will default to `C:\icinga\icinga_stable` and all files will be fetched from this location.
33+
34+
### Shared Folder Example
35+
36+
```powershell
37+
Sync-IcingaRepository `
38+
-Name 'Icinga Stable Local' `
39+
-Path 'C:\icinga\icinga_stable' `
40+
-RemotePath '\\myhost.example.com\icingastable' `
41+
-Source 'http://packages.icinga.com/IcingaForWindows/stable';
42+
```
43+
44+
We can for example use file sharing, to make certain folders available in our network. This example will download all files into `C:\icinga\icinga_stable`, but tell Icinga for Windows to use your shared network drive `\\myhost.example.com\icingastable` to fetch them from.
45+
46+
You can now add the repository on different machines with
47+
48+
```powershell
49+
Add-IcingaRepository `
50+
-Name 'Icinga Stable Local' `
51+
-RemotePath '\\myhost.example.com\icingastable';
52+
```
53+
54+
Every file will then be fetched over this network share to the local machines.
55+
56+
### Linux Webserver Example
57+
58+
```powershell
59+
Sync-IcingaRepository `
60+
-Name 'Icinga Stable Internal Web' `
61+
-Path '[email protected]:/var/www/icingastable/' `
62+
-RemotePath 'https://icingarepo.example.com/icingastable' `
63+
-Source 'http://packages.icinga.com/IcingaForWindows/stable' `
64+
-UseSCP;
65+
```
66+
67+
In this example we will sync all files to a Linux machine at `/var/www/icingastable/`. If we are running a local Apache or Nginx, we can create a web resource for this path and make it available in our network. We have to use `-UseSCP`, to tell Icinga for Windows to copy them to the Linux machine over `scp`. Please note that both, `scp` and `ssh` have to be installed on the system.
68+
69+
On different machines, you can then use
70+
71+
```powershell
72+
Add-IcingaRepository `
73+
-Name 'Icinga Stable Internal Web' `
74+
-RemotePath 'https://icingarepo.example.com/icingastable';
75+
```
76+
77+
to make the repository available.
78+
79+
### Sync from a Sync Example
80+
81+
Last but not least we have the method to sync repositories from a sync source, allowing us to distribute all Icinga for Windows files around or network on different zones as example.
82+
83+
Clone the repository to a local path:
84+
85+
```powershell
86+
Sync-IcingaRepository `
87+
-Name 'Icinga Stable Local' `
88+
-Path 'C:\icinga\icinga_stable' `
89+
-Source 'http://packages.icinga.com/IcingaForWindows/stable';
90+
```
91+
92+
Clone this repository to our internal web space:
93+
94+
```powershell
95+
Sync-IcingaRepository `
96+
-Name 'Icinga Stable Internal Web' `
97+
-Path '[email protected]:/var/www/icingastable/' `
98+
-RemotePath 'https://icingarepo.example.com/icingastable' `
99+
-Source 'C:\icinga\icinga_stable' `
100+
-UseSCP;
101+
```
102+
103+
## Update Sync Repositories
104+
105+
To update synced repositories, you can use `Update-IcingaRepository`. You can either update a specific repository by using the `-Name` argument or update all by leaving it empty.
106+
107+
### Available Arguments
108+
109+
| Argument | Type | Description |
110+
| --- |--- | --- |
111+
| Name | String | The name of the repository to update. Leave empty to update all configured repositories |
112+
| ForceTrust | Switch | By default repositories are validated with a hash, based on all files present inside the repository. If a repository is not providing a hash, it will be disabled after the sync for security reasons. In case the hash does not match with all files synced afterwards, the repository files will be deleted and the sync aborted. You can use this flag to ignore both states and always add the repository, regardless if the hash matches or the hash is not given |
113+
114+
### Update All Repositories
115+
116+
Updating all synced repositories is very easy, with a simple command call:
117+
118+
```powershell
119+
Update-IcingaRepository;
120+
```
121+
122+
Once run, all files will be downloaded from the source and validated. In case validation fails or the source is not containing a repository hash, you can use `-ForceTrust` to ignore this and enable it regardless.
123+
124+
```powershell
125+
Update-IcingaRepository -ForceTrust;
126+
```
127+
128+
### Update Specific Repository
129+
130+
You can update a specific repository, by simply providing it's name:
131+
132+
```powershell
133+
Update-IcingaRepository -Name 'Icinga Stable Internal Web';
134+
```
135+
136+
Like other methods, `-ForceTrust` will work here as well.
137+
138+
## Updating Linux Repositories
139+
140+
There is no special mechanic required, as the entire configuration for the repository is stored inside the Icinga for Windows configuration.
141+
142+
For easier usage, it is however advised to use SSH keys, as otherwise each sync and update task will require you to enter your SSH password multiple times.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Enable/Disable/Remove Repositories
2+
3+
Besides [adding](01-Add-Existing-Repositories.md) and [syncing])(02-Sync-Repositories.md) of repositories, you can also `enable`, `disable` and `remove` repositories from your local machine.
4+
5+
Please note that **removing** a repository will only remove the Icinga for Windows configuration and **not** the files on the disk. You have to do this step manually.
6+
7+
## Enabling Repositories
8+
9+
In case a repository is disabled, you can enable it with `Enable-IcingaRepository`.
10+
11+
```powershell
12+
Enable-IcingaRepository -Name 'Icinga Stable Internal Web';
13+
```
14+
15+
## Disabling Repositories
16+
17+
You can also disable enabled repositories with `Disable-IcingaRepository`.
18+
19+
```powershell
20+
Disable-IcingaRepository -Name 'Icinga Stable Internal Web';
21+
```
22+
23+
Please note that disabled Icinga repositories will be fully ignored during installation/update tasks and no files from these will be fetched.
24+
25+
## Removing Repositories
26+
27+
If you no longer require a certain repository, you can remove it with `Remove-IcingaRepository`.
28+
29+
```powershell
30+
Remove-IcingaRepository -Name 'Icinga Stable Internal Web';
31+
```
32+
33+
**Note:** This will only remove the repository from the configuration. All possible available files for sync runs or anything related will remain on the disk until you remove them manually.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Search Repository For Components
2+
3+
Once you [added](01-Add-Existing-Repositories.md) and/or [synced])(02-Sync-Repositories.md) your repositories, you can search them for available components.
4+
5+
We can do this with the command `Search-IcingaRepository` and filter for a component `Name`, it's `Version` and if we want to include `Release` or `Snapshot` packages.
6+
7+
## List Everything available
8+
9+
At the beginning we can have a full search over all repositories and lookup all components made available by our repositories.
10+
11+
```powershell
12+
Search-IcingaRepository -Name '*' -Release -Snapshot;
13+
```
14+
15+
This will print all components including the version, the repository, the source of the repository and the component name.
16+
17+
**Note:** Disabled repositories are not included inside the search and results.
18+
19+
## List Certain Release Component
20+
21+
You can only include certain components for a release branch by using the `Name` and `Release` argument:
22+
23+
```powershell
24+
Search-IcingaRepository -Name 'agent' -Release;
25+
```
26+
27+
## Search For Specific Version
28+
29+
If you want to check if a certain `Release` version for a component is available inside your repositories, you can specify it with `Version`:
30+
31+
```powershell
32+
Search-IcingaRepository -Name 'agent' -Version '2.12.5' -Release;
33+
```
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Lock/Unlock Components
2+
3+
Sometimes you might require to `lock` certain components to a specific version. This means regardless of any version available, this component will not be updated or touched, unless the version it is locked to is not yet installed.
4+
5+
A lock will override the version suggested by any repository or the user input and always force the version specified.
6+
7+
If for example you lock the [Icinga Plugins](https://icinga.com/docs/icinga-for-windows/latest/plugins/doc/01-Introduction/) to version 1.6.0, they will not get upgraded to any other version.
8+
9+
## Locking Commponents
10+
11+
You can lock any Icinga component with `Lock-IcingaComponent` by simply providing the name of the component and the target version.
12+
13+
For example we can look our plugins to version 1.6.0:
14+
15+
```powershell
16+
Lock-IcingaComponent `
17+
-Name 'plugins' `
18+
-Version '1.6.0';
19+
```
20+
21+
Now the only version being installed for the plugins is 1.6.0, while all other versions are skipped. You can directly replace the lock for a different version later on, like 1.6.1:
22+
23+
```powershell
24+
Lock-IcingaComponent `
25+
-Name 'plugins' `
26+
-Version '1.6.1';
27+
```
28+
29+
## Unlocking Components
30+
31+
You can release a lock for a component by using `Unlock-IcingaComponent`. Unlike the locking mechanism, you only require to specify the component name for unlocking it, as each component only accepts one version lock at the time.
32+
33+
```powershell
34+
Unlock-IcingaComponent `
35+
-Name 'plugins';
36+
```
37+
38+
Once the lock is removed, updates will be applied again for this component.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Install Components
2+
3+
Once you [added](01-Add-Existing-Repositories.md) and/or [synced])(02-Sync-Repositories.md) your repositories and configured - if required - your [locks](05-Lock-Unlock-Components.md), we can start installing components.
4+
5+
For this we will use `Install-IcingaComponent`.
6+
7+
**Note:** When the install component is looking up available versions, *all* defined repositories will be searched and the latest version available used by default. If a specific version is set, it will stop once this version is found in one of the repositories and go with this package.
8+
9+
## Available Arguments
10+
11+
| Argument | Type | Description |
12+
| --- |--- | --- |
13+
| Name | String | The name of the component you want to install |
14+
| Version | String | Specifies to install a specific version of the component, instead of the latest one found. Is ignored in case you added a [lock](05-Lock-Unlock-Components.md) to this component |
15+
| Release | Switch | Includes release versions only if set. If neither Release nor Snapshot is defined, it will enforce release |
16+
| Snapshot | Switch | Includes snapshots versions only if set. If neither Release nor Snapshot is defined, it will enforce release |
17+
| Confirm | Switch | Skips the message asking you if you want to install this component |
18+
| Force | Switch | In case the same version is already installed, it will be skipped by default. Use this switch to install the same version again |
19+
20+
## Install Release Components
21+
22+
You can install release components either by adding the `-Release` switch or by not adding `-Release` and `-Snapshot` at all, to enforce release versions. If no version is specified, the latest version found will be used. Use `-Confirm` in addition to skip the dialog requiring an approval to install it.
23+
24+
```powershell
25+
Install-IcingaComponent `
26+
-Name 'agent' `
27+
-Confirm;
28+
```
29+
30+
## Install Specific Component Version
31+
32+
If your repository contains multiple versions, you can specify which version will be installed:
33+
34+
```powershell
35+
Install-IcingaComponent `
36+
-Name 'agent' `
37+
-Version '2.11.2' `
38+
-Confirm;
39+
```
40+
41+
## Reinstall Installed Component
42+
43+
If a component with a specific version is already installed, you can use `-Force` to re-install it.
44+
45+
```powershell
46+
Install-IcingaComponent `
47+
-Name 'agent' `
48+
-Version '2.11.5' `
49+
-Confirm `
50+
-Force;
51+
```
52+
53+
This also works for auto detected latest versions:
54+
55+
```powershell
56+
Install-IcingaComponent `
57+
-Name 'agent' `
58+
-Confirm `
59+
-Force;
60+
```

0 commit comments

Comments
 (0)