Sonatype Nexus adalah platform terintegrasi yang dengannya pengembang dapat mem-proksi, menyimpan, dan mengelola dependensi Java (Maven), Docker, Python, Ruby, NPM, gambar Bower, paket RPM, gitlfs, Apt, Go, Nuget, dan juga mendistribusikan perangkat lunak mereka ketentuan
Mengapa saya membutuhkan Nexus Sonatype?
- Untuk menyimpan artefak pribadi;
- Untuk artefak caching yang diunduh dari Internet;
Artefak yang didukung dalam paket dasar Sonatype Nexus:
- Jawa, Maven (kendi)
- Docker
- Python (pip)
- Ruby (permata)
- NPM
- Bower
- Yum (rpm)
- gitlfs
- Mentah
- Apt (deb)
- Pergi
- Nuget
Artefak yang Didukung Komunitas:
- Komposer
- Conan
- CPAN
- ELPA
- Helm
- P2
- R
Persyaratan
- Baca tentang menggunakan ansible di internet.
- Instal ansible
pip install ansible
di workstation tempat playbook dimulai. - Instal geerlingguy.java di workstation tempat playbook dimulai.
- Instal geerlingguy.apache di workstation tempat playbook dimulai.
- Peran ini telah diuji pada CentOS 7, Ubuntu Xenial (16.04) dan Bionic (18.04), Debian Jessie and Stretch
- Pustaka
jmespath
harus diinstal pada workstation tempat playbook dimulai. Untuk menginstal, jalankan sudo pip install -r requirements.txt
- Simpan file playbook (contoh di bawah) ke file nexus.yml
- Jalankan instalasi nexus
ansible-playbook -i host nexus.yml
Contoh playbook yang mungkin untuk menginstal nexus tanpa LDAP dengan repositori Maven (java), Docker, Python, Ruby, NPM, Bower, RPM, dan 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'] }
Tangkapan layar:


Variabel peran
Variabel peran
Variabel dengan nilai default (lihat default/main.yml
):
Variabel umum
nexus_version: '' nexus_timezone: 'UTC'
Secara default, peran tersebut akan menginstal Nexus versi terbaru yang tersedia. Anda dapat memperbaiki versi dengan mengubah variabel nexus_version
. Lihat versi yang tersedia di https://www.sonatype.com/download-oss-sonatype .
Jika Anda mengubah versi ke yang lebih baru, peran tersebut akan mencoba memperbarui Nexus yang Anda instal.
Jika Anda menggunakan versi Nexus yang lebih lama dari yang terbaru, Anda harus memastikan bahwa Anda tidak menggunakan fitur yang tidak tersedia dalam rilis yang diinstal (misalnya, hosting repositori yum tersedia untuk nexus lebih dari 3.8.0, git jika repo untuk nexus lebih dari 3.3.0 dll.)
nexus timezone
adalah nama nexus timezone
Java yang dapat berguna dalam kombinasi dengan ekspresi cron di bawah ini untuk tugas nexus_scheduled.
Port Nexus dan Jalur Konteks
nexus_default_port: 8081 nexus_default_context_path: '/'
Port dan jalur konteks dari proses koneksi Java. nexus_default_context_path
harus mengandung garis miring ketika disetel, mis.: nexus_default_context_path: '/nexus/'
.
Pengguna dan grup Nexus
nexus_os_group: 'nexus' nexus_os_user: 'nexus'
Pengguna dan grup yang digunakan untuk memiliki file Nexus dan memulai layanan akan dibuat oleh peran jika hilang.
nexus_os_user_home_dir: '/home/nexus'
Izinkan mengubah direktori home default untuk pengguna nexus
Direktori Instance Nexus
nexus_installation_dir: '/opt' nexus_data_dir: '/var/nexus' nexus_tmp_dir: "{{ (ansible_os_family == 'RedHat') | ternary('/var/nexus-tmp', '/tmp/nexus') }}"
Katalog Nexus.
nexus_installation_dir
berisi executable yang diinstalnexus_data_dir
berisi semua konfigurasi, repositori, dan artefak yang dimuat. Path nexus_data_dir blobstore khusus dapat dikonfigurasikan, lihat nexus_blobstores
bawah ini.nexus_tmp_dir
berisi semua file sementara. Jalur default untuk redhat telah dipindahkan dari /tmp
untuk mengatasi potensi masalah dengan prosedur pembersihan otomatis. Lihat # 168.
Konfigurasikan penggunaan memori Nexus JVM
nexus_min_heap_size: "1200M" nexus_max_heap_size: "{{ nexus_min_heap_size }}" nexus_max_direct_memory: "2G"
Ini adalah pengaturan default untuk Nexus. Tolong jangan mengubah nilai-nilai ini jika Anda belum membaca bagian memori dari persyaratan sistem nexus dan tidak mengerti apa yang mereka lakukan.
Sebagai peringatan kedua, berikut adalah kutipan dari dokumen di atas:
Tidak disarankan untuk meningkatkan memori tumpukan JVM di luar nilai yang disarankan dalam upaya untuk meningkatkan kinerja. Ini sebenarnya dapat memiliki efek sebaliknya, yang mengarah ke operasi yang tidak perlu dari sistem operasi.
Kata sandi admin
nexus_admin_password: 'changeme'
Kata sandi untuk akun "admin" adalah untuk mengonfigurasi. Ini hanya berfungsi pada instalasi default pertama . Silakan lihat [Ubah kata sandi administrator setelah instalasi pertama] (# ubah-admin-kata sandi setelah instalasi pertama) jika Anda ingin mengubahnya nanti menggunakan peran.
Sangat tidak disarankan untuk menyimpan kata sandi Anda dalam teks yang jelas di buku pedoman, tetapi gunakan [enkripsi anault-vault] ( https://docs.ansible.com/ansible/latest/user_guide/vault.html ) (baik disematkan atau di file terpisah, dimuat mis. dengan include_vars)
Akses Anonim Default
nexus_anonymous_access: false
Akses anonim dimatikan secara default. Baca lebih lanjut tentang akses anonim .
Nama inang publik
nexus_public_hostname: 'nexus.vm' nexus_public_scheme: https
Nama dan skema domain yang sepenuhnya memenuhi syarat (https atau http) yang digunakan oleh instance Nexus untuk kliennya.
Akses API untuk peran ini
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 }}"
Variabel-variabel ini mengontrol bagaimana peran terhubung ke API Nexus untuk penyediaan.
Hanya untuk pengguna tingkat lanjut. Kemungkinan besar Anda tidak ingin mengubah pengaturan default ini
Membalikkan pengaturan proxy
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
Instal SSL Reverse Proxy .
Untuk melakukan ini, instal httpd. Catatan: ketika httpd_setup_enable
disetel ke true
, nexus menghubungi 127.0.0.1:8081, sehingga tidak dapat diakses langsung melalui port HTTP 8081 dari alamat IP eksternal.
Nama host default yang digunakan adalah nexus_public_hostname
. Jika Anda memerlukan nama yang berbeda karena alasan apa pun, Anda dapat mengatur httpd_server_name
dengan nilai yang berbeda.
Dengan httpd_copy_ssl_files: true
(default), sertifikat di atas harus ada di direktori playbook Anda dan akan disalin ke server dan dikonfigurasi di apache.
Jika Anda ingin menggunakan sertifikat yang ada di server, setel httpd_copy_ssl_files: false
dan berikan variabel berikut:
# 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
adalah opsional dan harus httpd_ssl_cert_chain_file_location
jika Anda tidak ingin mengkonfigurasi file berantai
httpd_default_admin_email: "admin@example.com"
Tetapkan email admin default
Konfigurasi LDAP
Koneksi LDAP dan ruang lingkup keamanan dinonaktifkan secara default
nexus_ldap_realm: false ldap_connections: []
Koneksi LDAP , setiap item adalah sebagai berikut:
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
Contoh konfigurasi LDAP untuk otentikasi anonim (pengikatan anonim), juga merupakan konfigurasi "minimal":
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'
Contoh konfigurasi LDAP untuk otentikasi sederhana (menggunakan akun 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
Contoh konfigurasi LDAP untuk otentikasi sederhana (menggunakan akun DSA) + grup yang dipetakan sebagai peran:
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
Contoh konfigurasi LDAP untuk otentikasi sederhana (menggunakan akun DSA) + grup yang dipetakan secara dinamis sebagai peran:
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'
Hak istimewa
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
Daftar hak istimewa untuk dikonfigurasi. Lihat dokumentasi dan GUI untuk melihat variabel mana yang harus diatur tergantung pada jenis hak istimewa.
Elemen-elemen ini dikombinasikan dengan nilai-nilai default berikut:
_nexus_privilege_defaults: type: repository-view format: maven2 actions: - read
Peran (di dalam Nexus tersedia)
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
Daftar peran yang harus dikonfigurasi.
Pengguna
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
Daftar pengguna / akun lokal (non-LDAP) untuk dibuat di nexus.
Daftar pengguna / akun lokal (non-LDAP) untuk dibuat di Nexus.
nexus_ldap_users: [] # - username: j.doe # state: present # roles: # - "nx-admin"
Memetakan pengguna / peran Ldap. Status absent
akan menghapus peran dari pengguna yang ada, jika sudah ada.
Pengguna Ldap tidak dihapus. Mencoba memasang peran untuk pengguna yang tidak ada akan menghasilkan kesalahan.
Penyeleksi konten
nexus_content_selectors: - name: docker-login description: Selector for docker login privilege search_expression: format=="docker" and path=~"/v2/"
Untuk informasi lebih lanjut tentang pemilih konten, lihat Dokumentasi .
Untuk menggunakan pemilih konten, tambahkan hak istimewa baru dengan type: repository-content-selector
dan type: repository-content-selector
yang sesuai
- name: docker-login-privilege type: repository-content-selector contentSelector: docker-login description: 'Login to Docker registry' repository: '*' actions: - read - browse
Blobstore dan repositori
nexus_delete_default_repos: false
Hapus repositori dari nexus instal konfigurasi default awal. Langkah ini hanya dijalankan pada instalasi pertama kali (ketika nexus_data_dir
telah terdeteksi kosong).
Hapus repositori dari konfigurasi default asli untuk Nexus. Langkah ini hanya dilakukan selama instalasi pertama (ketika nexus_data_dir
kosong).
nexus_delete_default_blobstore: false
Hapus blobstore default dari nexus instal konfigurasi default awal. Ini dapat dilakukan hanya jika nexus_delete_default_repos: true
dan semua repositori yang dikonfigurasi (lihat di bawah) memiliki blob_store: custom
eksplisit blob_store: custom
. Langkah ini hanya dijalankan pada instalasi pertama kali (ketika nexus_data_dir
telah terdeteksi kosong).
Menghapus penyimpanan gumpalan (artefak biner) dinonaktifkan secara default dari konfigurasi asli. Untuk menghapus penyimpanan gumpalan (artefak biner), matikan nexus_delete_default_repos: true
. Langkah ini hanya dilakukan selama instalasi pertama (ketika nexus_data_dir
kosong).
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 untuk membuat. Jalur blobstore dan blobstore repositori tidak dapat diperbarui setelah pembuatan awal (pembaruan apa pun di sini akan diabaikan pada penyediaan ulang).
Mengkonfigurasi blobstore pada S3 disediakan sebagai kenyamanan dan bukan bagian dari tes otomatis yang kami jalankan di travis. Harap dicatat bahwa menyimpan pada S3 hanya disarankan untuk mesin virtual yang digunakan pada AWS.
Membuat Blobstores Jalur penyimpanan dan repositori penyimpanan tidak dapat diperbarui setelah pembuatan awal (pembaruan apa pun di sini akan diabaikan ketika diinstal ulang).
Konfigurasi penyimpanan gumpalan pada S3 disediakan untuk kenyamanan. Perhatikan bahwa penyimpanan S3 direkomendasikan hanya untuk instance yang digunakan pada 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
Di atas adalah contoh konfigurasi proxy Maven.
nexus_repos_maven_hosted: - name: private-release version_policy: release write_policy: allow_once # one of "allow", "allow_once" or "deny"
Maven meng-host konfigurasi repositori . Konfigurasi cache negatif adalah opsional dan akan default ke nilai-nilai di atas jika dihilangkan.
Konfigurasi repositori Maven yang di- host . Konfigurasi cache negatif (-1) bersifat opsional dan akan default ke nilai di atas jika tidak ditentukan.
nexus_repos_maven_group: - name: public member_repos: - central - jboss
Konfigurasi grup Maven.
Ketiga jenis repositori digabungkan dengan nilai default berikut:
_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 dan jenis repositori yum:
lihat defaults/main.yml
untuk opsi ini:
Docker, Pypi, Raw, Rubygems, Bower, NPM, Git-LFS, dan yum repositori dimatikan secara default:
Lihat defaults/main.yml
untuk opsi ini:
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
Perhatikan bahwa Anda mungkin perlu mengaktifkan area keamanan tertentu jika Anda ingin menggunakan repositori jenis lain selain pakar. Ini salah secara default.
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 juga dapat diaktifkan menggunakan
nexus_rut_auth_realm: true
dan judul dapat dikustomisasi dengan mendefinisikan
nexus_rut_auth_header: "CUSTOM_HEADER"
Tugas Terjadwal
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"
Tugas yang dijadwalkan untuk dikonfigurasikan. typeId
dan task-spesifik taskProperties
/ booleanTaskProperties
dapat ditebak:
- dari hierarki tipe Java
org.sonatype.nexus.scheduling.TaskDescriptorSupport
- memeriksa formulir HTML untuk membuat tugas di browser Anda
- dari melihat permintaan AJAX di browser ketika secara manual mengatur tugas.
Properti tugas harus dideklarasikan di blok yaml yang benar, tergantung pada jenisnya :
taskProperties
untuk semua properti string (mis. nama repositori, nama repositori, periode waktu ...).booleanTaskProperties
untuk semua properti logis (mis. pada dasarnya kotak centang di antarmuka grafis dari tugas pembuatan nexus).
Cadangan
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)
Cadangan tidak akan ditetapkan sampai Anda beralih nexus_backup_configure
ke true
.
Dalam hal ini, tugas skrip yang dijadwalkan akan dikonfigurasi untuk dijalankan pada Nexus
pada interval yang ditentukan dalam nexus_backup_cron
(standarnya adalah 21:00 setiap hari).
Lihat [Template asyik untuk tugas ini] (templat / backup.groovy.j2) untuk detailnya.
Tugas terjadwal ini terpisah dari nexus_scheduled_tasks
lainnya
umumkan di buku pedoman Anda.
Jika Anda ingin memutar / menghapus cadangan, atur nexus_backup_rotate: true
dan konfigurasikan jumlah cadangan yang ingin Anda simpan dengan nexus_backup_keep_rotations
(standarnya adalah 4).
Saat menggunakan rotasi, jika Anda ingin menghemat ruang disk tambahan selama proses pencadangan,
Anda dapat mengatur 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