vmware / nsx-t-datacenter-ci-pipelines

CI pipelines for VMware NSX-T Datacenter
Other
71 stars 43 forks source link

Publish image to DockerHub #31

Open rbales79 opened 5 years ago

rbales79 commented 5 years ago

It would be really great if the nsx-t-install image was published to dockerhub so it could be pulled without the wonky tar file image and all the issues associated with that. tags :master :unified :whatever

rbales79 commented 5 years ago

Deployment

I have forked the repo, and added the original as upstream, so I fetch upstream, merge upstream to master and push to origin. Then I created a docker hub build job that build the docker image anytime I push changes

I use port 80 for my nginx server, and I create a persistent volume for workspace just to make it easier to t-shoot which versions or what's in some of the files that i'm pulling from github. all you need to do is create the /home/concourse folder, and place your edited pipeline yml file in it, then run the following command to pull the image from docker hub and get it kickstarted.

docker run --name install-nsxt -d -v /var/run/docker.sock:/var/run/docker.sock -v /home/concourse:/home/concourse -v /home/workspace:/home/workspace -e CONCOURSE_URL="http://10.0.102.83:8080" -e EXTERNAL_DNS="10.0.1.2" -e IMAGE_WEBSERVER_PORT=80 -e NSXT_VERSION=2.4.0 -e PIPELINE_BRANCH='nsxt_2.4.0' -e VMWARE_USER='vmwareaccount' -e VMWARE_PASSWORD='vmwareacctpassword' rbales79/install-nsxt:nsxt_2.4.0

For older versions than 2.4 they use the master branch which is default, so no need to specify pipeline_branch.

docker run --name install-nsxt -d -v /var/run/docker.sock:/var/run/docker.sock -v /home/concourse:/home/concourse -v /home/workspace:/home/workspace -e CONCOURSE_URL="http://10.0.102.83:8080" -e EXTERNAL_DNS="10.0.1.2" -e IMAGE_WEBSERVER_PORT=80 -e NSXT_VERSION=2.3.0 -e VMWARE_USER='vmwareaccount' -e VMWARE_PASSWORD='vmwareacctpassword' rbales79/install-nsxt

So I can monitor the initial download of the ova's i watch the file system, the second one can be used to monitor docker containers being deployed

watch -n 1 df watch -n 1 docker ps

Cleanup - in the event of failures, even using terraform to deploy a jumphost, it got tedious redeploying constantly. It was easier to just cleanup and try again, don't forget to delete any vm's and unregister the extension, if nsx vibs were installed on hosts, you should unprep them before doing any of this. I created the bash script to copy my updated yml files, perform the cleanup, and then i can just run the above again.

docker kill $(docker ps -q) docker rm $(docker ps -a -q) docker rmi $(docker images -q) docker system prune --all --force rm -rf /var/lib/docker rm -rf /home/concourse/keys rm -rf /home/concourse/docker-compose.yml rm -rf /home/concourse/generate-keys.sh rm -rf /home/concourse/pipeline_config_internal.yml

Because I mounted workspace as well for troubleshooting

rm -rf /home/workspace/concourse-docker rm -rf /home/workspace/nsx-t-datacenter-ci-pipelines

Because overlayFS hates me

rm -rf /var/lib/docker systemctl stop docker systemctl start docker cp /home/ubuntu/nsx_pipeline_config.yml /home/concourse

Remove vCenter NSX Extension via mob