diff --git a/README.md b/README.md index 3c53f03..ff83fd8 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ Nexus uses [OrientDB](https://en.wikipedia.org/wiki/OrientDB) as its database. T 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.23.0-03 # make sure you have the correct version here. +nexus_home=/opt/nexus/nexus-3.29.2-02 # 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 $* @@ -163,9 +163,6 @@ nexus account and create the `orientdb-console` function, then: ```bash # check the databases. # NB use CHECK DATABASE -v to see the verbose log. -orientdb-console 'CONNECT PLOCAL:db/accesslog admin admin; CHECK DATABASE;' -orientdb-console 'CONNECT PLOCAL:db/analytics admin admin; CHECK DATABASE;' -orientdb-console 'CONNECT PLOCAL:db/audit admin admin; CHECK DATABASE;' 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;' diff --git a/Vagrantfile b/Vagrantfile index 55b6178..3a7fd40 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -25,8 +25,12 @@ Vagrant.configure(2) do |config| config.vm.hostname = nexus_domain config.vm.network 'private_network', ip: nexus_ip config.vm.provider :libvirt do |lv, config| + lv.memory = 3*1024 config.vm.synced_folder '.', '/vagrant', type: 'nfs' end + config.vm.provider :virtualbox do |vb, config| + vb.memory = 3*1024 + end config.vm.provision :shell, path: 'provision/provision-base.sh' config.vm.provision :shell, path: 'provision/provision-docker.sh' config.vm.provision :shell, path: 'provision/provision-nexus.sh' @@ -46,9 +50,9 @@ Vagrant.configure(2) do |config| config.vm.provider :libvirt do |lv, config| config.vm.synced_folder '.', '/vagrant', type: 'smb', smb_username: ENV['USER'], smb_password: ENV['VAGRANT_SMB_PASSWORD'] end - config.vm.provider :virtualbox do |v, override| - v.customize ['modifyvm', :id, '--vram', 64] - v.customize ['modifyvm', :id, '--clipboard', 'bidirectional'] + config.vm.provider :virtualbox do |vb, config| + vb.customize ['modifyvm', :id, '--vram', 64] + vb.customize ['modifyvm', :id, '--clipboard', 'bidirectional'] end config.vm.provision :shell, inline: "echo '#{nexus_ip} #{nexus_domain}' | Out-File -Encoding Ascii -Append c:/Windows/System32/drivers/etc/hosts" config.vm.provision :shell, path: 'provision/windows/ps.ps1', args: ['provision-base.ps1', nexus_domain] diff --git a/provision/provision-nexus.sh b/provision/provision-nexus.sh index c4bc7fe..6cc6e05 100644 --- a/provision/provision-nexus.sh +++ b/provision/provision-nexus.sh @@ -33,17 +33,17 @@ pushd /opt/nexus # see https://www.sonatype.com/download-oss-sonatype # see https://help.sonatype.com/repomanager3/download/download-archives---repository-manager-3 # see https://help.sonatype.com/display/NXRM3 -nexus_version=3.23.0-03 +nexus_version=3.29.2-02 nexus_home=/opt/nexus/nexus-$nexus_version nexus_tarball=nexus-$nexus_version-unix.tar.gz nexus_download_url=https://download.sonatype.com/nexus/3/$nexus_tarball -nexus_download_sha1=8298bd6db3b0f4d083942343a89f47cae7d791de +nexus_download_sha1=8e29ebdfea3e66723372a23f321233c6fa39f870 wget -q $nexus_download_url if [ "$(sha1sum $nexus_tarball | awk '{print $1}')" != "$nexus_download_sha1" ]; then echo "downloaded $nexus_download_url failed the checksum verification" exit 1 fi -tar xf $nexus_tarball # NB this creates the $nexus_home (e.g. nexus-3.23.0-03) and sonatype-work directories. +tar xf $nexus_tarball # NB this creates the $nexus_home (e.g. nexus-3.29.2-02) and sonatype-work directories. rm $nexus_tarball install -d -o nexus -g nexus -m 700 .java # java preferences are saved here (the default java.util.prefs.userRoot preference). install -d -o nexus -g nexus -m 700 sonatype-work/nexus3/etc diff --git a/provision/provision-nexus/Makefile b/provision/provision-nexus/Makefile index 9c0d9f7..6135cca 100644 --- a/provision/provision-nexus/Makefile +++ b/provision/provision-nexus/Makefile @@ -17,7 +17,7 @@ binaries: binaries-download binaries-download: mkdir -p binaries - wget -qO- https://download.sonatype.com/nexus/3/nexus-3.23.0-03-unix.tar.gz \ + wget -qO- https://download.sonatype.com/nexus/3/nexus-3.29.2-02-unix.tar.gz \ | tar xzf - --strip-components 1 -C binaries clean: diff --git a/provision/provision-nexus/pom.xml b/provision/provision-nexus/pom.xml index c06158a..068a332 100644 --- a/provision/provision-nexus/pom.xml +++ b/provision/provision-nexus/pom.xml @@ -8,7 +8,7 @@ 1.0-SNAPSHOT - 3.23.0-03 + 3.29.2-02 diff --git a/provision/provision-nexus/provision-nexus.iml b/provision/provision-nexus/provision-nexus.iml index 5876cef..b48562f 100644 --- a/provision/provision-nexus/provision-nexus.iml +++ b/provision/provision-nexus/provision-nexus.iml @@ -8,154 +8,158 @@ - - - - + + + + - - + + + + - + - - - + + + - + - + - - + + + + + - - + + + - - - + + + - - + + - + - + - - + + - - + + - + - - + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - + + - - - + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + - + - + @@ -164,12 +168,12 @@ - - + + - + - + diff --git a/provision/provision-nexus/src/main/groovy/provision.groovy b/provision/provision-nexus/src/main/groovy/provision.groovy index 4cc76a1..d50f4cd 100644 --- a/provision/provision-nexus/src/main/groovy/provision.groovy +++ b/provision/provision-nexus/src/main/groovy/provision.groovy @@ -4,7 +4,7 @@ import groovy.json.JsonOutput import org.sonatype.nexus.capability.CapabilityRegistry -import org.sonatype.nexus.repository.storage.WritePolicy +import org.sonatype.nexus.repository.config.WritePolicy import org.sonatype.nexus.security.user.UserSearchCriteria import org.sonatype.nexus.security.authc.apikey.ApiKeyStore import org.sonatype.nexus.security.realm.RealmManager @@ -57,8 +57,10 @@ repository.repositoryManager.update(config) // create a powershell repository backed by the default blob store. repository.createNugetHosted("powershell-hosted", "default", true, WritePolicy.ALLOW_ONCE) // create a powershell proxy repository backed by the default blob store. -// see https://help.sonatype.com/display/NXRM3/.NET+Package+Repositories+with+NuGet -repository.createNugetProxy("powershellgallery.com-proxy", "https://www.powershellgallery.com/api/v2/", "default") +// see https://help.sonatype.com/repomanager3/formats/nuget-repositories +config = repository.createNugetProxy("powershellgallery.com-proxy", "https://www.powershellgallery.com/api/v2/", "default").configuration.copy() +config.attributes.nugetProxy.nugetVersion = "V2" +repository.repositoryManager.update(config) // create a powershell group repository that merges the powershell-host and powershellgallery.com-proxy together. repository.createNugetGroup("powershell-group", ["powershell-hosted", "powershellgallery.com-proxy"], "default") @@ -66,8 +68,10 @@ repository.createNugetGroup("powershell-group", ["powershell-hosted", "powershel // create a chocolatey repository backed by the default blob store. repository.createNugetHosted("chocolatey-hosted", "default", true, WritePolicy.ALLOW_ONCE) // create a chocolatey proxy repository backed by the default blob store. -// see https://help.sonatype.com/display/NXRM3/.NET+Package+Repositories+with+NuGet -repository.createNugetProxy("chocolatey.org-proxy", "https://chocolatey.org/api/v2/", "default") +// see https://help.sonatype.com/repomanager3/formats/nuget-repositories +config = repository.createNugetProxy("chocolatey.org-proxy", "https://chocolatey.org/api/v2/", "default").configuration.copy() +config.attributes.nugetProxy.nugetVersion = "V2" +repository.repositoryManager.update(config) // create a chocolatey group repository that merges the chocolatey-host and chocolatey.org-proxy together. repository.createNugetGroup("chocolatey-group", ["chocolatey-hosted", "chocolatey.org-proxy"], "default") diff --git a/provision/use-nuget-repository.sh b/provision/use-nuget-repository.sh index 89b0dd8..6876944 100644 --- a/provision/use-nuget-repository.sh +++ b/provision/use-nuget-repository.sh @@ -9,14 +9,15 @@ mkdir -p tmp/use-nuget-repository && cd tmp/use-nuget-repository # # test the NuGet repository. -# see https://help.sonatype.com/display/NXRM3/.NET+Package+Repositories+with+NuGet +# see https://help.sonatype.com/repomanager3/formats/nuget-repositories +# see https://help.sonatype.com/repomanager3/formats/nuget-repositories/grouping-nuget-repositories # install the dotnet core sdk. if ! which dotnet; then bash -eux /vagrant/provision/provision-dotnet-core-sdk.sh fi -nuget_source_url=https://$nexus_domain/repository/nuget-group/ +nuget_source_url=https://$nexus_domain/repository/nuget-group/index.json nuget_source_push_url=https://$nexus_domain/repository/nuget-hosted/ nuget_source_push_api_key=$(nexus-groovy get-jenkins-nuget-api-key | jq -r '.result | fromjson | .apiKey') echo -n $nuget_source_push_api_key >/vagrant/shared/jenkins-nuget-api-key