Skip to content

Dev env setup :: Vagrant (forked from rhamilto)

Ben Petersen edited this page Mar 16, 2017 · 4 revisions

Setting up a dev environment using Vagrant and oc cluster up

Within your origin fork, create .vagrant-openshift.json with the following contents:

{
   "private_network_ip": "10.245.2.2",
   "cpus": 4,
   "memory": 7168,
   "sync_folders_type": "nfs"
}

Run the following:

vagrant up
vagrant ssh
cd /data/src/github.com/openshift/origin
make clean build
unset KUBECONFIG
oc cluster up --metrics --public-hostname=10.245.2.2 --routing-suffix=10.245.2.2.xip.io  --version=latest

Then, within your origin-web-console fork, create or edit app/config.local.js with the following contents:

window.OPENSHIFT_CONFIG = {
  apis: {
    hostPort: "10.245.2.2:8443",
    prefix: "/apis"
  },
  api: {
    openshift: {
      hostPort: "10.245.2.2:8443",
      prefix: "/oapi"
    },
    k8s: {
      hostPort: "10.245.2.2:8443",
      prefix: "/api"
    }
  },
  auth: {
    oauth_authorize_uri: "https://10.245.2.2:8443/oauth/authorize",
    oauth_redirect_base: "https://localhost:9000/dev-console",
    oauth_client_id: "openshift-web-console",
    logout_uri: ""
  },
  loggingURL: "",
  metricsURL: "https://metrics-openshift-infra.10.245.2.2.xip.io/hawkular/metrics"
};

window.OPENSHIFT_VERSION = {
  openshift: "dev-mode",
  kubernetes: "dev-mode"
};

Then run:

grunt serve

Visit https://localhost:9000

Visit https://metrics-openshift-infra.10.245.2.2.xip.io/hawkular/metrics

Configuring your Vagrant dev environment for use within a VirtualBox virtual machine

The following insructions assume you've already set up a dev environment using oc cluster up.

  1. Within your origin Vagrant virtual machine, make the following changes to /var/lib/origin/openshift.local.config/master/master-config.yaml
corsAllowedOrigins:
  # add the following entry
  - rhamilto.usersys.redhat.com:9000
  1. Within your origin Vagrant virtual machine, run:

    oc cluster down
    
    oc cluster up --metrics --public-hostname=10.245.2.2 --routing-suffix=10.245.2.2.xip.io --version=latest --host-config-dir='/var/lib/origin/openshift.local.config' --use-existing-config=true
    
    oc login -u system:admin
    
    oc patch oauthclient/openshift-web-console -p '{"redirectURIs":["https://rhamilto.usersys.redhat.com:9000/"]}'
    
  2. Within your origin-web-console fork, edit app/config.local.js with the following change:

    oauth_redirect_base: "https://rhamilto.usersys.redhat.com:9000/dev-console",
    

    Note: integration tests will not run with this change in effect!

  3. Within your origin-web-console fork, stop grunt if it is already running and then:

    grunt serve --hostname=rhamilto.usersys.redhat.com
    
  4. Visit https://rhamilto.usersys.redhat.com:9000

  5. Visit https://metrics-openshift-infra.10.245.2.2.xip.io/hawkular/metrics

Clone this wiki locally