change(docker): use aurweb-config to update AUR_CONFIG

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-11-27 18:46:42 -08:00
parent 0726a08677
commit 5b350bc361
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
4 changed files with 37 additions and 37 deletions

View file

@ -5,23 +5,25 @@ set -eou pipefail
cp -vf conf/config.dev conf/config
sed -i "s;YOUR_AUR_ROOT;$(pwd);g" conf/config
# Change database user/password.
sed -ri "s/^;?(user) = .*$/\1 = aur/" conf/config
sed -ri "s/^;?(password) = .*$/\1 = aur/" conf/config
# Setup database.
aurweb-config set database user 'aur'
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
sed -ri "s;^(aur_location) = .+;\1 = ${AURWEB_FASTAPI_PREFIX};" conf/config
# Setup Redis for FastAPI.
sed -ri 's/^(cache) = .+/\1 = redis/' conf/config
sed -ri 's|^(redis_address) = .+|\1 = redis://redis|' conf/config
# Setup some other options.
aurweb-config set options cache 'redis'
aurweb-config set options redis_address 'redis://redis'
aurweb-config set options aur_location "$AURWEB_FASTAPI_PREFIX"
aurweb-config set options git_clone_uri_anon "${AURWEB_FASTAPI_PREFIX}/%s.git"
aurweb-config set options git_clone_uri_priv "${AURWEB_SSHD_PREFIX}/%s.git"
if [ ! -z ${COMMIT_HASH+x} ]; then
sed -ri "s/^;?(commit_hash) =.*$/\1 = $COMMIT_HASH/" conf/config
aurweb-config set devel commit_hash "$COMMIT_HASH"
fi
sed -ri "s|^(git_clone_uri_anon) = .+|\1 = ${AURWEB_FASTAPI_PREFIX}/%s.git|" conf/config.defaults
sed -ri "s|^(git_clone_uri_priv) = .+|\1 = ${AURWEB_SSHD_PREFIX}/%s.git|" conf/config.defaults
# Setup prometheus directory.
rm -rf $PROMETHEUS_MULTIPROC_DIR
mkdir -p $PROMETHEUS_MULTIPROC_DIR

View file

@ -42,20 +42,16 @@ EOF
cp -vf conf/config.dev $AUR_CONFIG
sed -i "s;YOUR_AUR_ROOT;$(pwd);g" $AUR_CONFIG
sed -ri "s/^;?(user) = .*$/\1 = aur/" $AUR_CONFIG
sed -ri "s/^;?(password) = .*$/\1 = aur/" $AUR_CONFIG
# Setup database.
aurweb-config set database user 'aur'
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
AUR_CONFIG_DEFAULTS="${AUR_CONFIG}.defaults"
if [[ "$AUR_CONFIG_DEFAULTS" != "/aurweb/conf/config.defaults" ]]; then
cp -vf conf/config.defaults $AUR_CONFIG_DEFAULTS
fi
# Set some defaults needed for pathing and ssh uris.
sed -ri "s|^(repo-path) = .+|\1 = /aurweb/aur.git/|" $AUR_CONFIG_DEFAULTS
# SSH_CMDLINE can be provided via override in docker-compose.aur-dev.yml.
sed -ri "s|^(ssh-cmdline) = .+$|\1 = ${SSH_CMDLINE}|" $AUR_CONFIG_DEFAULTS
# Setup some other options.
aurweb-config set serve repo-path '/aurweb/aur.git/'
aurweb-config set serve ssh-cmdline "$SSH_CMDLINE"
# Setup SSH Keys.
ssh-keygen -A

View file

@ -4,8 +4,9 @@ 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
sed -ri "s/^;?(user) = .*$/\1 = aur/g" conf/config
sed -ri "s/^;?(password) = .*$/\1 = aur/g" conf/config
aurweb-config set database user 'aur'
aurweb-config set database password 'aur'
python -m aurweb.initdb 2>/dev/null || /bin/true

View file

@ -9,17 +9,18 @@ done
cp -vf conf/config.dev conf/config
sed -i "s;YOUR_AUR_ROOT;$(pwd);g" conf/config
# Change database user/password.
sed -ri "s/^;?(user) = .*$/\1 = aur/" conf/config
sed -ri "s/^;?(password) = .*$/\1 = aur/" conf/config
# Setup database.
aurweb-config set database user 'aur'
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
# Enable memcached.
sed -ri 's/^(cache) = .+$/\1 = memcache/' conf/config
# Setup various location configurations.
sed -ri "s;^(aur_location) = .+;\1 = ${AURWEB_PHP_PREFIX};" conf/config
sed -ri "s|^(git_clone_uri_anon) = .+|\1 = ${AURWEB_PHP_PREFIX}/%s.git|" conf/config.defaults
sed -ri "s|^(git_clone_uri_priv) = .+|\1 = ${AURWEB_SSHD_PREFIX}/%s.git|" conf/config.defaults
# Setup some other options.
aurweb-config set options cache 'memcache'
aurweb-config set options aur_location "$AURWEB_PHP_PREFIX"
aurweb-config set options git_clone_uri_anon "${AURWEB_PHP_PREFIX}/%s.git"
aurweb-config set options git_clone_uri_priv "${AURWEB_SSHD_PREFIX}/%s.git"
# Listen on :9000.
sed -ri 's/^(listen).*/\1 = 0.0.0.0:9000/' /etc/php/php-fpm.d/www.conf