Code Monkey home page Code Monkey logo

vagrant-openshift's Introduction

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

Clone the OpenShift Origin repositories

OpenShift 3
$ echo "export GOPATH=~/code" >> ~/.bash_profile   # ~/code can be any dir
$ source ~/.bash_profile
$ cd $GOPATH
$ vagrant geard-local-checkout <github username>
OpenShift 2.x
$ vagrant origin-local-checkout <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 <instance name>
Command options:
  • Specify which OS to build with:

    • --os fedora - Launch a Fedora 20 image

    • --os rhel - Launch a RHEL image (where available)

    • --os centos - Launch a CentOS image (where available)

  • Specify the stage of image to launch:

    • --stage os - Launch the base operating system with no OpenShift dependencies

    • --stage deps - Launch the image with OpenShift dependencies already installed

    • --stage inst - Launch the image with OpenShift fully installed

So to launch the latest OpenShift instance:
$ 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

OpenShift 3
$ vagrant sync-geard
OpenShift 2.x
$ vagrant sync

Running OpenShift Origin Tests

OpenShift 3
$ vagrant test-geard --all
OpenShift 2.x
$ vagrant test --all

Other Notes

Install OpenShift and its Dependencies

If starting from --stage os, install the build and package dependencies.

OpenShift 3
$ vagrant build-geard-base
$ vagrant install-geard
$ vagrant build-geard-broker
$ vagrant install-geard-broker
OpenShift 2.x
$ vagrant origin-build-base
$ vagrant sync --clean

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.
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 '~/.awscreds' file and it will be automatically added to the Vagrantfile.

Example:

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

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.

vagrant-openshift's People

Contributors

bparees avatar danmcp avatar derekwaynecarr avatar jhadvig avatar jwforres avatar kraman avatar mfojtik avatar mihaibuzgau avatar nhr avatar pmorie avatar smarterclayton avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.