في هذا المنشور ، سنلقي نظرة على تخزين rpm artifact باستخدام برنامج نصي بسيط مع inotify + crierepo. يتم تحميل القطع الأثرية عبر webdav باستخدام apache httpd. لماذا ستكتب اباتشي httpd قرب نهاية المنشور.
لذا ، يجب أن يلبي الحل المتطلبات التالية لتنظيم تخزين RPM فقط:
- مجانا 
 
- توفر الحزمة في المستودع بعد بضع ثوانٍ من التحميل في مخزن القطع الأثرية. 
 
- سهلة التركيب والصيانة 
 
- القدرة على جعل توافر عالية 
 
 
- يؤدي تخزين أنواع كثيرة من القطع الأثرية في SonaType Nexus أو Pulp إلى جعل SonaType Nexus أو Pulp نقطة فشل واحدة. 
 
- يتم دفع التوفر العالي في SonaType Nexus . 
 
- يبدو اللب وكأنه حل متطور للغاية بالنسبة لي. 
 
- SonaType Nexus blob. blob, . : - ERROR [ForkJoinPool.commonPool-worker-2] *SYSTEM [com.orientechnologies.orient.core.storage](http://com.orientechnologies.orient.core.storage/).fs.OFileClassic - $ANSI{green {db=security}} Error during data read for file 'privilege_5.pcl' 1-th attempt [java.io](http://java.io/).IOException: Bad address. Blob .
 
 
→ 
:
#!/bin/bash
source /etc/inotify-createrepo.conf
LOGFILE=/var/log/inotify-createrepo.log
function monitoring() {
    inotifywait -e close_write,delete -msrq --exclude ".repodata|.olddata|repodata" "${REPO}" | while read events 
    do
      echo $events >> $LOGFILE
      touch /tmp/need_create
    done
}
function run_createrepo() {
  while true; do
    if [ -f /tmp/need_create ];
    then
      rm -f /tmp/need_create
      echo "start createrepo $(date --rfc-3339=seconds)"
      /usr/bin/createrepo --update "${REPO}"
      echo "finish createrepo $(date --rfc-3339=seconds)"
    fi
    sleep 1
  done
}
echo "Start filesystem monitoring: Directory is $REPO, monitor logfile is $LOGFILE"
monitoring >> $LOGFILE &
run_createrepo >> $LOGFILE &
Inotify-createrepo CentOS 7 . CentOS 6 .
yum -y install yum-plugin-copr
yum copr enable antonpatsev/inotify-createrepo
yum -y install inotify-createrepo
systemctl start inotify-createrepo
inotify-createrepo /var/www/repos/rpm-repo/.
/etc/inotify-createrepo.conf.
/var/www/repos/rpm-repo/ inotifywait /tmp/need_create. run_createrepo /tmp/need_create. , createrepo --update.
:
/var/www/repos/rpm-repo/ CREATE nginx-1.16.1-1.el7.ngx.x86_64.rpm
start createrepo 2020-03-02 09:46:21+03:00
Spawning worker 0 with 1 pkgs
Spawning worker 1 with 0 pkgs
Spawning worker 2 with 0 pkgs
Spawning worker 3 with 0 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
finish createrepo 2020-03-02 09:46:22+03:00
(high availability)
(high availability) , 2 , Keepalived HA Lsyncd . Lsyncd — , , , rsync . "C ".
WebDav
: SSH, NFS, WebDav. WebDav .
WebDav Apache httpd. Apache httpd 2020 , nginx?
Nginx + (, Webdav).
Nginx + — Nginx-builder. nginx + wevdav , nginx-dav-ext-module. Nginx nginx-dav-ext-module Nginx-builder Used by http_dav_module instead of nginx-dav-ext-module. nginx: [emerg] unknown directive dav_methods.
Pull request Add check git_url for embedded, refactored --with-{}_module if module == "http_dav_module" append --with. .
webdav.conf
DavLockDB /var/www/html/DavLock
<VirtualHost localhost:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    ErrorLog /var/log/httpd/error.log
    CustomLog /var/log/httpd/access.log combined
    Alias /rpm /var/www/repos/rpm-repo
    <Directory /var/www/repos/rpm-repo>
        DAV On
        Options Indexes FollowSymlinks SymLinksifOwnerMatch IncludesNOEXEC
        IndexOptions NameWidth=* DescriptionWidth=*
        AllowOverride none
        Require all granted
    </Directory>
</VirtualHost>
Apache httpd .
Nginx Apache httpd
على عكس Apache ، يستخدم Nginx نموذج معالجة طلب مدفوعًا بالأحداث ، لذا فإن أي عدد من العملاء يتطلب عملية خادم HTTP واحدة فقط. يمكنك استخدام nginx وتقليل حمل الخادم.
تكوين nginx-front.conf. بقية تكوين nginx ، أعتقد أنك ستفعل ذلك بنفسك.
upstream nginx_front {
    server localhost:80;
}
server {
    listen 443 ssl;
    server_name --;
    access_log /var/log/nginx/nginx-front-access.log main;
    error_log /var/log/nginx/nginx-front.conf-error.log warn;
    location / {
        proxy_pass http://nginx_front;
    }
}
تحميل الملفات عبر WebDav
تنزيل rpm بسيط للغاية.
curl -T ./nginx-1.16.1-1.el7.ngx.x86_64.rpm https://--/rpm/