in the root folder of the project run:
docker build -t <name_container> .
Then we need add a connector to communicate with the http api server.
connector {
host: 127.0.0.1
port: 10000
saslMechanisms: ANONYMOUS
role: normal
}
Here a possible example:
- create a file called qdrouterd.json
[
[
"router",
{
"id": "local-router",
"mode": "interior"
}
],
[
"listener",
{
"name": "amqp",
"host": "0.0.0.0",
"port": 5672
}
],
[
"connector",
{
"host": "127.0.0.1",
"port": 10000,
"saslMechanisms": "ANONYMOUS",
"role": "normal"
}
]
]
then add this file when you run your container
docker run --rm --name router -v <path of your config file>/qdrouterd.json:/tmp/qdrouterd.json:Z -e QDROUTERD_CONF_TYPE=json --network host <name container>
Go into the frontend, api, data-manager folder and run the command:
npm install
Before running the application we need to create a build of the frontend app and move it into the api/src folder
To do that go into the frontend folder and run the command:
npm run build
then you can go into the api and data-manager folder and run the command:
npm run start
then open the browser at http://localhost:3002
Go into the frontend, api, data-manager folder and run the command:
npm run start-dev
then open the browser at http://localhost:3000
Go into data-manager and api folders and run
docker build -t <name_container> .
docker run --rm --network host <name_container>
then open the browser at http://localhost:3002
On the Mac the option --network=host doesn't work: The docker daemon is actually running in a virtual machine, not your actual machine. Thus, it’s not connecting to host ports for your Mac, but rather it’s connecting to host ports for that specific virtual machine.
The connector should be
connector {
host: "host.docker.internal",
port: 10000
saslMechanisms: ANONYMOUS
role: normal
}
moreover the Skupper-router container should expose the port (by default 5672)
docker run --rm --name router -v <path of your config file>/qdrouterd.json:/tmp/qdrouterd.json:Z -e QDROUTERD_CONF_TYPE=json -p <BROKER_PORT_HOST>:<BROKER_PORT_CONTAINER> <name container>
then the api server
docker run --rm -p 10000:10000 -p 3002:3002 <name http api server container>
before running the datastore server container we need to pass the right host to connect
RHEA_DATASTORE_HOST="host.docker.internal" docker run --rm <name container>
The following example uses Openshift to set our kubernetes clusters, but we can work with different cluster configurations
To run this tutorial you will need:
-
The
kubectl
command-line tool, version 1.15 or later (installation guide) -
The
skupper
command-line tool, the latest version (installation guide) -
Two Kubernetes namespaces, from any providers you choose, on any clusters you choose
-
Two logged-in console terminals, one for each cluster or namespace
- Open 2 terminal console tabs and type:
Namespace web-server
and be-store
:
skupper init
Namespace web-server
:
kubectl apply -f <rhea-http-app path>/api/web-server.yaml
kubectl expose deployment/web-server --port <web server port> --type LoadBalancer // default port 3002
oc create route edge --service=web-server -n web-server
Namespace be-store
:
kubectl apply -f <rhea-http-app path>/data_manager/be-store.yaml
.yaml configurations shoud have the path of your containers
Namespace web-server
:
skupper service create datastore 5672
skupper service bind datastore deployment web-server --target-port 10000
Namespace web-server
:
skupper token create <custom path> // ie: /tmp/web-server
Namespace be-store
:
skupper link create <path token created in web server namespace>
The console terminals in this demo are run by the same user on the same host.
Namespace web-server
:
$ skupper status
Skupper is enabled for namespace "web-server" in interior mode. It is connected to 1 other site. It has 1 exposed service.
Namespace be-store
:
$ skupper status
Skupper is enabled for namespace "be-store" in interior mode. It is connected to 1 other site. It has 1 exposed service.
Namespace web-server
:
oc get route -n web-server
then get the public URL to show the app on the browser
Namespace web-server
:
skupper delete
kubectl delete service/web-server
kubectl delete deployment/web-server
kubectl delete namespace web-server
Namespace be-stpre
:
skupper delete
kubectl delete service/be-store
kubectl delete deployment/be-store
kubectl delete namespace be-store