Sonatype Nexus عبارة عن نظام أساسي متكامل يمكن للمطورين من خلاله إرسال وتوثيق وإدارة تبعيات Java (Maven) و Docker و Python و Ruby و NPM و Bower وحزم RPM و gitlfs و Apt و Go و Nuget وأيضًا توزيع البرامج الخاصة بهم البرمجيات.
لماذا أحتاج إلى Sonatype Nexus؟
- لتخزين القطع الأثرية الخاصة ؛
- للتخزين المؤقت للقطع الأثرية التي يتم تنزيلها من الإنترنت ؛
التحف المدعومة في الحزمة الأساسية Sonatype Nexus:
- جافا ، مافن (جرة)
- عامل ميناء
- بيثون (نقطة)
- روبي (جوهرة)
- الآلية الوقائية الوطنية
- كوخ ريفي
- يوم (دورة في الدقيقة)
- gitlfs
- الخام
- شقة (ديب)
- العودة
- Nuget
التحف المدعومة من المجتمع:
متطلبات
- اقرأ عن استخدام ansible على شبكة الإنترنت.
- قم بتركيب ansible
pip install ansible
على محطة العمل حيث يبدأ playbook. - قم بتثبيت geerlingguy.java على محطة العمل حيث يبدأ playbook.
- قم بتثبيت geerlingguy.apache على محطة العمل حيث يبدأ playbook.
- تم اختبار هذا الدور في CentOS 7 و Ubuntu Xenial (16.04) و Bionic (18.04) و Debian Jessie and Stretch
- يجب تثبيت مكتبة
jmespath
على محطة العمل التي يبدأ فيها playbook. لتثبيت ، قم بتشغيل sudo pip install -r requirements.txt
- احفظ ملف playbook (المثال أدناه) في ملف nexus.yml
- قم بتشغيل تثبيت nexus
ansible-playbook -i host nexus.yml
مثال anbook- playbook لتثبيت nexus بدون LDAP مع مستودعات Maven (java) و Docker و Python و Ruby و NPM و Bower و RPM و gitlfs.
--- - 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: support@company.com 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'] }
لقطات:


متغيرات الدور
متغيرات الدور
المتغيرات ذات القيم الافتراضية (انظر default/main.yml
):
المتغيرات العامة
nexus_version: '' nexus_timezone: 'UTC'
بشكل افتراضي ، سيقوم الدور بتثبيت أحدث إصدار متوفر من Nexus. يمكنك إصلاح الإصدار عن طريق تغيير متغير nexus_version
. راجع الإصدارات المتوفرة على https://www.sonatype.com/download-oss-sonatype .
إذا قمت بتغيير الإصدار إلى إصدار أحدث ، فسيحاول الدور تحديث Nexus المثبت لديك.
إذا كنت تستخدم إصدارًا أقدم من Nexus مقارنة بالإصدار الأحدث ، فيجب عليك التأكد من أنك لا تستخدم ميزات غير متوفرة في الإصدار المثبت (على سبيل المثال ، يتوفر استضافة مستودعات yum لـ nexus أكثر من 3.8.0 ، git lfs repo لـ nexus أكثر من 3.3.0 ور. د.)
nexus timezone
هو اسم منطقة nexus timezone
Java يمكن أن يكون مفيدًا مع تعبيرات cron أدناه للمهام nexus_scheduled.
Nexus Port و سياق السياق
nexus_default_port: 8081 nexus_default_context_path: '/'
مسار المنفذ والسياق لعملية اتصال Java. يجب أن يحتوي nexus_default_context_path
على شرطة مائلة عند تعيينه ، على سبيل المثال: nexus_default_context_path: '/nexus/'
.
نيكزس المستخدم والمجموعة
nexus_os_group: 'nexus' nexus_os_user: 'nexus'
سيتم إنشاء المستخدم والمجموعة المستخدمة لامتلاك ملفات Nexus وبدء الخدمة من خلال الدور إذا كانت مفقودة.
nexus_os_user_home_dir: '/home/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_installation_dir
على الملفات التنفيذية المثبتة - يحتوي
nexus_data_dir
على جميع التكوينات والمستودعات والتحف التي تم تحميلها. يمكن تكوين nexus_data_dir
blobstores 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/lans/lus/vide.html ) (إما مضمن أو في ملف منفصل ، تم التحميل ، على سبيل المثال ، include_vars)
الوصول المجهول الافتراضي
nexus_anonymous_access: false
تم إيقاف تشغيل الوصول المجهول افتراضيًا. اقرأ المزيد عن الوصول المجهول .
اسم المضيف العام
nexus_public_hostname: 'nexus.vm' nexus_public_scheme: https
اسم النطاق والمخطط المؤهلين تمامًا (https أو http) والذي سيكون به مثيل Nexus متاحًا لعملائه.
وصول 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: "admin@example.com" 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
ضبط httpd_setup_enable
على جهات اتصال true
، فإن الصلة بين 127.0.0.1:8081 ، وبالتالي لا يمكن الوصول إليها مباشرة عبر منفذ HTTP 8081 من عنوان IP خارجي.
اسم المضيف الافتراضي المستخدم هو nexus_public_hostname
. إذا كنت بحاجة إلى أسماء مختلفة لأي سبب ، فيمكنك تعيين httpd_server_name
بقيمة مختلفة.
باستخدام httpd_copy_ssl_files: true
(افتراضي) ، يجب أن تكون الشهادات المذكورة أعلاه موجودة في دليل playbook وسيتم نسخها إلى الخادم وتهيئتها في apache.
إذا كنت ترغب في استخدام الشهادات الموجودة على الخادم ، httpd_copy_ssl_files: false
بتعيين 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: "admin@example.com"
تعيين البريد الإلكتروني الافتراضي للمشرف
تكوين 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
قائمة الامتيازات لتكوين. راجع الوثائق وواجهة المستخدم الرسومية للتعرف على المتغيرات التي يجب تعيينها وفقًا لنوع الامتياز.
يتم دمج هذه العناصر مع القيم الافتراضية التالية:
_nexus_privilege_defaults: type: repository-view format: maven2 actions: - read
الأدوار (داخل نيكزس متاح)
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: support@company.com # password: "s3cr3t" # roles: # - developers # role ID
قائمة المستخدمين / الحسابات المحلية (بخلاف LDAP) لإنشاء في نيكزس.
قائمة المستخدمين / الحسابات المحلية (بخلاف LDAP) المراد إنشاؤها على Nexus.
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
المناظر المقابل
- name: docker-login-privilege type: repository-content-selector contentSelector: docker-login description: 'Login to Docker registry' repository: '*' actions: - read - browse
Blobstores والمستودعات
nexus_delete_default_repos: false
احذف المستودعات من nexus تثبيت التكوين الافتراضي الأولي. يتم تنفيذ هذه الخطوة فقط عند التثبيت لأول مرة (عندما يتم الكشف عن nexus_data_dir
فارغ).
قم بإزالة المستودعات من التكوين الافتراضي الأصلي لـ Nexus. يتم تنفيذ هذه الخطوة فقط عند التثبيت الأول (عندما يكون nexus_data_dir
فارغًا).
nexus_delete_default_blobstore: false
حذف blobstore الافتراضي من نيكزس تثبيت التكوين الافتراضي الأولي. لا يمكن القيام بذلك إلا إذا كان nexus_delete_default_repos: true
وجميع المستودعات التي تم تكوينها (انظر أدناه) تحتوي على blob_store: custom
صريحة blob_store: custom
. يتم تنفيذ هذه الخطوة فقط عند التثبيت لأول مرة (عندما يتم الكشف عن nexus_data_dir
فارغ).
يتم تعطيل إزالة تخزين النقطة (التحف الثنائية) افتراضيًا من التكوين الأصلي. لحذف التخزين nexus_delete_default_repos: true
(القطع الأثرية الثنائية) ، أوقف 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 }}"
Blobstores لخلق. لا يمكن تحديث مسار blobstore ومستودع blobstore بعد الإنشاء الأولي (سيتم تجاهل أي تحديث هنا عند إعادة التوفير).
يتم توفير تكوين blobstore على S3 كوسيلة راحة وليس جزءًا من الاختبارات الآلية التي نجريها على ترافيس. يرجى ملاحظة أن التخزين على S3 يوصى به فقط للحالات المنشورة على AWS.
خلق Blobstores لا يمكن تحديث مسار التخزين ومستودع التخزين بعد الإنشاء الأولي (سيتم تجاهل أي تحديث هنا عند إعادة التثبيت).
يتم توفير تكوين تخزين النقطة على 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
أعلاه مثال تكوين وكيل Maven.
nexus_repos_maven_hosted: - name: private-release version_policy: release write_policy: allow_once # one of "allow", "allow_once" or "deny"
استضافت Maven تكوين المستودعات . يعد التكوين المؤقت السلبي خيارًا اختياريًا وسيتم افتراضيًا بالقيم المذكورة أعلاه إذا تم حذفها.
تكوين مستودعات Maven المستضافة . تكوين ذاكرة التخزين المؤقت سالبة (-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
أنواع مستودعات الإرساء و 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
يمكن أيضًا تمكين مجال المستخدم عن بُعد باستخدام
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: alerts@example.org # 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: alerts@example.org # 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: alerts@example.org # 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: alerts@example.org # optional # taskProperties: # age: "24"
المهام المجدولة لتكوين. typeId
والمهمة الخاصة taskProperties
/ booleanTaskProperties
يمكن booleanTaskProperties
إما:
- من التسلسل الهرمي لنوع Java
org.sonatype.nexus.scheduling.TaskDescriptorSupport
- التحقق من نموذج HTML لإنشاء مهمة في متصفحك
- من عرض طلبات AJAX في المستعرض عند إعداد المهمة يدويًا.
يجب الإعلان عن خصائص المهمة في كتلة yaml الصحيحة ، اعتمادًا على نوعها :
taskProperties
لجميع خصائص السلسلة (مثل أسماء المستودعات وأسماء المستودعات والفترات الزمنية ...).booleanTaskProperties
لجميع الخصائص المنطقية (مثل مربعات الاختيار في الواجهة الرسومية لمهمة إنشاء nexus).
النسخ الاحتياطي
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 لهذه المهمة] (القوالب / backup.groovy.j2) للحصول على التفاصيل.
هذه المهمة المجدولة مستقلة عن nexus_scheduled_tasks
الأخرى لك
أعلن في قواعد اللعبة التي تمارسها.
إذا كنت ترغب في تدوير / حذف النسخ الاحتياطية ، nexus_backup_rotate: true
بتعيين 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
: . ,
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