This is a Vagrant 1.2+ plugin that adds command and provisioner to build and test OpenShift Origin.
Note
|
This plugin requires Vagrant 1.2+ |
-
Compatible with VMs run via VirtualBox, AWS or managed providers.
-
Provides commands to install build dependencies, sync repositories, and run tests
To work on the vagrant-openshift plugin, clone this repository out, and use Bundler to get the dependencies:
$ bundle
Install prereq plugins to Vagrant
$ vagrant plugin install vagrant-aws
Compile an install the plugin using Rake
$ rake vagrant:install
$ echo "export GOPATH=~/code" >> ~/.bash_profile # ~/code can be any dir
$ source ~/.bash_profile
$ cd $GOPATH
$ vagrant openshift3-local-checkout -u <github username>
$ cd github.com/src/openshift/origin
Generate a .vagrant-openshift.json it to match your requirements:
$ vagrant origin-init --stage inst --os fedora <instance name>
-
Syncing and building code from local repository clones
$ vagrant sync-openshift3
$ vagrant openshift2-local-checkout -u <github username>
This will clone several repositories from GitHub and link them against the upstream repositories.
Note
|
Skip this step if building upstream code |
Create a Vagrantfile and customize it to match your requirements:
$ vagrant origin-init --stage inst --os centos6 <instance name>
-
Syncing and building code from local repository clones
$ vagrant sync-openshift2
-
Install the latest vagrant-aws plugin. Follow the build steps.
-
Edit the Vagrantfile and update your EC2 credentials.
aws.access_key_id = "<API KEY>" aws.secret_access_key = "<API SECRET>" aws.keypair_name = "<SSH KEY NAME>" override.ssh.private_key_path = "<PRIVATE KEY FILE>"
-
Start the AWS machine
vagrant up --provider=aws
Note
|
Requires latest AWS provider. |
Note
|
You can use the Vagrant-AMI plugin to create an AMI from a running AWS machine. |
-
Install the latest vagrant-openstack-plugin. See: https://github.com/cloudbau/vagrant-openstack-plugin.
-
Edit the Vagrantfile and update your OpenStack credentials, endpoint and tenant (They can be read automatically from ~/.openstackcred).
os.endpoint = "<OPENSTACK ENDPOINT URL>" os.tenant = "<OPENSTACK TENANT>" os.username = "<OPENSTACK USERNAME>" os.api_key = "<OPENSTACK PASSWORD>" os.keypair_name = "<OPENSTACK KEYPAIR NAME>" override.ssh.private_key_path = "<PRIVATE KEY FILE>"
-
Start the OpenStack machine
vagrant up --provider=openstack
Note
|
Requires latest OpenStack provider. |
-
Install the vagrant-libvirt plugin dependencies
yum install libxslt-devel libxml2-devel libvirt-devel
-
Install the vagrant-libvirt plugin
vagrant plugin install vagrant-libvirt
-
Configure LibVirt to allow remote TLS connections
-
Create TLS certificates and key pairs. Follow the guide at http://libvirt.org/remote.html#Remote_certificates Example commands for creating a self signed certificate are provided below.
-
mkdir -p /etc/pki/libvirt/private
#CA Cert
certtool --generate-privkey > cakey.pem
cat <<EOF> ca.info
cn = MyOrg
ca
cert_signing_key
EOF
certtool --generate-self-signed --load-privkey cakey.pem --template ca.info --outfile cacert.pem
/bin/cp -f cacert.pem /etc/pki/CA/cacert.pem
#Server cert
certtool --generate-privkey > serverkey.pem
cat <<EOF> server.info
organization = MyOrg
cn = oirase
tls_www_server
encryption_key
signing_key
EOF
certtool --generate-certificate --load-privkey serverkey.pem \
--load-ca-certificate cacert.pem --load-ca-privkey cakey.pem \
--template server.info --outfile servercert.pem
/bin/cp -f serverkey.pem /etc/pki/libvirt/private/serverkey.pem
/bin/cp -f servercert.pem /etc/pki/libvirt/servercert.pem
#Client cert
certtool --generate-privkey > clientkey.pem
cat <<EOF> client.info
country = US
state = California
locality = Mountain View
organization = MyOrg
cn = client1
tls_www_client
encryption_key
signing_key
EOF
certtool --generate-certificate --load-privkey clientkey.pem \
--load-ca-certificate cacert.pem --load-ca-privkey cakey.pem \
--template client.info --outfile clientcert.pem
/bin/cp -f clientkey.pem /etc/pki/libvirt/private/clientkey.pem
/bin/cp -f clientcert.pem /etc/pki/libvirt/clientcert.pem
-
Modify /etc/sysconfig/libvirtd and enable listening to connections
LIBVIRTD_ARGS="--listen"
-
Restart libvirtd
-
Start the LibVirt machine
-
vagrant up --provider=libvirt
Note
|
Requires latest LibVirt provider |
Running on other environments which are not managed by Vagrant directly.
-
Install the vagrant-managed-servers plugin
vagrant plugin install vagrant-managed-servers
-
Edit the Vagrantfile and update the managed section to update the IP address, User name and SSH key.
managed.server = "HOST or IP of machine" override.ssh.username = "root" override.ssh.private_key_path = "~/.ssh/id_rsa"
-
Connect to the manually managed machine
vagrant up --provider=managed
Note
|
Requires latest Managed provider |
To enable easy customization of the build environment, any files placed under '\~/.openshiftdev/home.d' will be copied to the vagrant user home directory. For example: '~/.openshiftdev/home.d/.bash_profile' will be copied to '.bash_profile' on the vagrant VM.
Rather than have to add AWS credentials every time the Vagrantfile is created using origin-init command, you can specify your credentials in the '~/.awscred' file and it will be automatically added to the Vagrantfile.
Example:
AWSAccessKeyId=<AWS API Key> AWSSecretKey=<AWS API Secret> AWSKeyPairName=<Keypair name> AWSPrivateKeyPath=<SSH Private key>
Rather than have to add OpenStack credentials every time the Vagrantfile is created using origin-init command, you can specify your credentials in the '~/.openstackcred' file and it will be automatically added to the Vagrantfile.
Example:
OSEndpoint=<OpenStack Endpoint URL> OSUsername=<OpenStack Username> OSAPIKey=<OpenStack Password> OSKeyPairName=<Keypair name > OSPrivateKeyPath=<SSH Private key path> OSTenant=<OpenStack Tenant Name>
This software distribution includes cryptographic software that is subject to the U.S. Export Administration Regulations (the "EAR") and other U.S. and foreign laws and may not be exported, re-exported or transferred (a) to any country listed in Country Group E:1 in Supplement No. 1 to part 740 of the EAR (currently, Cuba, Iran, North Korea, Sudan & Syria); (b) to any prohibited destination or to any end user who has been prohibited from participating in U.S. export transactions by any federal agency of the U.S. government; or (c) for use in connection with the design, development or production of nuclear, chemical or biological weapons, or rocket systems, space launch vehicles, or sounding rockets, or unmanned air vehicle systems.You may not download this software or technical information if you are located in one of these countries or otherwise subject to these restrictions. You may not provide this software or technical information to individuals or entities located in one of these countries or otherwise subject to these restrictions. You are also responsible for compliance with foreign law requirements applicable to the import, export and use of this software and technical information.