copr: performance tunning of cgit

See
https://lists.zx2c4.com/pipermail/cgit/2016-July/003153.html

Lets make cron job, which generate the cgitrc file.

Generate the cgitrc every hours and set TTL to 2 hours.
This commit is contained in:
Miroslav Suchý 2016-07-11 14:36:30 +02:00
parent 5b25f55a01
commit cc1658ce3a
2 changed files with 37 additions and 8 deletions

View file

@ -0,0 +1,3 @@
#!/usr/bin/bash
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 && mv /var/cache/cgit/repo-list.rc.new /var/cache/cgit/repo-list.rc

View file

@ -92,11 +92,14 @@
notify:
- reload httpd
- copy: src="dist-git.conf" dest="/etc/dist-git/dist-git.conf" mode=0644
tags:
- config
- copy: src="copr-dist-git.hourly" dest="/etc/cron.hourly/copr-dist-git" mode=755
tags:
- config
- copy: src="ssh_config" dest="/home/copr-service/.ssh/config" owner=copr-service group=copr-service mode=0600
- lineinfile: dest=/etc/cgitrc regexp="^project-list=" line="project-list=/var/lib/copr-dist-git/cgit_pkg_list"
@ -105,30 +108,53 @@
- lineinfile: dest=/etc/cgitrc regexp="^scan-path=" line="scan-path=/var/lib/dist-git/git/rpms"
tags:
- config
- lineinfile: dest=/etc/cgitrc regexp="^cache-dynamic-ttl=" line="cache-dynamic-ttl=30"
- lineinfile: dest=/etc/cgitrc regexp="^cache-dynamic-ttl=" line="cache-dynamic-ttl=120"
tags:
- config
- lineinfile: dest=/etc/cgitrc regexp="^cache-repo-ttl=" line="cache-repo-ttl=30"
- lineinfile: dest=/etc/cgitrc regexp="^cache-repo-ttl=" line="cache-repo-ttl=120"
tags:
- config
- lineinfile: dest=/etc/cgitrc regexp="^cache-root-ttl=" line="cache-root-ttl=30"
- lineinfile: dest=/etc/cgitrc regexp="^cache-root-ttl=" line="cache-root-ttl=120"
tags:
- config
- lineinfile: dest=/etc/cgitrc regexp="^cache-scanrc-ttl=" line="cache-scanrc-ttl=30"
- lineinfile: dest=/etc/cgitrc regexp="^cache-scanrc-ttl=" line="cache-scanrc-ttl=120"
tags:
- config
- lineinfile: dest=/etc/cgitrc regexp="^cache-about-ttl=" line="cache-about-ttl=30"
- lineinfile: dest=/etc/cgitrc regexp="^cache-about-ttl=" line="cache-about-ttl=120"
tags:
- config
- lineinfile: dest=/etc/cgitrc regexp="^cache-snapshot-ttl=" line="cache-snapshot-ttl=30"
- lineinfile: dest=/etc/cgitrc regexp="^cache-snapshot-ttl=" line="cache-snapshot-ttl=120"
tags:
- config
- lineinfile: dest=/etc/cgitrc regexp="^cache-size=" line="cache-size=10000"
- lineinfile: dest=/etc/cgitrc regexp="^cache-size=" line="cache-size=100000"
tags:
- config
- lineinfile: dest=/etc/cgitrc regexp="^scan-path=" state=absent
tags:
- config
- lineinfile: dest=/etc/cgitrc regexp="^include=" line="include=/var/cache/cgit/repo-list.rc"
tags:
- config
- name: Copy /etc/cgitrc to /etc/cgitrc.slow
copy: remote_src=True src=/etc/cgitrc dest=/etc/cgitrc.slow
tags:
- config
- lineinfile: dest=/etc/cgitrc.slow regexp="^scan-path=" line="scan-path=/var/lib/dist-git/git/rpms"
tags:
- config
- lineinfile: dest=/etc/cgitrc.slow regexp="^include=" state=absent
tags:
- config
- lineinfile: dest=/etc/cgitrc.slow regexp="^cache-scanrc-ttl=" line="cache-scanrc-ttl=10"
tags:
- config
- command: "/usr/share/dist-git/dist_git_sync.sh"
- name: Create /var/cache/cgit/repo-list.rc if does not exists (it last 30 minutes to generate)
command: /etc/cron.hourly/copr-dist-git creates=/var/cache/cgit/repo-list.rc
- name: allow httpd to run cgit
seboolean: name=httpd_enable_cgi state=true persistent=true