1、使用docker-compose部署

mkdir -p /srv/nexus/nexus-compose/
mkdir -p /srv/nexus/data
chown 200 -R /srv/nexus/data/

# vim /srv/nexus/nexus-compose/docker-compose.yml
version: '3'
services:
  nexus3:
    restart: always
    image: sonatype/nexus3:3.33.1
    ports:
      - 10.11.1.13:8081:8081
	  - 10.11.1.13:18081:8081
	  - 10.11.1.13:18082:8082
    volumes:
      - /srv/nexus/data:/nexus-data

cd /srv/nexus/nexus-compose/
docker-compose up -d

2、配置Nginx代理

cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/nexus.conf
# vim /etc/nginx/conf.d/nexus.conf
upstream nexus_website {
    server 10.11.1.13:8081;
}
upstream nexus_docker_hosted {
    server 10.11.1.13:18081;
}
upstream nexus_docker_group {
    server 10.11.1.13:18082;
}

server {
  listen 443 ssl http2;
  listen 80;
  server_name nexus.opsbugs.com;
  ssl_certificate /etc/nginx/cert/6172143_nexus.opsbugs.com.pem;
  ssl_certificate_key /etc/nginx/cert/6172143_nexus.opsbugs.com.key;
  client_max_body_size 10G;
  location / {
    proxy_pass http://nexus_website;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto "https";
  }
}

server {
  listen 443 ssl http2;
  listen 80;
  server_name repo.opsbugs.com;
  ssl_certificate /etc/nginx/cert/6174303_repo.opsbugs.com.pem;
  ssl_certificate_key /etc/nginx/cert/6174303_repo.opsbugs.com.key;
  client_max_body_size 10G;
  chunked_transfer_encoding on;
  set $upstream "nexus_docker_hosted";
  if ( $request_method ~* 'GET') {
    set $upstream "nexus_docker_group";
  }
  if ($request_uri ~ '/search') {
    set $upstream "nexus_docker_hosted";
  }
  location / {
    proxy_pass http://$upstream;
    proxy_set_header Host $host;
    proxy_connect_timeout 3600;
    proxy_send_timeout 3600;
    proxy_read_timeout 3600;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_buffering off;
    proxy_request_buffering off;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto http;
  }
}

3、集成LDAP

字段 内容
Name AD
LDAP server address ldap://10.11.10.1:389
Search Base DN ou=opsbugs,dc=opsbugs,dc=com
Authentication method Simple Authenticaition
Username or DN Administrator@opsbugs.com
Password
Conflguration template Active Directory
User relative DN
User filter (&(|(objectclass=person))(|(|(memberof=CN=运维,OU=运维,OU=opsbugs,DC=opsbugs,DC=com))))

部署helm仓库

# 添加仓库
helm repo add opsbugshttps://nexus.opsbugs.com/repository/charts/
helm repo add bitnami https://charts.bitnami.com/bitnami

# 下载charts
helm pull bitnami/postgresql-ha

# 安装插件
helm plugin install --version master https://github.com/sonatype-nexus-community/helm-nexus-push.git

# 上传charts
helm nexus-push opsbugs postgresql-ha-8.6.11.tgz -u xxx -p xxx

#打包并上传
helm package ray/
helm nexus-push opsbugs ray-0.1.0.tgz -u xxx -p xxxx