This continues the instructions from Install the Open Horizon Hub Services.
NOTE: This assumes you are running as root (with sudo
) on the Ubuntu VM
as described in the previous set of instructions and are continuing in the same session.
If you are not, you may need to export all previous environment variables from step 1.
NOTE: Replace x.x.x.x
with the actual IP address of your machine.
export MY_IP=x.x.x.x
echo "export MY_IP=x.x.x.x" >> ~/.bashrc
export HZN_ORG_ID=testorg
echo "export HZN_ORG_ID=testorg" >> ~/.bashrc
export HZN_EXCHANGE_URL=http://${MY_IP}:3090/v1/
echo "export HZN_EXCHANGE_URL=http://${MY_IP}:3090/v1/" >> ~/.bashrc
export HZN_FSS_CSSURL=http://${MY_IP}:9443
echo "export HZN_FSS_CSSURL=http://${MY_IP}:9443" >> ~/.bashrc
export HZN_EXCHANGE_ROOT_USER_AUTH='root/root:Horizon-Rul3s'
echo "export HZN_EXCHANGE_ROOT_USER_AUTH='root/root:Horizon-Rul3s'" >> ~/.bashrc
NOTE: Again, this is assuming that you cloned this repository and it is located at ./horizon-edgex/
.
Change to the oh
folder and and generate the hub config file, config.json.
Edit the config.json
file if you would like to make changes.
cd horizon-edgex/oh
envsubst '${MY_IP}' < config.json.template > config.json
NOTE: The following text refers to nodes in the config.json
file using XPath-like dot notation.
Your IP address for this machine is found at .horizon.hostname
.
The AgBot's name and token are specified at .services.agbot.bot
.
The Exchange's root credentials are at .exchange.root
and .exchange.password
.
The admin user for your org is at .exchange.admin.username
, and .exchange.admin.password
.
The organization is specified at .horizon.namespace
and .exchange.org
.
These instructions are assuming, and will be referring to, the default values specified at the nodes listed above.
NOTE: I am assuming that you are still in the horizon-edgex/oh
directory.
make
make up
Let's confirm that the Exchange is running (and our environment variable are configured correctly) by
requesting the endpoints for version
and status
:
curl -u ${HZN_EXCHANGE_ROOT_USER_AUTH} ${HZN_EXCHANGE_URL}admin/version
curl -u ${HZN_EXCHANGE_ROOT_USER_AUTH} ${HZN_EXCHANGE_URL}admin/status | jq .
If all is well, let's continue by listing the existing Organizations:
curl -u ${HZN_EXCHANGE_ROOT_USER_AUTH} ${HZN_EXCHANGE_URL}orgs | jq .
Add an Organization named testorg
:
curl -sSf -X POST -u ${HZN_EXCHANGE_ROOT_USER_AUTH} -H "Content-Type:application/json" -d '{"label": "testorg", "description": "Organization for Testing"}' ${HZN_EXCHANGE_URL}orgs/testorg | jq .
And then list the existing Organizations again to see testorg
now in the list:
curl -u ${HZN_EXCHANGE_ROOT_USER_AUTH} ${HZN_EXCHANGE_URL}orgs | jq .
If all is well, let's "prime the pump" by clearing the tables and refilling to a known state:
make prime
The step you just performed created an admin user for your testorg and also told your new AgBot agbot1
to listen for Deployment Patterns and Policies from the testorg
Organization.
List the current users in testorg
:
curl -sSf -u ${HZN_EXCHANGE_ROOT_USER_AUTH} ${HZN_EXCHANGE_URL}orgs/testorg/users | jq .