forked from tsai/budibase
13 changed files with 181 additions and 490 deletions
@ -1,149 +0,0 @@ |
|||||
static_resources: |
|
||||
listeners: |
|
||||
- name: main_listener |
|
||||
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 |
|
||||
stat_prefix: ingress |
|
||||
codec_type: auto |
|
||||
route_config: |
|
||||
name: local_route |
|
||||
virtual_hosts: |
|
||||
- name: local_services |
|
||||
domains: ["*"] |
|
||||
routes: |
|
||||
# special case to redirect specifically the route path |
|
||||
# to the builder, if this were a prefix then it would break minio |
|
||||
- match: { path: "/" } |
|
||||
redirect: { path_redirect: "/builder/" } |
|
||||
|
|
||||
- match: { prefix: "/db/" } |
|
||||
route: |
|
||||
cluster: couchdb-service |
|
||||
prefix_rewrite: "/" |
|
||||
|
|
||||
- match: { prefix: "/api/system/" } |
|
||||
route: |
|
||||
cluster: worker-dev |
|
||||
|
|
||||
- match: { prefix: "/api/admin/" } |
|
||||
route: |
|
||||
cluster: worker-dev |
|
||||
|
|
||||
- match: { prefix: "/api/global/" } |
|
||||
route: |
|
||||
cluster: worker-dev |
|
||||
|
|
||||
- match: { prefix: "/api/" } |
|
||||
route: |
|
||||
cluster: server-dev |
|
||||
timeout: 120s |
|
||||
|
|
||||
- match: { prefix: "/app_" } |
|
||||
route: |
|
||||
cluster: server-dev |
|
||||
|
|
||||
- match: { prefix: "/app/" } |
|
||||
route: |
|
||||
cluster: server-dev |
|
||||
prefix_rewrite: "/" |
|
||||
|
|
||||
# the below three cases are needed to make sure |
|
||||
# all traffic prefixed for the builder is passed through |
|
||||
# correctly. |
|
||||
- match: { path: "/" } |
|
||||
route: |
|
||||
cluster: builder-dev |
|
||||
|
|
||||
- match: { prefix: "/builder/" } |
|
||||
route: |
|
||||
cluster: builder-dev |
|
||||
|
|
||||
- match: { prefix: "/builder" } |
|
||||
route: |
|
||||
cluster: builder-dev |
|
||||
prefix_rewrite: "/builder/" |
|
||||
|
|
||||
# minio is on the default route because this works |
|
||||
# best, minio + AWS SDK doesn't handle path proxy |
|
||||
- match: { prefix: "/" } |
|
||||
route: |
|
||||
cluster: minio-service |
|
||||
|
|
||||
http_filters: |
|
||||
- name: envoy.filters.http.router |
|
||||
|
|
||||
clusters: |
|
||||
- name: minio-service |
|
||||
connect_timeout: 0.25s |
|
||||
type: strict_dns |
|
||||
lb_policy: round_robin |
|
||||
load_assignment: |
|
||||
cluster_name: minio-service |
|
||||
endpoints: |
|
||||
- lb_endpoints: |
|
||||
- endpoint: |
|
||||
address: |
|
||||
socket_address: |
|
||||
address: minio-service |
|
||||
port_value: 9000 |
|
||||
|
|
||||
- name: couchdb-service |
|
||||
connect_timeout: 0.25s |
|
||||
type: strict_dns |
|
||||
lb_policy: round_robin |
|
||||
load_assignment: |
|
||||
cluster_name: couchdb-service |
|
||||
endpoints: |
|
||||
- lb_endpoints: |
|
||||
- endpoint: |
|
||||
address: |
|
||||
socket_address: |
|
||||
address: couchdb-service |
|
||||
port_value: 5984 |
|
||||
|
|
||||
- name: server-dev |
|
||||
connect_timeout: 0.25s |
|
||||
type: strict_dns |
|
||||
lb_policy: round_robin |
|
||||
load_assignment: |
|
||||
cluster_name: server-dev |
|
||||
endpoints: |
|
||||
- lb_endpoints: |
|
||||
- endpoint: |
|
||||
address: |
|
||||
socket_address: |
|
||||
address: {{ address }} |
|
||||
port_value: 4001 |
|
||||
|
|
||||
- name: builder-dev |
|
||||
connect_timeout: 15s |
|
||||
type: strict_dns |
|
||||
lb_policy: round_robin |
|
||||
load_assignment: |
|
||||
cluster_name: builder-dev |
|
||||
endpoints: |
|
||||
- lb_endpoints: |
|
||||
- endpoint: |
|
||||
address: |
|
||||
socket_address: |
|
||||
address: {{ address }} |
|
||||
port_value: 3000 |
|
||||
|
|
||||
- name: worker-dev |
|
||||
connect_timeout: 0.25s |
|
||||
type: strict_dns |
|
||||
lb_policy: round_robin |
|
||||
load_assignment: |
|
||||
cluster_name: worker-dev |
|
||||
endpoints: |
|
||||
- lb_endpoints: |
|
||||
- endpoint: |
|
||||
address: |
|
||||
socket_address: |
|
||||
address: {{ address }} |
|
||||
port_value: 4002 |
|
||||
@ -1,21 +0,0 @@ |
|||||
# Use the main port in the builder for your self hosting URL, e.g. localhost:10000 |
|
||||
MAIN_PORT=10000 |
|
||||
|
|
||||
# This section contains all secrets pertaining to the system |
|
||||
# These should be updated |
|
||||
JWT_SECRET=testsecret |
|
||||
MINIO_ACCESS_KEY=budibase |
|
||||
MINIO_SECRET_KEY=budibase |
|
||||
COUCH_DB_PASSWORD=budibase |
|
||||
COUCH_DB_USER=budibase |
|
||||
REDIS_PASSWORD=budibase |
|
||||
INTERNAL_API_KEY=budibase |
|
||||
|
|
||||
# This section contains variables that do not need to be altered under normal circumstances |
|
||||
APP_PORT=4002 |
|
||||
WORKER_PORT=4003 |
|
||||
MINIO_PORT=4004 |
|
||||
COUCH_DB_PORT=4005 |
|
||||
REDIS_PORT=6379 |
|
||||
WATCHTOWER_PORT=6161 |
|
||||
BUDIBASE_ENVIRONMENT=PRODUCTION |
|
||||
@ -1,4 +0,0 @@ |
|||||
FROM envoyproxy/envoy:v1.16-latest |
|
||||
COPY envoy.yaml /etc/envoy/envoy.yaml |
|
||||
RUN chmod go+r /etc/envoy/envoy.yaml |
|
||||
|
|
||||
@ -1,146 +0,0 @@ |
|||||
static_resources: |
|
||||
listeners: |
|
||||
- name: main_listener |
|
||||
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 |
|
||||
stat_prefix: ingress |
|
||||
codec_type: auto |
|
||||
route_config: |
|
||||
name: local_route |
|
||||
virtual_hosts: |
|
||||
- name: local_services |
|
||||
domains: ["*"] |
|
||||
routes: |
|
||||
- match: { prefix: "/app/" } |
|
||||
route: |
|
||||
cluster: app-service |
|
||||
prefix_rewrite: "/" |
|
||||
|
|
||||
- match: { prefix: "/builder/" } |
|
||||
route: |
|
||||
cluster: app-service |
|
||||
|
|
||||
- match: { prefix: "/builder" } |
|
||||
route: |
|
||||
cluster: app-service |
|
||||
|
|
||||
- match: { prefix: "/app_" } |
|
||||
route: |
|
||||
cluster: app-service |
|
||||
|
|
||||
# special cases for worker admin (deprecated), global and system API |
|
||||
- match: { prefix: "/api/global/" } |
|
||||
route: |
|
||||
cluster: worker-service |
|
||||
|
|
||||
- match: { prefix: "/api/admin/" } |
|
||||
route: |
|
||||
cluster: worker-service |
|
||||
|
|
||||
- match: { prefix: "/api/system/" } |
|
||||
route: |
|
||||
cluster: worker-service |
|
||||
|
|
||||
- match: { path: "/" } |
|
||||
route: |
|
||||
cluster: app-service |
|
||||
|
|
||||
- match: |
|
||||
safe_regex: |
|
||||
google_re2: {} |
|
||||
regex: "/api/.*/export" |
|
||||
route: |
|
||||
timeout: 0s |
|
||||
cluster: app-service |
|
||||
|
|
||||
- match: { path: "/api/deploy" } |
|
||||
route: |
|
||||
timeout: 60s |
|
||||
cluster: app-service |
|
||||
|
|
||||
# special case for when API requests are made, can just forward, not to minio |
|
||||
- match: { prefix: "/api/" } |
|
||||
route: |
|
||||
cluster: app-service |
|
||||
|
|
||||
- match: { prefix: "/worker/" } |
|
||||
route: |
|
||||
cluster: worker-service |
|
||||
prefix_rewrite: "/" |
|
||||
|
|
||||
- match: { prefix: "/db/" } |
|
||||
route: |
|
||||
cluster: couchdb-service |
|
||||
prefix_rewrite: "/" |
|
||||
|
|
||||
# minio is on the default route because this works |
|
||||
# best, minio + AWS SDK doesn't handle path proxy |
|
||||
- match: { prefix: "/" } |
|
||||
route: |
|
||||
cluster: minio-service |
|
||||
|
|
||||
http_filters: |
|
||||
- name: envoy.filters.http.router |
|
||||
|
|
||||
clusters: |
|
||||
- name: app-service |
|
||||
connect_timeout: 0.25s |
|
||||
type: strict_dns |
|
||||
lb_policy: round_robin |
|
||||
load_assignment: |
|
||||
cluster_name: app-service |
|
||||
endpoints: |
|
||||
- lb_endpoints: |
|
||||
- endpoint: |
|
||||
address: |
|
||||
socket_address: |
|
||||
address: app-service.budibase.svc.cluster.local |
|
||||
port_value: 4002 |
|
||||
|
|
||||
- name: minio-service |
|
||||
connect_timeout: 0.25s |
|
||||
type: strict_dns |
|
||||
lb_policy: round_robin |
|
||||
load_assignment: |
|
||||
cluster_name: minio-service |
|
||||
endpoints: |
|
||||
- lb_endpoints: |
|
||||
- endpoint: |
|
||||
address: |
|
||||
socket_address: |
|
||||
address: minio-service.budibase.svc.cluster.local |
|
||||
port_value: 9000 |
|
||||
|
|
||||
- name: worker-service |
|
||||
connect_timeout: 0.25s |
|
||||
type: strict_dns |
|
||||
lb_policy: round_robin |
|
||||
load_assignment: |
|
||||
cluster_name: worker-service |
|
||||
endpoints: |
|
||||
- lb_endpoints: |
|
||||
- endpoint: |
|
||||
address: |
|
||||
socket_address: |
|
||||
address: worker-service.budibase.svc.cluster.local |
|
||||
port_value: 4001 |
|
||||
|
|
||||
- name: couchdb-service |
|
||||
connect_timeout: 0.25s |
|
||||
type: strict_dns |
|
||||
lb_policy: round_robin |
|
||||
load_assignment: |
|
||||
cluster_name: couchdb-service |
|
||||
endpoints: |
|
||||
- lb_endpoints: |
|
||||
- endpoint: |
|
||||
address: |
|
||||
socket_address: |
|
||||
address: budibase-prod-svc-couchdb |
|
||||
port_value: 5984 |
|
||||
|
|
||||
@ -1,3 +1,2 @@ |
|||||
# FROM envoyproxy/envoy:v1.16-latest |
FROM nginx:latest |
||||
# COPY envoy.yaml /etc/envoy/envoy.yaml |
COPY nginx.conf /etc/nginx/nginx.conf |
||||
# RUN chmod go+r /etc/envoy/envoy.yaml |
|
||||
|
|||||
@ -1,146 +1,113 @@ |
|||||
static_resources: |
user nginx; |
||||
listeners: |
error_log /var/log/nginx/error.log debug; |
||||
- name: main_listener |
pid /var/run/nginx.pid; |
||||
address: |
worker_processes auto; |
||||
socket_address: { address: 0.0.0.0, port_value: 10000 } |
worker_rlimit_nofile 33282; |
||||
filter_chains: |
|
||||
- filters: |
events { |
||||
- name: envoy.filters.network.http_connection_manager |
worker_connections 1024; |
||||
typed_config: |
} |
||||
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager |
|
||||
stat_prefix: ingress |
http { |
||||
codec_type: auto |
limit_req_zone $binary_remote_addr zone=ratelimit:10m rate=10r/s; |
||||
route_config: |
include /etc/nginx/mime.types; |
||||
name: local_route |
default_type application/octet-stream; |
||||
virtual_hosts: |
|
||||
- name: local_services |
|
||||
domains: ["*"] |
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' |
||||
routes: |
'$status $body_bytes_sent "$http_referer" ' |
||||
- match: { prefix: "/app/" } |
'"$http_user_agent" "$http_x_forwarded_for"'; |
||||
route: |
|
||||
cluster: app-service |
map $http_upgrade $connection_upgrade { |
||||
prefix_rewrite: "/" |
default "upgrade"; |
||||
|
} |
||||
- match: { prefix: "/builder/" } |
|
||||
route: |
server { |
||||
cluster: app-service |
listen 10000 default_server; |
||||
|
server_name _; |
||||
- match: { prefix: "/builder" } |
client_max_body_size 1000m; |
||||
route: |
ignore_invalid_headers off; |
||||
cluster: app-service |
proxy_buffering off; |
||||
|
|
||||
- match: { prefix: "/app_" } |
# Security Headers |
||||
route: |
add_header X-Frame-Options SAMEORIGIN always; |
||||
cluster: app-service |
add_header X-Content-Type-Options nosniff always; |
||||
|
add_header X-XSS-Protection "1; mode=block" always; |
||||
# special cases for worker admin (deprecated), global and system API |
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdn.budi.live https://js.intercomcdn.com https://widget.intercom.io; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://fonts.googleapis.com https://rsms.me; object-src 'none'; base-uri 'self'; connect-src 'self' https://api-iam.intercom.io https://app.posthog.com wss://nexus-websocket-a.intercom.io; font-src 'self' https://cdn.jsdelivr.net https://fonts.gstatic.com https://rsms.me; frame-src 'self'; img-src https: data:; manifest-src 'self'; media-src 'self'; worker-src 'none';" always; |
||||
- match: { prefix: "/api/global/" } |
|
||||
route: |
location /app { |
||||
cluster: worker-service |
proxy_pass http://app-service:4002; |
||||
|
rewrite ^/app/(.*)$ /$1 break; |
||||
- match: { prefix: "/api/admin/" } |
} |
||||
route: |
|
||||
cluster: worker-service |
location = / { |
||||
|
proxy_pass http://app-service.budibase.svc.cluster.local:4002; |
||||
- match: { prefix: "/api/system/" } |
} |
||||
route: |
|
||||
cluster: worker-service |
location /builder/ { |
||||
|
proxy_http_version 1.1; |
||||
- match: { path: "/" } |
proxy_set_header Connection $connection_upgrade; |
||||
route: |
proxy_set_header Upgrade $http_upgrade; |
||||
cluster: app-service |
proxy_set_header Host $host; |
||||
|
proxy_set_header X-Real-IP $remote_addr; |
||||
- match: |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
||||
safe_regex: |
proxy_pass http://app-service.budibase.svc.cluster.local:4002; |
||||
google_re2: {} |
} |
||||
regex: "/api/.*/export" |
|
||||
route: |
location ^/(builder|app_) { |
||||
timeout: 0s |
proxy_pass http://app-service.budibase.svc.cluster.local:4002; |
||||
cluster: app-service |
} |
||||
|
|
||||
- match: { path: "/api/deploy" } |
location ~ ^/api/(system|admin|global)/ { |
||||
route: |
proxy_pass http://worker-service.budibase.svc.cluster.local:4003; |
||||
timeout: 60s |
} |
||||
cluster: app-service |
|
||||
|
location /worker/ { |
||||
# special case for when API requests are made, can just forward, not to minio |
proxy_pass http://worker-service.budibase.svc.cluster.local:4003; |
||||
- match: { prefix: "/api/" } |
rewrite ^/worker/(.*)$ /$1 break; |
||||
route: |
} |
||||
cluster: app-service |
|
||||
|
location /api/ { |
||||
- match: { prefix: "/worker/" } |
# calls to the API are rate limited with bursting |
||||
route: |
limit_req zone=ratelimit burst=10 nodelay; |
||||
cluster: worker-service |
|
||||
prefix_rewrite: "/" |
# 120s timeout on API requests |
||||
|
proxy_read_timeout 120s; |
||||
- match: { prefix: "/db/" } |
proxy_connect_timeout 120s; |
||||
route: |
proxy_send_timeout 120s; |
||||
cluster: couchdb-service |
|
||||
prefix_rewrite: "/" |
proxy_http_version 1.1; |
||||
|
proxy_set_header Connection $connection_upgrade; |
||||
# minio is on the default route because this works |
proxy_set_header Upgrade $http_upgrade; |
||||
# best, minio + AWS SDK doesn't handle path proxy |
proxy_set_header Host $host; |
||||
- match: { prefix: "/" } |
proxy_set_header X-Real-IP $remote_addr; |
||||
route: |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
||||
cluster: minio-service |
|
||||
|
proxy_pass http://app-service.budibase.svc.cluster.local:4002; |
||||
http_filters: |
} |
||||
- name: envoy.filters.http.router |
|
||||
|
location /db/ { |
||||
clusters: |
proxy_pass http://budibase-prod-svc-couchdb:5984; |
||||
- name: app-service |
rewrite ^/db/(.*)$ /$1 break; |
||||
connect_timeout: 0.25s |
} |
||||
type: strict_dns |
|
||||
lb_policy: round_robin |
location / { |
||||
load_assignment: |
proxy_set_header X-Real-IP $remote_addr; |
||||
cluster_name: app-service |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
||||
endpoints: |
proxy_set_header X-Forwarded-Proto $scheme; |
||||
- lb_endpoints: |
proxy_set_header Host $http_host; |
||||
- endpoint: |
|
||||
address: |
proxy_connect_timeout 300; |
||||
socket_address: |
proxy_http_version 1.1; |
||||
address: app-service.budibase.svc.cluster.local |
proxy_set_header Connection ""; |
||||
port_value: 4002 |
chunked_transfer_encoding off; |
||||
|
proxy_pass http://minio-service.budibase.svc.cluster.local:9000; |
||||
- name: minio-service |
} |
||||
connect_timeout: 0.25s |
|
||||
type: strict_dns |
client_header_timeout 60; |
||||
lb_policy: round_robin |
client_body_timeout 60; |
||||
load_assignment: |
keepalive_timeout 60; |
||||
cluster_name: minio-service |
gzip on; |
||||
endpoints: |
gzip_comp_level 4; |
||||
- lb_endpoints: |
} |
||||
- endpoint: |
} |
||||
address: |
|
||||
socket_address: |
|
||||
address: minio-service.budibase.svc.cluster.local |
|
||||
port_value: 9000 |
|
||||
|
|
||||
- name: worker-service |
|
||||
connect_timeout: 0.25s |
|
||||
type: strict_dns |
|
||||
lb_policy: round_robin |
|
||||
load_assignment: |
|
||||
cluster_name: worker-service |
|
||||
endpoints: |
|
||||
- lb_endpoints: |
|
||||
- endpoint: |
|
||||
address: |
|
||||
socket_address: |
|
||||
address: worker-service.budibase.svc.cluster.local |
|
||||
port_value: 4001 |
|
||||
|
|
||||
- name: couchdb-service |
|
||||
connect_timeout: 0.25s |
|
||||
type: strict_dns |
|
||||
lb_policy: round_robin |
|
||||
load_assignment: |
|
||||
cluster_name: couchdb-service |
|
||||
endpoints: |
|
||||
- lb_endpoints: |
|
||||
- endpoint: |
|
||||
address: |
|
||||
socket_address: |
|
||||
address: budibase-prod-svc-couchdb |
|
||||
port_value: 5984 |
|
||||
|
|
||||
@ -1,6 +1,5 @@ |
|||||
node_modules/ |
node_modules/ |
||||
docker-compose.yaml |
docker-compose.yaml |
||||
envoy.yaml |
envoy.yaml |
||||
hosting.properties |
|
||||
build/ |
build/ |
||||
docker-error.log |
docker-error.log |
||||
|
|||||
Loading…
Reference in new issue