├── .gitignore ├── LICENSE ├── README.md ├── Vagrantfile └── scripts ├── build.sh ├── config.sh ├── install.sh ├── nginx.sh └── packages.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .Vagrant 2 | *.yml 3 | *.rpm -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Christopher Banck 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | vagrant-coprhd 2 | --------------- 3 | 4 | # Description 5 | 6 | Vagrantfile to create a single node [CoprHD](coprhd.github.io) controller. CoprHD will be build from sources. 7 | 8 | # Requirements 9 | * 4 vCPU 10 | * 6 GB of free RAM 11 | * Vagrant 12 | * Virtualbox or VMware Fusion 13 | 14 | # Usage 15 | Either use the "Download ZIP" link on the right side of this page and unpack the zipfile somewhere on your computer, or clone using git: `git clone https://github.com/vchrisb/vagrant-coprhd.git` 16 | 17 | Now open a shell and change directory to vagrant-coprhd 18 | 19 | Finally issue `vagrant up`. Depending on your Vagrant Provider you may want to add `--provider virtualbox` or `--provider vmware_fusion`. 20 | 21 | Depending on your download bandwidth does the installation and build take some time. 22 | 23 | Once Vagrant is done you should be able to connect to CoprHD a few minutes later by opening `https://192.168.100.10`. 24 | 25 | Username: `root` 26 | Password: `ChangeMe` 27 | 28 | Documentation for CoprHD is currently the same as the commercial ViPR Product: 29 | https://community.emc.com/docs/DOC-41200 30 | 31 | # Troubleshoot 32 | 33 | If you experience an error please look at the logs. The CoprHD build process will download artifacts from the CoprHD Jenkins server and many other ones. 34 | I've tested with `Vagrant 1.7.2` and `Virtualbox 4.3.28` on `Windows 7`. 35 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # CoprHD IP Address using a host only network 5 | node_ip = "192.168.100.11" 6 | virtual_ip = "192.168.100.10" 7 | 8 | # we are using the vagrant host IP as GW 9 | gw_ip = "192.168.100.1" 10 | 11 | # build CoprHD from sources 12 | build = true 13 | 14 | Vagrant.configure(2) do |config| 15 | 16 | # try to enable caching to speed up package installation for second run 17 | if Vagrant.has_plugin?("vagrant-cachier") 18 | config.cache.scope = :box 19 | end 20 | 21 | # using a minimal OpenSUSE 13.2 64Bit box 22 | # Packer Template can be found here: https://github.com/vchrisb/packer-templates 23 | config.vm.box = "vchrisb/openSUSE-13.2_64" 24 | 25 | # Set up hostname 26 | config.vm.hostname = "coprhd1.lab.local" 27 | 28 | # Create a private network, which allows host-only access to the machine 29 | # using a specific IP. 30 | config.vm.network "private_network", ip: "#{node_ip}" 31 | 32 | # configure virtualbox provider 33 | config.vm.provider "virtualbox" do |v| 34 | v.gui = false 35 | v.name = "CoprHD1" 36 | v.memory = 6144 37 | v.cpus = 4 38 | end 39 | 40 | config.vm.provider "vmware_fusion" do |v| 41 | v.gui = false 42 | v.vmx["displayname"] = "CoprHD1" 43 | v.vmx["memsize"] = 8192 44 | v.vmx["numvcpus"] = 2 45 | v.vmx["cpuid.coresPerSocket"] = 2 46 | end 47 | 48 | # install necessary packages 49 | config.vm.provision "packages", type: "shell" do |s| 50 | s.path = "scripts/packages.sh" 51 | s.args = "--build #{build}" 52 | end 53 | 54 | # donwload, patch and build nginx 55 | config.vm.provision "nginx", type: "shell", path: "scripts/nginx.sh" 56 | 57 | # create CoprHD configuration file 58 | config.vm.provision "config", type: "shell" do |s| 59 | s.path = "scripts/config.sh" 60 | s.args = "--node_ip #{node_ip} --virtual_ip #{virtual_ip} --gw_ip #{gw_ip} --node_count 1 --node_id vipr1" 61 | end 62 | 63 | # download and compile CoprHD from sources 64 | config.vm.provision "build", type: "shell" do |s| 65 | s.path = "scripts/build.sh" 66 | s.args = "--build #{build}" 67 | end 68 | 69 | # install CoprHD RPM 70 | config.vm.provision "install", type: "shell" do |s| 71 | s.path = "scripts/install.sh" 72 | s.args = "--virtual_ip #{virtual_ip}" 73 | end 74 | 75 | end 76 | 2 77 | -------------------------------------------------------------------------------- /scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | while [[ $# > 1 ]] 3 | do 4 | key="$1" 5 | case $key in 6 | -b|--build) 7 | build="$2" 8 | shift 9 | ;; 10 | *) 11 | # unknown option 12 | ;; 13 | esac 14 | shift 15 | done 16 | 17 | if [ "$build" = true ] || [ ! -e /vagrant/*.rpm ]; then 18 | # build CoprHD 19 | cd /tmp 20 | git clone https://review.coprhd.org/scm/ch/coprhd-controller.git 21 | cd coprhd-controller 22 | make clobber BUILD_TYPE=oss rpm 23 | rm -rf /vagrant/*.rpm 24 | cp -a /tmp/coprhd-controller/build/RPMS/x86_64/storageos-*.x86_64.rpm /vagrant 25 | fi 26 | -------------------------------------------------------------------------------- /scripts/config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | while [[ $# > 1 ]] 4 | do 5 | key="$1" 6 | 7 | case $key in 8 | -ip|--node_ip) 9 | IP="$2" 10 | shift 11 | ;; 12 | -vip|--virtual_ip) 13 | VIP="$2" 14 | shift 15 | ;; 16 | -gw|--gw_ip) 17 | GW="$2" 18 | shift 19 | ;; 20 | -count|--node_count) 21 | COUNT="$2" 22 | shift 23 | ;; 24 | -id|--node_id) 25 | ID="$2" 26 | shift 27 | ;; 28 | *) 29 | # unknown option 30 | ;; 31 | esac 32 | shift 33 | done 34 | 35 | #add required users and groups 36 | groupadd storageos 37 | useradd -d /opt/storageos -g storageos storageos 38 | 39 | #create config file 40 | cat > /etc/ovfenv.properties << EOF 41 | network_1_ipaddr6=::0 42 | network_1_ipaddr=$IP 43 | network_gateway6=::0 44 | network_gateway=$GW 45 | network_netmask=255.255.255.0 46 | network_prefix_length=64 47 | network_vip6=::0 48 | network_vip=$VIP 49 | node_count=$COUNT 50 | node_id=$ID 51 | EOF 52 | 53 | -------------------------------------------------------------------------------- /scripts/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | while [[ $# > 1 ]] 4 | do 5 | key="$1" 6 | 7 | case $key in 8 | -vip|--virtual_ip) 9 | VIP="$2" 10 | shift 11 | ;; 12 | *) 13 | # unknown option 14 | ;; 15 | esac 16 | shift 17 | done 18 | 19 | # install CoprHD 20 | rpm -U /vagrant/storageos-*.x86_64.rpm 21 | 22 | #CoprHD Version 23 | sudo cat /opt/storageos/etc/product 24 | 25 | printf "Waiting for the CoprHD services to start..." 26 | SERVICES="nginx storageos-api storageos-auth storageos-controller storageos-coordinator storageos-db storageos-installer storageos-portal storageos-sa storageos-sys" 27 | TIMER=1 28 | INTERVAL=10 29 | while [[ "`systemctl is-active $SERVICES`" =~ "inactive" ]]; 30 | do 31 | if [ $TIMER -gt 300 ]; then 32 | echo "" 33 | echo "CoprHD Services did not start in a timely (300s) fashion!" >&2 34 | echo "Services start may have been delayed or failed." >&2 35 | echo "Issue 'vagrant destroy' followed by 'vagrant up' to restart deplyoment." >&2 36 | exit 1 37 | fi 38 | printf "." 39 | sleep $INTERVAL 40 | let TIMER=TIMER+$INTERVAL 41 | done 42 | sleep 60 43 | 44 | echo "" 45 | echo "#########################################################" 46 | echo "# #" 47 | echo "# Please open your browser and connect to CoprHD #" 48 | echo "# #" 49 | echo "# https://$VIP #" 50 | echo "# Username: root #" 51 | echo "# Password: ChangeMe #" 52 | echo "# #" 53 | echo "#########################################################" 54 | -------------------------------------------------------------------------------- /scripts/nginx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #install nginx 4 | cd /tmp 5 | wget 'http://nginx.org/download/nginx-1.6.2.tar.gz' 6 | wget 'https://github.com/yaoweibin/nginx_upstream_check_module/archive/v0.3.0.tar.gz' 7 | wget 'https://github.com/openresty/headers-more-nginx-module/archive/v0.25.tar.gz' 8 | tar -xzvf nginx-1.6.2.tar.gz 9 | tar -xzvf v0.3.0.tar.gz 10 | tar -xzvf v0.25.tar.gz 11 | cd nginx-1.6.2 12 | patch -p1 < ../nginx_upstream_check_module-0.3.0/check_1.5.12+.patch 13 | ./configure --add-module=../nginx_upstream_check_module-0.3.0 --add-module=../headers-more-nginx-module-0.25 --with-http_ssl_module --prefix=/usr --conf-path=/etc/nginx/nginx.conf 14 | make 15 | make install -------------------------------------------------------------------------------- /scripts/packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | while [[ $# > 1 ]] 3 | do 4 | key="$1" 5 | case $key in 6 | -b|--build) 7 | build="$2" 8 | shift 9 | ;; 10 | *) 11 | # unknown option 12 | ;; 13 | esac 14 | shift 15 | done 16 | 17 | #update system 18 | zypper -n update 19 | 20 | #remove if existing, otherwise phython-devel and other install will raise a conflict 21 | zypper -n remove patterns-openSUSE-minimal_base-conflicts 22 | 23 | if [ "$build" = true ] || [ ! -e /vagrant/*.rpm ]; then 24 | 25 | #install required packages 26 | zypper -n install wget telnet nano ant apache2-mod_perl createrepo expect gcc-c++ gpgme inst-source-utils java-1_8_0-openjdk java-1_8_0-openjdk-devel kernel-default-devel kernel-source kiwi-desc-isoboot kiwi-desc-oemboot kiwi-desc-vmxboot kiwi-templates libtool openssh-fips perl-Config-General perl-Tk python-libxml2 python-py python-requests setools-libs python-setools qemu regexp rpm-build sshpass sysstat unixODBC xfsprogs xml-commons-jaxp-1.3-apis zlib-devel git git-core glib2-devel libgcrypt-devel libgpg-error-devel libopenssl-devel libuuid-devel libxml2-devel pam-devel pcre-devel perl-Error python-devel readline-devel subversion xmlstarlet xz-devel libpcrecpp0 libpcreposix0 ca-certificates-cacert p7zip python-iniparse python-gpgme yum keepalived 27 | 28 | #add repos 29 | zypper addrepo -k -t rpm-md -n suse-13.2-scalpel4k http://download.opensuse.org/repositories/home:/scalpel4k/openSUSE_13.2 suse-13.2-scalpel4k 30 | zypper addrepo -k -t rpm-md -n suse-13.1-cesarizu http://download.opensuse.org/repositories/home:/cesarizu/openSUSE_13.1 suse-13.1-cesarizu 31 | zypper addrepo -k -t rpm-md -n suse-13.2-seife http://download.opensuse.org/repositories/home:/seife:/testing/openSUSE_13.2 suse-13.2-seife 32 | zypper addrepo -k -t rpm-md -n suse-13.2-python http://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_13.2 suse-13.2-python 33 | zypper addrepo -k -t rpm-md -n suse-13.2-monitoring http://download.opensuse.org/repositories/server:/monitoring/openSUSE_13.2 suse-13.2-monitoring 34 | zypper addrepo -k -t rpm-md -n suse-13.2-network_utilities http://download.opensuse.org/repositories/network:utilities/openSUSE_13.2 suse-13.2-network_utilities 35 | 36 | #refresh repos 37 | zypper --gpg-auto-import-keys -n refresh 38 | 39 | #install ndisc6 40 | zypper -n install -r suse-13.2-network_utilities ndisc6 41 | 42 | #install maven and disable repo 43 | zypper -n install -r suse-13.1-cesarizu apache-maven 44 | zypper modifyrepo -d suse-13.1-cesarizu 45 | 46 | #install monitoring packages and disable repo 47 | zypper -n install -r suse-13.2-monitoring atop GeoIP-data libGeoIP1 GeoIP 48 | zypper modifyrepo -d suse-13.2-monitoring 49 | 50 | #install sipcalcand disable repo 51 | zypper -n install -r suse-13.2-seife sipcalc 52 | zypper modifyrepo -d suse-13.2-seife 53 | 54 | #install python-cjson and disable repo 55 | zypper -n install -r suse-13.2-python python-cjson 56 | zypper modifyrepo -d suse-13.2-python 57 | 58 | #install gradle and disable repo 59 | zypper -n install -r suse-13.2-scalpel4k gradle 60 | zypper modifyrepo -d suse-13.2-scalpel4k 61 | else 62 | zypper -n install patch gcc-c++ pcre-devel libopenssl-devel keepalived make telnet java-1_8_0-openjdk java-1_8_0-openjdk-devel openssh-fips 63 | 64 | zypper addrepo -k -t rpm-md -n suse-13.2-seife http://download.opensuse.org/repositories/home:/seife:/testing/openSUSE_13.2 suse-13.2-seife 65 | zypper --gpg-auto-import-keys -n refresh 66 | 67 | #install sipcalcand disable repo 68 | zypper -n install -r suse-13.2-seife sipcalc 69 | zypper modifyrepo -d suse-13.2-seife 70 | fi 71 | --------------------------------------------------------------------------------