All Projects → rgl → nexus-vagrant

rgl / nexus-vagrant

Licence: other
Vagrant Environment for a Nexus Repository OSS service

Programming Languages

shell
77523 projects
groovy
2714 projects
powershell
5483 projects
Makefile
30231 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to nexus-vagrant

nodejs-dev-vm
DEPRECATED Simple Node.js Development VM using Vagrant + VirtualBox + Ansible
Stars: ✭ 25 (+31.58%)
Mutual labels:  vagrant
EasyGitianBuilder
🔨 Gitian Building made simpler on any Windows Debian/Ubuntu MacOS with Vagrant, lxc, and virtualbox
Stars: ✭ 18 (-5.26%)
Mutual labels:  vagrant
vagrant-pxe
A vagrant PXE client/server environment with libvirt provider.
Stars: ✭ 51 (+168.42%)
Mutual labels:  vagrant
dockpack
This project uses ansible, packer and vagrant to create an agile lab.
Stars: ✭ 13 (-31.58%)
Mutual labels:  vagrant
packer-windows
Windows Templates for Packer: Windows 11, Windows 10, Windows Server 2022, 2019, 2016, also with Docker
Stars: ✭ 1,116 (+5773.68%)
Mutual labels:  vagrant
nexus3-github-oauth-plugin
This nexus plugin provides a way to authenticate/authorize your users based on Github.
Stars: ✭ 52 (+173.68%)
Mutual labels:  nexus
proxmox-ve
Proxmox VE Vagrant Base Box
Stars: ✭ 70 (+268.42%)
Mutual labels:  vagrant
packer-vagrant-builder
Build Solaris,CentOS or Ubuntu Vagrant box with puppet rpm's
Stars: ✭ 49 (+157.89%)
Mutual labels:  vagrant
vagrant-ovirt4
oVirt v4 provider for Vagrant
Stars: ✭ 33 (+73.68%)
Mutual labels:  vagrant
magento2-ansible-vagrant
Ⓜ️2️⃣ Ansible provisioned Ubuntu 16.04 vagrant box for Magento2 development.
Stars: ✭ 25 (+31.58%)
Mutual labels:  vagrant
visual-studio-community-vagrant
Vagrant Environment for Visual Studio Community
Stars: ✭ 28 (+47.37%)
Mutual labels:  vagrant
artifact-resolver
Standalone jar executable client Maven 2 artifact resolver based on Eclipse Aether.
Stars: ✭ 13 (-31.58%)
Mutual labels:  nexus
ldap-vagrant
A LDAP Server in a Vagrant sandbox
Stars: ✭ 20 (+5.26%)
Mutual labels:  vagrant
upstream-institute-virtual-environment
A Vagrant-based image creator for OpenStack Upstream Training sessions
Stars: ✭ 18 (-5.26%)
Mutual labels:  vagrant
maven-artifacts-uploader
command line tool for uploading directory of maven artifacts to nexus 3.x repository
Stars: ✭ 30 (+57.89%)
Mutual labels:  nexus
iosxrv-x64-vbox
IOS XR VirtualBox Vagrant Image Generation tools
Stars: ✭ 72 (+278.95%)
Mutual labels:  vagrant
vagrant
Vagrant Builds
Stars: ✭ 154 (+710.53%)
Mutual labels:  vagrant
drupal8-vagrant
Simple Drupal 8 Development Environment
Stars: ✭ 59 (+210.53%)
Mutual labels:  vagrant
vagrant-pebble-sdk
This repo contains allows you to quickly and easily create a Virtual Machine with a working Pebble SDK install using Vagrant and Virtualbox
Stars: ✭ 13 (-31.58%)
Mutual labels:  vagrant
kubernetes-automation-toolkit
This repository contains code examples and documentation for learning how applications can be developed with Kubernetes
Stars: ✭ 51 (+168.42%)
Mutual labels:  vagrant

This is a Vagrant Environment for a Nexus Repository OSS service.

This will:

  • Configure Nexus through Groovy scripts.
    • Create the adhoc-package repository.
    • Create the npm-group, npm-hosted and npmjs.org-proxy repositories.
    • Create the chocolatey-group, chocolatey-hosted and chocolatey.org-proxy repositories.
    • Create the powershell-group, powershell-hosted and powershellgallery.com-proxy repositories.
    • Configure the NuGet nuget-hosted repository to accept pushing with an API key.
    • Schedule a task to remove the old snapshots from the maven-snapshots repository.
    • Create users and a custom deployer role.
    • Setup an Active Directory LDAP user authentication source (when config_authentication='ldap' is set inside the provision-nexus.sh file).
    • For more details look inside the provision/provision-nexus directory.
  • Setup nginx as a Nexus HTTPS proxy and static file server.
  • Test the installed repositories by using and publishing to them (see the use-* files).

NB If you are new to Groovy, be sure to check the Groovy Learn X in Y minutes page.

Caveats

Usage

Build and install the Ubuntu 20.04 Base Box.

Build and install the Windows 2022 Base Box.

Add the following entry to your /etc/hosts file:

192.168.56.3 nexus.example.com

Install Vagrant 2.1+.

Run vagrant up --provider=virtualbox # or --provider=libvirt to launch the environment.

Access the Nexus home page and login as the admin user and password admin.

You can also login with one of the example accounts, e.g. alice.doe and password password.

NB nginx is setup with a self-signed certificate that you have to trust before being able to access the local Nexus home page.

Notes

Check for a component existence

With bash, HTTPie and jq:

function nexus-component-exists {
  [ \
    "$(
      http \
        get \
        https://nexus.example.com/service/rest/v1/search \
        "repository==$1" \
        "name==$2" \
        "version==$3" \
      | jq -r .items[].name)" == "$2" \
  ]
}

if nexus-component-exists npm-hosted hello-world 1.0.0; then
  echo 'component exists'
else
  echo 'component does not exists'
fi

With PowerShell:

function Test-NexusComponent {
  param(
    [string]$repository,
    [string]$name,
    [string]$version)
  $items = (Invoke-RestMethod `
    -Method Get `
    -Uri https://nexus.example.com/service/rest/v1/search `
    -Body @{
      repository = $repository
      name = $name
      version = $version
    }).items
  $items.Count -and ($items.name -eq $name)
}

if (Test-NexusComponent npm-hosted hello-world 1.0.0) {
  Write-Host 'component exists'
} else {
  Write-Host 'component does not exists'
}

Troubleshooting

Logs

The logs are at /opt/nexus/log/nexus.log.

You can also see them with journalctl -u nexus.

OrientDB

Nexus uses OrientDB as its database. To directly use it from the console run:

sudo su -l                            # switch to the root user.
systemctl stop nexus                  # make sure nexus is not running while you use the database.
su -s /bin/bash nexus                 # switch to the nexus user.
nexus_home=/opt/nexus/nexus-3.39.0-01 # make sure you have the correct version here.
nexus_data=$nexus_home/../sonatype-work/nexus3
function orientdb-console {
    java -jar $nexus_home/lib/support/nexus-orient-console.jar $*
}
cd $nexus_data
ls -laF db | grep ^d  # list the databases
orientdb-console      # start the console.

Then connect to one of the databases, e.g. to the security database:

connect plocal:db/security admin admin

Then execute some commands and exit the orientdb console, e.g.:

help
config
list classes
exit

Exit the nexus user shell:

exit

And start nexus again:

systemctl start nexus

For more information about the console see Running the OrientDB Console.

OrientDB Check Databases

Execute the commands from the OrientDB section to stop nexus, to enter the nexus account and create the orientdb-console function, then:

# check the databases.
# NB use CHECK DATABASE -v to see the verbose log.
orientdb-console 'CONNECT PLOCAL:db/component admin admin; CHECK DATABASE;'
#orientdb-console 'CONNECT PLOCAL:db/component admin admin; REPAIR DATABASE;'
orientdb-console 'CONNECT PLOCAL:db/config admin admin; CHECK DATABASE;'
orientdb-console 'CONNECT PLOCAL:db/security admin admin; CHECK DATABASE;'
#orientdb-console 'CONNECT PLOCAL:db/OSystem admin admin; CONFIG; LIST CLASSES;' # XXX fails to connect. see https://groups.google.com/a/glists.sonatype.com/forum/#!topic/nexus-users/7dVofIwC5HM

Then start nexus.

Reference

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].