Setup for nexus OSS version 2. No download, only configuration

master
Andrea Dell'Amico 3 years ago
parent 78e96f5c95
commit 143b88202a

@ -10,7 +10,25 @@ The most important variables are listed below:
``` yaml
nexus_behind_nginx: True
nexus_service_port: 8081
nexus_service_bind_host: 127.0.0.1
nexus_major_version: '2'
#nexus_version: '{{ nexus_major_version }}.28.1'
nexus_version: '{{ nexus_major_version }}.14.19'
nexus_release: '01'
nexus_download_url: 'https://download.sonatype.com/nexus/{{ nexus_major_version }}/nexus-{{ nexus_version }}-{{ nexus_release }}-unix.tar.gz'
nexus_install_basedir: /srv/nexus
nexus_webapp_dir: '{{ nexus_install_basedir }}/nexus-oss-webapp'
nexus_data_basedir: /data
nexus_data_dir: '{{ nexus_data_basedir }}/sonatype-work/nexus'
nexus_logdir: '/var/log/nexus'
nexus_accesslog_maxhistory: 20
nexus_wrapper_initmemory: 256
nexus_wrapper_maxmemory: 1024
nexus_wrapper_conf_dir: '{{ nexus_webapp_dir }}/bin/jsw/conf'
nexus_wrapper_logdir: '/var/log/nexus-wrapper'
# MB
nexus_wrapper_diskcache_buffersize: 4096
```
Dependencies

@ -1,3 +1,21 @@
---
nexus_behind_nginx: True
nexus_service_port: 8081
nexus_service_bind_host: 127.0.0.1
nexus_major_version: '2'
#nexus_version: '{{ nexus_major_version }}.28.1'
nexus_version: '{{ nexus_major_version }}.14.19'
nexus_release: '01'
nexus_download_url: 'https://download.sonatype.com/nexus/{{ nexus_major_version }}/nexus-{{ nexus_version }}-{{ nexus_release }}-unix.tar.gz'
nexus_install_basedir: /srv/nexus
nexus_webapp_dir: '{{ nexus_install_basedir }}/nexus-oss-webapp'
nexus_data_basedir: /data
nexus_data_dir: '{{ nexus_data_basedir }}/sonatype-work/nexus'
nexus_logdir: '/var/log/nexus'
nexus_accesslog_maxhistory: 20
nexus_wrapper_initmemory: 256
nexus_wrapper_maxmemory: 1024
nexus_wrapper_conf_dir: '{{ nexus_webapp_dir }}/bin/jsw/conf'
nexus_wrapper_logdir: '/var/log/nexus-wrapper'
# MB
nexus_wrapper_diskcache_buffersize: 4096

@ -1,2 +1,6 @@
---
# handlers file for ansible-role-template
- name: Reload the systemd data
systemd: daemon_reload=yes
- name: Restart Nexus
service: name=nexus state=restarted

@ -3,5 +3,41 @@
- name: Create a user for the Nexus OSS service
user: name={{ nexus_user }} home=/dev/null createhome=no shell=/usr/sbin/nologin system=yes
- name: Create the nexus logs directory
file: dest={{ nexus_logdir }} state=directory owner={{ nexus_user }} group={{ nexus_user }} mode=0755
- name: Install the systemd unit
template: src=nexus.service.j2 dest=/etc/systemd/system/nexus.service owner=root group=root mode='0644'
notify: Reload the systemd data
- meta:
free_form: flush_handlers
tags: [ 'nexus', 'nexus_oss' ]
- block:
- name: Create the nexus wrapper log directory
file: dest={{ nexus_wrapper_logdir }} state=directory owner={{ nexus_user }} group={{ nexus_user }} mode=0755
- name: Install the nexus wrapper configuration
template: src=wrapper.conf.j2 dest={{ nexus_wrapper_conf_dir }}/wrapper.conf owner=root group=root mode='0644'
notify: Restart Nexus
- name: Install the nexus base config
template: src=nexus.properties.j2 dest={{ nexus_webapp_dir }}/conf/nexus.properties owner=root group=root mode='0644'
notify: Restart Nexus
- name: Install the nexus access logs configuration
template: src=logback-access.xml.j2 dest={{ nexus_webapp_dir }}/conf/logback-access.xml owner=root group=root mode='0644'
- meta:
free_form: flush_handlers
when: nexus_major_version == '2'
tags: [ 'nexus', 'nexus_oss' ]
- block:
- name: Ensure that the Nexus service is started and enabled
service: name=nexus state=started enabled=yes
tags: [ 'nexus', 'nexus_oss' ]

@ -0,0 +1,31 @@
<?xml version="1.0"?>
<!--
Sonatype Nexus (TM) Open Source Version
Copyright (c) 2008-present Sonatype, Inc.
All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
Eclipse Foundation. All other trademarks are the property of their respective owners.
-->
<configuration>
<appender name="request.logfile" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>{{ nexus_logdir }}/request.log</File>
<Append>true</Append>
<encoder class="org.sonatype.nexus.bootstrap.log.AccessPatternLayoutEncoder">
<pattern>%clientHost %l %user [%date] "%requestURL" %statusCode %bytesSent %elapsedTime</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>{{ nexus_logdir }}/request-%d{yyyy-MM-dd}.log.gz</fileNamePattern>
<maxHistory>{{ nexus_accesslog_maxhistory }}</maxHistory>
</rollingPolicy>
</appender>
<appender-ref ref="request.logfile"/>
</configuration>

@ -0,0 +1,36 @@
#
# Sonatype Nexus (TM) Open Source Version
# Copyright (c) 2008-present Sonatype, Inc.
# All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
#
# This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
# which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
#
# Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
# of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
# Eclipse Foundation. All other trademarks are the property of their respective owners.
#
# Sonatype Nexus
# ==============
# This is the most basic configuration of Nexus.
# Jetty section
application-port={{ nexus_service_port }}
application-host={{ nexus_service_bind_host }}
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus
# Nexus section
#nexus-work=${bundleBasedir}/../sonatype-work/nexus
nexus-work={{ nexus_data_dir }}
runtime=${bundleBasedir}/nexus/WEB-INF
# orientdb buffer size in megabytes
storage.diskCache.bufferSize={{ nexus_wrapper_diskcache_buffersize }}
# Storage whitelist
# Generated using existing configured values from all repositories if not found on upgrade
# Comma-separated list of allowed override storage locations for repositories
# See https://links.sonatype.com/products/nxrm2/configuring-repositories
nexus.override.local.storage.whitelist=

@ -0,0 +1,15 @@
[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
LimitNOFILE=65536
ExecStart={{ nexus_webapp_dir }}/bin/nexus start
ExecStop={{ nexus_webapp_dir }}/bin/nexus stop
User={{ nexus_user }}
Restart=on-abort
TimeoutSec=600
[Install]
WantedBy=multi-user.target

@ -0,0 +1,53 @@
wrapper.java.additional.3=-Dcom.sun.jndi.ldap.connect.pool.protocol="plain ssl"
wrapper.java.additional.3.stripquotes=TRUE
#wrapper.java.additional.4=-Xdebug
#wrapper.java.additional.5=-Xnoagent
#wrapper.java.additional.6=-Djava.compiler=NONE
#wrapper.java.additional.7=-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
#wrapper.java.additional.8=-XX:+HeapDumpOnOutOfMemoryError
wrapper.app.parameter.1=./conf/jetty.xml
wrapper.app.parameter.2=./conf/jetty-requestlog.xml
# Size Java memory, in MB (-Xms)
wrapper.java.initmemory={{ nexus_wrapper_initmemory }}
# Size Java memory, in MB (-Xmx). This option only supports a setting up to 4000 (4Gb).
# If you need more, comment this option out and use an explicit wrapper.java.additional option with -Xmx
wrapper.java.maxmemory={{ nexus_wrapper_maxmemory }}
# How much to wait for JVM to respond to "ping" (increase on slower machines and VMs if needed)
wrapper.ping.timeout=0
# How much to wait for application to start up (increase on slower machines if needed)
wrapper.startup.timeout=0
# How much to wait for application to shutdown
wrapper.shutdown.timeout=300
# Make wrapper reload configuration between app restarts
# and set exit code 12 as "RESTART" command
wrapper.restart.reload_configuration=TRUE
wrapper.on_exit.12=RESTART
# Set up JSW logging
wrapper.logfile={{ nexus_wrapper_logdir }}/wrapper.log
wrapper.logfile.format=PM
wrapper.logfile.loglevel=INFO
wrapper.logfile.maxsize=10m
wrapper.logfile.maxfiles=10
# Set up system logging (if needed, change to INFO or other valid values)
wrapper.syslog.loglevel=NONE
# Set up JSW Console
wrapper.console.title=Sonatype Nexus
wrapper.console.format=PM
wrapper.console.loglevel=INFO
wrapper.console.flush=true
# Set up JSW as NT Service (unused on other OSes)
wrapper.ntservice.name=nexus-webapp
wrapper.ntservice.displayname=nexus
wrapper.ntservice.description=Sonatype Nexus
wrapper.ntservice.dependency.1=
wrapper.ntservice.starttype=AUTO_START
wrapper.ntservice.interactive=false
Loading…
Cancel
Save