mirror of
https://src.koozali.org/infra/smeserver-koji.git
synced 2024-11-21 17:17:28 +01:00
allow web-deploy without parameters (uses hub)
This commit is contained in:
parent
1690d98814
commit
1fc2cbb24c
@ -30,26 +30,13 @@ if [ ! -f "$SCRIPT_DIR"/koji-parameters.sh ] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
source "$SCRIPT_DIR"/koji-parameters.sh
|
source "$SCRIPT_DIR"/koji-parameters.sh
|
||||||
KOJI_HUB_FQDN="$(hostname -f)"
|
|
||||||
|
|
||||||
# pull down any required scripts
|
|
||||||
curl $SILENT $SCRIPT_GIT/koji-deploy-hub.sh > $SCRIPT_DIR/koji-deploy-hub.sh
|
|
||||||
|
|
||||||
if [ ! -d $SCRIPT_DIR ] ; then mkdir -p $SCRIPT_DIR ; fi
|
|
||||||
|
|
||||||
# install any required packages
|
|
||||||
if [[ -z $(dnf list installed | grep epel-release) ]] ; then
|
|
||||||
dnf install -y epel-release $QUIET
|
|
||||||
fi
|
|
||||||
if [[ -z $(dnf list installed | grep netcat) ]] ; then
|
|
||||||
dnf install -y netcat $QUIET
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if no build server given, deploy locally
|
# if no build server given, deploy locally
|
||||||
if [ -z $KOJI_BUILD_FQDN ] ; then
|
if [ -z $KOJI_BUILD_FQDN ] ; then
|
||||||
KOJI_BUILD_FQDN=$KOJI_HUB_FQDN
|
KOJI_BUILD_FQDN=$KOJI_HUB_FQDN
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# check that the target exists
|
||||||
RESP=$(nc -z $KOJI_BUILD_FQDN 22 2>&1 | grep succeeded)
|
RESP=$(nc -z $KOJI_BUILD_FQDN 22 2>&1 | grep succeeded)
|
||||||
if [[ -z $RESP ]] ; then
|
if [[ -z $RESP ]] ; then
|
||||||
echo "I cannot connect to $KOJI_BUILD_FQDN! Is it online? "
|
echo "I cannot connect to $KOJI_BUILD_FQDN! Is it online? "
|
||||||
@ -59,6 +46,14 @@ if [[ -z $RESP ]] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# install any required packages
|
||||||
|
if [[ -z $(dnf list installed | grep epel-release) ]] ; then
|
||||||
|
dnf install -y epel-release $QUIET
|
||||||
|
fi
|
||||||
|
if [[ -z $(dnf list installed | grep netcat) ]] ; then
|
||||||
|
dnf install -y netcat $QUIET
|
||||||
|
fi
|
||||||
|
|
||||||
## On the HUB
|
## On the HUB
|
||||||
# Add the host entry for the koji builder to the database
|
# Add the host entry for the koji builder to the database
|
||||||
sudo -u kojiadmin koji add-host "$KOJI_BUILD_FQDN" "$RPM_ARCH"
|
sudo -u kojiadmin koji add-host "$KOJI_BUILD_FQDN" "$RPM_ARCH"
|
||||||
@ -69,10 +64,10 @@ sudo -u kojiadmin koji edit-host --capacity="$KOJID_CAPACITY" "$KOJI_BUILD_FQDN"
|
|||||||
# Generate a certificate for the builder
|
# Generate a certificate for the builder
|
||||||
if [ ! -f $SCRIPT_DIR/koji-gencert.sh ] ; then
|
if [ ! -f $SCRIPT_DIR/koji-gencert.sh ] ; then
|
||||||
curl $SILENT $SCRIPT_GIT/koji-gencert.sh > $SCRIPT_DIR/koji-gencert.sh
|
curl $SILENT $SCRIPT_GIT/koji-gencert.sh > $SCRIPT_DIR/koji-gencert.sh
|
||||||
|
chmod a+x $SCRIPT_DIR/koji-gencert.sh
|
||||||
fi
|
fi
|
||||||
cp $SCRIPT_DIR/koji-gencert.sh $KOJI_PKI_DIR/.
|
|
||||||
pushd "$KOJI_PKI_DIR"
|
pushd "$KOJI_PKI_DIR"
|
||||||
./koji-gencert.sh "$KOJI_BUILD_FQDN" "/C=$COUNTRY_CODE/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/CN=$KOJI_BUILD_FQDN"
|
$SCRIPT_DIR/koji-gencert.sh "$KOJI_BUILD_FQDN" "/C=$COUNTRY_CODE/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/CN=$KOJI_BUILD_FQDN"
|
||||||
popd
|
popd
|
||||||
# check if local install or remote
|
# check if local install or remote
|
||||||
if [[ $KOJI_BUILD_FQDN = $KOJI_HUB_FQDN ]] ; then
|
if [[ $KOJI_BUILD_FQDN = $KOJI_HUB_FQDN ]] ; then
|
||||||
|
@ -2,15 +2,17 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
KOJI_WEB_FQDN=$1
|
KOJI_WEB_FQDN=
|
||||||
DEBUG=
|
DEBUG=
|
||||||
SILENT="-s"
|
SILENT="-s"
|
||||||
QUIET="-q"
|
QUIET="-q"
|
||||||
for param in $2 ; do
|
for param in $1 $2 ; do
|
||||||
if [ $param ] ; then
|
if [ $param ] ; then
|
||||||
case $param in
|
case $param in
|
||||||
debug )
|
debug )
|
||||||
DEBUG="debug" ;;
|
DEBUG="debug" ;;
|
||||||
|
* )
|
||||||
|
KOJI_WEB_FQDN=$param ;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
@ -31,6 +33,10 @@ if [ ! -f "$SCRIPT_DIR"/koji-parameters.sh ] ; then
|
|||||||
fi
|
fi
|
||||||
source "$SCRIPT_DIR"/koji-parameters.sh
|
source "$SCRIPT_DIR"/koji-parameters.sh
|
||||||
|
|
||||||
|
# if no build server given, deploy locally
|
||||||
|
if [[ -z $KOJI_WEB_FQDN ]] ; then KOJI_WEB_FQDN=$KOJI_HUB_FQDN ; fi
|
||||||
|
|
||||||
|
# check if local or remote deploy
|
||||||
if [[ "$KOJI_WEB_FQDN" != "$(hostname -f)" ]] ; then
|
if [[ "$KOJI_WEB_FQDN" != "$(hostname -f)" ]] ; then
|
||||||
if [[ $DEBUG ]] ; then echo "Deploying remotely to $KOJI_WEB_FQDN" ; fi
|
if [[ $DEBUG ]] ; then echo "Deploying remotely to $KOJI_WEB_FQDN" ; fi
|
||||||
# deploy remotely to $KOJI_WEB_FQDN
|
# deploy remotely to $KOJI_WEB_FQDN
|
||||||
@ -106,6 +112,7 @@ dnf install -y mod_ssl koji-web $QUIET
|
|||||||
# install locally
|
# install locally
|
||||||
# create secret
|
# create secret
|
||||||
SECRET="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 32)"
|
SECRET="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 32)"
|
||||||
|
# create config files
|
||||||
mkdir -p /etc/kojiweb
|
mkdir -p /etc/kojiweb
|
||||||
cat > /etc/kojiweb/web.conf <<- EOF
|
cat > /etc/kojiweb/web.conf <<- EOF
|
||||||
[web]
|
[web]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Add required bundles for koji
|
- name: Add required bundles for koji
|
||||||
swupd:
|
swupd:
|
||||||
name: koji postgresql web-server-basic
|
name: koji koji-hub koji-utils koji-web mod-ssl policycoreutils-python-utils postgresql web-server-basic
|
||||||
state: present
|
state: present
|
||||||
become: true
|
become: true
|
||||||
- name: copy koji-setup scripts
|
- name: copy koji-setup scripts
|
||||||
|
Loading…
Reference in New Issue
Block a user