|
|
| Line 3: |
Line 3: |
| = Setup Firebird Kubernete Cluster = | | = Setup Firebird Kubernete Cluster = |
| <div class="toccolours mw-collapsible mw-collapsed expandable"> | | <div class="toccolours mw-collapsible mw-collapsed expandable"> |
| <div class="mw-collapsible-preview">prerequisite</div> | | <div class="mw-collapsible-preview">Brief</div> |
| <div class="mw-collapsible-content"> | | <div class="mw-collapsible-content"> |
| | This section talks about how to setup firebird environment. Files references could be found at [https://github.com/stonezhong/firebird/tree/master/examples/getting-started https://github.com/stonezhong/firebird/tree/master/examples/getting-started] |
| | |
| * Assuming you have a kubernete cluster already created. In this example, we are using Kubernete provided by Oracle Cloud Infrastructure (aka OKE). | | * Assuming you have a kubernete cluster already created. In this example, we are using Kubernete provided by Oracle Cloud Infrastructure (aka OKE). |
| * Assuming you have a machine with kubectl installed, from which you can control the kubernete cluster | | * Assuming you have a machine with kubectl installed, from which you can control the kubernete cluster |
Firebird
Setup Firebird Kubernete Cluster
Brief
This section talks about how to setup firebird environment. Files references could be found at https://github.com/stonezhong/firebird/tree/master/examples/getting-started
- Assuming you have a kubernete cluster already created. In this example, we are using Kubernete provided by Oracle Cloud Infrastructure (aka OKE).
- Assuming you have a machine with kubectl installed, from which you can control the kubernete cluster
Create kubernete namespace: firebird
- We are going to deploy in this namespace
kubectl apply -f namespace.yaml
# Then check it, you should see firebird as namespace
kubectl get namespaces
# Then you can set firebird as your currrent namespace
kubectl config set-context --current --namespace=firebird
Setup rabbitmq and zookeeper
cd infra
kubectl apply -f rabbitmq.yaml
kubectl apply -f zookeeper.yaml
Setup firebird web console: create database
# assuming you have a MySQL 8.x installed
# create database user stonezhong
CREATE USER 'stonezhong'@'%' IDENTIFIED WITH mysql_native_password BY 'dbpassword';
# connect to mysql instance (e.g. using MySQL workbench)
CREATE SCHEMA `firebird` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
# give stonezhong full access to this db
GRANT ALL ON `firebird`.* TO 'stonezhong'@'%';
Setup firebird web console: build docker image
cd console
docker build -t firebird-console .
# now push this image to your private repo
docker tag firebird-console iad.ocir.io/idrnu3akjpv5/firebird-console
docker push iad.ocir.io/idrnu3akjpv5/firebird-console
Setup firebird web console: iniialize database
kubectl run myshell --rm -it --image iad.ocir.io/idrnu3akjpv5/firebird-console:latest -- sh
fbconsole migrate
Deploy firebird web console
cd console
kubectl apply -f console.yaml
# once deployment is done, you can try to access it
curl http://<service-external-ip>/
# and make sure you see the page, you can latter create a ssh tunnel to access the Firebird Web Console.
Deployment Sample Streaming Application
Streaming app: build image
cd app
docker build -t firebird-app1 .
# now push this image to your private repo
docker tag firebird-app1 iad.ocir.io/idrnu3akjpv5/firebird-app1
docker push iad.ocir.io/idrnu3akjpv5/firebird-app1
Streaming app: register your pipeline
# Before we can use any pipeline, we need to register the pipeline with the system
# A pipeline module is a python module which implements function get_pipeline(..) which returns a pipeline
# see app/src/pipe.py, since we use pipe.py, so the pipeline module name is "pipe"
kubectl run myshell --rm -it --image iad.ocir.io/idrnu3akjpv5/firebird-app1 -- sh
pipeline register \
--pipeline-module-name pipe \
--pipeline-namespace-name firebird \
--pipeline-image-name iad.ocir.io/idrnu3akjpv5/firebird-app1
# now you can list pipeline to make sure it is registered
pipeline list
test:
module: pipe
executors: None
Streaming app: start pipeline
kubectl run myshell --rm -it --image iad.ocir.io/idrnu3akjpv5/firebird-console -- sh
# or
# kubectl exec -it <console_pod_name> -- sh
pipeline start -pid test
Streaming app: stop pipeline
kubectl run myshell --rm -it --image iad.ocir.io/idrnu3akjpv5/firebird-console -- sh
# or
# kubectl exec -it <console_pod_name> -- sh
pipeline stop -pid test