66
77## Installation
88
9- #### Requirements
9+ ### Requirements
1010
1111- [ Python3] ( https://www.python.org/downloads/ )
1212
13+ ### Using PyPI
14+
15+ ``` bash
16+ pip3 install exonum-launcher-java-plugins
17+ ```
18+
19+ ### From Source
20+
1321``` bash
1422# Generate sources
1523source ./tests_profile
@@ -20,122 +28,9 @@ python3 -m pip install -e exonum_launcher_java_plugins
2028
2129## Usage
2230
23- TODO: Move the entire section to the EJB App tutorial.
24-
25- To deploy and start a specific list of services, use the following command with the
26- prepared ` config.yml ` file:
27-
28- ``` bash
29- python3 -m exonum_launcher -i config.yml
30- ```
31-
32- ### Writing Configuration File
33-
34- Start with specifying IP addresses of the blockchain nodes:
35-
36- ``` yaml
37- networks :
38- - host : " 127.0.0.1"
39- ssl : false
40- public-api-port : 8080
41- private-api-port : 8081
42- ` ` `
43-
44- You need to specify every node for which you have an access to its private API port. If you
45- do not have an access to every node in the network, the administrators of other nodes must
46- run ` exonum-launcher` with the same configuration file (with a different list of available nodes).
47-
48- Deadline height describes the maximum blockchain height for the deployment process. Make sure to
49- specify the value larger than the current blockchain height.
50-
51- ` ` ` yaml
52- deadline_height: 20000
53- ` ` `
54-
55- Enable Java runtime by specifying its identifier (`1`). Rust runtime is enabled by default :
56-
57- ` ` ` yaml
58- runtimes:
59- java: 1
60- ` ` `
61-
62- Add artifacts you want to deploy. For each artifact, you need to specify its name alias
63- (as YAML key) and its runtime (using `runtime` field). Name aliases are used in other parts
64- of configuration for readability and easier refactoring. Java artifacts also need name of the
65- `jar` file in the `spec : artifact_filename` field. In our example we add the Java
66- ` cryptocurrency-demo` service, and two Rust services - the `timestamping` and `time` oracle services.
67-
68- ` ` ` yaml
69- artifacts:
70- cryptocurrency:
71- runtime: java
72- name: "com.exonum.examples:cryptocurrency:0.10.0-SNAPSHOT"
73- spec:
74- artifact_filename: "exonum-java-binding-cryptocurrency-demo-0.10.0-SNAPSHOT-artifact.jar"
75- time:
76- runtime: rust
77- name: "exonum-time:0.13.0-rc.2"
78- timestamping:
79- runtime: rust
80- name: "exonum-timestamping:0.13.0-rc.2"
81- ` ` `
82-
83- Add a `plugins` section to enable both Java Runtime plugin and Instance Configuration plugin.
84- Runtime plugin is enabled for a specific runtime (`java` in our example), while Instance
85- Configuration plugin is enabled for a specific artifact name alias (`timestamping` in our example).
86-
87- ` ` ` yaml
88- plugins:
89- runtime:
90- java: "exonum_java_runtime_plugin.JavaDeploySpecLoader"
91- artifact:
92- timestamping: "exonum_instance_configuration_plugin.InstanceSpecLoader"
93- ` ` `
94-
95- In our example we will use the Instance Configuration plugin to serialize initial configuration parameters of
96- the `timestamping` service in Protobuf. We need to take a `service.proto` file with the message
97- description from the service sources and place it inside some known directory.
98-
99- ` ` ` proto
100- syntax = "proto3";
101-
102- package exonum.examples.timestamping;
103-
104- message Config {
105- string time_service_name = 1;
106- }
107- ` ` `
108-
109- Finally, add an `instances` section that describes the list of service instances you want to
110- start in the blockchain. For each instance you need to specify its artifact name alias.
111- Instance Configuration plugin also requires a list of additional parameters, which we
112- provide for the `timestamping` instance :
113-
114- - ` sources` . Points to a directory with the Protobuf sources of the service configuration
115- message. We use the `proto_sources` directory.
116- - ` config_message_source` . A file name where the `message_name` message
117- is located. In our example we use the `service.proto` file.
118- - ` message_name` . A name of the Protobuf message used to represent the service configuration.
119- Optional, defaults to `Config`.
120- - ` data` . Your actual configuration in the format corresponding to the `message_name` message.
121-
122- ` ` ` yaml
123- instances:
124- cryptocurrency:
125- artifact: cryptocurrency
126- time:
127- artifact: time
128- timestamping:
129- artifact: timestamping
130- config:
131- sources: "proto_sources"
132- config_message_source: "service.proto"
133- message_name: "Config"
134- data:
135- time_service_name: "time"
136- ` ` `
31+ See [ Deploy and Start the Service] [ deploy-and-start ] .
13732
138- See [sample-config.yml](sample-config.yml) for the final state of the configuration file.
33+ [ deploy-and-start ] : https://exonum.com/doc/version/0.13-rc.2/get-started/java-binding/#deploy-and-start- the-service
13934
14035# License
14136
0 commit comments