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

Compile an install the plugin using Rake

$ rake install

Getting started

Clone the OpenShift Origin repositories

$ vagrant origin-local-checkout <github username>

This will clone 3 repositores from your GitHub account 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
Command options:
  • Specify which OS to build with:

    • --os fedora - Launch a Fedora 19 image

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

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

  • Build from bare installation of OS:

    • --no-base

Start the machine

VirtualBox

Running with the default VirtualBox provider

vagrant up
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

Install build dependencies

If starting from a bare OS image, install the build and package dependencies.

$ vagrant origin-build-base
Note
It is a good idea to snapshot the VM after this step so that you don’t have to redo this step every time.

Sync and Build OpenShift packages

  • Perform initial sync from local repository clones and build packages

$ vagrant sync --clean
Note
This will rsync every git repo in your working directory to your origin machine. If you have multiple unrelated projects in the same directory, you can create a special working directory to run sync and populate it with symbolic links to your local clones.
  • Syncing and building code from local repository clones

$ vagrant sync
  • Syncing and building code from upstream repositories

$ vagrant sync --upstream

Running OpenShift Origin Tests

Running basic tests
$ vagrant test --all
Running extended tests
$ vagrant origin-test --extended --all

Other Notes

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>
AWSKeyPair=<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

kraman avatar nhr avatar pmorie avatar mihaibuzgau avatar

Watchers

James Cloos avatar Rabie Z. Abou-Taleb 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.