diff --git a/roles/copr/dist_git/files/copr-dist-git.hourly b/roles/copr/dist_git/files/copr-dist-git.hourly index 21e5072839..6731becce1 100755 --- a/roles/copr/dist_git/files/copr-dist-git.hourly +++ b/roles/copr/dist_git/files/copr-dist-git.hourly @@ -3,6 +3,6 @@ ( flock -n 9 || exit 1 # ... commands executed under lock ... -CGIT_CONFIG="/etc/cgitrc.slow" /var/www/cgi-bin/cgit --scan-path=/var/lib/dist-git/git/rpms >/var/cache/cgit/repo-list.rc.new 2>/dev/null && mv -f /var/cache/cgit/repo-list.rc.new /var/cache/cgit/repo-list.rc +CGIT_CONFIG="/etc/cgitrc.slow" /var/www/cgi-bin/cgit --scan-path=/srv/git/repositories >/var/cache/cgit/repo-list.rc.new 2>/dev/null && mv -f /var/cache/cgit/repo-list.rc.new /var/cache/cgit/repo-list.rc ) 9>/var/lock/mylockfile diff --git a/roles/copr/dist_git/files/httpd/dist-git/lookaside-copr.conf b/roles/copr/dist_git/files/httpd/dist-git/lookaside-copr.conf index c86e19d525..9aa3d78b5a 100644 --- a/roles/copr/dist_git/files/httpd/dist-git/lookaside-copr.conf +++ b/roles/copr/dist_git/files/httpd/dist-git/lookaside-copr.conf @@ -1,2 +1,2 @@ -AliasMatch "/repo(/.*)/md5(/.*)" "/var/lib/dist-git/cache/lookaside$1$2" -Alias /repo/ /var/lib/dist-git/cache/lookaside/ +AliasMatch "/repo(/.*)/md5(/.*)" "/srv/cache/lookaside$1$2" +Alias /repo/ /srv/cache/lookaside/ diff --git a/roles/copr/dist_git/files/httpd/dist-git/lookaside.conf b/roles/copr/dist_git/files/httpd/dist-git/lookaside.conf index d967d1b0ff..01a7608858 100644 --- a/roles/copr/dist_git/files/httpd/dist-git/lookaside.conf +++ b/roles/copr/dist_git/files/httpd/dist-git/lookaside.conf @@ -1,5 +1,5 @@ -alias /lookaside /var/lib/dist-git/cache/lookaside - +alias /lookaside /srv/cache/lookaside + Options Indexes FollowSymLinks AllowOverride None Require all granted diff --git a/roles/copr/dist_git/tasks/main.yml b/roles/copr/dist_git/tasks/main.yml index 329e08e016..f5b4cefa08 100644 --- a/roles/copr/dist_git/tasks/main.yml +++ b/roles/copr/dist_git/tasks/main.yml @@ -11,15 +11,26 @@ - name: create user for git repos user: name="copr-dist-git" group=copr-dist-git groups=cvsadmin,packager uid=1001 -- name: create user for copr-git service - user: name="copr-service" group=copr-service groups=packager generate_ssh_key=yes ssh_key_bits=2048 ssh_key_file=.ssh/id_rsa uid=1002 +- name: create user for copr-dist-git service + user: name="copr-service" group=copr-service groups=packager,docker generate_ssh_key=yes ssh_key_bits=2048 ssh_key_file=.ssh/id_rsa uid=1002 + +- name: enable copr dist-git repo + shell: "dnf -y copr enable clime/dist-git" + when: devel + +- name: install dist-git + dnf: state=latest name="dist-git" + +- name: set home for copr-dist-git user + user: name="copr-dist-git" home=/srv/git + when: devel - name: install packages dnf: state=present name={{ item }} with_items: #- epel-release - cgit - - dist-git +# - dist-git - copr-dist-git - rdiff-backup - tmpwatch @@ -38,6 +49,7 @@ file: path="/var/lib/dist-git/git" state=directory group=packager mode=0775 #- file: path="/var/lib/dist-git/git/pkgs-git-repos-list" state=file group=packager # - file: path="/var/lib/dist-git/git/rpms/" state=directory group=packager + when: not devel - name: install packages which should be added as requirements dnf: state=present name={{ item }} @@ -52,6 +64,11 @@ - name: make sure directories are owned by copr-service:packager user file: path=/var/lib/dist-git/git owner=copr-service group=packager + when: not devel + +- name: make sure directories are owned by root:root user + file: path=/srv/git owner=root group=root mode=0755 + when: devel # set ssh key, so that copr-service could access gitolite - name: read pub key into var @@ -64,8 +81,17 @@ - debug: msg={{pubkey}} +- name: prepare authorized key, so copr-service could interact with gitolite + authorized_key: user="copr-dist-git" key="{{pubkey}}" + when: devel + +- name: set correct selinux policy for copr-dist-git's .ssh dir + shell: 'semanage fcontext -a -t ssh_home_t "/srv/git/.ssh(/.*)?" && restorecon -R /srv/git/.ssh' + when: devel + - name: prepare authorized key, so copr-service could interact with gitolite authorized_key: user="copr-dist-git" key="{{pubkey}}" key_options="command=\"HOME=/var/lib/dist-git/git/ /usr/share/gitolite3/gitolite-shell $USER \"'" + when: not devel ## keys done - name: install config for copr-dist-git @@ -115,6 +141,7 @@ - template: src="cgitrc.slow" dest="/etc/cgitrc.slow" owner=root group=root mode=0644 - command: "/usr/share/dist-git/dist_git_sync.sh" + when: not devel - name: allow httpd to run cgit seboolean: name=httpd_enable_cgi state=true persistent=true diff --git a/roles/copr/dist_git/tasks/mount_fs.yml b/roles/copr/dist_git/tasks/mount_fs.yml index bdfee5e599..97e752f9e3 100644 --- a/roles/copr/dist_git/tasks/mount_fs.yml +++ b/roles/copr/dist_git/tasks/mount_fs.yml @@ -4,6 +4,22 @@ - name: mount up disk of copr repo mount: name=/var/lib/dist-git src='LABEL=copr-dist-git' fstype=ext4 state=mounted +- name: prepare new /srv/git bind mount point + file: state=directory path=/srv/git + when: devel + +- name: prepare new /srv/cache bind mount point + file: state=directory path=/srv/cache + when: devel + +- name: mount up /srv/git + mount: name=/srv/git src=/var/lib/dist-git/git fstype=ext4 opts=rw,bind state=mounted + when: devel + +- name: mount up /srv/cache + mount: name=/srv/cache src=/var/lib/dist-git/cache fstype=ext4 opts=rw,bind state=mounted + when: devel + - name: prepare mount point file: state=directory path=/var/lib/copr-dist-git diff --git a/roles/copr/dist_git/templates/cgitrc b/roles/copr/dist_git/templates/cgitrc index 73891919f6..f7b8bcf706 100644 --- a/roles/copr/dist_git/templates/cgitrc +++ b/roles/copr/dist_git/templates/cgitrc @@ -80,6 +80,6 @@ mimetype.svg=image/svg+xml #repo.owner=fooman@example.com #repo.readme=info/web/about.html project-list=/var/lib/copr-dist-git/cgit_pkg_list -#scan-path=/var/lib/dist-git/git/rpms +#scan-path=/srv/git/repositories include=/var/cache/cgit/repo-list.rc clone-prefix=http://{{ dist_git_base_url }}/git