Fix the path used to add files into docker image
[aai/gizmo.git] / README.md
1 # CRUD Microservice (Gizmo)
2
3 ## Overview
4 The CRUD microservice implements a set of RESTful APIs which allow a client to perform CREATE, UPDATE, GET, and DELETE operations on verticies and edges within the A&AI graph database.
5
6 ## Getting Started
7
8 ### Building The Microservice
9
10 After cloning the project, execute the following Maven command from the project's top level directory to build the project:
11
12     > mvn clean install
13
14 Now, you can build your Docker image:
15
16     > docker build -t onap/crud-service target
17
18 ### Deploying The Microservice
19
20 Push the Docker image that you have built to your Docker repository and pull it down to the location from which you will be running the service.
21
22 **Create the following directories on the host machine:**
23
24     ../logs
25     ../appconfig
26         ../appconfig/auth
27
28 You will be mounting these as data volumes when you start the Docker container.
29
30 #### Configuring the Microservice
31
32 Create configuration file **../appconfig/crud-api.properties**
33
34         # List of hostnames/addresses of the graph database
35         crud.graph.host=graphhost1.onap.com,graphhost2.onap.com
36
37         # Port on which to connect to the graph database
38         crud.graph.port=2181
39
40         # Name of the graph on which this service will operate
41         crud.graph.name=aaigraphautomation
42
43         # Backend storage type for the graph.  Types currently supported:
44         #  - cassandra
45         #  - hbase
46         crud.storage.backend.db=cassandra
47
48         # List of hostnames/addresses of the DMaaP/Kafka cluster on which to post notification events
49         event.stream.hosts=kafkahost1.onap.com,kafkahost2.onap.com
50
51         # Number of events to bath up before posting to DMaaP/Kafka
52         event.stream.batch-size=100
53
54         # Amount of time (in ms) to wait before sending batch of events (when batch does not reach batch-size)
55         event.stream.batch-timeout=60000
56
57 Create configuration file **../appconfig/auth/crud-policy.json**
58
59 This policy file defines which client certificates are authorized to use the service's APIs.  An example policy file follows:
60
61     {
62         "roles": [
63             {
64                 "name": "admin",
65                 "functions": [
66                     {
67                         "name": "search", "methods": [ { "name": "GET" },{ "name": "DELETE" }, { "name": "PUT" }, { "name": "POST" } ]
68                     }
69                 ],
70                 "users": [
71                     {
72                         "username": "CN=admin, OU=My Organization Unit, O=, L=Sometown, ST=SomeProvince, C=CA"
73                     }
74                 ]
75             }
76         ]
77     }
78
79 Create keystore file **../appconfig/auth/tomcat\_keystore**
80 _tomcat\_keystore_
81
82 Create a keystore with this name containing whatever CA certificates that you want your instance of the CRUD service to accept for HTTPS traffic.
83
84 #### Start the service
85
86 You can now start the Docker container in the following manner:
87
88         docker run -d \
89             -p 9520:9520 \
90                 -e CONFIG_HOME=/opt/app/crud-service/config/ \
91                 -e KEY_STORE_PASSWORD={{obfuscated password}} \
92                 -e KEY_MANAGER_PASSWORD=OBF:{{obfuscated password}} \
93             -v /<path>/logs:/opt/aai/logroot/AAI-CRUD \
94             -v /<path>/appconfig:/opt/app/crud-service/config \
95             --name crud-service \
96             {{your docker repo}}/crud-service
97
98 Where,
99
100     {{your docker repo}} = The Docker repository you have published your CRUD Service image to.
101     {{obfuscated password}} = The password for your key store/key manager after running it through the Jetty obfuscation tool.
102
103 ## API Definitions
104
105 ### Echo API
106
107         URL: https://<host>:9520/services/crud-api/v1/echo-service/echo/<input>
108         Method: GET
109         Success Response: 200
110
111 ### Vertex APIs
112 Gizmo exposes a set of APIs to operate on verticies within the graph.
113 [Vertex APIs](./VERTEX.md)
114
115 ### Edge APIs
116 Gizmo exposes a set of APIs to operate on edges within the graph.
117 [Edge APIs](./EDGE.md)
118
119 ### Bulk API
120 Gizmo exposes a bulk API to operate on multiple graph entities within a single request.
121 [Bulk API](./BULK.md)
122
123 ## ASYNC PIPELINE
124 Gizmo is capable of working Synchronously and Asynchronously. Asynchronous Pipeline is explained
125 here: [Async Pipeline](./ASYNC.MD)