Skip to content

Commit

Permalink
NEXUS-27617: Added new 3x-docker.rb recipe, this is effectively the r…
Browse files Browse the repository at this point in the history
…h-docker recipe, without java included (#60)
  • Loading branch information
dbradicich authored Jun 28, 2021
1 parent debd18c commit 70a6cb6
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ We also provide a `nexus_repository_manager::docker` recipe which is exactly the
OpenShift standards, a directory with the licenses applicable to the software and a man file for help on how to use
the software. It also uses an ENTRYPOINT script to ensure the running user has access to the appropriate
permissions for OpenShift 'restricted' SCC.
- nexus_repository_manager::3x-docker
Nearly identical to the rh-docker recipe, but excluding the java recipe

#### Red Hat help.1

Expand Down
74 changes: 74 additions & 0 deletions recipes/3x-docker.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#
# Cookbook:: nexus_repository_manager
# Recipe:: 3x-docker
#
# Copyright:: Copyright (c) 2017-present Sonatype, Inc. Apache License, Version 2.0.

if node['platform'] == 'rhel'
default['yum']['rhel-7-server-rpms']['enabled'] = true
default['yum']['rhel-7-server-rpms']['managed'] = true
default['yum']['rhel-7-server-optional-rpms']['enabled'] = true
default['yum']['rhel-7-server-optional-rpms']['managed'] = true
default['yum']['rhel-7-server-thirdparty-oracle-java-rpms']['enabled'] = true
default['yum']['rhel-7-server-thirdparty-oracle-java-rpms']['managed'] = true
end

include_recipe 'nexus_repository_manager::users'
include_recipe 'nexus_repository_manager::download'
include_recipe 'nexus_repository_manager::configure'

set_limit 'nexus' do
type 'hard'
item 'nofile'
value 65536
use_system true
end

set_limit 'nexus' do
type 'soft'
item 'nofile'
value 65536
use_system true
end

ruby_block "remove java memory settings from nexus.vmoptions" do
block do
file = Chef::Util::FileEdit.new(node['nexus_repository_manager']['nexus_home']['path'] + '/bin/nexus.vmoptions')
file.search_file_delete_line(/^-Xms/)
file.search_file_delete_line(/^-Xmx/)
file.search_file_delete_line(/^-XX:MaxDirectMemorySize/)
file.write_file
end
end

group 'root' do
action :modify
members 'nexus'
append true
end

directory '/licenses/' do
owner 'root'
group 'root'
mode '755'
action :create
end

[ 'help.1', 'uid_template.sh', 'uid_entrypoint.sh', 'licenses/LICENSE' ].each do | file |
cookbook_file "/#{file}" do
source "rh-docker/#{file}"
owner 'root'
group 'root'
mode '755'
end
end

bash 'uid_template.sh' do
code <<-EOH
/uid_template.sh
EOH
end

file '/etc/passwd' do
mode '664'
end

0 comments on commit 70a6cb6

Please sign in to comment.