@@ -13,6 +13,7 @@ BEGIN {
13
13
14
14
# netplugin_synced_gopath="/opt/golang"
15
15
go_version = ENV [ "GO_VERSION" ] || "1.7.3"
16
+ docker_version = ENV [ "CONTIV_DOCKER_VERSION" ] || "1.12.3"
16
17
gopath_folder = "/opt/gopath"
17
18
18
19
cluster_ip_nodes = ""
48
49
chown -R vagrant #{ gopath_folder }
49
50
50
51
# Install specific docker version if required
51
- if [[ $8 != "" ]]; then
52
- echo "Installing docker version " $8
53
- if [[ $9 == "ubuntu" ]]; then
54
- curl https://get.docker.com | sed s/docker-engine/docker-engine=$8-0~vivid/ | bash
55
- else
56
- # cleanup openstack-kilo repo if required
57
- yum-config-manager --disable openstack-kilo
58
- curl https://get.docker.com | sed s/docker-engine/docker-engine-$8/ | bash
59
- fi
52
+ echo "Cleaning docker up to reinstall"
53
+ service docker stop || :
54
+ rm -rf /var/lib/docker
55
+ echo "Installing docker version " $8
56
+ if [[ $9 == "ubuntu" ]]; then
57
+ sudo apt-get purge docker-engine -y || :
58
+ curl https://get.docker.com | sed s/docker-engine/docker-engine=#{ docker_version } -0~xenial/g | bash
59
+ else
60
+ # cleanup openstack-kilo repo if required
61
+ yum remove docker-engine -y || :
62
+ yum-config-manager --disable openstack-kilo
63
+ curl https://get.docker.com | sed s/docker-engine/docker-engine-#{ docker_version } / | bash
60
64
fi
65
+
61
66
# setup docker cluster store
62
67
if [[ $7 == *"consul:"* ]]
63
68
then
64
- cp #{ gopath_folder } /src/github.com/contiv/netplugin/scripts/docker.service.consul /lib/systemd/system/docker.service
69
+ perl -i -lpe 's!^ExecStart(.+)$!ExecStart$1 --cluster-store=consul://localhost:8500!' /lib/systemd/system/docker.service
65
70
else
66
- cp #{ gopath_folder } /src/github.com/contiv/netplugin/scripts/docker.service /lib/systemd/system/docker.service
71
+ perl -i -lpe 's!^ExecStart(.+)$!ExecStart$1 --cluster-store=etcd://localhost:2379!' /lib/systemd/system/docker.service
67
72
fi
73
+
68
74
# setup docker remote api
69
- cp #{ gopath_folder } /src/github.com/contiv/netplugin/scripts/docker-tcp.socket /etc/systemd/system/docker-tcp.socket
70
- systemctl enable docker-tcp.socket
71
75
mkdir /etc/systemd/system/docker.service.d
72
76
echo "[Service]" | sudo tee -a /etc/systemd/system/docker.service.d/http-proxy.conf
73
77
echo "Environment=\\ \" no_proxy=$CLUSTER_NODE_IPS,127.0.0.1,localhost,netmaster\\ \" \\ \" http_proxy=$http_proxy\\ \" \\ \" https_proxy=$https_proxy\\ \" " | sudo tee -a /etc/systemd/system/docker.service.d/http-proxy.conf
74
78
sudo systemctl daemon-reload
75
79
sudo systemctl stop docker
76
- systemctl start docker-tcp.socket
77
80
sudo systemctl start docker
78
81
79
82
# remove duplicate docker key
@@ -277,7 +280,18 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
277
280
end
278
281
node . vm . provision "shell" do |s |
279
282
s . inline = provision_common_once
280
- s . args = [ node_name , node_addr , cluster_ip_nodes , ENV [ "http_proxy" ] || "" , ENV [ "https_proxy" ] || "" , ENV [ "USE_RELEASE" ] || "" , ENV [ "CONTIV_CLUSTER_STORE" ] || "etcd://localhost:2379" , ENV [ "CONTIV_DOCKER_VERSION" ] || "" , ENV [ 'CONTIV_NODE_OS' ] || "" , *ENV [ 'CONTIV_ENV' ] ]
283
+ s . args = [
284
+ node_name ,
285
+ node_addr ,
286
+ cluster_ip_nodes ,
287
+ ENV [ "http_proxy" ] || "" ,
288
+ ENV [ "https_proxy" ] || "" ,
289
+ ENV [ "USE_RELEASE" ] || "" ,
290
+ ENV [ "CONTIV_CLUSTER_STORE" ] || "etcd://localhost:2379" ,
291
+ ENV [ "CONTIV_DOCKER_VERSION" ] || docker_version ,
292
+ ENV [ 'CONTIV_NODE_OS' ] || "" ,
293
+ *ENV [ 'CONTIV_ENV' ] ,
294
+ ]
281
295
end
282
296
node . vm . provision "shell" , run : "always" do |s |
283
297
s . inline = provision_common_always
0 commit comments