|
1 | | -### Channel Finder |
| 1 | +# Channel Finder |
2 | 2 |
|
3 | | -#### A simple directory service |
| 3 | +ChannelFinder is a directory server, implemented as a REST style web service. |
| 4 | +Its intended use is for control systems, namely the EPICS Control system. |
4 | 5 |
|
5 | | - ChannelFinder is a directory server, implemented as a REST style web service. |
6 | | -Its intended use is within control systems, namely the EPICS Control system, for which it has been written. |
| 6 | +- [Documentation](https://channelfinder.readthedocs.io/en/latest/) |
| 7 | +- [Releases](https://github.com/ChannelFinder/ChannelFinderService/releases) |
| 8 | +- [Docker Containers](https://github.com/ChannelFinder/ChannelFinderService/pkgs/container/channelfinderservice) |
7 | 9 |
|
8 | | -* Motivation and Objectives |
| 10 | +## Description |
9 | 11 |
|
10 | | - High level applications tend to prefer an hierarchical view of the control system name space. They group channel names by location or physical function. The name space of the EPICS Channel Access protocol, on the other hand, is flat. A good and thoroughly enforced naming convention may solve the problem of creating unique predictable names. It does not free every application from being configured explicitly, so that it knows all channel names it might be interested in beforehand. |
| 12 | +* **Motivation and Objectives** |
11 | 13 |
|
12 | | - ChannelFinder tries to overcome this limitation by implementing a generic directory service, which applications can query for a list of channels that match certain conditions, such as physical functionality or location. It also provides mechanisms to create channel name aliases, allowing for different perspectives of the same set of channel names. |
| 14 | + High level applications tend to prefer a hierarchical view of the control system name space. They group channel names |
| 15 | + by location or physical function. The name space of the EPICS Channel Access protocol, on the other hand, is flat. A |
| 16 | + good and thoroughly enforced naming convention may solve the problem of creating unique predictable names. It does not |
| 17 | + free every application from being configured explicitly, so that it knows all channel names it might be interested in |
| 18 | + beforehand. |
13 | 19 |
|
14 | | -* Directory Data Structure |
| 20 | + ChannelFinder tries to overcome this limitation by implementing a generic directory service, which applications can |
| 21 | + query for a list of channels that match certain conditions, such as physical functionality or location. It also |
| 22 | + provides mechanisms to create channel name aliases, allowing for different perspectives of the same set of channel |
| 23 | + names. |
15 | 24 |
|
16 | | - Each directory entry consists of a channel `<name>`, an arbitrary set of `<properties>` (name-value pairs), and an arbitrary set of `<tags>` (names). |
| 25 | +* **Directory Data Structure** |
17 | 26 |
|
18 | | -* Basic Operation |
| 27 | + Each directory entry consists of a channel `<name>`, an arbitrary set of `<properties>` (name-value pairs), and an |
| 28 | + arbitrary set of `<tags>` (names). |
19 | 29 |
|
20 | | - An application sends an HTTP query to the service, specifying an expression that references tags, properties and their values, or channel names. The service returns a list of matching channels with their properties and tags, as JSON documents. |
| 30 | +* **Basic Operation** |
21 | 31 |
|
| 32 | + An application sends an HTTP query to the service, specifying an expression that references tags, properties and their |
| 33 | + values, or channel names. The service returns a list of matching channels with their properties and tags, as JSON |
| 34 | + documents. |
22 | 35 |
|
23 | | -#### API reference guide |
| 36 | +## Installation |
24 | 37 |
|
25 | | -https://channelfinder.readthedocs.io/en/latest/ |
| 38 | +ChannelFinder is a Java EE5 REST-style web service. The directory data is held in a ElasticSearch index. |
26 | 39 |
|
27 | | -#### Installation |
| 40 | +### Docker Compose |
28 | 41 |
|
29 | | -ChannelFinder is a Java EE5 REST-style web service. The directory data is held in a ElasticSearch index. |
| 42 | +For using docker containers there is a barebones [docker compose file](./docker-compose.yml). |
30 | 43 |
|
31 | | -Collected installation recipes and notes may be found on [wiki pages](https://github.com/ChannelFinder/ChannelFinder-SpringBoot/wiki). |
| 44 | +### Manual Installation |
32 | 45 |
|
33 | 46 | * Prerequisites |
34 | 47 |
|
35 | | - * JDK 17 |
36 | | - * Elastic version 8.2.x |
37 | | - * <For authN/authZ using LDAP:> LDAP server, e.g. OpenLDAP |
38 | | - |
39 | | -* setup elastic search |
40 | | - **Install** |
41 | | - Download and install elasticsearch (verision 8.2.0) from [elastic.com](https://www.elastic.co/downloads/past-releases/elasticsearch-8-2-0) |
42 | | - following the instructions for your platform.\ |
43 | | - <Alternatively:> Install the elastic server from your distribution using a package manager. |
44 | | - |
45 | | -* Build |
46 | | -``` |
47 | | -# Debian 10 |
48 | | -sudo apt-get install openjdk-17-jdk git curl wget |
49 | | -wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.2.0-amd64.deb |
50 | | -sudo dpkg -i elasticsearch-8.2.0-amd64.deb |
51 | | -sudo systemctl start elasticsearch |
| 48 | + * JDK 17 |
| 49 | + * Elastic version 8.11.x |
| 50 | + * **For authN/authZ using LDAP:** LDAP server, e.g. OpenLDAP |
52 | 51 |
|
53 | | -#### Checkout and build ChannelFinder service source |
54 | | -git clone https://github.com/ChannelFinder/ChannelFinderService.git |
55 | | -cd ChannelFinderService |
56 | | -.\mvnw clean install |
| 52 | +#### Setup Elasticsearch |
57 | 53 |
|
58 | | -``` |
| 54 | +Options: |
59 | 55 |
|
60 | | -#### Start the service |
| 56 | +- Download and install elasticsearch (version 8.11.0) |
| 57 | + from [elastic.com](https://www.elastic.co) following the instructions for |
| 58 | + your platform. |
| 59 | +- Install the elastic server from your distribution using a package manager. |
| 60 | +- Run Elasticsearch in a [docker container](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html) |
61 | 61 |
|
62 | | -* Using spring boot via Maven |
| 62 | +#### Running |
63 | 63 |
|
64 | | -``` |
65 | | -.\mvnw spring-boot:run |
66 | | -``` |
| 64 | +```bash |
| 65 | +sudo apt-get install openjdk-17-jre git curl wget |
| 66 | +sudo systemctl start elasticsearch # Or other command to run elastic search |
67 | 67 |
|
68 | | -* or using the jar |
| 68 | +# Replace verison with the release you want |
| 69 | +wget https://github.com/ChannelFinder/ChannelFinderService/releases/download/ChannelFinder-{version}/ChannelFinder-{version}.jar |
| 70 | +java -jar target/ChannelFinder-*.jar |
| 71 | +``` |
69 | 72 |
|
70 | | -``` |
71 | | -java -jar target/ChannelFinder-4.7.0.jar |
| 73 | +Other installation recipes can be found |
| 74 | +on [the wiki pages](https://github.com/ChannelFinder/ChannelFinder-SpringBoot/wiki). |
| 75 | + |
| 76 | +### Configuration |
| 77 | + |
| 78 | +By default, the channelfinder service will start on port 8080 with the default settings. To start with a |
| 79 | +different `application.properties` file: |
| 80 | + |
| 81 | +```bash |
| 82 | +java -Dspring.config.location=file:./application.properties -jar ChannelFinder-*.jar |
72 | 83 | ``` |
73 | 84 |
|
74 | | -The above command will start the channelfinder service on port 8080 with the default settings, |
75 | | -which use embedded ldap server with users and roles defined in the [`cf.ldif`](src/main/resources/cf.ldif) file. |
| 85 | +The default authentication includes an embedded ldap server with users and roles defined in |
| 86 | +the [`cf.ldif`](src/main/resources/cf.ldif) file. |
76 | 87 | Note that `cf.ldif` contains **default credentials** and should only be used during testing and evaluation. |
77 | 88 |
|
78 | | -#### Verification |
| 89 | +### Verification |
79 | 90 |
|
80 | | -To check that the server is running correctly. |
| 91 | +To check that the server is running correctly, visit [the default homepage](http://localhost:8080/). |
81 | 92 |
|
82 | | -``` |
83 | | -$ curl --fail-with-body http://localhost:8080/ChannelFinder |
84 | | -{ |
85 | | - "name" : "ChannelFinder Service", |
86 | | - "version" : "4.7.0", |
87 | | - "elastic" : { |
88 | | - "status" : "Connected", |
89 | | - "clusterName" : "elasticsearch", |
90 | | - "clusterUuid" : "sA2L_cpoRD-H46c_Mya3mA", |
91 | | - "version" : "8.2.0" |
92 | | - } |
93 | | -} |
94 | | -
|
95 | | -
|
96 | | -# Verify by creating a simple Channel using the demo auth |
97 | | -$ curl --location -u admin:adminPass --request PUT 'http://localhost:7070/ChannelFinder/resources/channels/test_channel' \ |
98 | | ---header 'Content-Type: application/json' \ |
99 | | ---data '{ |
100 | | - "name": "test_channel", |
101 | | - "owner": "admin" |
102 | | - }' |
103 | | -
|
104 | | -$ curl --fail-with-body http://localhost:8080/ChannelFinder/resources/channels |
105 | | -
|
106 | | -... |
107 | | -$ curl --basic -u admin:adminPass --fail-with-body -H 'Content-Type: application/json' \ |
108 | | - -X PUT -d '{"name":"foo", "owner":"admin"}' \ |
109 | | - http://localhost:8080/ChannelFinder/resources/tags/foo |
110 | | -
|
111 | | -$ curl --fail-with-body http://localhost:8080/ChannelFinder/resources/tags |
112 | | -
|
113 | | -... |
114 | | -$ curl --fail-with-body http://localhost:8080/ChannelFinder/resources/tags |
115 | | -[{"name":"foo","owner":"admin","channels":[]}] |
116 | | -
|
117 | | -$ curl --basic -u admin:1234 --fail-with-body -X DELETE \ |
118 | | - http://localhost:8080/ChannelFinder/resources/tags/foo |
119 | | -``` |
| 93 | +## Development |
120 | 94 |
|
121 | | -#### Start up options |
| 95 | +It's strongly encouraged to use a modern IDE such as [Intelij](https://www.jetbrains.com/idea/) and [Eclipse](https://eclipseide.org/). |
122 | 96 |
|
123 | | -You can start the channelfinder service with your own applications.properties file as follows: |
| 97 | +* Prerequisites |
124 | 98 |
|
125 | | -``` |
126 | | -.\mvnw spring-boot:run -Dspring.config.location=file:./application.properties |
127 | | -``` |
128 | | -or |
129 | | -``` |
130 | | -java -Dspring.config.location=file:./application.properties -jar ChannelFinder-4.7.0.jar |
131 | | -``` |
| 99 | + * JDK 17 |
| 100 | + * Maven (via package manager or via the wrapper `./mvnw`) (version specified in [the wrapper properties](./.mvn/wrapper/maven-wrapper.properties)) |
132 | 101 |
|
133 | | -You can also start up channelfinder with demo data using the command line argument `demo-data` followed by an integer number `n`. For example, `--demo-data=n`. With this argument, `n*1500` channels will be created to simulate some of the most common types of devices found in accelerators like magnets, power supplies, etc... |
| 102 | +For the following commands `mvn` can be interchangeably used instead via `./mvnw` |
134 | 103 |
|
| 104 | +To build: |
| 105 | + |
| 106 | +```bash |
| 107 | +mvn clean install |
135 | 108 | ``` |
136 | | -java -jar target/ChannelFinder-4.7.*.jar --demo-data=1 |
137 | | -java -jar target/ChannelFinder-4.7.*.jar --cleanup=1 |
138 | | -``` |
139 | | - |
| 109 | + |
| 110 | +To test: |
| 111 | + |
| 112 | +```bash |
| 113 | +mvn test |
140 | 114 | ``` |
141 | | -.\mvnw spring-boot:run -Dspring-boot.run.arguments="--demo-data=1" |
142 | | -.\mvnw spring-boot:run -Dspring-boot.run.arguments="--cleanup=1" |
| 115 | + |
| 116 | +To run the server in development (you need a running version of Elasticsearch) |
| 117 | + |
| 118 | +```bash |
| 119 | +mvn spring-boot:run |
143 | 120 | ``` |
144 | 121 |
|
145 | | -#### Integration tests with Docker containers |
| 122 | +### Integration tests with Docker containers |
146 | 123 |
|
147 | 124 | Purpose is to have integration tests for ChannelFinder API with Docker. |
148 | 125 |
|
149 | 126 | See `src/test/java` and package |
| 127 | + |
150 | 128 | * `org.phoebus.channelfinder.docker` |
151 | 129 |
|
152 | | -Integration tests start docker containers for ChannelFinder and Elasticsearch and run http requests (GET) and curl commands (POST, PUT, DELETE) towards the application to test behavior (read, list, query, create, update, remove) and replies are received and checked if content is as expected. |
| 130 | +Integration tests start docker containers for ChannelFinder and Elasticsearch and run http requests (GET, POST, PUT, DELETE) towards the application to test behavior (read, list, query, create, update, remove) and |
| 131 | +replies are received and checked if content is as expected. |
153 | 132 |
|
154 | 133 | There are tests for properties, tags and channels separately and in combination. |
155 | 134 |
|
156 | 135 | Integration tests can be run in IDE and via Maven. |
157 | 136 |
|
158 | 137 | ``` |
159 | | -.\mvnw failsafe:integration-test -DskipITs=false |
| 138 | +mvn failsafe:integration-test -DskipITs=false |
160 | 139 | ``` |
161 | 140 |
|
162 | | -See |
| 141 | +See also |
| 142 | + |
163 | 143 | * [How to run Integration test with Docker](src/test/resources/INTEGRATIONTEST_DOCKER_RUN.md) |
164 | 144 | * [Tutorial for Integration test with Docker](src/test/resources/INTEGRATIONTEST_DOCKER_TUTORIAL.md) |
165 | 145 |
|
166 | | -#### ChannelFinder data managment |
167 | | - |
168 | | -The [cf-manager](https://github.com/ChannelFinder/cf-manager) project provides tools to perform operations on large queries ( potentially the entire directory ). |
169 | | -Some examples of these operations include running checks to validate the pv names or producing reports about the number of active PVs, a list of IOC names, etc.. |
170 | | - |
171 | 146 | ### Release ChannelFinder Server binaries to maven central |
172 | 147 |
|
173 | | -The Phoebus ChannelFinder service uses the maven release plugin to prepare the publish the ChannelFinder server binaries to maven central |
| 148 | +The Phoebus ChannelFinder service uses the maven release plugin to prepare the publish the ChannelFinder server binaries |
| 149 | +to maven central |
174 | 150 | using the sonatype repositories. |
175 | 151 |
|
176 | | -**Setup** |
| 152 | +#### Setup |
177 | 153 |
|
178 | 154 | Create a sonatype account and update the maven settings.xml file with your sonatype credentials |
179 | 155 |
|
180 | | -``` |
| 156 | +```xml |
181 | 157 | <servers> |
182 | 158 | <server> |
183 | 159 | <id>phoebus-releases</id> |
184 | | - <username>shroffk</username> |
| 160 | + <username>username</username> |
185 | 161 | <password>*******</password> |
186 | 162 | </server> |
187 | 163 | </servers> |
188 | 164 | ``` |
189 | 165 |
|
190 | | -**Prepare the release** |
191 | | -`.\mvnw release:prepare` |
| 166 | +#### Prepare the release |
| 167 | + |
| 168 | +```bash |
| 169 | +mvn release:prepare |
| 170 | +``` |
192 | 171 | In this step will ensure there are no uncommitted changes, ensure the versions number are correct, tag the scm, etc.. |
193 | | -A full list of checks is documented [here](https://maven.apache.org/maven-release/maven-release-plugin/examples/prepare-release.html): |
| 172 | +A full list of checks is |
| 173 | +documented [here](https://maven.apache.org/maven-release/maven-release-plugin/examples/prepare-release.html): |
| 174 | + |
| 175 | +#### Perform the release |
| 176 | + |
| 177 | + |
| 178 | +```bash |
| 179 | +mvn release:perform |
| 180 | +``` |
194 | 181 |
|
195 | | -**Perform the release** |
196 | | -`.\mvnw release:perform` |
197 | 182 | Checkout the release tag, build, sign and push the build binaries to sonatype. |
198 | 183 |
|
199 | | -**Publish** |
200 | | -Open the staging repository in [sonatype](https://s01.oss.sonatype.org/#stagingRepositories) and hit the *publish* button |
| 184 | +#### Publish |
| 185 | + |
| 186 | +Open the staging repository in [sonatype](https://s01.oss.sonatype.org/#stagingRepositories) and hit the *publish* |
| 187 | +button |
0 commit comments