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-11-25 06:59:22 +01: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.
|
2016-12-02 06:41:38 +01:00
|
|
|
gc 2>&1 >> /var/log/harbor/gc.log || true
|
2016-10-25 12:09:54 +02:00
|
|
|
else
|
|
|
|
echo "GC disabled, skip garbage collection"
|
|
|
|
fi
|
|
|
|
|
|
|
|
#Configure Harbor
|
|
|
|
echo "Configuring Harbor..."
|
|
|
|
configure
|
|
|
|
|
|
|
|
#Start Harbor
|
|
|
|
echo "Starting Harbor..."
|
|
|
|
up
|
|
|
|
|
|
|
|
echo "===================================================="
|