OSDN Git Service

adds the Nexus 2 support. nexus-grid-0.1.2
authorwhitestar <whitestar@users.osdn.me>
Thu, 3 Aug 2017 13:11:24 +0000 (22:11 +0900)
committerwhitestar <whitestar@users.osdn.me>
Thu, 3 Aug 2017 13:11:24 +0000 (22:11 +0900)
cookbooks/nexus-grid/CHANGELOG.md
cookbooks/nexus-grid/README.md
cookbooks/nexus-grid/attributes/default.rb
cookbooks/nexus-grid/recipes/docker-compose.rb
cookbooks/nexus-grid/templates/default/opt/docker-compose/app/nexus/etc/nginx/nginx.conf
cookbooks/nexus-grid/version

index 3b5c429..f3b786e 100644 (file)
@@ -1,5 +1,10 @@
 # nexus-grid CHANGELOG
 
+0.1.2
+-----
+- adds the Nexus 2 support.
+- adds Concourse pipeline configurations.
+
 0.1.1
 -----
 - adds a reverse proxy (nginx) service to the `nexus-grid::docker-compose` recipe.
index c5fffd6..97af9a5 100644 (file)
@@ -70,6 +70,7 @@ run_list(
 )
 
 image = 'sonatype/nexus3'
+#image = 'sonatype/nexus'  # Nexus2
 port = '8081'
 
 override_attributes(
@@ -92,12 +93,22 @@ override_attributes(
             'image' => image,
             'volumes' => [
               # This volume will be set by the nexus-grid::docker-compose recipe automatically.
-              #"#{node['nexus-grid']['docker-compose']['data_dir']}:/nexus-data",
+              # * Nexus3
+              #"#{node['nexus-grid']['docker-compose']['data_dir']}:/nexus-data:rw",
+              # * Nexus2
+              #"#{node['nexus-grid']['docker-compose']['data_dir']}:/sonatype-work:rw",
             ],
             'environment' => {
+              # * Nexus3
               #'JAVA_MAX_HEAP' => '1200m',  # passed as -Xmx. Defaults to 1200m.
               #'JAVA_MIN_HEAP' => '1200m',  # passed as -Xms. Defaults to 1200m.
               #'EXTRA_JAVA_OPTS' => '',  # Additional options can be passed to the JVM via this variable.
+              # * Nexus2
+              #'CONTEXT_PATH' => '/nexus',
+              #'MAX_HEAP' => '768m',
+              #'MIN_HEAP' => '256m',
+              #'JAVA_OPTS' => '-server -XX:MaxPermSize=192m -Djava.net.preferIPv4Stack=true',
+              #'LAUNCHER_CONF' => './conf/jetty.xml ./conf/jetty-requestlog.xml',
             },
           },
         },
@@ -120,6 +131,7 @@ run_list(
 )
 
 image = 'sonatype/nexus3'
+#image = 'sonatype/nexus'  # Nexus2
 port = '8081'
 cn = 'nexus.io.example.com'
 
@@ -153,12 +165,22 @@ override_attributes(
             'image' => image,
             'volumes' => [
               # This volume will be set by the nexus-grid::docker-compose recipe automatically.
-              #"#{node['nexus-grid']['docker-compose']['data_dir']}:/nexus-data",
+              # * Nexus3
+              #"#{node['nexus-grid']['docker-compose']['data_dir']}:/nexus-data:rw",
+              # * Nexus2
+              #"#{node['nexus-grid']['docker-compose']['data_dir']}:/sonatype-work:rw",
             ],
             'environment' => {
+              # * Nexus3
               #'JAVA_MAX_HEAP' => '1200m',  # passed as -Xmx. Defaults to 1200m.
               #'JAVA_MIN_HEAP' => '1200m',  # passed as -Xms. Defaults to 1200m.
               #'EXTRA_JAVA_OPTS' => '',  # Additional options can be passed to the JVM via this variable.
+              # * Nexus2
+              #'CONTEXT_PATH' => '/nexus',
+              #'MAX_HEAP' => '768m',
+              #'MIN_HEAP' => '256m',
+              #'JAVA_OPTS' => '-server -XX:MaxPermSize=192m -Djava.net.preferIPv4Stack=true',
+              #'LAUNCHER_CONF' => './conf/jetty.xml ./conf/jetty-requestlog.xml',
             },
           },
         },
index e156fc7..fe649f3 100644 (file)
@@ -51,6 +51,7 @@ version_2_config = {
     },
     'nexus' => {
       'restart' => 'always',
+      #'image' => 'sonatype/nexus',  # Nexus2
       'image' => 'sonatype/nexus3',
       'ports' => [
         # Do not expose!
@@ -59,12 +60,22 @@ version_2_config = {
       ],
       'volumes' => [
         # This volume will be set by the nexus-grid::docker-compose recipe automatically.
-        #"#{node['nexus-grid']['docker-compose']['data_dir']}:/nexus-data",
+        # * Nexus3
+        #"#{node['nexus-grid']['docker-compose']['data_dir']}:/nexus-data:rw",
+        # * Nexus2
+        #"#{node['nexus-grid']['docker-compose']['data_dir']}:/sonatype-work:rw",
       ],
       'environment' => {
+        # * Nexus3
         #'JAVA_MAX_HEAP' => '1200m',  # passed as -Xmx. Defaults to 1200m.
         #'JAVA_MIN_HEAP' => '1200m',  # passed as -Xms. Defaults to 1200m.
         #'EXTRA_JAVA_OPTS' => '',  # Additional options can be passed to the JVM via this variable.
+        # * Nexus2
+        #'CONTEXT_PATH' => '/nexus',
+        #'MAX_HEAP' => '768m',
+        #'MIN_HEAP' => '256m',
+        #'JAVA_OPTS' => '-server -XX:MaxPermSize=192m -Djava.net.preferIPv4Stack=true',
+        #'LAUNCHER_CONF' => './conf/jetty.xml ./conf/jetty-requestlog.xml',
       },
     },
   },
index cf6b741..3f29d06 100644 (file)
@@ -17,8 +17,6 @@
 # limitations under the License.
 #
 
-doc_url = 'https://hub.docker.com/r/sonatype/nexus3/'
-
 include_recipe 'platform_utils::kernel_user_namespace'
 include_recipe 'docker-grid::compose'
 
@@ -46,6 +44,10 @@ override_config_srvs = node.override['nexus-grid']['docker-compose']['config']['
 rproxy_vols = config_srvs['reverseproxy']['volumes'].to_a
 nexus_vols = config_srvs['nexus']['volumes'].to_a
 
+nexus_ver = config_srvs['nexus']['image'] =~ %r{^sonatype/nexus3} ? '3' : '2'
+doc_url = 'https://hub.docker.com/r/sonatype'
+doc_url = nexus_ver == '3' ? "#{doc_url}/nexus3/" : "#{doc_url}/nexus/"
+
 ports = config_srvs['reverseproxy']['ports']
 override_config_srvs['reverseproxy']['ports'] = ['8081:8081'] if ports.empty?
 
@@ -55,6 +57,9 @@ template "#{etc_dir}/nginx/nginx.conf" do
   group 'root'
   mode '0644'
   action :create
+  variables(
+    nexus_ver: nexus_ver
+  )
 end
 
 rproxy_vols.push("#{etc_dir}/nginx/nginx.conf:/etc/nginx/nginx.conf:ro")
@@ -67,7 +72,8 @@ resources(directory: data_dir) rescue directory data_dir do
   recursive true
 end if !data_dir.nil? && !data_dir.empty?
 
-nexus_vols.push("#{data_dir}:/nexus-data") if !data_dir.nil? && !data_dir.empty?
+container_data_dir = nexus_ver == '3' ? '/nexus-data' : '/sonatype-work'
+nexus_vols.push("#{data_dir}:#{container_data_dir}:rw") if !data_dir.nil? && !data_dir.empty?
 
 if node['nexus-grid']['with_ssl_cert_cookbook']
   ::Chef::Recipe.send(:include, SSLCert::Helper)
index 8f0908d..f69e316 100644 (file)
@@ -1,5 +1,6 @@
 <%
 ssl_enabled = node['nexus-grid']['with_ssl_cert_cookbook']
+context_path = @nexus_ver == '3' ? '/' : '/nexus'
 -%>
 worker_processes 1;
 
@@ -24,8 +25,8 @@ http {
     listen 8081;
 <% end %>
 
-    location / {
-      proxy_pass         http://docker-nexus;
+    location <%= context_path %> {
+      proxy_pass         http://docker-nexus<%= context_path %>;
       proxy_redirect     off;
       proxy_set_header   Host $http_host;  # $host does not include the port number.
       proxy_set_header   X-Real-IP $remote_addr;