Version information
This version is compatible with:
- Puppet Enterprise 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x
- Puppet >= 6.0.0 < 8.0.0
- , , ,
Start using this module
Add this module to your Puppetfile:
mod 'pest-nexus', '3.1.0'
Learn more about managing modules with a PuppetfileDocumentation
Sonatype Nexus Repository Manager 3 Puppet module
Install and configure Sonatype Nexus Repository Manager 3.
This module was forked from hubspot/nexus.
Requirements of this module
- puppet/archive
- puppet/extlib
- puppetlabs/stdlib
Migration from pre 3.x versions of this module
With version 3.0.0 we changed the default installation path from /srv
to /opt/sonatype
.
To migrate your current installation you will have to put something like the following into your role_nexus_server.pp
:
# shutdown the currently running service as we have to modify the operation system user
exec { 'shutdown-running-service':
command => '/usr/bin/systemctl stop nexus.service',
onlyif => [
'/usr/bin/test -d /srv/sonatype-work',
'/usr/bin/test ! -d /opt/sonatype/sonatype-work'
],
before => [
Class['nexus::package'],
Class['nexus::user']
],
}
# nexus::package will extract the archive which contains an empty work directory
exec { 'remove-empty-work-directory':
command => '/usr/bin/rm -rf /opt/sonatype/sonatype-work',
onlyif => [
'/usr/bin/test -d /srv/sonatype-work',
'/usr/bin/test -d /opt/sonatype/sonatype-work'
],
before => [
Exec['move-work-directory-to-new-location']
],
require => [
Class['nexus::package'],
]
}
# move the old working directory to the new location
exec { 'move-work-directory-to-new-location':
command => '/usr/bin/mv /srv/sonatype-work /opt/sonatype/',
onlyif => [
'/usr/bin/test -d /srv/sonatype-work',
'/usr/bin/test ! -d /opt/sonatype/sonatype-work'
],
require => [
Class['nexus::package'],
Exec['remove-empty-work-directory'],
],
before => Class['nexus::service'],
}
Usage
The following is a basic role class for building a nexus host. Adjust accordingly as needed.
NOTE: you must pass version to Class['nexus']
. This is needed for the
download link and determining the name of the nexus directory.
class role_nexus_server {
# puppetlabs-java
# NOTE: Nexus requires
class{ 'java': }
class{ 'nexus':
version => '3.37.3',
revision => '02',
nexus_type => 'unix',
}
Class['java'] ->
Class['nexus']
}
Valid versions and revisions can be picked from the official page
Nginx proxy
The following is setup for using the puppet/puppet-nginx module. Nexus does not adequately support HTTP and HTTPS simultaneously. Below forces all connections to HTTPS. Be sure to login after the app is up and head to Administration -> Server. Change the base URL to "https" and check "Force Base URL". The application will be available at:
https://${::fqdn}/
class{ '::nginx': }
file { '/etc/nginx/conf.d/default.conf':
ensure => absent,
require => Class['::nginx::package'],
notify => Class['::nginx::service']
}
nginx::resource::vhost { 'nexus':
ensure => present,
www_root => '/usr/share/nginx/html',
rewrite_to_https => true,
ssl => true,
ssl_cert => '/etc/pki/tls/certs/server.crt',
ssl_key => '/etc/pki/tls/private/server.key',
}
nginx::resource::location { 'nexus':
ensure => present,
location => '/',
vhost => 'nexus',
proxy => "http://${nexus::host}:${nexus::port}",
ssl => true,
}
TODO
- Find a way to not require a version to be passed to Class['nexus']
Authors
- Tom McLaughlin tmclaughlin@hubspot.com
Copyright
Hubspot, Inc.
Reference
Table of Contents
Classes
Public Classes
nexus
: Install and configure Sonatype Nexus Repository Manager 3.nexus::plugin::composer
: Install the composer repository format plugin
Private Classes
nexus::config
: Configure nexus repository managernexus::package
: Install the Nexus Repository Manager packagenexus::plugin
: Base class used by plugin classesnexus::service
: Maintains the Nexus servicenexus::user
: Manages the operation system user account which is used to start up the service
Classes
nexus
Install and configure Sonatype Nexus Repository Manager 3.
Examples
class{ 'nexus':
version => '3.37.3-02',
}
Parameters
The following parameters are available in the nexus
class:
version
download_folder
download_site
download_proxy
install_root
work_dir
user
group
host
port
manage_user
manage_config
manage_work_dir
purge_installations
version
Data type: Pattern[/3.\d+.\d+-\d+/]
The version to download, install and manage.
download_folder
Data type: Stdlib::Absolutepath
Destination folder of the downloaded archive.
download_site
Data type: Stdlib::HTTPUrl
Download uri which will be appended with filename of the archive to download.
download_proxy
Data type: Optional[Stdlib::HTTPUrl]
Proxyserver address which will be used to download the archive file.
install_root
Data type: Stdlib::Absolutepath
The root filesystem path where the downloaded archive will be extracted to.
work_dir
Data type: Stdlib::Absolutepath
The nexus repository manager working directory which contains the embedded database and local blobstores.
user
Data type: String[1]
The operation system user used to start the nexus repository manager service.
group
Data type: String[1]
The operation system group used to start the nexus repository manager service.
host
Data type: Stdlib::Host
The bind address where the nexus repository manager service should bind to.
port
Data type: Stdlib::Port
The port which the nexus repository manager service should use.
manage_user
Data type: Boolean
Set if this module should manage the creation of the operation system user.
manage_config
Data type: Boolean
Set if this module should manage the config file of nexus repository manager.
manage_work_dir
Data type: Boolean
Set if this module should manage the work directory of the nexus repository manager.
purge_installations
Data type: Boolean
Set this option if you want old installations of nexus repository manager to get automatically deleted.
nexus::plugin::composer
Install the composer repository format plugin
Examples
class { 'nexus':
version => '3.34.3-02',
}
class { 'nexus::plugin::composer':
version => '0.0.18',
}
Parameters
The following parameters are available in the nexus::plugin::composer
class:
version
Data type: Pattern[/\d+.\d+.\d+/]
The composer repository format plugin version.
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[3.1.0]
Added
nexus::plugin::composer
to install composer (php) repository plugin
[3.0.0]
Added
REFERENCE.md
generated bypuppet strings generate --format markdown --out REFERENCE.md
purge_old_installation
to delete old Nexus Repository Manager installations~/.java/.userPrefs
creation to preventCouldn't flush user prefs
-error
Changed
- Variable names in
init.pp
no longer containnexus
as it's already the module name. - User and group creation moved to
user.pp
- Default installation path changed from
/srv
to/opt/sonatype
- Default bind address changed from
0.0.0.0
to127.0.0.1
Removed
- Support for Nexus Repository Manager 2
[2.0.0]
Added
- Add proper data types for module parameter
Changed
- Http download urls to https
params.pp
pattern to hiera lookup- Change nexus_port from data type string to integer (Stdlib::Port)
Removed
version
parameter fromnexus::service
class as it is not usedmd5sum
parameter fromnexus
class as it is not used (checksum source depends on download url)- Nexus Repository Manager 2 example - next major version will drop support for that version
- Support for end of life puppet versions
[1.9.2]
Added
- Allow proxy use to download the archive
[1.9.1]
Added
- Set file recurse variable for nexus_home_real
[1.9.0]
Added
- Updated README.md
- Dropped end of life distributions
- Updated module dependencies
- Extended test suite to puppet 7
- Fix too wide match strings - issue #8
- Changes by
pdk update
[1.8.0]
Changed
- Replaced obsolete
puppet/wget
module by puppet/archive - Nexus artifact downloads get always validated against published md5 sum - md5sum parameter is currently getting ignored
[1.7.5]
Added
.sync.yml
forpdk update
Changed
- Extended test suite to puppet 5 and puppet 6
- Fix test suite
- Updated README.md and metadata.json
[1.7.4]
Changed
- Replaced obsolete
maestrodev/wget
module by puppet/wget - Initial
pdk convert
changes - Adjust module requirements in metadata.json
[1.7.1]
Added
- Support for validating the md5 checksum of the Nexus package file. https://github.com/hubspotdevops/puppet-nexus/pull/80
[1.7.0]
Added
- Support for CentOS and RedHat versions using systemd: https://github.com/hubspotdevops/puppet-nexus/pull/76
[1.6.1]
Added
- Support for older versions of Ubuntu: https://github.com/hubspotdevops/puppet-nexus/pull/70
[1.6.0]
Added
- Support for Ubuntu https://github.com/hubspotdevops/puppet-nexus/pull/67
[1.5.0]
Added
- Support for Puppet 4.5.2 https://github.com/hubspotdevops/puppet-nexus/pull/65
[1.4.0]
Added
- Support for Nexus 3
- Support for Debian 8
[1.3.1]
Changed
- Fix the location of the Nexus work directory if $nexus_work_dir is not passed in.
[1.3.0]
Added
- Make $nexus_work_dir configurable instead of using "${nexus_root}/${nexus::params::nexus_work_dir}" (/srv/sonatype-work)
- Make managing owner and perms of $nexus_work_dir configurable.
- installations with large repos can turn this off to prevent overconsumption of resources.
- This has been requested for ages.
- Add rudimentary spec tests
Changed
- Updated download location of package.
- Set 'run_as_user' for service status to $nexus_user. A bug from 2.7 days appears to be gone.
Dependencies
- puppetlabs/stdlib (>=4.0.0 < 9.0.0)
- puppet/archive (>=3.2.1 < 7.0.0)
- puppet/extlib (>=2.1.0 < 6.0.0)
The MIT License (MIT) Copyright (c) 2013 HubSpot, Inc. Copyright (c) 2020 Puppets Epic Show Theatre Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.