mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-18 13:09:08 +02:00
Use envoy proxy for rpc (#977)
* Got basic envoy proxy use working * Got envoy proxy working with frontend dev mode and envoy v 1.16.0 * Change envoy proxy port to 15081
This commit is contained in:
parent
eb15a1bf53
commit
ebf08e7fe0
7 changed files with 137 additions and 10 deletions
|
|
@ -4,9 +4,12 @@ sync_interval_s=10
|
|||
|
||||
[lnd]
|
||||
host=lnd
|
||||
tls_cert_path=~/.lnd/tls.cert
|
||||
macaroon_path=~/.lnd/data/chain/bitcoin/testnet/admin.macaroon
|
||||
|
||||
[bitcoin]
|
||||
rpc_host=bitcoin-core
|
||||
rpc_port=18332
|
||||
rpc_user=devuser
|
||||
rpc_pass=devpass
|
||||
|
||||
|
|
|
|||
|
|
@ -55,3 +55,33 @@ services:
|
|||
# sysctls:
|
||||
# - net.ipv6.conf.all.disable_ipv6=0
|
||||
# entrypoint: ["./start-squeaknode.sh"]
|
||||
|
||||
# squeaknode:
|
||||
# image: squeaknode
|
||||
# container_name: squeaknode
|
||||
# build:
|
||||
# context: ../
|
||||
# dockerfile: Dockerfile
|
||||
# depends_on:
|
||||
# - "bitcoin-core"
|
||||
# - "lnd"
|
||||
# volumes:
|
||||
# - ~/.lnd:/root/.lnd:rw
|
||||
# - ./config.ini:/config.ini
|
||||
# ports:
|
||||
# - 12994:12994
|
||||
# - 8994:8994
|
||||
# links:
|
||||
# - "bitcoin-core:bitcoin-core"
|
||||
# - "lnd:lnd"
|
||||
# sysctls:
|
||||
# - net.ipv6.conf.all.disable_ipv6=0
|
||||
# entrypoint: ["./start-squeaknode.sh"]
|
||||
|
||||
envoy:
|
||||
image: envoyproxy/envoy:v1.16.0
|
||||
ports:
|
||||
- 15081:15081
|
||||
network_mode: "host"
|
||||
volumes:
|
||||
- ../frontend/envoy.yaml:/etc/envoy/envoy.yaml:ro
|
||||
|
|
|
|||
31
docker/envoy/Dockerfile
Normal file
31
docker/envoy/Dockerfile
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Copyright 2018 Google LLC
|
||||
#
|
||||
# Licensed 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
|
||||
#
|
||||
# https://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.
|
||||
|
||||
FROM envoyproxy/envoy:v1.15.0
|
||||
|
||||
#COPY "frontend/envoy.yaml" /etc/envoy/envoy.yaml
|
||||
|
||||
#CMD /usr/local/bin/envoy -c /etc/envoy/envoy.yaml -l trace --log-path /tmp/envoy_info.log
|
||||
|
||||
|
||||
|
||||
COPY "frontend/envoy.yaml" /tmpl/envoy.yaml.tmpl
|
||||
COPY docker/envoy/docker-entrypoint.sh /
|
||||
|
||||
RUN chmod 500 /docker-entrypoint.sh
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install gettext -y
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
8
docker/envoy/docker-entrypoint.sh
Normal file
8
docker/envoy/docker-entrypoint.sh
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
echo "Generating envoy.yaml config file..."
|
||||
cat /tmpl/envoy.yaml.tmpl | envsubst \$ENVOY_LB_ALG,\$SERVICE_NAME > /etc/envoy.yaml
|
||||
|
||||
echo "Starting Envoy..."
|
||||
/usr/local/bin/envoy -c /etc/envoy.yaml
|
||||
49
frontend/envoy.yaml
Normal file
49
frontend/envoy.yaml
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
static_resources:
|
||||
listeners:
|
||||
- name: listener_0
|
||||
address:
|
||||
socket_address: { address: 0.0.0.0, port_value: 15081 }
|
||||
filter_chains:
|
||||
- filters:
|
||||
- name: envoy.filters.network.http_connection_manager
|
||||
typed_config:
|
||||
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
|
||||
codec_type: auto
|
||||
stat_prefix: ingress_http
|
||||
route_config:
|
||||
name: local_route
|
||||
virtual_hosts:
|
||||
- name: local_service
|
||||
domains: ["*"]
|
||||
routes:
|
||||
- match: { prefix: "/" }
|
||||
route:
|
||||
cluster: squeak_admin_service
|
||||
max_stream_duration:
|
||||
grpc_timeout_header_max: 0s
|
||||
cors:
|
||||
allow_origin_string_match:
|
||||
- prefix: "*"
|
||||
allow_methods: GET, PUT, DELETE, POST, OPTIONS
|
||||
allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout
|
||||
max_age: "1728000"
|
||||
expose_headers: custom-header-1,grpc-status,grpc-message
|
||||
http_filters:
|
||||
- name: envoy.filters.http.grpc_web
|
||||
- name: envoy.filters.http.cors
|
||||
- name: envoy.filters.http.router
|
||||
clusters:
|
||||
- name: squeak_admin_service
|
||||
connect_timeout: 0.25s
|
||||
type: logical_dns
|
||||
http2_protocol_options: {}
|
||||
lb_policy: round_robin
|
||||
load_assignment:
|
||||
cluster_name: cluster_0
|
||||
endpoints:
|
||||
- lb_endpoints:
|
||||
- endpoint:
|
||||
address:
|
||||
socket_address:
|
||||
address: 0.0.0.0
|
||||
port_value: 8994
|
||||
|
|
@ -122,6 +122,10 @@ import {
|
|||
DownloadRepliesReply,
|
||||
} from "../proto/squeak_admin_pb"
|
||||
|
||||
import { SqueakAdminClient } from "../proto/squeak_admin_grpc_web_pb"
|
||||
|
||||
console.log("Using SqueakAdminClient");
|
||||
|
||||
console.log('The value of REACT_APP_SERVER_PORT is:', process.env.REACT_APP_SERVER_PORT);
|
||||
const SERVER_PORT = process.env.REACT_APP_SERVER_PORT || window.location.port;
|
||||
|
||||
|
|
@ -179,15 +183,17 @@ export function getUserRequest(handleResponse) {
|
|||
}
|
||||
|
||||
export function getTimelineSqueakDisplaysRequest(handleResponse) {
|
||||
var request = new GetTimelineSqueakDisplaysRequest();
|
||||
makeRequest(
|
||||
'gettimelinesqueakdisplays',
|
||||
request,
|
||||
GetTimelineSqueakDisplaysReply.deserializeBinary,
|
||||
(response) => {
|
||||
handleResponse(response.getSqueakDisplayEntriesList());
|
||||
}
|
||||
);
|
||||
console.log(SqueakAdminClient);
|
||||
var clientUrl = 'http://' + window.location.hostname + ':15081';
|
||||
console.log("Using clientUrl: " + clientUrl);
|
||||
var client = new SqueakAdminClient(clientUrl);
|
||||
//var client = new SqueakAdminClient("envoy" + ':8080')
|
||||
var getTimelineSqueakDisplaysRequest = new GetTimelineSqueakDisplaysRequest()
|
||||
client.getTimelineSqueakDisplays(getTimelineSqueakDisplaysRequest, {}, (err, response) => {
|
||||
console.log(response);
|
||||
console.log(response.getSqueakDisplayEntriesList());
|
||||
handleResponse(response.getSqueakDisplayEntriesList());
|
||||
});
|
||||
}
|
||||
|
||||
export function lndGetInfoRequest(handleResponse, handleErr) {
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class ServerConfig(Config):
|
|||
|
||||
@section('admin')
|
||||
class AdminConfig(Config):
|
||||
rpc_enabled = key(cast=bool, required=False, default=False)
|
||||
rpc_enabled = key(cast=bool, required=False, default=True)
|
||||
rpc_host = key(cast=str, required=False, default=DEFAULT_ADMIN_RPC_HOST)
|
||||
rpc_port = key(cast=int, required=False, default=DEFAULT_ADMIN_RPC_PORT)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue