change master / slave to hub / build

This commit is contained in:
Trevor Batley 2023-09-01 08:53:11 +10:00
parent 5b757a74a1
commit 05e190bc4d
6 changed files with 24 additions and 18 deletions

View File

@ -32,12 +32,12 @@ workdir=/tmp/koji
mockdir=/var/lib/mock
mockuser=kojibuilder
mockhost=generic-linux-gnu
user=$KOJI_SLAVE_FQDN
user=$KOJI_BUILD_FQDN
server=$KOJI_URL/kojihub
topurl=$KOJI_URL/kojifiles
use_createrepo_c=True
allowed_scms=$GIT_FQDN:/packages/*
cert = $KOJI_PKI_DIR/$KOJI_SLAVE_FQDN.pem
cert = $KOJI_PKI_DIR/$KOJI_BUILD_FQDN.pem
serverca = $KOJI_PKI_DIR/koji_ca_cert.crt
EOF

View File

@ -19,7 +19,7 @@ Description=Koji NFS Mount
After=network.target
[Mount]
What=$KOJI_MASTER_FQDN:$KOJI_DIR
What=$KOJI_HUB_FQDN:$KOJI_DIR
Where=$KOJI_DIR
Type=nfs
Options=defaults,ro

View File

@ -10,7 +10,7 @@ source "$SCRIPT_DIR"/parameters.sh
dnf install -y nfs-utils
# Export server directory to be mounted by clients
echo "$KOJI_DIR $KOJI_SLAVE_FQDN(ro,no_root_squash)" >> /etc/exports
echo "$KOJI_DIR $KOJI_BUILD_FQDN(ro,no_root_squash)" >> /etc/exports
# allow nfs usage in selinux and firewall
setsebool -P httpd_use_nfs=1

View File

@ -98,14 +98,14 @@ EOF
touch "$KOJI_PKI_DIR"/index.txt
echo 01 > "$KOJI_PKI_DIR"/serial
openssl genrsa -out "$KOJI_PKI_DIR"/private/koji_ca_cert.key 2048
openssl req -subj "/C=$COUNTRY_CODE/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/OU=koji_ca/CN=$KOJI_MASTER_FQDN" -config "$KOJI_PKI_DIR"/ssl.cnf -new -x509 -days 3650 -key "$KOJI_PKI_DIR"/private/koji_ca_cert.key -out "$KOJI_PKI_DIR"/koji_ca_cert.crt -extensions v3_ca
openssl req -subj "/C=$COUNTRY_CODE/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/OU=koji_ca/CN=$KOJI_HUB_FQDN" -config "$KOJI_PKI_DIR"/ssl.cnf -new -x509 -days 3650 -key "$KOJI_PKI_DIR"/private/koji_ca_cert.key -out "$KOJI_PKI_DIR"/koji_ca_cert.crt -extensions v3_ca
mkdir -p /etc/ca-certs/trusted
# Generate the koji component certificates and the admin certificate and generate a PKCS12 user certificate (for web browser)
cp "$SCRIPT_DIR"/gencert.sh "$KOJI_PKI_DIR"
pushd "$KOJI_PKI_DIR"
./gencert.sh kojiweb "/C=$COUNTRY_CODE/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/OU=kojiweb/CN=$KOJI_MASTER_FQDN"
./gencert.sh kojihub "/C=$COUNTRY_CODE/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/OU=kojihub/CN=$KOJI_MASTER_FQDN"
./gencert.sh kojiweb "/C=$COUNTRY_CODE/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/OU=kojiweb/CN=$KOJI_HUB_FQDN"
./gencert.sh kojihub "/C=$COUNTRY_CODE/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/OU=kojihub/CN=$KOJI_HUB_FQDN"
./gencert.sh kojiadmin "/C=$COUNTRY_CODE/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/OU=$ORG_UNIT/CN=kojiadmin"
./gencert.sh kojira "/C=$COUNTRY_CODE/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/OU=$ORG_UNIT/CN=kojira"
popd
@ -169,7 +169,7 @@ DBName = koji
DBUser = koji
KojiDir = $KOJI_DIR
DNUsernameComponent = CN
ProxyDNs = C=$COUNTRY_CODE,ST=$STATE,L=$LOCATION,O=$ORGANIZATION,OU=kojiweb,CN=$KOJI_MASTER_FQDN
ProxyDNs = C=$COUNTRY_CODE,ST=$STATE,L=$LOCATION,O=$ORGANIZATION,OU=kojiweb,CN=$KOJI_HUB_FQDN
LoginCreatesUser = On
KojiWebURL = $KOJI_URL/koji
DisableNotifications = True
@ -259,7 +259,7 @@ restorecon -r -v $KOJI_DIR
## Apache Configuration Files
mkdir -p /etc/httpd/conf.d
cat > /etc/httpd/conf.d/ssl.conf <<- EOF
ServerName $KOJI_MASTER_FQDN
ServerName $KOJI_HUB_FQDN
Listen 443 https
@ -321,20 +321,20 @@ sudo -u kojiadmin koji moshimoshi
## KOJI DAEMON - BUILDER
# Add the host entry for the koji builder to the database
sudo -u kojiadmin koji add-host "$KOJI_SLAVE_FQDN" "$RPM_ARCH"
sudo -u kojiadmin koji add-host "$KOJI_BUILD_FQDN" "$RPM_ARCH"
# Add the host to the createrepo channel
sudo -u kojiadmin koji add-host-to-channel "$KOJI_SLAVE_FQDN" createrepo
sudo -u kojiadmin koji add-host-to-channel "$KOJI_BUILD_FQDN" createrepo
# A note on capacity
sudo -u kojiadmin koji edit-host --capacity="$KOJID_CAPACITY" "$KOJI_SLAVE_FQDN"
sudo -u kojiadmin koji edit-host --capacity="$KOJID_CAPACITY" "$KOJI_BUILD_FQDN"
# Generate certificates
pushd "$KOJI_PKI_DIR"
./gencert.sh "$KOJI_SLAVE_FQDN" "/C=$COUNTRY_CODE/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/CN=$KOJI_SLAVE_FQDN"
./gencert.sh "$KOJI_BUILD_FQDN" "/C=$COUNTRY_CODE/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/CN=$KOJI_BUILD_FQDN"
popd
if [[ "$KOJI_SLAVE_FQDN" = "$KOJI_MASTER_FQDN" ]]; then
if [[ "$KOJI_BUILD_FQDN" = "$KOJI_HUB_FQDN" ]]; then
"$SCRIPT_DIR"/deploy-koji-builder.sh
fi

View File

@ -0,0 +1,6 @@
#!/bin/bash
set -xe
SCRIPT_DIR="$(dirname "$(realpath "$0")")"

View File

@ -4,12 +4,12 @@
## KOJI RPM BUILD AND TRACKER
export KOJI_DIR=/mnt/koji
export KOJI_MASTER_FQDN="koji.koozali.org"
export KOJI_HUB_FQDN="koji.koozali.org"
# Use master FQDN if a combined build and master server
#export KOJI_SLAVE_FQDN="$KOJI_MASTER_FQDN"
#export KOJI_BUILD_FQDN="$KOJI_MASTER_FQDN"
# Build server FQDN if different from master
export KOJI_SLAVE_FQDN="kojibuild1.koozali.org"
export KOJI_URL=http://"$KOJI_MASTER_FQDN"
export KOJI_BUILD_FQDN="kojibuild1.koozali.org"
export KOJI_URL=http://"$KOJI_HUB_FQDN"
export KOJID_CAPACITY=16
export TAG_NAME=sme
# Use for koji SSL certificates