Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Latest commit

 

History

History

minishift

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Running Auth, Cluster services on OpenShift

Prerequisites

Install Minishift

Make sure you have all prerequisites installed. Please check the list here.

Download and put minishift in your $PATH by following steps here.

Verify installation by running following command, you should get version number.

minishift version

Install oc

Please install and set up oc on your machine by visiting oc.

Verify installation by running following command, you should get version number.

oc version

Usage

TL;DR

make minishift-start
eval $(minishift docker-env)
make dev-openshift

Make sure that you have minishift running. you can check it using minishift status. If not then start it using make minishift-start target.

Please enter sudo password when prompted, it is needed in order to create an entry in the /etc/hosts. minishift ip gives the IP address on which MiniShift is running. This automation creates a host entry as minishift.local for that IP. This domain is whitelisted on fabric8-auth.

After successfully starting minishift, configure your shell to use docker daemon from minishift using eval $(minishift docker-env).

Now it’s time to run fabric8-cluster and it’s dependent services i.e. fabric8-auth on OpenShift use following command:

make dev-openshift

This build uses the developer account for creating a project called fabric8-services.

The above command then automates the process of running the containers on OpenShift in MiniShift by using openshift templates.

Once the cluster service is running, it will be available at http://f8cluster-fabric8-services.$(minishift_ip).nip.io/api.

If you wish to access the cluster Postgres database, it is available on the same host but on port 31002. Use the following command to connect with the Postgres client:

PGPASSWORD=mysecretpassword psql -h minishift.local -U postgres -d postgres -p 31002

However you can see auth service is running, and will be available at http://auth-fabric8-services.$(minishift_ip).nip.io/api.

If you wish to access the auth Postgres database, it is available on the same host but on port 31001. Use the following command to connect with the Postgres client:

PGPASSWORD=mysecretpassword psql -h minishift.local -U postgres -d postgres -p 31001

See the next sections for other make targets to run fabric8-cluster, fabric8-auth independently on minishift

Deploying services on Minishift

Here, we are going to deploy auth, cluster, services on minishift.

Minishift Configuration

Start Minishift

We have make target defined to start minishift with required cpu’s and configuration.

make minishift-start

Please enter sudo password when prompted, it is needed in order to create an entry in the /etc/hosts. minishift ip gives the IP address on which MiniShift is running. This automation creates a host entry as minishift.local for that IP. This domain is whitelisted on fabric8-auth.

Make sure to verify that your console is configured to reuse the Minishift Docker daemon by running docker ps command. You should be able to see running containers for origin. If not then follow this guide to configure it.

Create a Project

Let’s create a new project by executing following make target.

make init-project

This will create a new project with name fabric8-services with developer:developer account and switch to it. Make sure to verify that using oc project.

Auth Service

Deploying Auth

To deploy auth service, we have following make target which will deploy required secrets, postgres DB and create routes for you.

make deploy-auth

Look for running pods using oc get pods. You should be able to see two pods(auth-, db-auth-). First time it will take some time as it has download required container images.

Check auth service status

You can get auth route by using oc get routes. It should be in format auth-fabric8-services.${minishift ip}.nip.io You can check status by hitting this in browser http://auth-fabric8-services.$(minishift_ip).nip.io/api/status(e.g. http://auth-fabric8-services.192.168.42.177.nip.io/api/status).

Connecting to Auth Postgres DB

If you wish to access the Postgres database, it is available on the same host but on port 31001. Use the following command to connect with the Postgres client:

PGPASSWORD=mysecretpassword psql -h minishift.local -U postgres -d postgres -p 31001

Cluster Service

Deploying Cluster

To deploy cluster service, we have following make target which will deploy required secrets, config map, postgres DB and create routes for you.

make deploy-cluster

Look for running pods using oc get pods. You should be able to see two pods(f8cluster-, db-f8cluster-). First time it will take some time as it has download required container images.

Check Cluster service status

You can get cluster route by using oc get routes. It should be in format f8cluster-fabric8-services.${minishift ip}.nip.io You can check status by hitting this in browser http://f8cluster-fabric8-services.${minishift_ip}.nip.io/api/status(e.g. http://f8cluster-fabric8-services.192.168.42.177.nip.io/api/status).

Connecting to Cluster Postgres DB

If you wish to access the Postgres database, it is available on the same host but on port 31002. Use the following command to connect with the Postgres client:

PGPASSWORD=mysecretpassword psql -h minishift.local -U postgres -d postgres -p 31002

Deploying Auth, Cluster together

To deploy auth, f8cluster together we have following target:

make deploy-all

Cleaning Up

Cleaning Auth

This removes both the auth and db-auth services from minishift.

make clean-auth

Cleaning Cluster

This removes both the f8cluster and db-f8cluster services from minishift.

make clean-cluster

Cleaning Auth, Cluster

This removes auth, f8cluster services from minishift and deletes the fabric8-services project.

make clean-all

Redeploying Cluster service

However if you are working on cluster service and wants to redeploy latest code change by building container with latest binary. We have special target for it which will do that for you.

It won’t deploy required secrets and postgres db again. It’ll re-deploy cluster service only.

make redeploy-cluster

Checking services logs

List out all running services in MiniShift using

oc get pods

Wait until all pods are in running state and then copy pod name and use following command to see logs

oc logs <<pod name>> -f