Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push photon to project library #1184

Merged
merged 2 commits into from
Nov 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions tools/ova/script/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,57 @@ function configureHarborCfg {
then
sed -i -r s%"#?$cfg_key\s*=\s*.*"%"$cfg_key = $cfg_value"% $cfg_file
fi
}

function configureDockerDNS {
echo "Resetting DNS using vami_ovf_process..."
/opt/vmware/share/vami/vami_ovf_process --setnetwork || true

sed -n -e 's/^nameserver //p' /etc/resolv.conf > /tmp/dns
readarray dns < /tmp/dns

opts=""
for d in "${dns[@]}"
do
if [ -n "$d" ]
then
opts="$opts --dns=$d"
fi
done
rm /tmp/dns

domain=$(sed -n -e 's/^domain //p' /etc/resolv.conf)
if [ -n "$domain" ]
then
opts="$opts --dns-search=$domain"
fi

search=$(sed -n -e 's/^search //p' /etc/resolv.conf)
if [ -n "$search" ]
then
searcharray=($search)
for s in "${searcharray[@]}"
do
if [ -n "$s" ]
then
opts="$opts --dns-search=$s"
fi
done
fi

echo Setting docker: $opts
echo DOCKER_OPTS=$opts > /etc/default/docker
systemctl restart docker
}

function pushPhoton {
set +e
basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
registry_version=$(sed -n -e 's|.*library/registry:||p' $basedir/../harbor/docker-compose.yml)
docker run -d --name photon_pusher -v /data/registry:/var/lib/registry -p 5000:5000 registry:$registry_version
docker tag photon:1.0 127.0.0.1:5000/library/photon:1.0
sleep 5
docker push 127.0.0.1:5000/library/photon:1.0
docker rm -f photon_pusher
set -e
}
2 changes: 1 addition & 1 deletion tools/ova/script/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function detectHostname {
# echo "Get hostname from ovfenv: $hostname"
# return
#fi
echo "Resetting DNS and hostname using vami_ovf_process..."
echo "Resetting hostname using vami_ovf_process..."
/opt/vmware/share/vami/vami_ovf_process --setnetwork || true
hostname=$(hostname --fqdn) || true
if [ -n $hostname ]
Expand Down
9 changes: 7 additions & 2 deletions tools/ova/script/firstboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,20 @@ addIptableRules
echo "Installing docker compose..."
installDockerCompose

echo "Starting docker service..."
systemctl start docker
#echo "Starting docker service..."
#systemctl start docker
echo "Configuring docker..."
configureDockerDNS

echo "Uncompress Harbor offline instaler tar..."
tar -zxvf $base_dir/../harbor-offline-installer*.tgz -C $base_dir/../

echo "Loading images..."
load

echo "Pushing photon to project library..."
pushPhoton

echo "Configuring Harbor..."
chmod 600 $base_dir/../harbor/harbor.cfg

Expand Down
3 changes: 3 additions & 0 deletions tools/ova/script/subsequentboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ fi
echo "Configuring Harbor..."
configure

echo "Configuring docker..."
configureDockerDNS

#Start Harbor
echo "Starting Harbor..."
up
Expand Down