2018-09-19 09:49:43 +00:00
|
|
|
#!/bin/bash
|
2019-11-28 11:57:49 +00:00
|
|
|
set -x
|
2018-09-19 09:49:43 +00:00
|
|
|
|
|
|
|
set +e
|
|
|
|
sudo rm -fr /data/*
|
|
|
|
sudo mkdir -p /data
|
2019-12-11 11:11:20 +00:00
|
|
|
DIR="$(cd "$(dirname "$0")" && pwd)"
|
2018-09-19 09:49:43 +00:00
|
|
|
|
|
|
|
set -e
|
2019-11-28 11:57:49 +00:00
|
|
|
if [ -z "$1" ]; then echo no ip specified; exit 1;fi
|
2018-09-19 09:49:43 +00:00
|
|
|
# prepare cert ...
|
2019-11-28 11:57:49 +00:00
|
|
|
sudo ./tests/generateCerts.sh $1
|
2021-01-26 09:03:34 +00:00
|
|
|
|
|
|
|
python --version
|
|
|
|
pip -V
|
|
|
|
cat /etc/issue
|
|
|
|
cat /proc/version
|
|
|
|
sudo -H pip install --ignore-installed urllib3 chardet requests --upgrade
|
|
|
|
python --version
|
|
|
|
|
2021-03-17 14:33:02 +00:00
|
|
|
#---------------Set DNS for docker v20-----------------------#
|
2021-02-25 03:57:27 +00:00
|
|
|
# In docker v20, it fixed an issue named "Wrong resolv.conf
|
2021-03-17 14:33:02 +00:00
|
|
|
# used on Ubuntu 19", this fix caused DNS solve problem
|
2021-02-25 03:57:27 +00:00
|
|
|
# in container. So the current work round is read DNS server
|
|
|
|
# from system and set the value in /etc/docker/daemon.json.
|
|
|
|
|
|
|
|
ip addr
|
2021-03-17 14:33:02 +00:00
|
|
|
docker_config_file="/etc/docker/daemon.json"
|
|
|
|
dns_ip_string=$(netplan ip leases eth0 | grep -i dns | awk -F = '{print $2}' | tr " " "\n" | sed 's/,/","/g')
|
|
|
|
dns=[\"${dns_ip_string}\"]
|
|
|
|
echo dns=${dns}
|
2021-02-25 03:57:27 +00:00
|
|
|
|
2021-03-17 14:33:02 +00:00
|
|
|
cat $docker_config_file
|
|
|
|
if [ -f $docker_config_file ];then
|
|
|
|
if [ $(cat /etc/docker/daemon.json |grep \"dns\" |wc -l) -eq 0 ];then
|
|
|
|
sudo sed "s/}/,\n \"dns\": $dns\n}/" -i $docker_config_file
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "{\"dns\": $dns}" > $docker_config_file
|
2021-02-25 03:57:27 +00:00
|
|
|
fi
|
2021-03-17 14:33:02 +00:00
|
|
|
cat $docker_config_file
|
|
|
|
sudo systemctl stop docker
|
|
|
|
sudo systemctl start docker
|
|
|
|
sleep 2
|
|
|
|
#------------------------------------------------------------#
|
2021-02-25 03:57:27 +00:00
|
|
|
|
2019-04-02 12:08:26 +00:00
|
|
|
sudo ./tests/hostcfg.sh
|
|
|
|
|
2018-09-19 09:49:43 +00:00
|
|
|
if [ "$2" = 'LDAP' ]; then
|
|
|
|
cd tests && sudo ./ldapprepare.sh && cd ..
|
|
|
|
fi
|
|
|
|
|
2020-03-10 06:55:55 +00:00
|
|
|
if [ $GITHUB_TOKEN ];
|
|
|
|
then
|
|
|
|
sed "s/# github_token: xxx/github_token: $GITHUB_TOKEN/" -i make/harbor.yml
|
|
|
|
fi
|
2020-09-01 10:48:56 +00:00
|
|
|
|
2021-01-07 10:34:01 +00:00
|
|
|
sed "s|# metric:|metric:|" -i make/harbor.yml
|
|
|
|
sed "s|# enabled: false| enabled: true|" -i make/harbor.yml
|
|
|
|
sed "s|# port: 9090| port: 9090|" -i make/harbor.yml
|
|
|
|
sed "s|# path: /metrics| path: /metrics|" -i make/harbor.yml
|
|
|
|
|
2021-01-22 03:33:42 +00:00
|
|
|
sudo make build_base_docker compile build prepare COMPILETAG=compile_golangimage GOBUILDTAGS="include_oss include_gcs" BUILDBIN=true NOTARYFLAG=true TRIVYFLAG=true CHARTFLAG=true GEN_TLS=true
|
2020-07-22 03:09:01 +00:00
|
|
|
|
|
|
|
# set the debugging env
|
|
|
|
echo "GC_TIME_WINDOW_HOURS=0" | sudo tee -a ./make/common/config/core/env
|
|
|
|
sudo make start
|
2020-04-20 08:00:08 +00:00
|
|
|
|
|
|
|
# waiting 5 minutes to start
|
|
|
|
for((i=1;i<=30;i++)); do
|
|
|
|
echo $i waiting 10 seconds...
|
|
|
|
sleep 10
|
|
|
|
curl -k -L -f 127.0.0.1/api/v2.0/systeminfo && break
|
2020-06-15 16:20:18 +00:00
|
|
|
docker ps
|
2020-05-22 04:06:25 +00:00
|
|
|
done
|