mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
change(fastapi): setup live database in mariadb-init-entrypoint.sh
Centralize database setup there and remove all copying of config.dev from the entrypoint scripts (the Dockerfile now does it). Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
343a306bb8
commit
dbeebd3b01
6 changed files with 34 additions and 40 deletions
|
@ -1,12 +1,30 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eou pipefail
|
set -eou pipefail
|
||||||
|
|
||||||
# Prepare AUR_CONFIG.
|
# Setup the DB.
|
||||||
cp -vf conf/config.dev conf/config
|
NO_INITDB=1 /docker/mariadb-init-entrypoint.sh
|
||||||
sed -i "s;YOUR_AUR_ROOT;$(pwd);g" conf/config
|
|
||||||
|
|
||||||
# Create directories we need.
|
# Create aurblup's directory.
|
||||||
mkdir -p /aurweb/aurblup
|
AURBLUP_DIR="/aurweb/aurblup/"
|
||||||
|
mkdir -p $AURBLUP_DIR
|
||||||
|
|
||||||
|
# Setup aurblup config for Docker.
|
||||||
|
AURBLUP_DBS='core extra community multilib testing community-testing'
|
||||||
|
AURBLUP_SERVER='https://mirrors.kernel.org/archlinux/%s/os/x86_64'
|
||||||
|
aurweb-config set aurblup db-path "$AURBLUP_DIR"
|
||||||
|
aurweb-config set aurblup sync-dbs "$AURBLUP_DBS"
|
||||||
|
aurweb-config set aurblup server "$AURBLUP_SERVER"
|
||||||
|
|
||||||
|
# Setup mkpkglists config for Docker.
|
||||||
|
ARCHIVE_DIR='/var/lib/aurweb/archives'
|
||||||
|
aurweb-config set mkpkglists archivedir "$ARCHIVE_DIR"
|
||||||
|
aurweb-config set mkpkglists packagesfile "$ARCHIVE_DIR/packages.gz"
|
||||||
|
aurweb-config set mkpkglists packagesmetafile \
|
||||||
|
"$ARCHIVE_DIR/packages-meta-v1.json.gz"
|
||||||
|
aurweb-config set mkpkglists packagesmetaextfile \
|
||||||
|
"$ARCHIVE_DIR/packages-meta-ext-v1.json.gz"
|
||||||
|
aurweb-config set mkpkglists pkgbasefile "$ARCHIVE_DIR/pkgbase.gz"
|
||||||
|
aurweb-config set mkpkglists userfile "$ARCHIVE_DIR/users.gz"
|
||||||
|
|
||||||
# Install the cron configuration.
|
# Install the cron configuration.
|
||||||
cp /docker/config/aurweb-cron /etc/cron.d/aurweb-cron
|
cp /docker/config/aurweb-cron /etc/cron.d/aurweb-cron
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eou pipefail
|
set -eou pipefail
|
||||||
|
|
||||||
# Setup a config for our mysql db.
|
|
||||||
cp -vf conf/config.dev conf/config
|
|
||||||
sed -i "s;YOUR_AUR_ROOT;$(pwd);g" conf/config
|
|
||||||
|
|
||||||
# Setup database.
|
# Setup database.
|
||||||
aurweb-config set database user 'aur'
|
NO_INITDB=1 /docker/mariadb-init-entrypoint.sh
|
||||||
aurweb-config set database password 'aur'
|
|
||||||
aurweb-config set database host 'localhost'
|
|
||||||
aurweb-config set database socket '/var/lib/mysqld/mysqld.sock'
|
|
||||||
aurweb-config unset database port
|
|
||||||
|
|
||||||
# Setup some other options.
|
# Setup some other options.
|
||||||
aurweb-config set options cache 'redis'
|
aurweb-config set options cache 'redis'
|
||||||
|
|
|
@ -38,16 +38,8 @@ Match User aur
|
||||||
AcceptEnv AUR_OVERWRITE
|
AcceptEnv AUR_OVERWRITE
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Setup a config for our mysql db.
|
|
||||||
cp -vf conf/config.dev $AUR_CONFIG
|
|
||||||
sed -i "s;YOUR_AUR_ROOT;$(pwd);g" $AUR_CONFIG
|
|
||||||
|
|
||||||
# Setup database.
|
# Setup database.
|
||||||
aurweb-config set database user 'aur'
|
NO_INITDB=1 /docker/mariadb-init-entrypoint.sh
|
||||||
aurweb-config set database password 'aur'
|
|
||||||
aurweb-config set database host 'localhost'
|
|
||||||
aurweb-config set database socket '/var/lib/mysqld/mysqld.sock'
|
|
||||||
aurweb-config unset database port
|
|
||||||
|
|
||||||
# Setup some other options.
|
# Setup some other options.
|
||||||
aurweb-config set serve repo-path '/aurweb/aur.git/'
|
aurweb-config set serve repo-path '/aurweb/aur.git/'
|
||||||
|
|
|
@ -2,12 +2,16 @@
|
||||||
set -eou pipefail
|
set -eou pipefail
|
||||||
|
|
||||||
# Setup a config for our mysql db.
|
# Setup a config for our mysql db.
|
||||||
cp -vf conf/config.dev conf/config
|
aurweb-config set database name 'aurweb'
|
||||||
sed -i "s;YOUR_AUR_ROOT;$(pwd);g" conf/config
|
|
||||||
|
|
||||||
aurweb-config set database user 'aur'
|
aurweb-config set database user 'aur'
|
||||||
aurweb-config set database password 'aur'
|
aurweb-config set database password 'aur'
|
||||||
|
aurweb-config set database host 'localhost'
|
||||||
|
aurweb-config set database socket '/var/run/mysqld/mysqld.sock'
|
||||||
|
aurweb-config unset database port
|
||||||
|
|
||||||
|
if [ ! -z ${NO_INITDB+x} ]; then
|
||||||
|
exec "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
python -m aurweb.initdb 2>/dev/null || /bin/true
|
python -m aurweb.initdb 2>/dev/null || /bin/true
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
|
@ -5,16 +5,8 @@ for archive in packages pkgbase users packages-meta-v1.json packages-meta-ext-v1
|
||||||
ln -vsf /var/lib/aurweb/archives/${archive}.gz /aurweb/web/html/${archive}.gz
|
ln -vsf /var/lib/aurweb/archives/${archive}.gz /aurweb/web/html/${archive}.gz
|
||||||
done
|
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
|
|
||||||
|
|
||||||
# Setup database.
|
# Setup database.
|
||||||
aurweb-config set database user 'aur'
|
NO_INITDB=1 /docker/mariadb-init-entrypoint.sh
|
||||||
aurweb-config set database password 'aur'
|
|
||||||
aurweb-config set database host 'localhost'
|
|
||||||
aurweb-config set database socket '/var/lib/mysqld/mysqld.sock'
|
|
||||||
aurweb-config unset database port
|
|
||||||
|
|
||||||
# Setup some other options.
|
# Setup some other options.
|
||||||
aurweb-config set options cache 'memcache'
|
aurweb-config set options cache 'memcache'
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eou pipefail
|
set -eou pipefail
|
||||||
|
|
||||||
# Setup a config for our mysql db.
|
|
||||||
cp -vf conf/config.dev conf/config
|
|
||||||
sed -i "s;YOUR_AUR_ROOT;$(pwd);g" conf/config
|
|
||||||
|
|
||||||
# We use the root user for testing in Docker.
|
# We use the root user for testing in Docker.
|
||||||
# The test user must be able to create databases and drop them.
|
# The test user must be able to create databases and drop them.
|
||||||
aurweb-config set database user 'root'
|
aurweb-config set database user 'root'
|
||||||
|
|
Loading…
Add table
Reference in a new issue