From 05e190bc4d6524c830b786caa81ff1297f5ddfe0 Mon Sep 17 00:00:00 2001 From: Trevor Batley Date: Fri, 1 Sep 2023 08:53:11 +1000 Subject: [PATCH] change master / slave to hub / build --- koji-setup/deploy-koji-builder.sh | 4 ++-- koji-setup/deploy-koji-nfs-client.sh | 2 +- koji-setup/deploy-koji-nfs-server.sh | 2 +- koji-setup/deploy-koji.sh | 20 ++++++++++---------- koji-setup/install_koji_farm.sh | 6 ++++++ koji-setup/parameters.sh | 8 ++++---- 6 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 koji-setup/install_koji_farm.sh diff --git a/koji-setup/deploy-koji-builder.sh b/koji-setup/deploy-koji-builder.sh index fec2e6d..33387bd 100755 --- a/koji-setup/deploy-koji-builder.sh +++ b/koji-setup/deploy-koji-builder.sh @@ -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 diff --git a/koji-setup/deploy-koji-nfs-client.sh b/koji-setup/deploy-koji-nfs-client.sh index 64e78ef..867eac8 100755 --- a/koji-setup/deploy-koji-nfs-client.sh +++ b/koji-setup/deploy-koji-nfs-client.sh @@ -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 diff --git a/koji-setup/deploy-koji-nfs-server.sh b/koji-setup/deploy-koji-nfs-server.sh index 9865232..99e27a0 100755 --- a/koji-setup/deploy-koji-nfs-server.sh +++ b/koji-setup/deploy-koji-nfs-server.sh @@ -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 diff --git a/koji-setup/deploy-koji.sh b/koji-setup/deploy-koji.sh index 7283a00..8993d90 100755 --- a/koji-setup/deploy-koji.sh +++ b/koji-setup/deploy-koji.sh @@ -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 diff --git a/koji-setup/install_koji_farm.sh b/koji-setup/install_koji_farm.sh new file mode 100644 index 0000000..5eda498 --- /dev/null +++ b/koji-setup/install_koji_farm.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -xe +SCRIPT_DIR="$(dirname "$(realpath "$0")")" + + diff --git a/koji-setup/parameters.sh b/koji-setup/parameters.sh index 8b57d82..6fdde01 100644 --- a/koji-setup/parameters.sh +++ b/koji-setup/parameters.sh @@ -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