Removal of a committer
[ric-plt/ricdms.git] / README.md
1 # RICDMS
2
3 - [RICDMS](#ricdms)
4   - [Building](#building)
5     - [Local build and Run](#local-build-and-run)
6     - [Kubernetes](#kubernetes)
7   - [Developer Environment](#developer-environment)
8     - [Mocking all the dependent services (chartmuseum, appmgr...)](#mocking-all-the-dependent-services-chartmuseum-appmgr)
9     - [Running the RICDMS](#running-the-ricdms)
10
11
12 ## Building
13
14 ### Local build and Run
15
16 Chekout code for [RICDMS](https://gerrit.o-ran-sc.org/r/admin/repos/ric-plt/ricdms) repository from gerrit.
17 ```sh
18 $ git clone ssh://subhash_singh@gerrit.o-ran-sc.org:29418/ric-plt/ricdms
19 ```
20
21 build locally
22 ```sh
23 $ make build
24 ```
25
26 Run the executable
27 ```sh
28 $./ricdms
29 {"ts":1684321663015,"crit":"INFO","id":"ricdms","mdc":{},"msg":"Logger is initialized without config file()."}
30 {"ts":1684321663023,"crit":"INFO","id":"ricdms","mdc":{},"msg":"Starting server at : 0.0.0.0:8000"}
31 2023/05/17 11:07:43 Serving r i c d m s at http://[::]:8000
32 ```
33
34 It will start the RICDMS on port `:8000`
35
36 ### Kubernetes
37
38 Build the image
39 ```
40 $ make image
41 ```
42
43 Add the changes to `deployment/dms-config.yaml` as per your environment (refer your `.kubeconfig` file).
44 ```yaml
45 apiVersion: v1
46 kind: ConfigMap
47 metadata:
48   name: kube-env
49 data:
50   config: |
51     apiVersion: v1
52     clusters:
53     - cluster:
54         certificate-authority-data: <certificate>
55         server: https://<kube-ip>:<kube-port>
56       name: <name>
57     contexts:
58     - context:
59         cluster:<cluster-name>
60         user: <user>
61       name: <name>
62     current-context: <context>
63     kind: Config
64     preferences: {}
65     users:
66     - name: <name>
67       user:
68         client-certificate-data: <cliet-cert> 
69         client-key-data: <client-key-data>
70 ```
71
72 Apply the deployment yaml :
73 ```
74 $ kubectl apply -f deployment
75 ```
76
77 Make sure that following pod, svc and configmap is created :
78 ```sh
79 $ kubectl get po,svc,config
80 NAME                                          READY   STATUS    RESTARTS   AGE
81 pod/dms-server-r2k64                          1/1     Running   0          15s
82
83 NAME                             TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
84 service/ric-dms-service          NodePort    <cluster-IP>    <none>        8000:32625/TCP   15s
85
86 NAME                         DATA   AGE
87 configmap/kube-env           1      90s
88 ```
89
90 ## Developer Environment
91
92 ### Mocking all the dependent services (chartmuseum, appmgr...)
93 One can bring [`moco`](https://github.com/dreamhead/moco) server to mock environment for development purpose. Mocks are captured in `mock` folder.
94
95 Use below command to bring up the mock server :
96 ```sh
97 $ docker run --rm -d -v /home/ubuntu/osc/ric-plt/ricdms/mock:/var/moco -p 9191:8000 rezzza/docker-moco:latest
98 ```
99
100 ### Running the RICDMS
101 Export the `` enviroment variable to use the URLs from `` so that mock server could be used.
102 ```bash
103 $ export RIC_DMS_CONFIG_FILE=$(pwd)/config/config-test.yaml
104 ```
105
106 Now, developer environment is ready :computer: