Skip to content

Instantly share code, notes, and snippets.

@nbauernfeind
Last active September 29, 2021 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nbauernfeind/69620321b4b564925abf55221e24e8f7 to your computer and use it in GitHub Desktop.
Save nbauernfeind/69620321b4b564925abf55221e24e8f7 to your computer and use it in GitHub Desktop.
deephaven install files
server {
listen 1818;
listen [::]:1818;
server_name host.domain.com;
# Disable redirect that breaks when passed through envoy
absolute_redirect off;
# Redirect from / to the IDE
rewrite ^/$ /ide/ redirect;
root /deephaven/html;
location / {
index index.html index.htm;
# Caching is taken care of by etags
# Settings expires -1 also sets the 'no-cache' Cache-Control header (http://nginx.org/en/docs/http/ngx_http_headers_module.html)
expires -1;
add_header Cache-Control 'must-revalidate, max-age=0';
}
# .chunk.* files are safe to cache, as they contain a sha in their file name
location ~* \.chunk.(?:css|js)$ {
expires 1y;
add_header Cache-Control 'public, immutable, max-age=31536000';
}
location ~ ^/(notebooks|layouts)/ {
root /deephaven/storage;
autoindex on;
# Uncomment the next few lines to disable CORS
# Useful for local development
# add_header Access-Control-Allow-Origin * always;
# add_header Access-Control-Allow-Methods * always;
# add_header Access-Control-Allow-Headers * always;
# enable creating directories without trailing slash
set $x $uri$request_method;
if ($x ~ [^/]MKCOL$) {
rewrite ^(.*)$ $1/;
}
client_body_temp_path /tmp/client_temp;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK;
dav_ext_lock zone=notebooks;
dav_access user:rw group:rw all:rw;
create_full_put_path on;
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address: { address: 127.0.0.1, port_value: 9090 }
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 443 }
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
access_log:
- name: envoy.access_loggers.file
typed_config:
"@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
path: "/dev/stdout" # easier debugging
stat_prefix: ingress_http
codec_type: AUTO
upgrade_configs:
- upgrade_type: websocket
stream_idle_timeout: 0s
route_config:
name: local_route
virtual_hosts:
- name: reverse_proxy
domains: ["*"]
routes:
- match: # Call to / goes to the landing page
path: "/"
route: { cluster: web }
- match: # Web IDE lives in this path
prefix: "/ide"
route: { cluster: web }
- match: # JS API lives in this path
prefix: "/jsapi"
route: { cluster: web }
- match: # Notebook file storage at this path
prefix: "/notebooks"
route: { cluster: web }
- match: # Application mode layout storage at this path
prefix: "/layouts"
route: { cluster: web }
- match: # Any GRPC call is assumed to be forwarded to the real service
prefix: "/"
route:
cluster: grpc-api
max_stream_duration:
grpc_timeout_header_max: 0s
timeout: 0s
http_filters:
- name: envoy.filters.http.grpc_web
- name: envoy.filters.http.router
transport_socket:
name: envoy.transport_sockets.tls
typed_config:
"@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext
common_tls_context:
alpn_protocols: ["h2"]
tls_certificates:
- certificate_chain:
filename: /deephaven/config/fullchain.pem
private_key:
filename: /deephaven/config/privkey.pem
clusters:
- name: grpc-api
connect_timeout: 10s
type: LOGICAL_DNS
lb_policy: ROUND_ROBIN
http2_protocol_options: {}
load_assignment:
cluster_name: grpc-api
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: localhost
port_value: 8080
- name: web
connect_timeout: 10s
type: LOGICAL_DNS
lb_policy: ROUND_ROBIN
http_protocol_options: {}
load_assignment:
cluster_name: web
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: localhost
port_value: 1818
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address: { address: 0.0.0.0, port_value: 9090 }
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 10000 }
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
access_log:
- name: envoy.access_loggers.file
typed_config:
"@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
path: "/dev/stdout" # easier debugging
stat_prefix: ingress_http
codec_type: AUTO
upgrade_configs:
- upgrade_type: websocket
stream_idle_timeout: 0s
route_config:
name: local_route
virtual_hosts:
- name: reverse_proxy
domains: ["*"]
routes:
- match:
prefix: "/"
headers:
- name: "sec-websocket-protocol"
present_match: true
route: { cluster: grpc-proxy }
- match: # Call to / goes to the landing page
path: "/"
route: { cluster: web }
- match: # Web IDE lives in this path
prefix: "/ide"
route: { cluster: web }
- match: # JS API lives in this path
prefix: "/jsapi"
route: { cluster: web }
- match: # Notebook file storage at this path
prefix: "/notebooks"
route: { cluster: web }
- match: # Application mode layout storage at this path
prefix: "/layouts"
route: { cluster: web }
- match: # Any GRPC call is assumed to be forwarded to the real service
prefix: "/"
route:
cluster: grpc-api
max_stream_duration:
grpc_timeout_header_max: 0s
timeout: 0s
http_filters:
- name: envoy.filters.http.grpc_web
- name: envoy.filters.http.router
clusters:
- name: grpc-proxy
connect_timeout: 10s
type: LOGICAL_DNS
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: grpc-proxy
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: grpc-proxy # assuming the name of the grpc-api server container
port_value: 8080
- name: grpc-api
connect_timeout: 10s
type: LOGICAL_DNS
lb_policy: ROUND_ROBIN
http2_protocol_options: {}
load_assignment:
cluster_name: grpc-proxy
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: grpc-api # here we assume the name of the websocket proxy
port_value: 8080
- name: web
connect_timeout: 10s
type: LOGICAL_DNS
lb_policy: ROUND_ROBIN
http_protocol_options: {}
load_assignment:
cluster_name: web
endpoints:
- lb_endpoints:
- endpoint:
hostname: web
address:
socket_address:
address: web
port_value: 80
<configuration debug="false">
<property name="LOG_FILE" value="dhvn" />
<property name="LOG_DIR" value="/deephaven/logs/" />
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_DIR}/${LOG_FILE}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_DIR}/archive/%d{yyyyMMdd}/%d{yyyyMMdd-HH-}${LOG_FILE}.gz</fileNamePattern>
<totalSizeCap>300MB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z', UTC} | %green(%-20.20thread) | %highlight(%5level) | %yellow(%-25.25logger{25}) | %m%n</pattern>
</encoder>
</appender>
<!-- System.out / System.err may be redirected (and captured by LogBuffer).
By referencing PrintStreamGlobalsConsole, we can be sure that we avoid that redirection so
we don not double up messages to the LogBuffer. -->
<appender name="STDOUT" class="io.deephaven.logback.PrintStreamGlobalsConsole">
<encoder>
<pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z', UTC} | %green(%-20.20thread) | %highlight(%5level) | %yellow(%-25.25logger{25}) | %m%n</pattern>
</encoder>
</appender>
<appender name="LOGBUFFER" class="io.deephaven.logback.LogBufferAppender">
<encoder>
<!-- LogBufferRecord has timestamp and level, so no need to encode -->
<pattern>%-20.20thread | %-25.25logger{25} | %m</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="FILE" />
<appender-ref ref="LOGBUFFER" />
</root>
</configuration>
#!/usr/bin/env bash
java_home=$(update-java-alternatives -l | grep -w "1.8.0" | sed 's/ */ /g' | cut -f 3 -d ' ')
pushd /
$java_home/bin/java -server \
-XX:+UseG1GC \
-XX:MaxGCPauseMillis=100 \
-XX:+UseStringDeduplication \
-Xmx8G \
-XshowSettings:vm \
-cp /deephaven/resources/:/deephaven/lib/* \
-Ddeephaven.console.type=groovy \
io.deephaven.grpc_api.runner.Main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment