mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat(docker): host gzip archive downloads
- added config option [mkpkglists] archivedir - created by mkpkglists Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
abbecf5194
commit
4f7aeafa8d
6 changed files with 38 additions and 6 deletions
|
@ -19,6 +19,7 @@ on the following, right-hand side fields are added to each item.
|
|||
"""
|
||||
|
||||
import gzip
|
||||
import os
|
||||
import sys
|
||||
|
||||
from collections import defaultdict
|
||||
|
@ -29,6 +30,9 @@ import orjson
|
|||
import aurweb.config
|
||||
import aurweb.db
|
||||
|
||||
archivedir = aurweb.config.get("mkpkglists", "archivedir")
|
||||
os.makedirs(archivedir, exist_ok=True)
|
||||
|
||||
packagesfile = aurweb.config.get('mkpkglists', 'packagesfile')
|
||||
packagesmetafile = aurweb.config.get('mkpkglists', 'packagesmetafile')
|
||||
packagesmetaextfile = aurweb.config.get('mkpkglists', 'packagesmetaextfile')
|
||||
|
|
|
@ -101,6 +101,7 @@ sync-dbs = core extra community multilib testing community-testing
|
|||
server = https://mirrors.kernel.org/archlinux/%s/os/x86_64
|
||||
|
||||
[mkpkglists]
|
||||
archivedir = /srv/http/aurweb/web/html
|
||||
packagesfile = /srv/http/aurweb/web/html/packages.gz
|
||||
packagesmetafile = /srv/http/aurweb/web/html/packages-meta-v1.json.gz
|
||||
packagesmetaextfile = /srv/http/aurweb/web/html/packages-meta-ext-v1.json.gz
|
||||
|
|
|
@ -67,11 +67,12 @@ session_secret = secret
|
|||
;commit_hash = 1234567
|
||||
|
||||
[mkpkglists]
|
||||
packagesfile = /packages.gz
|
||||
packagesmetafile = /packages-meta-v1.json.gz
|
||||
packagesmetaextfile = /packages-meta-ext-v1.json.gz
|
||||
pkgbasefile = /pkgbase.gz
|
||||
userfile = /users.gz
|
||||
archivedir = /var/lib/aurweb/archives
|
||||
packagesfile = /var/lib/aurweb/archives/packages.gz
|
||||
packagesmetafile = /var/lib/aurweb/archives/packages-meta-v1.json.gz
|
||||
packagesmetaextfile = /var/lib/aurweb/archives/packages-meta-ext-v1.json.gz
|
||||
pkgbasefile = /var/lib/aurweb/archives/pkgbase.gz
|
||||
userfile = /var/lib/aurweb/archives/users.gz
|
||||
|
||||
[aurblup]
|
||||
db-path = YOUR_AUR_ROOT/aurblup/
|
||||
|
|
|
@ -156,6 +156,7 @@ services:
|
|||
condition: service_started
|
||||
volumes:
|
||||
- mariadb_run:/var/run/mysqld
|
||||
- archives:/var/lib/aurweb/archives
|
||||
|
||||
php-fpm:
|
||||
image: aurweb:latest
|
||||
|
@ -180,6 +181,7 @@ services:
|
|||
condition: service_started
|
||||
volumes:
|
||||
- mariadb_run:/var/run/mysqld
|
||||
- archives:/var/lib/aurweb/archives
|
||||
ports:
|
||||
- "19000:9000"
|
||||
|
||||
|
@ -236,6 +238,8 @@ services:
|
|||
condition: service_healthy
|
||||
php-fpm:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- archives:/var/lib/aurweb/archives
|
||||
|
||||
sharness:
|
||||
image: aurweb:latest
|
||||
|
@ -343,3 +347,4 @@ volumes:
|
|||
mariadb_data: {} # Share /var/lib/mysql
|
||||
git_data: {} # Share aurweb/aur.git
|
||||
smartgit_run: {}
|
||||
archives: {}
|
||||
|
|
|
@ -94,7 +94,24 @@ http {
|
|||
ssl_certificate /etc/ssl/certs/web.cert.pem;
|
||||
ssl_certificate_key /etc/ssl/private/web.key.pem;
|
||||
|
||||
root /aurweb/web/html;
|
||||
location ~ ^/.*\.gz$ {
|
||||
# Override mime type to text/plain.
|
||||
types { text/plain gz; }
|
||||
default_type text/plain;
|
||||
|
||||
# Filesystem location of .gz archives.
|
||||
root /var/lib/aurweb/archives;
|
||||
|
||||
# When we match this block, fix-up trying without a trailing slash.
|
||||
try_files $uri $uri/ =404;
|
||||
|
||||
# Caching headers.
|
||||
expires max;
|
||||
add_header Content-Encoding gzip;
|
||||
add_header Cache-Control public;
|
||||
add_header Last-Modified "";
|
||||
add_header ETag "";
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri @proxy_to_app;
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
#!/bin/bash
|
||||
set -eou pipefail
|
||||
|
||||
for archive in packages pkgbase users packages-meta-v1.json packages-meta-ext-v1.json; do
|
||||
ln -vsf /var/lib/aurweb/archives/${archive}.gz /aurweb/web/html/${archive}.gz
|
||||
done
|
||||
|
||||
# Setup a config for our mysql db.
|
||||
cp -vf conf/config.dev conf/config
|
||||
sed -i "s;YOUR_AUR_ROOT;$(pwd);g" conf/config
|
||||
|
|
Loading…
Add table
Reference in a new issue