කේත ප්‍රවේශය ලෙස යටිතල පහසුකම් භාවිතා කරමින් Nexus Sonatype ස්ථාපනය කිරීම සහ වින්‍යාස කිරීම

Sonatype Nexus යනු සංවර්ධකයින්ට Java (Maven) පරායත්තතා, Docker, Python, Ruby, NPM, Bower images, RPM පැකේජ, gitlfs, Apt, Go, Nuget, සහ ඔවුන්ගේ මෘදුකාංග ආරක්ෂාව බෙදා හැරීම සඳහා ප්‍රොක්සි කිරීමට, ගබඩා කිරීමට සහ කළමනාකරණය කිරීමට හැකි ඒකාබද්ධ වේදිකාවකි.

ඔබට Sonatype Nexus අවශ්‍ය වන්නේ ඇයි?

  • පුද්ගලික පුරාවස්තු ගබඩා කිරීම සඳහා;
  • අන්තර්ජාලයෙන් බාගත කරන ලද පුරාවස්තු හැඹිලි කිරීම සඳහා;

මූලික Sonatype Nexus පැකේජයේ සහාය දක්වන පුරාවස්තු:

  • ජාවා, මාවන් (භාජනය)
  • Docker
  • පයිතන් (පයිප්)
  • රූබි (මැණික්)
  • එන්පීඑම්
  • බෝවර්
  • Yum (rpm)
  • gitlfs
  • අමු
  • Apt (deb)
  • Go
  • නුගට්

ප්‍රජා ආධාරක කෞතුක වස්තු:

  • සංයුක්තය
  • සත්ව කරුණාව
  • CPAN
  • ELPA
  • හෙල්ම්
  • P2
  • R

භාවිතා කරමින් Sonatype Nexus ස්ථාපනය කිරීම https://github.com/ansible-ThoTeam/nexus3-oss

අවශ්යතා

  • අන්තර්ජාලයේ ඇන්සිබල් භාවිතා කිරීම ගැන කියවන්න.
  • ඇන්සිබල් ස්ථාපනය කරන්න pip install ansible Playbook ධාවනය වන වැඩපොළේ.
  • සකසන්න geerlingguy.java Playbook ධාවනය වන වැඩපොළේ.
  • සකසන්න geerlingguy.apache Playbook ධාවනය වන වැඩපොළේ.
  • මෙම භූමිකාව CentOS 7, Ubuntu Xenial (16.04) සහ Bionic (18.04), Debian Jessie සහ Stretch මත පරීක්ෂා කර ඇත.
  • jmespath පුස්තකාලය ක්‍රීඩා පොත ක්‍රියාත්මක වන වැඩපොළේ ස්ථාපනය කළ යුතුය. ස්ථාපනය සඳහා: sudo pip install -r requirements.txt
  • playbook ගොනුව (පහත උදාහරණය) nexus.yml ගොනුව වෙත සුරකින්න
  • nexus ස්ථාපනය ධාවනය කරන්න ansible-playbook -i host nexus.yml

Maven (java), Docker, Python, Ruby, NPM, Bower, RPM සහ gitlfs repositories සමඟ LDAP නොමැතිව nexus ස්ථාපනය කිරීම සඳහා ansible-playbook උදාහරණය.

---
- name: Nexus
  hosts: nexus
  become: yes

  vars:
    nexus_timezone: 'Asia/Omsk'
    nexus_admin_password: "admin123"
    nexus_public_hostname: 'apatsev-nexus-playbook'
    httpd_setup_enable: false
    nexus_privileges:
      - name: all-repos-read
        description: 'Read & Browse access to all repos'
        repository: '*'
        actions:
          - read
          - browse
      - name: company-project-deploy
        description: 'Deployments to company-project'
        repository: company-project
        actions:
          - add
          - edit
    nexus_roles:
      - id: Developpers # maps to the LDAP group
        name: developers
        description: All developers
        privileges:
          - nx-search-read
          - all-repos-read
          - company-project-deploy
        roles: []
    nexus_local_users:
      - username: jenkins # used as key to update
        first_name: Jenkins
        last_name: CI
        email: [email protected]
        password: "s3cr3t"
        roles:
          - Developpers # role ID here
    nexus_blobstores:
      - name: company-artifacts
        path: /var/nexus/blobs/company-artifacts
    nexus_scheduled_tasks:
      - name: compact-blobstore
        cron: '0 0 22 * * ?'
        typeId: blobstore.compact
        taskProperties:
          blobstoreName: 'company-artifacts'

    nexus_repos_maven_proxy:
      - name: central
        remote_url: 'https://repo1.maven.org/maven2/'
        layout_policy: permissive
      - name: jboss
        remote_url: 'https://repository.jboss.org/nexus/content/groups/public-jboss/'
      - name: vaadin-addons
        remote_url: 'https://maven.vaadin.com/vaadin-addons/'
      - name: jaspersoft
        remote_url: 'https://jaspersoft.artifactoryonline.com/jaspersoft/jaspersoft-repo/'
        version_policy: mixed
    nexus_repos_maven_hosted:
      - name: company-project
        version_policy: mixed
        write_policy: allow
        blob_store: company-artifacts
    nexus_repos_maven_group:
      - name: public
        member_repos:
          - central
          - jboss
          - vaadin-addons
          - jaspersoft

    # Yum. Change nexus_config_yum to true for create yum repository
    nexus_config_yum: true
    nexus_repos_yum_hosted:
      - name: private_yum_centos_7
        repodata_depth: 1
    nexus_repos_yum_proxy:
      - name: epel_centos_7_x86_64
        remote_url: http://download.fedoraproject.org/pub/epel/7/x86_64
        maximum_component_age: -1
        maximum_metadata_age: -1
        negative_cache_ttl: 60
      - name: centos-7-os-x86_64
        remote_url: http://mirror.centos.org/centos/7/os/x86_64/
        maximum_component_age: -1
        maximum_metadata_age: -1
        negative_cache_ttl: 60
    nexus_repos_yum_group:
      - name: yum_all
        member_repos:
          - private_yum_centos_7
          - epel_centos_7_x86_64

    # NPM. Change nexus_config_npm to true for create npm repository
    nexus_config_npm: true
    nexus_repos_npm_hosted: []
    nexus_repos_npm_group:
      - name: npm-public
        member_repos:
          - npm-registry
    nexus_repos_npm_proxy:
      - name: npm-registry
        remote_url: https://registry.npmjs.org/
        negative_cache_enabled: false

    # Docker. Change nexus_config_docker to true for create docker repository
    nexus_config_docker: true
    nexus_repos_docker_hosted:
      - name: docker-hosted
        http_port: "{{ nexus_docker_hosted_port }}"
        v1_enabled: True
    nexus_repos_docker_proxy:
      - name: docker-proxy
        http_port: "{{ nexus_docker_proxy_port }}"
        v1_enabled: True
        index_type: "HUB"
        remote_url: "https://registry-1.docker.io"
        use_nexus_certificates_to_access_index: false
        maximum_component_age: 1440
        maximum_metadata_age: 1440
        negative_cache_enabled: true
        negative_cache_ttl: 1440
    nexus_repos_docker_group:
      - name: docker-group
        http_port: "{{ nexus_docker_group_port }}"
        v1_enabled: True
        member_repos:
          - docker-hosted
          - docker-proxy

    # Bower. Change nexus_config_bower to true for create bower repository
    nexus_config_bower: true
    nexus_repos_bower_hosted:
      - name: bower-hosted
    nexus_repos_bower_proxy:
      - name: bower-proxy
        index_type: "proxy"
        remote_url: "https://registry.bower.io"
        use_nexus_certificates_to_access_index: false
        maximum_component_age: 1440
        maximum_metadata_age: 1440
        negative_cache_enabled: true
        negative_cache_ttl: 1440
    nexus_repos_bower_group:
      - name: bower-group
        member_repos:
          - bower-hosted
          - bower-proxy

    # Pypi. Change nexus_config_pypi to true for create pypi repository
    nexus_config_pypi: true
    nexus_repos_pypi_hosted:
      - name: pypi-hosted
    nexus_repos_pypi_proxy:
      - name: pypi-proxy
        index_type: "proxy"
        remote_url: "https://pypi.org/"
        use_nexus_certificates_to_access_index: false
        maximum_component_age: 1440
        maximum_metadata_age: 1440
        negative_cache_enabled: true
        negative_cache_ttl: 1440
    nexus_repos_pypi_group:
      - name: pypi-group
        member_repos:
          - pypi-hosted
          - pypi-proxy

    # rubygems. Change nexus_config_rubygems to true for create rubygems repository
    nexus_config_rubygems: true
    nexus_repos_rubygems_hosted:
      - name: rubygems-hosted
    nexus_repos_rubygems_proxy:
      - name: rubygems-proxy
        index_type: "proxy"
        remote_url: "https://rubygems.org"
        use_nexus_certificates_to_access_index: false
        maximum_component_age: 1440
        maximum_metadata_age: 1440
        negative_cache_enabled: true
        negative_cache_ttl: 1440
    nexus_repos_rubygems_group:
      - name: rubygems-group
        member_repos:
          - rubygems-hosted
          - rubygems-proxy

    # gitlfs. Change nexus_config_gitlfs to true for create gitlfs repository
    nexus_config_gitlfs: true
    nexus_repos_gitlfs_hosted:
      - name: gitlfs-hosted

  roles:
    - { role: geerlingguy.java }
    # Debian/Ubuntu only
    # - { role: geerlingguy.apache, apache_create_vhosts: no, apache_mods_enabled: ["proxy_http.load", "headers.load"], apache_remove_default_vhost: true, tags: ["geerlingguy.apache"] }
    # RedHat/CentOS only
    - { role: geerlingguy.apache, apache_create_vhosts: no, apache_remove_default_vhost: true, tags: ["geerlingguy.apache"] }
    - { role: ansible-thoteam.nexus3-oss, tags: ['ansible-thoteam.nexus3-oss'] }

තිර දර්ශන:

කේත ප්‍රවේශය ලෙස යටිතල පහසුකම් භාවිතා කරමින් Nexus Sonatype ස්ථාපනය කිරීම සහ වින්‍යාස කිරීම

කේත ප්‍රවේශය ලෙස යටිතල පහසුකම් භාවිතා කරමින් Nexus Sonatype ස්ථාපනය කිරීම සහ වින්‍යාස කිරීම

විචල්ය භූමිකාවන්

භූමිකාව විචල්යයන්

පෙරනිමි අගයන් සහිත විචල්‍ය (බලන්න default/main.yml):

සාමාන්ය විචල්යයන්

    nexus_version: ''
    nexus_timezone: 'UTC'

පෙරනිමියෙන්, භූමිකාව Nexus හි පවතින නවතම අනුවාදය ස්ථාපනය කරනු ඇත. විචල්‍යය වෙනස් කිරීමෙන් ඔබට අනුවාදය නිවැරදි කළ හැකිය nexus_version. ලබා ගත හැකි අනුවාද බලන්න https://www.sonatype.com/download-oss-sonatype.

ඔබ නව අනුවාදයකට වෙනස් වුවහොත්, භූමිකාව ඔබගේ Nexus ස්ථාපනය යාවත්කාලීන කිරීමට උත්සාහ කරයි.

ඔබ Nexus හි නවතම අනුවාදයට වඩා පැරණි අනුවාදයක් භාවිතා කරන්නේ නම්, ඔබ ස්ථාපිත නිකුතුවේ නොමැති විශේෂාංග භාවිතා නොකරන බවට සහතික විය යුතුය (උදාහරණයක් ලෙස, 3.8.0, git lfs repo වඩා වැඩි nexus සඳහා yum repositories සත්කාරකත්වය ලබා ගත හැක. 3.3.0 ට වැඩි nexus සඳහා යනාදිය)

nexus timezone Nexus_scheduled කාර්යයන් සඳහා පහත ක්‍රෝන් ප්‍රකාශන සමඟ ඒකාබද්ධව ප්‍රයෝජනවත් විය හැකි Java වේලා කලාපයේ නම වේ.

Nexus වරාය සහ සන්දර්භය මාර්ගය

    nexus_default_port: 8081
    nexus_default_context_path: '/'

ජාවා සම්බන්ධතා ක්‍රියාවලියේ වරාය සහ සන්දර්භය මාර්ගය. nexus_default_context_path එය සකසන විට ඉදිරි කැපුමක් අඩංගු විය යුතුය, උදා: nexus_default_context_path: '/nexus/'.

Nexus OS පරිශීලක සහ කණ්ඩායම

    nexus_os_group: 'nexus'
    nexus_os_user: 'nexus'

Nexus ගොනු හිමිකර ගැනීමට සහ සේවාව ක්‍රියාත්මක කිරීමට භාවිතා කරන පරිශීලකයා සහ කණ්ඩායම එකක් අස්ථානගත වී ඇත්නම් භූමිකාව විසින් නිර්මාණය කරනු ලැබේ.

    nexus_os_user_home_dir: '/home/nexus'

nexus පරිශීලකයා සඳහා පෙරනිමි නිවාස නාමාවලිය වෙනස් කිරීමට ඉඩ දෙන්න

Nexus අවස්ථා නාමාවලි

    nexus_installation_dir: '/opt'
    nexus_data_dir: '/var/nexus'
    nexus_tmp_dir: "{{ (ansible_os_family == 'RedHat') | ternary('/var/nexus-tmp', '/tmp/nexus') }}"

Nexus නාමාවලි.

  • nexus_installation_dir ස්ථාපිත ක්‍රියාත්මක කළ හැකි ගොනු අඩංගු වේ
  • nexus_data_dir සියලුම වින්‍යාස කිරීම්, ගබඩාවන් සහ බාගත කළ පුරාවස්තු අඩංගු වේ. අභිරුචි බ්ලොබ්ස්ටෝර් මාර්ග nexus_data_dir අභිරුචිකරණය කළ හැකිය, පහත බලන්න nexus_blobstores.
  • nexus_tmp_dir සියලුම තාවකාලික ගොනු අඩංගු වේ. redhat සඳහා පෙරනිමි මාර්ගය ගෙන ගොස් ඇත /tmp ස්වයංක්‍රීය පිරිසිදු කිරීමේ ක්‍රියා පටිපාටි සමඟ ඇති විය හැකි ගැටළු මඟහරවා ගැනීමට. #168 බලන්න.

Nexus JVM මතක භාවිතය වින්‍යාස කිරීම

    nexus_min_heap_size: "1200M"
    nexus_max_heap_size: "{{ nexus_min_heap_size }}"
    nexus_max_direct_memory: "2G"

මේවා Nexus සඳහා පෙරනිමි සැකසුම් වේ. කරුණාකර මෙම අගයන් වෙනස් නොකරන්න ඔබ කියවා නොමැති නම් nexus පද්ධති අවශ්‍යතා මතක කොටස සහ ඔවුන් කරන්නේ කුමක්ද යන්න තේරෙන්නේ නැත.

දෙවන අනතුරු ඇඟවීමක් ලෙස, ඉහත ලේඛනයේ උපුටනයක් මෙන්න:

කාර්ය සාධනය වැඩි දියුණු කිරීමේ උත්සාහයක් ලෙස නිර්දේශිත අගයන් ඉක්මවා JVM ගොඩ මතකය වැඩි කිරීම නිර්දේශ නොකරයි. මෙය ඇත්ත වශයෙන්ම ප්රතිවිරුද්ධ බලපෑමක් ඇති කළ හැකි අතර, මෙහෙයුම් පද්ධතිය සඳහා අනවශ්ය වැඩ ඇති විය හැක.

පරිපාලක මුරපදය

    nexus_admin_password: 'changeme'

පිහිටුවීම සඳහා "පරිපාලක" ගිණුම් මුරපදය. මෙය ක්‍රියාත්මක වන්නේ පළමු පෙරනිමි ස්ථාපනයේදී පමණි. ඔබට පසුව භූමිකාවක් භාවිතයෙන් එය වෙනස් කිරීමට අවශ්‍ය නම් කරුණාකර [පළමු ස්ථාපනයෙන් පසු පරිපාලක මුරපදය වෙනස් කරන්න](# change-admin-password-after-first-install) බලන්න.

ඔබගේ මුරපදය ක්‍රීඩා පොතේ පැහැදිලි පෙළෙහි ගබඩා නොකිරීමට තරයේ නිර්දේශ කරනු ලැබේ, නමුත් [ansible-vault encryption] (https://docs.ansible.com/ansible/latest/user_guide/vault.html) (එක්කෝ පේළිගතව හෝ වෙනම ගොනුවක් තුළ පූරණය කර ඇත. උදා: include_vars)

පෙරනිමියෙන් නිර්නාමික ප්රවේශය

    nexus_anonymous_access: false

නිර්නාමික ප්‍රවේශය පෙරනිමියෙන් අබල කර ඇත. ගැන වැඩිදුර කියවන්න නිර්නාමික ප්රවේශය.

පොදු සත්කාරක නාමය

    nexus_public_hostname: 'nexus.vm'
    nexus_public_scheme: https

Nexus අවස්ථාව එහි සේවාලාභීන්ට ලබා ගත හැකි සම්පූර්ණ සුදුසුකම් ලත් වසම් නාමය සහ යෝජනා ක්‍රමය (https හෝ http).

මෙම භූමිකාව සඳහා API ප්රවේශය

    nexus_api_hostname: localhost
    nexus_api_scheme: http
    nexus_api_validate_certs: "{{ nexus_api_scheme == 'https' }}"
    nexus_api_context_path: "{{ nexus_default_context_path }}"
    nexus_api_port: "{{ nexus_default_port }}"

මෙම විචල්‍යයන් ප්‍රතිපාදන සඳහා භූමිකාව Nexus API වෙත සම්බන්ධ වන ආකාරය පාලනය කරයි.
උසස් පරිශීලකයින් සඳහා පමණි. ඔබට මෙම පෙරනිමි සැකසුම් වෙනස් කිරීමට අවශ්‍ය නොවනු ඇත

ප්‍රතිලෝම ප්‍රොක්සියක් සැකසීම

    httpd_setup_enable: false
    httpd_server_name: "{{ nexus_public_hostname }}"
    httpd_default_admin_email: "[email protected]"
    httpd_ssl_certificate_file: 'files/nexus.vm.crt'
    httpd_ssl_certificate_key_file: 'files/nexus.vm.key'
    # httpd_ssl_certificate_chain_file: "{{ httpd_ssl_certificate_file }}"
    httpd_copy_ssl_files: true

සකසන්න SSL Reverse Proxy.
මෙය සිදු කිරීම සඳහා ඔබ httpd ස්ථාපනය කළ යුතුය. සටහන: කවදාද httpd_setup_enable අගය සකසන්නtrue, nexus සම්බන්ධතා 127.0.0.1:8081, මේ අනුව නෑ බාහිර IP ලිපිනයෙන් HTTP port 8081 හරහා සෘජුවම ප්‍රවේශ විය හැක.

භාවිතා කරන පෙරනිමි සත්කාරක නාමය වේ nexus_public_hostname. කිසියම් හේතුවක් නිසා ඔබට විවිධ නම් අවශ්ය නම්, ඔබට සැකසිය හැක httpd_server_name වෙනත් අර්ථයක් සමඟ.

С httpd_copy_ssl_files: true (පෙරනිමියෙන්) ඉහත සහතික ඔබේ ප්ලේබුක් නාමාවලියෙහි තිබිය යුතු අතර ඒවා සේවාදායකයට පිටපත් කර apache හි වින්‍යාස කෙරේ.

ඔබට සේවාදායකයේ පවතින සහතික භාවිතා කිරීමට අවශ්‍ය නම්, ස්ථාපනය කරන්න httpd_copy_ssl_files: false සහ පහත විචල්‍යයන් සපයන්න:

    # These specifies to the vhost where to find on the remote server file
    # system the certificate files.
    httpd_ssl_cert_file_location: "/etc/pki/tls/certs/wildcard.vm.crt"
    httpd_ssl_cert_key_location: "/etc/pki/tls/private/wildcard.vm.key"
    # httpd_ssl_cert_chain_file_location: "{{ httpd_ssl_cert_file_location }}"

httpd_ssl_cert_chain_file_location වෛකල්පිත වන අතර ඔබට දාම ගොනුව අභිරුචිකරණය කිරීමට අවශ්‍ය නැතිනම් එය නොසකසා තැබිය යුතුය

    httpd_default_admin_email: "[email protected]"

පෙරනිමි පරිපාලක ඊමේල් ලිපිනය සකසන්න

LDAP වින්‍යාසය

LDAP සම්බන්ධතා සහ ආරක්ෂක ක්ෂේත්‍රය පෙරනිමියෙන් අබල කර ඇත

    nexus_ldap_realm: false
    ldap_connections: []

LDAP සම්බන්ධතා, සෑම අංගයක්ම මේ ආකාරයට පෙනේ:

    nexus_ldap_realm: true
    ldap_connections:
      - ldap_name: 'My Company LDAP' # used as a key to update the ldap config
        ldap_protocol: 'ldaps' # ldap or ldaps
        ldap_hostname: 'ldap.mycompany.com'
        ldap_port: 636
        ldap_use_trust_store: false # Wether or not to use certs in the nexus trust store
        ldap_search_base: 'dc=mycompany,dc=net'
        ldap_auth: 'none' # or simple
        ldap_auth_username: 'username' # if auth = simple
        ldap_auth_password: 'password' # if auth = simple
        ldap_user_base_dn: 'ou=users'
        ldap_user_filter: '(cn=*)' # (optional)
        ldap_user_object_class: 'inetOrgPerson'
        ldap_user_id_attribute: 'uid'
        ldap_user_real_name_attribute: 'cn'
        ldap_user_email_attribute: 'mail'
        ldap_user_subtree: false
        ldap_map_groups_as_roles: false
        ldap_group_base_dn: 'ou=groups'
        ldap_group_object_class: 'posixGroup'
        ldap_group_id_attribute: 'cn'
        ldap_group_member_attribute: 'memberUid'
        ldap_group_member_format: '${username}'
        ldap_group_subtree: false

නිර්නාමික සත්‍යාපනය සඳහා උදාහරණ LDAP වින්‍යාසය (නිර්නාමික බැඳීම), මෙයද "අවම" වින්‍යාසයකි:

    nexus_ldap_realm: true
    ldap_connection:
      - ldap_name: 'Simplest LDAP config'
        ldap_protocol: 'ldaps'
        ldap_hostname: 'annuaire.mycompany.com'
        ldap_search_base: 'dc=mycompany,dc=net'
        ldap_port: 636
        ldap_use_trust_store: false
        ldap_user_id_attribute: 'uid'
        ldap_user_real_name_attribute: 'cn'
        ldap_user_email_attribute: 'mail'
        ldap_user_object_class: 'inetOrgPerson'

සරල සත්‍යාපනය සඳහා උදාහරණ LDAP වින්‍යාසය (DSA ගිණුම භාවිතා කරමින්):

    nexus_ldap_realm: true
    ldap_connections:
      - ldap_name: 'LDAP config with DSA'
        ldap_protocol: 'ldaps'
        ldap_hostname: 'annuaire.mycompany.com'
        ldap_port: 636
        ldap_use_trust_store: false
        ldap_auth: 'simple'
        ldap_auth_username: 'cn=mynexus,ou=dsa,dc=mycompany,dc=net'
        ldap_auth_password: "{{ vault_ldap_dsa_password }}" # better keep passwords in an ansible vault
        ldap_search_base: 'dc=mycompany,dc=net'
        ldap_user_base_dn: 'ou=users'
        ldap_user_object_class: 'inetOrgPerson'
        ldap_user_id_attribute: 'uid'
        ldap_user_real_name_attribute: 'cn'
        ldap_user_email_attribute: 'mail'
        ldap_user_subtree: false

සරල සත්‍යාපනය සඳහා උදාහරණ LDAP වින්‍යාසය (DSA ගිණුම භාවිතා කරමින්) + භූමිකා ලෙස සිතියම්ගත කර ඇති කණ්ඩායම්:

    nexus_ldap_realm: true
    ldap_connections
      - ldap_name: 'LDAP config with DSA'
        ldap_protocol: 'ldaps'
        ldap_hostname: 'annuaire.mycompany.com'
        ldap_port: 636
        ldap_use_trust_store: false
        ldap_auth: 'simple'
        ldap_auth_username: 'cn=mynexus,ou=dsa,dc=mycompany,dc=net'
        ldap_auth_password: "{{ vault_ldap_dsa_password }}" # better keep passwords in an ansible vault
        ldap_search_base: 'dc=mycompany,dc=net'
        ldap_user_base_dn: 'ou=users'
        ldap_user_object_class: 'inetOrgPerson'
        ldap_user_id_attribute: 'uid'
        ldap_user_real_name_attribute: 'cn'
        ldap_user_email_attribute: 'mail'
        ldap_map_groups_as_roles: true
        ldap_group_base_dn: 'ou=groups'
        ldap_group_object_class: 'groupOfNames'
        ldap_group_id_attribute: 'cn'
        ldap_group_member_attribute: 'member'
        ldap_group_member_format: 'uid=${username},ou=users,dc=mycompany,dc=net'
        ldap_group_subtree: false

සරල සත්‍යාපනය සඳහා උදාහරණ LDAP වින්‍යාසය (DSA ගිණුම භාවිතා කරමින්) + කණ්ඩායම් ගතිකව භූමිකා ලෙස සිතියම්ගත කර ඇත:

    nexus_ldap_realm: true
    ldap_connections:
      - ldap_name: 'LDAP config with DSA'
        ldap_protocol: 'ldaps'
        ldap_hostname: 'annuaire.mycompany.com'
        ldap_port: 636
        ldap_use_trust_store: false
        ldap_auth: 'simple'
        ldap_auth_username: 'cn=mynexus,ou=dsa,dc=mycompany,dc=net'
        ldap_auth_password: "{{ vault_ldap_dsa_password }}" # better keep passwords in an ansible vault
        ldap_search_base: 'dc=mycompany,dc=net'
        ldap_user_base_dn: 'ou=users'
        ldap_user_object_class: 'inetOrgPerson'
        ldap_user_id_attribute: 'uid'
        ldap_user_real_name_attribute: 'cn'
        ldap_user_email_attribute: 'mail'
        ldap_map_groups_as_roles: true
        ldap_map_groups_as_roles_type: 'dynamic'
        ldap_user_memberof_attribute: 'memberOf'

වරප්‍රසාද

    nexus_privileges:
      - name: all-repos-read # used as key to update a privilege
        # type: <one of application, repository-admin, repository-content-selector, repository-view, script or wildcard>
        description: 'Read & Browse access to all repos'
        repository: '*'
        actions: # can be add, browse, create, delete, edit, read or  * (all)
          - read
          - browse
        # pattern: pattern
        # domain: domain
        # script_name: name

ලැයිස්තුව වරප්රසාද සැකසුම් සඳහා. වරප්‍රසාද වර්ගය අනුව සැකසිය යුතු විචල්‍යයන් පරීක්ෂා කිරීමට ලේඛන සහ GUI බලන්න.

මෙම මූලද්රව්ය පහත පෙරනිමි අගයන් සමඟ සංයුක්ත වේ:

    _nexus_privilege_defaults:
      type: repository-view
      format: maven2
      actions:
        - read

භූමිකාවන් (Nexus ඇතුළත මෙයින් අදහස් වේ)

    nexus_roles:
      - id: Developpers # can map to a LDAP group id, also used as a key to update a role
        name: developers
        description: All developers
        privileges:
          - nx-search-read
          - all-repos-read
        roles: [] # references to other role names

ලැයිස්තුව භූමිකාවන් සැකසුම් සඳහා.

පරිශීලකයින්

    nexus_local_users: []
      # - username: jenkins # used as key to update
      #   state: present # default value if ommited, use 'absent' to remove user
      #   first_name: Jenkins
      #   last_name: CI
      #   email: [email protected]
      #   password: "s3cr3t"
      #   roles:
      #     - developers # role ID

Nexus තුළ නිර්මාණය කිරීමට දේශීය (LDAP නොවන) පරිශීලකයන්/ගිණුම් ලැයිස්තුව.

Nexus හි නිර්මාණය කිරීමට දේශීය (LDAP නොවන) පරිශීලකයින්/ගිණුම් ලැයිස්තුව.

      nexus_ldap_users: []
      # - username: j.doe
      #   state: present
      #   roles:
      #     - "nx-admin"

පරිශීලකයන්/භූමිකාවන් Ldap සිතියම්ගත කිරීම. රජයේ absent දැනටමත් පවතින පරිශීලකයෙකුගෙන් භූමිකාවන් ඉවත් කරනු ඇත.
Ldap භාවිතා කරන්නන් මකා නොදමනු ලැබේ. නොපවතින පරිශීලකයෙකු සඳහා භූමිකාවක් සැකසීමට උත්සාහ කිරීම දෝෂයකට තුඩු දෙනු ඇත.

අන්තර්ගත තේරීම් කරන්නන්

  nexus_content_selectors:
  - name: docker-login
    description: Selector for docker login privilege
    search_expression: format=="docker" and path=~"/v2/"

අන්තර්ගත තේරීම පිළිබඳ වැඩි විස්තර සඳහා, බලන්න ලේඛනගත කිරීම.

අන්තර්ගත තේරීම්කාරකය භාවිතා කිරීමට, සමඟ නව වරප්‍රසාදයක් එක් කරන්න type: repository-content-selector සහ අදාළcontentSelector

- name: docker-login-privilege
  type: repository-content-selector
  contentSelector: docker-login
  description: 'Login to Docker registry'
  repository: '*'
  actions:
  - read
  - browse

බ්ලොබ්ස්ටෝර් සහ ගබඩා

    nexus_delete_default_repos: false

nexus ස්ථාපන ආරම්භක පෙරනිමි වින්‍යාසයෙන් ගබඩාවන් මකන්න. මෙම පියවර ක්‍රියාත්මක වන්නේ පළමු වරට ස්ථාපනය කිරීමේදී පමණි (කවදා nexus_data_dir හිස් බව හඳුනාගෙන ඇත).

Nexus සඳහා පෙරනිමි පෙරනිමි වින්‍යාසයෙන් ගබඩාවන් ඉවත් කිරීම. මෙම පියවර සිදු කරනු ලබන්නේ පළමු ස්ථාපනය අතරතුර පමණි (කවදා nexus_data_dir හිස්).

    nexus_delete_default_blobstore: false

nexus ස්ථාපන ආරම්භක පෙරනිමි වින්‍යාසයෙන් පෙරනිමි බ්ලොබ්ස්ටෝර් එක මකන්න. මෙය කළ හැක්කේ නම් පමණි nexus_delete_default_repos: true සහ සියලුම වින්‍යාසගත ගබඩාවලට (පහත බලන්න) පැහැදිලි බවක් ඇත blob_store: custom. මෙම පියවර ක්‍රියාත්මක වන්නේ පළමු වරට ස්ථාපනය කිරීමේදී පමණි (කවදා nexus_data_dir හිස් බව හඳුනාගෙන ඇත).

බ්ලොබ් ආචයනය ඉවත් කිරීම (ද්විමය කෞතුක වස්තු) මූලික වින්‍යාසයෙන් පෙරනිමියෙන් අක්‍රීය කර ඇත. බ්ලොබ් ගබඩාව (ද්විමය කෞතුක වස්තු) ඉවත් කිරීමට, අක්රිය කරන්න nexus_delete_default_repos: true. මෙම පියවර සිදු කරනු ලබන්නේ පළමු ස්ථාපනය අතරතුර පමණි (කවදා nexus_data_dir හිස්).

    nexus_blobstores: []
    # example blobstore item :
    # - name: separate-storage
    #   type: file
    #   path: /mnt/custom/path
    # - name: s3-blobstore
    #   type: S3
    #   config:
    #     bucket: s3-blobstore
    #     accessKeyId: "{{ VAULT_ENCRYPTED_KEY_ID }}"
    #     secretAccessKey: "{{ VAULT_ENCRYPTED_ACCESS_KEY }}"

බ්ලොබ්ස්ටෝර්ස් නිර්මාණය කිරීමට. බ්ලොබ්ස්ටෝර් මාර්ගයක් සහ ගබඩා බ්ලොබ්ස්ටෝරයක් මූලික නිර්මාණයෙන් පසුව යාවත්කාලීන කළ නොහැක (මෙහි ඕනෑම යාවත්කාලීනයක් නැවත ප්‍රතිපාදන කිරීමේදී නොසලකා හරිනු ඇත).

S3 මත blobstore වින්‍යාස කිරීම පහසුවක් ලෙස සපයනු ලබන අතර එය අප ට්‍රැවිස් මත ධාවනය කරන ස්වයංක්‍රීය පරීක්ෂණවල කොටසක් නොවේ. S3 මත ගබඩා කිරීම නිර්දේශ කරනුයේ AWS හි යොදවා ඇති අවස්ථා සඳහා පමණක් බව කරුණාවෙන් සලකන්න.

නිර්මාණය බ්ලොබ්ස්ටෝර්ස්. ආරම්භක නිර්මාණයෙන් පසු ගබඩා මාර්ගය සහ ගබඩා ගබඩාව යාවත්කාලීන කළ නොහැක (මෙහි ඕනෑම යාවත්කාලීනයක් නැවත ස්ථාපනය කරන විට නොසලකා හරිනු ඇත).

S3 මත බ්ලොබ් ගබඩාව සැකසීම පහසුවක් ලෙස සපයනු ලැබේ. S3 ආචයනය නිර්දේශ කරනු ලබන්නේ AWS හි යොදවා ඇති අවස්ථා සඳහා පමණක් බව කරුණාවෙන් සලකන්න.

    nexus_repos_maven_proxy:
      - name: central
        remote_url: 'https://repo1.maven.org/maven2/'
        layout_policy: permissive
        # maximum_component_age: -1
        # maximum_metadata_age: 1440
        # negative_cache_enabled: true
        # negative_cache_ttl: 1440
      - name: jboss
        remote_url: 'https://repository.jboss.org/nexus/content/groups/public-jboss/'
        # maximum_component_age: -1
        # maximum_metadata_age: 1440
        # negative_cache_enabled: true
        # negative_cache_ttl: 1440
    # example with a login/password :
    # - name: secret-remote-repo
    #   remote_url: 'https://company.com/repo/secure/private/go/away'
    #   remote_username: 'username'
    #   remote_password: 'secret'
    #   # maximum_component_age: -1
    #   # maximum_metadata_age: 1440
    #   # negative_cache_enabled: true
    #   # negative_cache_ttl: 1440

ඉහත දැක්වෙන්නේ උදාහරණ වින්‍යාසයකි ප්රොක්සි සේවාදායකය මේවන්.

    nexus_repos_maven_hosted:
      - name: private-release
        version_policy: release
        write_policy: allow_once  # one of "allow", "allow_once" or "deny"

මේවන් ධාරක ගබඩා වින්යාසය. සෘණ හැඹිලි වින්‍යාසය වෛකල්පිත වන අතර එය මඟ හැරියහොත් ඉහත අගයන්ට පෙරනිමි වේ.

වින්‍යාසය ධාරක ගබඩා මේවන්. සෘණ හැඹිලි වින්‍යාසය (-1) වෛකල්පිත වන අතර නිශ්චිතව දක්වා නොමැති නම් ඉහත අගයන්ට පෙරනිමි වේ.

    nexus_repos_maven_group:
      - name: public
        member_repos:
          - central
          - jboss

වින්‍යාසය කණ්ඩායම් මේවන්.

ගබඩා වර්ග තුනම පහත පෙරනිමි අගයන් සමඟ ඒකාබද්ධ වේ:

    _nexus_repos_maven_defaults:
      blob_store: default # Note : cannot be updated once the repo has been created
      strict_content_validation: true
      version_policy: release # release, snapshot or mixed
      layout_policy: strict # strict or permissive
      write_policy: allow_once # one of "allow", "allow_once" or "deny"
      maximum_component_age: -1  # Nexus gui default. For proxies only
      maximum_metadata_age: 1440  # Nexus gui default. For proxies only
      negative_cache_enabled: true # Nexus gui default. For proxies only
      negative_cache_ttl: 1440 # Nexus gui default. For proxies only

Docker, Pypi, Raw, Rubygems, Bower, NPM, Git-LFS සහ yum ගබඩා වර්ග:
බලන්න defaults/main.yml මෙම විකල්ප සඳහා:

Docker, Pypi, Raw, Rubygems, Bower, NPM, Git-LFS සහ yum ගබඩාවන් පෙරනිමියෙන් අබල කර ඇත:
බලන්න defaults/main.yml මෙම විකල්ප සඳහා:

      nexus_config_pypi: false
      nexus_config_docker: false
      nexus_config_raw: false
      nexus_config_rubygems: false
      nexus_config_bower: false
      nexus_config_npm: false
      nexus_config_gitlfs: false
      nexus_config_yum: false

ඔබට maven හැර වෙනත් ආකාරයේ ගබඩාවන් භාවිතා කිරීමට අවශ්‍ය නම් ඔබට ඇතැම් ආරක්ෂක විෂය පථයන් සක්‍රීය කිරීමට අවශ්‍ය විය හැකි බව කරුණාවෙන් සලකන්න. මෙය පෙරනිමියෙන් අසත්‍යයි

nexus_nuget_api_key_realm: false
nexus_npm_bearer_token_realm: false
nexus_docker_bearer_token_realm: false  # required for docker anonymous access

Remote User Realm ද භාවිතයෙන් සක්‍රීය කළ හැක

nexus_rut_auth_realm: true

සහ මාතෘකාව නිර්වචනය කිරීමෙන් අභිරුචිකරණය කළ හැකිය

nexus_rut_auth_header: "CUSTOM_HEADER"

නියමිත කාර්යයන්

    nexus_scheduled_tasks: []
    #  #  Example task to compact blobstore :
    #  - name: compact-docker-blobstore
    #    cron: '0 0 22 * * ?'
    #    typeId: blobstore.compact
    #    task_alert_email: [email protected]  # optional
    #    taskProperties:
    #      blobstoreName: {{ nexus_blob_names.docker.blob }} # all task attributes are stored as strings by nexus internally
    #  #  Example task to purge maven snapshots
    #  - name: Purge-maven-snapshots
    #    cron: '0 50 23 * * ?'
    #    typeId: repository.maven.remove-snapshots
    #    task_alert_email: [email protected]  # optional
    #    taskProperties:
    #      repositoryName: "*"  # * for all repos. Change to a repository name if you only want a specific one
    #      minimumRetained: "2"
    #      snapshotRetentionDays: "2"
    #      gracePeriodInDays: "2"
    #    booleanTaskProperties:
    #      removeIfReleased: true
    #  #  Example task to purge unused docker manifest and images
    #  - name: Purge unused docker manifests and images
    #    cron: '0 55 23 * * ?'
    #    typeId: "repository.docker.gc"
    #    task_alert_email: [email protected]  # optional
    #    taskProperties:
    #      repositoryName: "*"  # * for all repos. Change to a repository name if you only want a specific one
    #  #  Example task to purge incomplete docker uploads
    #  - name: Purge incomplete docker uploads
    #    cron: '0 0 0 * * ?'
    #    typeId: "repository.docker.upload-purge"
    #    task_alert_email: [email protected]  # optional
    #    taskProperties:
    #      age: "24"

නියමිත කාර්යයන් සැකසුම් සඳහා. typeId සහ කාර්යය විශේෂිතtaskProperties/booleanTaskProperties ඔබට අනුමාන කළ හැකිය:

  • ජාවා වර්ගයේ ධුරාවලියෙන් org.sonatype.nexus.scheduling.TaskDescriptorSupport
  • ඔබගේ බ්‍රවුසරයේ HTML කාර්ය නිර්මාණය කිරීමේ පෝරමය පරීක්ෂා කිරීම
  • කාර්යයක් අතින් සැකසීමේදී බ්‍රවුසරයේ AJAX ඉල්ලීම් බැලීමෙන්.

කාර්ය ගුණාංග ඒවායේ වර්ගය අනුව නිවැරදි yaml කොටසෙහි ප්‍රකාශ කළ යුතුය:

  • taskProperties සියලුම තන්තු ගුණාංග සඳහා (එනම් ගබඩා නාම, ගබඩා නාම, කාල පරිච්ඡේද...).
  • booleanTaskProperties සියලුම තාර්කික ගුණාංග සඳහා (එනම් ප්‍රධාන වශයෙන් nexus නිර්මාණය කිරීමේ කාර්යයේ GUI හි ඇති පිරික්සුම් කොටු).

උපස්ථ

      nexus_backup_configure: false
      nexus_backup_cron: '0 0 21 * * ?'  # See cron expressions definition in nexus create task gui
      nexus_backup_dir: '/var/nexus-backup'
      nexus_restore_log: '{{ nexus_backup_dir }}/nexus-restore.log'
      nexus_backup_rotate: false
      nexus_backup_rotate_first: false
      nexus_backup_keep_rotations: 4  # Keep 4 backup rotation by default (current + last 3)

ඔබ මාරු වන තුරු උපස්ථය වින්‍යාස නොකෙරේ nexus_backup_configure в true.
මෙම අවස්ථාවේදී, නියමිත ස්ක්‍රිප්ට් කාර්යය Nexus මත ධාවනය කිරීමට වින්‍යාස කෙරේ
හි නිශ්චිතව දක්වා ඇති පරතරය තුළ nexus_backup_cron (පෙරනිමිය සෑම දිනකම 21:00).
විස්තර සඳහා [මෙම කාර්යය සඳහා groovy අච්චුව](templates/backup.groovy.j2) බලන්න.
මෙම කාලසටහන්ගත කාර්යය අන් අයගෙන් ස්වාධීන වේ nexus_scheduled_tasksකුමන ඔබ
ඔබගේ ක්‍රීඩා පොතේ නිවේදනය කරන්න.

ඔබට උපස්ථ කරකවීමට/මැකීමට අවශ්‍ය නම්, ස්ථාපනය කරන්න nexus_backup_rotate: true සහ ඔබ භාවිතා කර සුරැකීමට කැමති උපස්ථ ගණන වින්‍යාස කරන්න nexus_backup_keep_rotations (පෙරනිමිය 4).

භ්‍රමණය භාවිතා කරන විට, ඔබට උපස්ථ ක්‍රියාවලියේදී අමතර තැටි ඉඩ ඉතිරි කර ගැනීමට අවශ්‍ය නම්,
ඔබට ස්ථාපනය කළ හැකිය nexus_backup_rotate_first: true. මෙය උපස්ථ කිරීමට පෙර පෙර-භ්‍රමණය/මැකීම වින්‍යාස කරනු ඇත. පෙරනිමියෙන්, උපස්ථයක් නිර්මාණය කිරීමෙන් පසුව භ්රමණය සිදු වේ. මෙම නඩුවේ පැරණි උපස්ථ බව කරුණාවෙන් සලකන්න
වත්මන් උපස්ථය සෑදීමට පෙර මකා දැමෙනු ඇත.

ප්රතිසාධන ක්රියා පටිපාටිය

පරාමිතිය සමඟ Playbook ධාවනය කරන්න -e nexus_restore_point=<YYYY-MM-dd-HH-mm-ss>
(උදාහරණයක් ලෙස, 2017-12-17-21-00-00 දෙසැම්බර් 17, 2017 සඳහා 21:00 ට

නෙක්සස් ඉවත් කිරීම

අවවාදයයි: මෙය ඔබගේ වත්මන් දත්ත සම්පූර්ණයෙන්ම මකනු ඇත. අවශ්‍ය නම් කලින් උපස්ථයක් සෑදීමට වග බලා ගන්න

විචල්‍යයක් භාවිතා කරන්න nexus_purgeඔබට මුල සිට නැවත ආරම්භ කිරීමට අවශ්‍ය නම් සහ සියලු දත්ත ඉවත් කර nexus අවස්ථාව නැවත ස්ථාපනය කරන්න.

ansible-playbook -i your/inventory.ini your_nexus_playbook.yml -e nexus_purge=true

පළමු ස්ථාපනයෙන් පසු පරිපාලක මුරපදය වෙනස් කරන්න

    nexus_default_admin_password: 'admin123'

මෙය ඔබගේ Playbook හි වෙනස් නොකළ යුතුය. මෙම විචල්‍යය මුලින්ම ස්ථාපනය කරන විට පෙරනිමි Nexus පරිපාලක මුරපදය සමඟින් පිරී ඇති අතර අපට පරිපාලක මුරපදය වෙනස් කළ හැකි බව සහතික කරයි nexus_admin_password.

පළමු ස්ථාපනයෙන් පසු ඔබට පරිපාලක මුරපදය වෙනස් කිරීමට අවශ්‍ය නම්, ඔබට එය තාවකාලිකව විධාන රේඛාවෙන් පැරණි මුරපදයට වෙනස් කළ හැකිය. වෙනස් කිරීමෙන් පසු nexus_admin_password ඔබගේ ක්‍රීඩා පොතේ ඔබට ධාවනය කළ හැක:

ansible-playbook -i your/inventory.ini your_playbook.yml -e nexus_default_admin_password=oldPassword

Nexus Sonatype හි ටෙලිග්‍රාම් නාලිකාව: https://t.me/ru_nexus_sonatype

සමීක්ෂණයට සහභාගී විය හැක්කේ ලියාපදිංචි පරිශීලකයින්ට පමණි. පුරන්නකරුණාකර.

ඔබ භාවිතා කරන කෞතුක භාණ්ඩ ගබඩා මොනවාද?

  • Sonatype Nexus නොමිලේ

  • Sonatype Nexus ගෙවා ඇත

  • කෘතිම කර්මාන්ත ශාලාව නොමිලේ

  • කෘතිම කර්මාන්තශාලා ගෙවා ඇත

  • වරාය

  • පල්ප්

පරිශීලකයින් 9 දෙනෙක් ඡන්දය දුන්හ. පරිශීලකයින් 3 දෙනෙක් ඡන්දය දීමෙන් වැළකී සිටියහ.

මූලාශ්රය: www.habr.com

අදහස් එක් කරන්න