forked from apache/incubator-tuweni
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
243 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
# JSON-RPC proxy | ||
|
||
The JSON-RPC proxy allows you to cache requests to a JSON-RPC endpoint. | ||
|
||
This example showcases how to use the proxy with a public service. | ||
|
||
## Requirements | ||
|
||
This example requires Docker, Docker Compose 1.25, Java 11 and Gradle > 6. | ||
|
||
## Steps | ||
|
||
### Check out this repository | ||
|
||
`$> git clone https://github.com/apache/incubator-tuweni` | ||
|
||
### Build the image | ||
|
||
You need to install the Gradle wrapper the first time you make a checkout: | ||
|
||
`$> gradle setup` | ||
|
||
You can now run gradle to build the docker image: | ||
|
||
`$> ./gradlew dist::buildBinImage` | ||
|
||
The build should end with similar lines: | ||
```bash | ||
---> be57b46c612c | ||
Successfully built be57b46c612c | ||
Successfully tagged apache-tuweni/tuweni:2.1.0-SNAPSHOT | ||
Created image with ID 'be57b46c612c'. | ||
|
||
BUILD SUCCESSFUL in 1m 13s | ||
256 actionable tasks: 2 executed, 254 up-to-date | ||
``` | ||
|
||
### Run the example | ||
|
||
Make sure the image you just tagged matches the one in the `docker_compose.yml` file. | ||
|
||
Run Docker: | ||
|
||
```bash | ||
docker-compose up | ||
``` | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
endpointUrl="https://rpc.xdaichain.com/" # service URL | ||
port=8545 | ||
networkInterface="0.0.0.0" | ||
cacheEnabled=true | ||
cachedMethods=[""] # All methods are cached | ||
cacheStoragePath="/var/jsonrpccache" # Cache location | ||
allowedMethods=[""] # All methods are enabled | ||
metricsGrpcPushEnabled=true | ||
metricsPrometheusEnabled=false | ||
metricsGrpcTimeout=2000 | ||
metricsGrpcEndpoint="http://otelcollector:4317" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
version: "3" | ||
services: | ||
jsonrpc: | ||
container_name: jsonrpc | ||
image: apache-tuweni/tuweni:2.1.0-SNAPSHOT | ||
volumes: | ||
- ./config.toml:/etc/config.toml | ||
- ./logback.xml:/usr/tuweni/bin/logback.xml | ||
entrypoint: /usr/tuweni/bin/jsonrpc | ||
command: /etc/config.toml | ||
environment: | ||
- JAVA_OPTS="-Dlogback.configurationFile=/usr/tuweni/bin/logback.xml" | ||
ports: | ||
- 8545:8545 | ||
otelcollector: | ||
container_name: otelcollector | ||
image: otel/opentelemetry-collector-contrib:0.31.0 | ||
command: ["--config=/etc/otel-collector-config.yml", "--log-level=DEBUG"] | ||
volumes: | ||
- ./otel-collector-config.yml:/etc/otel-collector-config.yml | ||
metricsviewer: | ||
image: docker.io/tmio/metrics-ui | ||
container_name: metricsviewer | ||
ports: | ||
- 8080:8080 | ||
# Zipkin | ||
zipkin: | ||
container_name: zipkin | ||
image: openzipkin/zipkin | ||
ports: | ||
- 9411:9411 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE | ||
file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file | ||
to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the | ||
License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations under the License. | ||
--> | ||
<configuration> | ||
|
||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<!-- encoders are assigned the type | ||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> | ||
<encoder> | ||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
<logger name="io.opentelemetry" level="trace" additivity="true"> | ||
<appender-ref ref="STDOUT" /> | ||
</logger> | ||
|
||
<root level="trace"> | ||
<appender-ref ref="STDOUT" /> | ||
</root> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
endpoint: 0.0.0.0:4317 | ||
|
||
exporters: | ||
otlp: | ||
endpoint: "metricsviewer:4317" | ||
insecure: true | ||
zipkin: | ||
endpoint: "http://zipkin:9411/api/v2/spans" | ||
logging: | ||
loglevel: debug | ||
sampling_initial: 5 | ||
sampling_thereafter: 200 | ||
processors: | ||
batch: | ||
|
||
extensions: | ||
health_check: | ||
endpoint: 0.0.0.0:13133 | ||
pprof: | ||
endpoint: :1888 | ||
zpages: | ||
endpoint: :55679 | ||
|
||
service: | ||
extensions: [pprof, zpages, health_check] | ||
pipelines: | ||
metrics: | ||
receivers: [otlp] | ||
processors: [batch] | ||
exporters: [otlp, logging] | ||
traces: | ||
receivers: [ otlp ] | ||
processors: [ batch ] | ||
exporters: [ zipkin, logging ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters