ืžืื’ืจ ืกืœ"ื“ ืคืฉื•ื˜ ื‘ืืžืฆืขื•ืช Inotify ื•-webdav

ื‘ืคื•ืกื˜ ื–ื” ื ืกืชื›ืœ ืขืœ ืื—ืกื•ืŸ ื—ืคืฆื™ ื”-rpm ื‘ืืžืฆืขื•ืช ืกืงืจื™ืคื˜ ืคืฉื•ื˜ ืขื inotify + createrepo. ื”ืขืœืืช ื—ืคืฆื™ื ืžืชื‘ืฆืขืช ื‘ืืžืฆืขื•ืช webdav ื‘ืืžืฆืขื•ืช apache httpd. ืœืžื” apache httpd ื™ื™ื›ืชื‘ ืœืงืจืืช ืกื•ืฃ ื”ืคื•ืกื˜.

ืœื›ืŸ, ื”ืคืชืจื•ืŸ ื—ื™ื™ื‘ ืœืขืžื•ื“ ื‘ื“ืจื™ืฉื•ืช ื”ื‘ืื•ืช ืœืืจื’ื•ืŸ ืื—ืกื•ืŸ RPM ื‘ืœื‘ื“:

  • ื—ื™ื ื

  • ื–ืžื™ื ื•ืช ื”ื—ื‘ื™ืœื” ื‘ืžืื’ืจ ืžืกืคืจ ืฉื ื™ื•ืช ืœืื—ืจ ื”ืขืœืื” ืœืžืื’ืจ ื”ื—ืคืฆื™ื.

  • ืงืœ ืœื”ืชืงื ื” ื•ืœืชื—ื–ื•ืงื”

  • ื™ื›ื•ืœืช ื–ืžื™ื ื•ืช ื’ื‘ื•ื”ื”

    ืœืžื” ืœื SonaType Nexus ืื• ืฆื™ืคื”:

  • ืื—ืกื•ืŸ ื‘ SonaType Nexus ืื• ืฆื™ืคื” ืกื•ื’ื™ื ืจื‘ื™ื ืฉืœ ื—ืคืฆื™ื ืžื•ื‘ื™ืœื™ื ืœื›ืš SonaType Nexus ืื• ืฆื™ืคื” ืœื”ืคื•ืš ืœื ืงื•ื“ืช ื›ื™ืฉืœื•ืŸ ืื—ืช.

  • ื–ืžื™ื ื•ืช ื’ื‘ื•ื”ื” ื‘ SonaType Nexus ืฉื•ืœื.

  • ืฆื™ืคื” ื ืจืื” ืœื™ ื›ืžื• ืคืชืจื•ืŸ ืžืกื•ื‘ืš ืžื“ื™.

  • ื—ืคืฆื™ื ื‘ SonaType Nexus ืžืื•ื—ืกื ื™ื ื‘ื›ืชื. ืื ื™ืฉ ื”ืคืกืงืช ื—ืฉืžืœ ืคืชืื•ืžื™ืช, ืœื ืชื•ื›ืœ ืœืฉื—ื–ืจ ืืช ื”ื›ืชื ืื ืื™ืŸ ืœืš ื’ื™ื‘ื•ื™. ื”ื™ื™ืชื” ืœื ื• ื”ืฉื’ื™ืื” ื”ื–ื•: 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. ื‘ืœื•ื‘ ืžืขื•ืœื ืœื ืฉื•ื—ื–ืจ.

ืงื•ื“ ืžืงื•ืจ

โ†’ ื ืžืฆื ืงื•ื“ ื”ืžืงื•ืจ ื›ืืŸ

ื”ืชืกืจื™ื˜ ื”ืจืืฉื™ ื ืจืื” ื›ืš:

#!/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

ื™ื›ื•ืœืช ื–ืžื™ื ื•ืช ื’ื‘ื•ื”ื”

ื›ื“ื™ ืœื”ืคื•ืš ื–ืžื™ื ื•ืช ื’ื‘ื•ื”ื” ืžืคืชืจื•ืŸ ืงื™ื™ื, ืื ื™ ื—ื•ืฉื‘ ืฉืืชื” ื™ื›ื•ืœ ืœื”ืฉืชืžืฉ ื‘ืฉื ื™ ืฉืจืชื™ื, Keepalved ืขื‘ื•ืจ HA ื•-Lsyncd ืœืกื ื›ืจื•ืŸ ื—ืคืฆื™ื. Lsyncd - ื“ืžื•ืŸ ืฉืขื•ืงื‘ ืื—ืจ ืฉื™ื ื•ื™ื™ื ื‘ืกืคืจื™ื™ื” ืžืงื•ืžื™ืช, ืฆื•ื‘ืจ ืื•ืชื, ื•ืœืื—ืจ ื–ืžืŸ ืžืกื•ื™ื rsync ืžืชื—ื™ืœ ืœืกื ื›ืจืŸ ืื•ืชื. ืคืจื˜ื™ื ื•ื”ื’ื“ืจื” ืžืชื•ืืจื™ื ื‘ืคื•ืกื˜ "ืกื ื›ืจื•ืŸ ืžื”ื™ืจ ืฉืœ ืžื™ืœื™ืืจื“ ืงื‘ืฆื™ื".

WebDav

ืืชื” ื™ื›ื•ืœ ืœื”ืขืœื•ืช ืงื‘ืฆื™ื ื‘ื›ืžื” ื“ืจื›ื™ื: SSH, NFS, WebDav. ื ืจืื” ืฉ-WebDav ื”ื™ื ืืคืฉืจื•ืช ืžื•ื“ืจื ื™ืช ื•ืคืฉื•ื˜ื”.

ืขื‘ื•ืจ WebDav ื ืฉืชืžืฉ ื‘- Apache httpd. ืœืžื” Apache httpd ื‘ืฉื ืช 2020 ื•ืœื nginx?

ื‘ืจืฆื•ื ื™ ืœื”ืฉืชืžืฉ ื‘ื›ืœื™ื ืื•ื˜ื•ืžื˜ื™ื™ื ืœื‘ื ื™ื™ืช ืžื•ื“ื•ืœื™ื ืฉืœ Nginx + (ืœื“ื•ื’ืžื”, Webdav).

ื™ืฉ ืคืจื•ื™ืงื˜ ืœื‘ื ื™ื™ืช Nginx + ืžื•ื“ื•ืœื™ื - ื‘ื•ื ื” Nginx. ืื ืืชื” ืžืฉืชืžืฉ ื‘-nginx + wevdav ื›ื“ื™ ืœื”ืขืœื•ืช ืงื‘ืฆื™ื, ืืชื” ืฆืจื™ืš ืžื•ื“ื•ืœ nginx-dav-ext-module. ื›ืืฉืจ ืžื ืกื™ื ืœื‘ื ื•ืช ื•ืœื”ืฉืชืžืฉ ื‘- Nginx ืขื nginx-dav-ext-module ื‘ืืžืฆืขื•ืช ื‘ื•ื ื” Nginx ื ืงื‘ืœ ืฉื’ื™ืื” ื‘ืฉื™ืžื•ืฉ ืขืœ ื™ื“ื™ http_dav_module ื‘ืžืงื•ื nginx-dav-ext-module. ืื•ืชื• ื‘ืื’ ื ืกื’ืจ ื‘ืงื™ืฅ nginx: [emerg] ื”ื ื—ื™ื” ืœื ื™ื“ื•ืขื” dav_methods.

ื”ื’ืฉืชื™ ื‘ืงืฉืช ืžืฉื™ื›ื” ื”ื•ืกืฃ check git_url ืขื‘ื•ืจ Embedded, refactored โ€”with-{}_module ะธ if module == "http_dav_module" ืฆืจืฃ --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

ื˜ืขื™ื ืช ืกืœ"ื“ ื”ื™ื ืคืฉื•ื˜ื” ืžืื•ื“.

curl -T ./nginx-1.16.1-1.el7.ngx.x86_64.rpm https://ะฒะฐัˆ-ะฒะธั€ั‚ัƒะฐะปัŒะฝั‹ะน-ั…ะพัั‚/rpm/

ืžืงื•ืจ: www.habr.com

ื”ื•ืกืคืช ืชื’ื•ื‘ื”