Evaluating FeatureHub with simple Docker example
If you are just curious to see how FeatureHub works and would like to play with it before deciding which of the installation options are right for you, start with running this simple line:
on Mac or Windows:
docker run -p 8085:8085 --user 999:999 -v $HOME/party:/db featurehub/party-server:latest
docker run --network host --user 999:999 -p 8085:8085 -v $HOME/party:/db featurehub/party-server:latest
$HOME/tmp is where you wish to store the database (h2).
An alternative is to use the Docker Compose based evaluation example if you are familiar with that tool.
You can watch the video with some instructions here or follow the instructions below.
This is what will be running:
|the dotted edge represents the container boundary.
With the database embedded inside the container, yet storing its files on your local disk, this is very much an evaluation style of deployment.
This will start FeatureHub Admin Console on port 8085 and you can now register as Super Admin, then create Portfolios, Applications, Features etc.
Once you have done this, you can then simply run the example app that comes in its own docker container, so you don’t have to create sample app and add SDK code yourself. The example project consists of a back-end service (Node) and a front-end sample app (React) with some sample features already in place.
The example will need to know the SDK API Key of your application/environment (which you can find in the FeatureHub Admin Console), and it will need an IP address that the example docker image can get access to.
Find your en0 ip address (you can type:
ifconfig en0 - choose the inet address, Windows will be slightly different) or similar. (Do not use localhost as that will not work)
# this is the "client_eval" key used by the example server export FEATUREHUB_CLIENT_API_KEY="default/82afd7ae-e7de-4567-817b-dd684315adf7/SHxmTA83AJupii4TsIciWvhaQYBIq2*JxIKxiUoswZPmLQAIIWN" # this is the "server eval" key used by the React front-end export FEATUREHUB_SERVER_API_KEY="default/d8ba747d-7d3c-4454-9c58-130390848412/5EE3vua1NqY0ez6Zd4TXU7XnsZdAPHtR96XaDmhfegitKGiQ9aCdmtmeNUNPubkRZLJLUUpaC7b05ELk" export MY_IP=192.168.XX.XX export FEATUREHUB_EDGE_URL=http://$MY_IP:8085/ docker run --rm -e FEATUREHUB_EDGE_URL=$FEATUREHUB_EDGE_URL -e FEATUREHUB_CLIENT_API_KEY=$FEATUREHUB_CLIENT_API_KEY -e FEATUREHUB_SERVER_API_KEY=$FEATUREHUB_SERVER_API_KEY -p 5000:5000 featurehub/example_node:1.3.0
on Linux, replace the last line with:
docker run --network host --rm -e FEATUREHUB_EDGE_URL=$FEATUREHUB_EDGE_URL -e FEATUREHUB_CLIENT_API_KEY=$FEATUREHUB_CLIENT_API_KEY -e FEATUREHUB_SERVER_API_KEY=$FEATUREHUB_SERVER_API_KEY -p 5000:5000 featurehub/example_node:1.3.0
This will kick off the example React app that can be accessed on port 5000. It will also start the "back-end" Node server that runs inside the container on port 8099. Experiment with the sample app - add a few todo’s using "lower case" letters.
If you create a feature flag in the FeatureHub Admin Console called
FEATURE_TITLE_TO_UPPERCASE, unlock it and set it to true. Add another "to-do" and see how items now being served in "upper case" letters. This flag is affecting the Node backend service as this is where the feature is implemented using Typescript FeatureHub SDK.
Now in the FeatureHub Admin Console, if you create a feature of type "String" called
SUBMIT_COLOR_BUTTON and set its value to
cyan, you will see the "Add" button will swap to cyan colour in near real-time.