Skip to content

BlueShells/vagrant-openshift

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenShift Origin Build Tools

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+

Features

  • Compatible with VMs run via VirtualBox, AWS or managed providers.

  • Provides commands to install build dependencies, sync repositories, and run tests

Installing

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

Getting started with Openshift v3

Clone the OpenShift Origin repositories

$ 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

Initialize the Vagrantfile

Generate a .vagrant-openshift.json it to match your requirements:

$ vagrant origin-init --stage inst --os fedora <instance name>

Start the machine

VirtualBox

Running with the default VirtualBox provider

vagrant up

Note: See Other Environments below for launching against other options.

Making Subsequent Changes

  • Syncing and building code from local repository clones

$ vagrant sync-openshift3

Running Tests

$ vagrant test-openshift3 --all

Getting started with Openshift v2

Clone the OpenShift Origin repositories

$ 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

Initialize the Vagrantfile

Create a Vagrantfile and customize it to match your requirements:

$ vagrant origin-init --stage inst --os centos6 <instance name>

Start the machine

VirtualBox

Running with the default VirtualBox provider

vagrant up

Note: See Other Environments below for launching against other options.

Making Subsequent Changes

  • Syncing and building code from local repository clones

$ vagrant sync-openshift2

Running Tests

$ vagrant test-openshift2 --all

Other Notes

Other Environments

AWS/EC2
  • 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.
OpenStack
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.
LibVirt
  • Install the vagrant-libvirt plugin dependencies

yum install libxslt-devel libxml2-devel libvirt-devel
  • Install the vagrant-libvirt plugin

vagrant plugin install vagrant-libvirt
Example self-signed certificates
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
Managed

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

Developer environment

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.

AWS Credentials

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:

'~/.awscred'
AWSAccessKeyId=<AWS API Key>
AWSSecretKey=<AWS API Secret>
AWSKeyPairName=<Keypair name>
AWSPrivateKeyPath=<SSH Private key>

OpenStack Credentials

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:

'~/.openstackcred'
OSEndpoint=<OpenStack Endpoint URL>
OSUsername=<OpenStack Username>
OSAPIKey=<OpenStack Password>
OSKeyPairName=<Keypair name >
OSPrivateKeyPath=<SSH Private key path>
OSTenant=<OpenStack Tenant Name>

Notice of Export Control Law

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.

About

vagrant-openshift

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 98.1%
  • Python 1.9%