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

fabric8-services/fabric8-toggles

Repository files navigation

Fabric8 Toggles

Unleash-server bundled for OpenShift deployment. Loosely based on https://github.com/Unleash/unleash-docker

Build

npm install

Dev deployment

Pre-requisites

2 options to run the DB:

  • either Deploy on minishift see toggles-db.yml

  • or run locally postgres

Without authentication

  • Test in dev mode without GH auth/authz

DEV_MODE=true DATABASE_URL=postgres://user:password@MINISHIFT_IP:31210/unleashdb npm start

where MINISHIFT_IP is where you DB is deployed and 31210 the port where it’s running. It could be minishift or locally.

  • Debug

DEV_MODE=true DATABASE_URL=postgres://user:password@MINISHIFT_IP:31210/unleashdb npm run start:debug

Open chrome with chrome://inspect and choose Remote Target to open a chrome too.

With GH auth/authz

pre-requisites

You need to configure GH OAuth app to test it locally:

  1. Go to OAuth app

  2. Create a new developer application, in the Authorization callback URL,

  3. Enter the url http://localhost:4242/api/auth/callback.

You’ll get a page with GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET.

Note
The URL you enter should should match the env variable GITHUB_CALLBACK_URL you’ll use to start the server

Run

To test with GH authorization targeting prod-preview GH teams

DATABASE_URL=postgres://user:password@MINISHIFT_IP:31210/unleashdb GITHUB_CLIENT_ID=YYY GITHUB_CLIENT_SECRET=XXX GITHUB_CALLBACK_URL=http://localhost:4242/api/auth/callback npm start

Deployment on minishift

Pre-requisites

  • Install Minishift

  • Install OpenShift command oc

  • Start minishift

minishift start --memory=7000 --cpus=4 --disk-size=50g

on macOS:

minishift start --vm-driver=xhyve --memory=7000 --cpus=4 --disk-size=50g
  • Point oc to Minishift

oc config use-context minishift
oc login -u developer -p developer

Build docker image and push to minishift repo

(optional) if you want to start deleting any existing fabric8 project in your minishift:

make clean-minishift

and once ready:

make push-minishift
Note
To check the image was pushed to your minishift internal repo: eval $(minishift docker-env) and docker images

Deploy to minishift

As pre-requisites, make sure you have your GH OAuth app created.

GITHUB_CLIENT_ID=XXX GITHUB_CLIENT_SECRET=YYY GITHUB_CALLBACK_URL=http://toggles-fabric8.192.168.64.6.nip.io/api/auth/callback TOGGLES_ORG=push.registry.devshift.net/fabric8-services GITHUB_ORG=rhdt-toggles-test GITHUB_TEAM=toggles-admin-test TOGGLES_CONTEXT='' make deploy-minishift

to deploy to minishift using the CI?/CD image.

NOTE 1: If you want to use CI/CD image run TOGGLES_ORG=registry.devshift.net/fabric8-services/fabric8-toggles make deploy-minishift

NOTE 2: Pre-fix the target with relevant env variables:

  • either with auth: GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, GITHUB_CLIENT_SECRET, GITHUB_CALLBACK_URL, GITHUB_ORG, GITHUB_TEAM.

  • or without auth: DEV_MODE

Release

fabric8-toggles is a wrapper around unleash-server which depends on unleash-frontend upstream projects. When we need different release cycle we use forked npm releases until upstream projects released latest content.

Release unleash-frontent

npm login
npm publish
Note
make sure unleash-server is pointing to your unleash-frontend release.

Release unleash

At the moment, we point to github branch to point to forked unleash-frontend release.