2016-10-25 12:09:54 +02:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
echo "======================= $(date)====================="
|
|
|
|
|
|
|
|
export PATH=$PATH:/usr/local/bin
|
|
|
|
|
|
|
|
base_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
source $base_dir/common.sh
|
|
|
|
|
2016-11-04 08:36:15 +01:00
|
|
|
#configure SSH
|
|
|
|
configSSH
|
|
|
|
|
2016-10-25 12:09:54 +02:00
|
|
|
#echo "Adding rules to iptables..."
|
2016-11-04 08:36:15 +01:00
|
|
|
addIptableRules
|
2016-10-25 12:09:54 +02:00
|
|
|
|
|
|
|
#Stop Harbor
|
|
|
|
echo "Shutting down Harbor..."
|
2016-11-10 09:18:13 +01:00
|
|
|
down || true
|
2016-10-25 12:09:54 +02:00
|
|
|
|
|
|
|
#Garbage collection
|
|
|
|
value=$(ovfenv -k gc_enabled)
|
|
|
|
if [ "$value" = "true" ]
|
|
|
|
then
|
|
|
|
echo "GC enabled, starting garbage collection..."
|
|
|
|
#If the registry contains no images, the gc will fail.
|
|
|
|
#So append a true to avoid failure.
|
|
|
|
gc registry:2.5.0 2>&1 >> /var/log/harbor/gc.log || true
|
|
|
|
else
|
|
|
|
echo "GC disabled, skip garbage collection"
|
|
|
|
fi
|
|
|
|
|
|
|
|
#Configure Harbor
|
|
|
|
echo "Configuring Harbor..."
|
|
|
|
configure
|
|
|
|
|
|
|
|
#Start Harbor
|
|
|
|
echo "Starting Harbor..."
|
|
|
|
up
|
|
|
|
|
|
|
|
echo "===================================================="
|