Compare commits
1 Commits
cli/fix/up
...
feat/devbo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8dd674aab3 |
4
apps/studio/README.md
Normal file
4
apps/studio/README.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# devbox
|
||||||
|
Terminus App development management tools
|
||||||
|
|
||||||
|
https://github.com/beclab/devbox
|
||||||
23
apps/studio/config/user/helm-charts/studio/.helmignore
Normal file
23
apps/studio/config/user/helm-charts/studio/.helmignore
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Patterns to ignore when building packages.
|
||||||
|
# This supports shell glob matching, relative path matching, and
|
||||||
|
# negation (prefixed with !). Only one pattern per line.
|
||||||
|
.DS_Store
|
||||||
|
# Common VCS dirs
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
.bzr/
|
||||||
|
.bzrignore
|
||||||
|
.hg/
|
||||||
|
.hgignore
|
||||||
|
.svn/
|
||||||
|
# Common backup files
|
||||||
|
*.swp
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
*.orig
|
||||||
|
*~
|
||||||
|
# Various IDEs
|
||||||
|
.project
|
||||||
|
.idea/
|
||||||
|
*.tmproj
|
||||||
|
.vscode/
|
||||||
26
apps/studio/config/user/helm-charts/studio/Chart.yaml
Normal file
26
apps/studio/config/user/helm-charts/studio/Chart.yaml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: studio
|
||||||
|
description: A Terminus app development tool
|
||||||
|
maintainers:
|
||||||
|
- name: bytetrade
|
||||||
|
|
||||||
|
# A chart can be either an 'application' or a 'library' chart.
|
||||||
|
#
|
||||||
|
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||||
|
# to be deployed.
|
||||||
|
#
|
||||||
|
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||||
|
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||||
|
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||||
|
type: application
|
||||||
|
|
||||||
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
|
# to the chart and its templates, including the app version.
|
||||||
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
|
version: 0.1.3
|
||||||
|
|
||||||
|
# This is the version number of the application being deployed. This version number should be
|
||||||
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
|
# It is recommended to use it with quotes.
|
||||||
|
appVersion: "4.9.1"
|
||||||
BIN
apps/studio/config/user/helm-charts/studio/devbox.png
Normal file
BIN
apps/studio/config/user/helm-charts/studio/devbox.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 749 KiB |
@@ -0,0 +1,549 @@
|
|||||||
|
{{- $namespace := printf "%s%s" "user-system-" .Values.bfl.username -}}
|
||||||
|
{{- $studio_secret := (lookup "v1" "Secret" $namespace "studio-secrets") -}}
|
||||||
|
|
||||||
|
{{- $pg_password := "" -}}
|
||||||
|
{{ if $studio_secret -}}
|
||||||
|
{{ $pg_password = (index $studio_secret "data" "pg_password") }}
|
||||||
|
{{ else -}}
|
||||||
|
{{ $pg_password = randAlphaNum 16 | b64enc }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: studio-secrets
|
||||||
|
namespace: user-system-{{ .Values.bfl.username }}
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
pg_password: {{ $pg_password }}
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: apr.bytetrade.io/v1alpha1
|
||||||
|
kind: MiddlewareRequest
|
||||||
|
metadata:
|
||||||
|
name: studio-pg
|
||||||
|
namespace: user-system-{{ .Values.bfl.username }}
|
||||||
|
spec:
|
||||||
|
app: studio
|
||||||
|
appNamespace: {{ .Release.Namespace }}
|
||||||
|
middleware: postgres
|
||||||
|
postgreSQL:
|
||||||
|
user: studio_{{ .Values.bfl.username }}
|
||||||
|
password:
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: pg_password
|
||||||
|
name: studio-secrets
|
||||||
|
databases:
|
||||||
|
- name: studio
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: studio-server
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: studio-server
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 8080
|
||||||
|
targetPort: 8088
|
||||||
|
name: http
|
||||||
|
- protocol: TCP
|
||||||
|
port: 8083
|
||||||
|
targetPort: 8083
|
||||||
|
name: https
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: Service
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: chartmuseum-studio
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
protocol: TCP
|
||||||
|
port: 8080
|
||||||
|
targetPort: 8888
|
||||||
|
selector:
|
||||||
|
app: studio-server
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: studio-san-cnf
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
data:
|
||||||
|
san.cnf: |
|
||||||
|
[req]
|
||||||
|
distinguished_name = req_distinguished_name
|
||||||
|
req_extensions = v3_req
|
||||||
|
prompt = no
|
||||||
|
|
||||||
|
[req_distinguished_name]
|
||||||
|
countryName = CN
|
||||||
|
stateOrProvinceName = Beijing
|
||||||
|
localityName = Beijing
|
||||||
|
0.organizationName = bytetrade
|
||||||
|
commonName = studio-server.{{ .Release.Namespace }}.svc
|
||||||
|
|
||||||
|
[v3_req]
|
||||||
|
basicConstraints = CA:FALSE
|
||||||
|
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
|
||||||
|
subjectAltName = @bytetrade
|
||||||
|
|
||||||
|
[bytetrade]
|
||||||
|
DNS.1 = studio-server.{{ .Release.Namespace }}.svc
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: studio-server
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
labels:
|
||||||
|
app: studio-server
|
||||||
|
applications.app.bytetrade.io/author: bytetrade.io
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: studio-server
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: studio-server
|
||||||
|
spec:
|
||||||
|
serviceAccountName: bytetrade-controller
|
||||||
|
volumes:
|
||||||
|
- name: chart
|
||||||
|
hostPath:
|
||||||
|
type: DirectoryOrCreate
|
||||||
|
path: {{ .Values.userspace.appData}}/studio/Chart
|
||||||
|
- name: data
|
||||||
|
hostPath:
|
||||||
|
type: DirectoryOrCreate
|
||||||
|
path: {{ .Values.userspace.appData }}/studio/Data
|
||||||
|
- name: storage-volume
|
||||||
|
hostPath:
|
||||||
|
path: {{ .Values.userspace.appData }}/studio/helm-repo-dev
|
||||||
|
type: DirectoryOrCreate
|
||||||
|
- name: config-san
|
||||||
|
configMap:
|
||||||
|
name: studio-san-cnf
|
||||||
|
items:
|
||||||
|
- key: san.cnf
|
||||||
|
path: san.cnf
|
||||||
|
- name: sidecar-configs-studio
|
||||||
|
configMap:
|
||||||
|
name: sidecar-configs-studio
|
||||||
|
items:
|
||||||
|
- key: envoy.yaml
|
||||||
|
path: envoy.yaml
|
||||||
|
- name: certs
|
||||||
|
emptyDir: {}
|
||||||
|
initContainers:
|
||||||
|
- name: init-chmod-data
|
||||||
|
image: busybox:1.28
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- '-c'
|
||||||
|
- |
|
||||||
|
chown -R 1000:1000 /home/coder
|
||||||
|
chown -R 65532:65532 /charts
|
||||||
|
chown -R 65532:65532 /data
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 0
|
||||||
|
resources: { }
|
||||||
|
volumeMounts:
|
||||||
|
- name: storage-volume
|
||||||
|
mountPath: /home/coder
|
||||||
|
- name: chart
|
||||||
|
mountPath: /charts
|
||||||
|
- name: data
|
||||||
|
mountPath: /data
|
||||||
|
- name: terminus-sidecar-init
|
||||||
|
image: aboveos/openservicemesh-init:v1.2.3
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
iptables-restore --noflush <<EOF
|
||||||
|
# sidecar interception rules
|
||||||
|
*nat
|
||||||
|
:PROXY_IN_REDIRECT - [0:0]
|
||||||
|
:PROXY_INBOUND - [0:0]
|
||||||
|
:PROXY_OUTBOUND - [0:0]
|
||||||
|
:PROXY_OUT_REDIRECT - [0:0]
|
||||||
|
|
||||||
|
-A PREROUTING -p tcp -j PROXY_INBOUND
|
||||||
|
-A OUTPUT -p tcp -j PROXY_OUTBOUND
|
||||||
|
-A PROXY_INBOUND -p tcp --dport 15000 -j RETURN
|
||||||
|
-A PROXY_INBOUND -p tcp --dport 8083 -j RETURN
|
||||||
|
-A PROXY_INBOUND -p tcp -j PROXY_IN_REDIRECT
|
||||||
|
-A PROXY_IN_REDIRECT -p tcp -j REDIRECT --to-port 15003
|
||||||
|
|
||||||
|
|
||||||
|
-A PROXY_OUTBOUND -p tcp --dport 5432 -j RETURN
|
||||||
|
-A PROXY_OUTBOUND -p tcp --dport 6379 -j RETURN
|
||||||
|
-A PROXY_OUTBOUND -p tcp --dport 27017 -j RETURN
|
||||||
|
-A PROXY_OUTBOUND -p tcp --dport 443 -j RETURN
|
||||||
|
|
||||||
|
|
||||||
|
-A PROXY_OUTBOUND -d ${POD_IP}/32 -j RETURN
|
||||||
|
|
||||||
|
-A PROXY_OUTBOUND -o lo ! -d 127.0.0.1/32 -m owner --uid-owner 1555 -j PROXY_IN_REDIRECT
|
||||||
|
-A PROXY_OUTBOUND -o lo -m owner ! --uid-owner 1555 -j RETURN
|
||||||
|
-A PROXY_OUTBOUND -m owner --uid-owner 1555 -j RETURN
|
||||||
|
-A PROXY_OUTBOUND -d 127.0.0.1/32 -j RETURN
|
||||||
|
|
||||||
|
-A PROXY_OUTBOUND -j PROXY_OUT_REDIRECT
|
||||||
|
-A PROXY_OUT_REDIRECT -p tcp -j REDIRECT --to-port 15001
|
||||||
|
|
||||||
|
COMMIT
|
||||||
|
EOF
|
||||||
|
env:
|
||||||
|
- name: POD_IP
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
apiVersion: v1
|
||||||
|
fieldPath: status.podIP
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
capabilities:
|
||||||
|
add:
|
||||||
|
- NET_ADMIN
|
||||||
|
runAsNonRoot: false
|
||||||
|
runAsUser: 0
|
||||||
|
|
||||||
|
- name: generate-certs
|
||||||
|
image: beclab/openssl:v3
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
command: [ "/bin/sh", "-c" ]
|
||||||
|
args:
|
||||||
|
- |
|
||||||
|
openssl genrsa -out /etc/certs/ca.key 2048
|
||||||
|
openssl req -new -x509 -days 3650 -key /etc/certs/ca.key -out /etc/certs/ca.crt \
|
||||||
|
-subj "/CN=bytetrade CA/O=bytetrade/C=CN"
|
||||||
|
openssl req -new -newkey rsa:2048 -nodes \
|
||||||
|
-keyout /etc/certs/server.key -out /etc/certs/server.csr \
|
||||||
|
-config /etc/san/san.cnf
|
||||||
|
openssl x509 -req -days 3650 -in /etc/certs/server.csr \
|
||||||
|
-CA /etc/certs/ca.crt -CAkey /etc/certs/ca.key \
|
||||||
|
-CAcreateserial -out /etc/certs/server.crt \
|
||||||
|
-extensions v3_req -extfile /etc/san/san.cnf
|
||||||
|
chown -R 65532 /etc/certs/*
|
||||||
|
volumeMounts:
|
||||||
|
- name: config-san
|
||||||
|
mountPath: /etc/san
|
||||||
|
- name: certs
|
||||||
|
mountPath: /etc/certs
|
||||||
|
|
||||||
|
containers:
|
||||||
|
- name: studio
|
||||||
|
image: beclab/devbox-server:v0.1.42
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
args:
|
||||||
|
- server
|
||||||
|
ports:
|
||||||
|
- name: port
|
||||||
|
containerPort: 8088
|
||||||
|
protocol: TCP
|
||||||
|
- name: ssl-port
|
||||||
|
containerPort: 8083
|
||||||
|
protocol: TCP
|
||||||
|
volumeMounts:
|
||||||
|
- name: chart
|
||||||
|
mountPath: /charts
|
||||||
|
- name: data
|
||||||
|
mountPath: /data
|
||||||
|
- mountPath: /etc/certs
|
||||||
|
name: certs
|
||||||
|
lifecycle:
|
||||||
|
preStop:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- "/devbox"
|
||||||
|
- "clean"
|
||||||
|
env:
|
||||||
|
- name: BASE_DIR
|
||||||
|
value: /charts
|
||||||
|
- name: OS_API_KEY
|
||||||
|
value: {{ .Values.os.studio.appKey }}
|
||||||
|
- name: OS_API_SECRET
|
||||||
|
value: {{ .Values.os.studio.appSecret }}
|
||||||
|
- name: OS_SYSTEM_SERVER
|
||||||
|
value: system-server.user-system-{{ .Values.bfl.username }}
|
||||||
|
- name: NAME_SPACE
|
||||||
|
value: {{ .Release.Namespace }}
|
||||||
|
- name: OWNER
|
||||||
|
value: '{{ .Values.bfl.username }}'
|
||||||
|
- name: DB_HOST
|
||||||
|
value: citus-master-svc.user-system-{{ .Values.bfl.username }}
|
||||||
|
- name: DB_USERNAME
|
||||||
|
value: studio_{{ .Values.bfl.username }}
|
||||||
|
- name: DB_PASSWORD
|
||||||
|
value: "{{ $pg_password | b64dec }}"
|
||||||
|
- name: DB_NAME
|
||||||
|
value: user_space_{{ .Values.bfl.username }}_studio
|
||||||
|
- name: DB_PORT
|
||||||
|
value: "5432"
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: "50m"
|
||||||
|
memory: 100Mi
|
||||||
|
limits:
|
||||||
|
cpu: "0.5"
|
||||||
|
memory: 1000Mi
|
||||||
|
- name: terminus-envoy-sidecar
|
||||||
|
image: bytetrade/envoy:v1.25.11.1
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
runAsUser: 1555
|
||||||
|
ports:
|
||||||
|
- name: proxy-admin
|
||||||
|
containerPort: 15000
|
||||||
|
- name: proxy-inbound
|
||||||
|
containerPort: 15003
|
||||||
|
- name: proxy-outbound
|
||||||
|
containerPort: 15001
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: "50m"
|
||||||
|
memory: 100Mi
|
||||||
|
limits:
|
||||||
|
cpu: "0.5"
|
||||||
|
memory: 200Mi
|
||||||
|
volumeMounts:
|
||||||
|
- name: sidecar-configs-studio
|
||||||
|
readOnly: true
|
||||||
|
mountPath: /etc/envoy/envoy.yaml
|
||||||
|
subPath: envoy.yaml
|
||||||
|
command:
|
||||||
|
- /usr/local/bin/envoy
|
||||||
|
- --log-level
|
||||||
|
- debug
|
||||||
|
- -c
|
||||||
|
- /etc/envoy/envoy.yaml
|
||||||
|
env:
|
||||||
|
- name: POD_UID
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.uid
|
||||||
|
- name: POD_NAME
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.name
|
||||||
|
- name: POD_NAMESPACE
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.namespace
|
||||||
|
- name: POD_IP
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: status.podIP
|
||||||
|
- name: APP_KEY
|
||||||
|
value: {{ .Values.os.appKey }}
|
||||||
|
- name: APP_SECRET
|
||||||
|
value: {{ .Values.os.appSecret }}
|
||||||
|
- name: chartmuseum
|
||||||
|
image: aboveos/helm-chartmuseum:v0.15.0
|
||||||
|
args:
|
||||||
|
- '--port=8888'
|
||||||
|
- '--storage-local-rootdir=/storage'
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 8888
|
||||||
|
protocol: TCP
|
||||||
|
env:
|
||||||
|
- name: CHART_POST_FORM_FIELD_NAME
|
||||||
|
value: chart
|
||||||
|
- name: DISABLE_API
|
||||||
|
value: 'false'
|
||||||
|
- name: LOG_JSON
|
||||||
|
value: 'true'
|
||||||
|
- name: PROV_POST_FORM_FIELD_NAME
|
||||||
|
value: prov
|
||||||
|
- name: STORAGE
|
||||||
|
value: local
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: "50m"
|
||||||
|
memory: 100Mi
|
||||||
|
limits:
|
||||||
|
cpu: "0.5"
|
||||||
|
memory: 256Mi
|
||||||
|
volumeMounts:
|
||||||
|
- name: storage-volume
|
||||||
|
mountPath: /storage
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /health
|
||||||
|
port: http
|
||||||
|
scheme: HTTP
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
timeoutSeconds: 1
|
||||||
|
periodSeconds: 10
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 3
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /health
|
||||||
|
port: http
|
||||||
|
scheme: HTTP
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
timeoutSeconds: 1
|
||||||
|
periodSeconds: 10
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 3
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
data:
|
||||||
|
envoy.yaml: |
|
||||||
|
admin:
|
||||||
|
access_log_path: "/dev/stdout"
|
||||||
|
address:
|
||||||
|
socket_address:
|
||||||
|
address: 0.0.0.0
|
||||||
|
port_value: 15000
|
||||||
|
static_resources:
|
||||||
|
listeners:
|
||||||
|
- name: listener_0
|
||||||
|
address:
|
||||||
|
socket_address:
|
||||||
|
address: 0.0.0.0
|
||||||
|
port_value: 15003
|
||||||
|
listener_filters:
|
||||||
|
- name: envoy.filters.listener.original_dst
|
||||||
|
typed_config:
|
||||||
|
"@type": type.googleapis.com/envoy.extensions.filters.listener.original_dst.v3.OriginalDst
|
||||||
|
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: desktop_http
|
||||||
|
upgrade_configs:
|
||||||
|
- upgrade_type: websocket
|
||||||
|
- upgrade_type: tailscale-control-protocol
|
||||||
|
skip_xff_append: false
|
||||||
|
codec_type: AUTO
|
||||||
|
route_config:
|
||||||
|
name: local_route
|
||||||
|
virtual_hosts:
|
||||||
|
- name: service
|
||||||
|
domains: ["*"]
|
||||||
|
routes:
|
||||||
|
- match:
|
||||||
|
prefix: "/"
|
||||||
|
route:
|
||||||
|
cluster: original_dst
|
||||||
|
timeout: 180s
|
||||||
|
http_protocol_options:
|
||||||
|
accept_http_10: true
|
||||||
|
http_filters:
|
||||||
|
- name: envoy.filters.http.router
|
||||||
|
typed_config:
|
||||||
|
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
|
||||||
|
- name: listener_1
|
||||||
|
address:
|
||||||
|
socket_address:
|
||||||
|
address: 0.0.0.0
|
||||||
|
port_value: 15001
|
||||||
|
listener_filters:
|
||||||
|
- name: envoy.filters.listener.original_dst
|
||||||
|
typed_config:
|
||||||
|
"@type": type.googleapis.com/envoy.extensions.filters.listener.original_dst.v3.OriginalDst
|
||||||
|
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: devbox_out_http
|
||||||
|
skip_xff_append: false
|
||||||
|
codec_type: AUTO
|
||||||
|
route_config:
|
||||||
|
name: local_route
|
||||||
|
virtual_hosts:
|
||||||
|
- name: service
|
||||||
|
domains: ["*"]
|
||||||
|
routes:
|
||||||
|
- match:
|
||||||
|
prefix: "/server/intent/send"
|
||||||
|
request_headers_to_add:
|
||||||
|
- header:
|
||||||
|
key: X-App-Key
|
||||||
|
value: {{ .Values.os.appKey }}
|
||||||
|
route:
|
||||||
|
cluster: system-server
|
||||||
|
prefix_rewrite: /system-server/v2/legacy_api/api.intent/v2/server/intent/send
|
||||||
|
- match:
|
||||||
|
prefix: "/"
|
||||||
|
route:
|
||||||
|
cluster: original_dst
|
||||||
|
timeout: 180s
|
||||||
|
typed_per_filter_config:
|
||||||
|
envoy.filters.http.lua:
|
||||||
|
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.LuaPerRoute
|
||||||
|
disabled: true
|
||||||
|
|
||||||
|
http_protocol_options:
|
||||||
|
accept_http_10: true
|
||||||
|
http_filters:
|
||||||
|
- name: envoy.filters.http.lua
|
||||||
|
typed_config:
|
||||||
|
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
|
||||||
|
inline_code:
|
||||||
|
local sha = require("lib.sha2")
|
||||||
|
function envoy_on_request(request_handle)
|
||||||
|
local app_key = os.getenv("APP_KEY")
|
||||||
|
local app_secret = os.getenv("APP_SECRET")
|
||||||
|
local current_time = os.time()
|
||||||
|
local minute_level_time = current_time - (current_time % 60)
|
||||||
|
local time_string = tostring(minute_level_time)
|
||||||
|
local s = app_key .. app_secret .. time_string
|
||||||
|
request_handle:logInfo("originstring:" .. s)
|
||||||
|
local hash = sha.sha256(s)
|
||||||
|
request_handle:logInfo("Hello World.")
|
||||||
|
request_handle:logInfo(hash)
|
||||||
|
request_handle:headers():add("X-Auth-Signature",hash)
|
||||||
|
end
|
||||||
|
- name: envoy.filters.http.router
|
||||||
|
typed_config:
|
||||||
|
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
|
||||||
|
|
||||||
|
|
||||||
|
clusters:
|
||||||
|
- name: original_dst
|
||||||
|
connect_timeout: 5000s
|
||||||
|
type: ORIGINAL_DST
|
||||||
|
lb_policy: CLUSTER_PROVIDED
|
||||||
|
- name: system-server
|
||||||
|
connect_timeout: 2s
|
||||||
|
type: LOGICAL_DNS
|
||||||
|
dns_lookup_family: V4_ONLY
|
||||||
|
dns_refresh_rate: 600s
|
||||||
|
lb_policy: ROUND_ROBIN
|
||||||
|
load_assignment:
|
||||||
|
cluster_name: system-server
|
||||||
|
endpoints:
|
||||||
|
- lb_endpoints:
|
||||||
|
- endpoint:
|
||||||
|
address:
|
||||||
|
socket_address:
|
||||||
|
address: system-server.user-system-{{ .Values.bfl.username }}
|
||||||
|
port_value: 80
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: sidecar-configs-studio
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
44
apps/studio/config/user/helm-charts/studio/values.yaml
Normal file
44
apps/studio/config/user/helm-charts/studio/values.yaml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
bfl:
|
||||||
|
nodeport: 30883
|
||||||
|
nodeport_ingress_http: 30083
|
||||||
|
nodeport_ingress_https: 30082
|
||||||
|
username: 'test'
|
||||||
|
url: 'test'
|
||||||
|
nodeName: test
|
||||||
|
pvc:
|
||||||
|
userspace: test
|
||||||
|
userspace:
|
||||||
|
userData: test/Home
|
||||||
|
appData: test/Data
|
||||||
|
appCache: test
|
||||||
|
dbdata: test
|
||||||
|
docs:
|
||||||
|
nodeport: 30881
|
||||||
|
desktop:
|
||||||
|
nodeport: 30180
|
||||||
|
os:
|
||||||
|
portfolio:
|
||||||
|
appKey: '${ks[0]}'
|
||||||
|
appSecret: test
|
||||||
|
vault:
|
||||||
|
appKey: '${ks[0]}'
|
||||||
|
appSecret: test
|
||||||
|
desktop:
|
||||||
|
appKey: '${ks[0]}'
|
||||||
|
appSecret: test
|
||||||
|
message:
|
||||||
|
appKey: '${ks[0]}'
|
||||||
|
appSecret: test
|
||||||
|
rss:
|
||||||
|
appKey: '${ks[0]}'
|
||||||
|
appSecret: test
|
||||||
|
search:
|
||||||
|
appKey: '${ks[0]}'
|
||||||
|
appSecret: test
|
||||||
|
search2:
|
||||||
|
appKey: '${ks[0]}'
|
||||||
|
appSecret: test
|
||||||
|
kubesphere:
|
||||||
|
redis_password: ""
|
||||||
|
|
||||||
@@ -109,6 +109,19 @@ spec:
|
|||||||
port: 3010
|
port: 3010
|
||||||
targetPort: 3010
|
targetPort: 3010
|
||||||
---
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: studio-svc
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: system-frontend
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 8080
|
||||||
|
targetPort: 87
|
||||||
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
@@ -121,11 +134,11 @@ metadata:
|
|||||||
applications.app.bytetrade.io/group: 'true'
|
applications.app.bytetrade.io/group: 'true'
|
||||||
applications.app.bytetrade.io/author: bytetrade.io
|
applications.app.bytetrade.io/author: bytetrade.io
|
||||||
annotations:
|
annotations:
|
||||||
applications.app.bytetrade.io/icon: '{"dashboard":"https://file.bttcdn.com/appstore/dashboard/icon.png","control-hub":"https://file.bttcdn.com/appstore/control-hub/icon.png","profile":"https://file.bttcdn.com/appstore/profile/icon.png","wise":"https://file.bttcdn.com/appstore/rss/icon.png","headscale": "https://file.bttcdn.com/appstore/headscale/icon.png","settings": "https://file.bttcdn.com/appstore/settings/icon.png"}'
|
applications.app.bytetrade.io/icon: '{"dashboard":"https://file.bttcdn.com/appstore/dashboard/icon.png","control-hub":"https://file.bttcdn.com/appstore/control-hub/icon.png","profile":"https://file.bttcdn.com/appstore/profile/icon.png","wise":"https://file.bttcdn.com/appstore/rss/icon.png","headscale": "https://file.bttcdn.com/appstore/headscale/icon.png","settings": "https://file.bttcdn.com/appstore/settings/icon.png","studio":"https://file.bttcdn.com/appstore/devbox/icon.png"}'
|
||||||
applications.app.bytetrade.io/title: '{"dashboard": "Dashboard","control-hub":"Control Hub","profile":"Profile","wise":"Wise","headscale":"Headscale","settings":"Settings"}'
|
applications.app.bytetrade.io/title: '{"dashboard": "Dashboard","control-hub":"Control Hub","profile":"Profile","wise":"Wise","headscale":"Headscale","settings":"Settings","studio":"Studio"}'
|
||||||
applications.app.bytetrade.io/version: '{"dashboard": "0.0.1","control-hub":"0.0.1","profile":"0.0.1","wise":"0.0.1","headscale":"0.0.1","settings":"0.0.1"}'
|
applications.app.bytetrade.io/version: '{"dashboard": "0.0.1","control-hub":"0.0.1","profile":"0.0.1","wise":"0.0.1","headscale":"0.0.1","settings":"0.0.1","studio":"0.0.1"}'
|
||||||
applications.app.bytetrade.io/policies: '{"dashboard":{"policies":[{"entranceName":"dashboard","uriRegex":"/js/script.js", "level":"public"},{"entranceName":"dashboard","uriRegex":"/js/api/send", "level":"public"}]}}'
|
applications.app.bytetrade.io/policies: '{"dashboard":{"policies":[{"entranceName":"dashboard","uriRegex":"/js/script.js", "level":"public"},{"entranceName":"dashboard","uriRegex":"/js/api/send", "level":"public"}]}}'
|
||||||
applications.app.bytetrade.io/entrances: '{"dashboard":[{"name":"dashboard","host":"dashboard-service","port":80,"title":"Dashboard","windowPushState":true}],"control-hub":[{"name":"control-hub","host":"control-hub-service","port":80,"title":"Control Hub","windowPushState":true}],"profile":[{"name":"profile", "host":"profile-service", "port":80,"title":"Profile","windowPushState":true}],"wise":[{"name":"wise", "host":"wise-svc", "port":80,"title":"Wise","windowPushState":true}],"headscale":[{"name":"headscale", "host":"headscale-svc", "port":80,"title":"Headscale","invisible": true}],"settings":[{"name":"settings", "host":"settings-service", "port":80,"title":"Settings"}]}'
|
applications.app.bytetrade.io/entrances: '{"dashboard":[{"name":"dashboard","host":"dashboard-service","port":80,"title":"Dashboard","windowPushState":true}],"control-hub":[{"name":"control-hub","host":"control-hub-service","port":80,"title":"Control Hub","windowPushState":true}],"profile":[{"name":"profile", "host":"profile-service", "port":80,"title":"Profile","windowPushState":true}],"wise":[{"name":"wise", "host":"wise-svc", "port":80,"title":"Wise","windowPushState":true}],"headscale":[{"name":"headscale", "host":"headscale-svc", "port":80,"title":"Headscale","invisible": true}],"settings":[{"name":"settings", "host":"settings-service", "port":80,"title":"Settings"}],"studio":[{"name":"studio","host":"studio-svc","port":8080,"title":"Studio","openMethod":"window"}]}'
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
@@ -136,7 +149,7 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: system-frontend
|
app: system-frontend
|
||||||
io.bytetrade.app: "true"
|
io.bytetrade.app: "true"
|
||||||
annotations:
|
# annotations:
|
||||||
# instrumentation.opentelemetry.io/inject-nodejs: "olares-instrumentation"
|
# instrumentation.opentelemetry.io/inject-nodejs: "olares-instrumentation"
|
||||||
# instrumentation.opentelemetry.io/nodejs-container-names: "settings-server"
|
# instrumentation.opentelemetry.io/nodejs-container-names: "settings-server"
|
||||||
# instrumentation.opentelemetry.io/inject-nginx: "olares-instrumentation"
|
# instrumentation.opentelemetry.io/inject-nginx: "olares-instrumentation"
|
||||||
@@ -254,6 +267,18 @@ spec:
|
|||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /www
|
- mountPath: /www
|
||||||
name: www-dir
|
name: www-dir
|
||||||
|
- name: studio-init
|
||||||
|
image: beclab/devbox:v0.1.39
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
mkdir -p /www/studio
|
||||||
|
cp -r /app/* /www/studio
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /www
|
||||||
|
name: www-dir
|
||||||
containers:
|
containers:
|
||||||
- name: terminus-envoy-sidecar
|
- name: terminus-envoy-sidecar
|
||||||
image: bytetrade/envoy:v1.25.11
|
image: bytetrade/envoy:v1.25.11
|
||||||
@@ -326,6 +351,9 @@ spec:
|
|||||||
- name: system-frontend-nginx-config
|
- name: system-frontend-nginx-config
|
||||||
mountPath: /etc/nginx/conf.d/settings.conf
|
mountPath: /etc/nginx/conf.d/settings.conf
|
||||||
subPath: settings.conf
|
subPath: settings.conf
|
||||||
|
- name: system-frontend-nginx-config
|
||||||
|
mountPath: /etc/nginx/conf.d/studio.conf
|
||||||
|
subPath: studio.conf
|
||||||
env:
|
env:
|
||||||
- name: POD_UID
|
- name: POD_UID
|
||||||
valueFrom:
|
valueFrom:
|
||||||
@@ -428,6 +456,8 @@ spec:
|
|||||||
path: headscale.conf
|
path: headscale.conf
|
||||||
- key: settings.conf
|
- key: settings.conf
|
||||||
path: settings.conf
|
path: settings.conf
|
||||||
|
- key: studio.conf
|
||||||
|
path: studio.conf
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -483,6 +513,35 @@ status:
|
|||||||
---
|
---
|
||||||
apiVersion: sys.bytetrade.io/v1alpha1
|
apiVersion: sys.bytetrade.io/v1alpha1
|
||||||
kind: ApplicationPermission
|
kind: ApplicationPermission
|
||||||
|
metadata:
|
||||||
|
name: studio
|
||||||
|
namespace: user-system-{{ .Values.bfl.username }}
|
||||||
|
spec:
|
||||||
|
app: studio
|
||||||
|
appid: studio
|
||||||
|
key: {{ .Values.os.studio.appKey }}
|
||||||
|
secret: {{ .Values.os.studio.appSecret }}
|
||||||
|
permissions:
|
||||||
|
- dataType: app
|
||||||
|
group: service.appstore
|
||||||
|
ops:
|
||||||
|
- InstallDevApp
|
||||||
|
- UninstallDevApp
|
||||||
|
version: v1
|
||||||
|
- dataType: legacy_api
|
||||||
|
group: api.intent
|
||||||
|
appName: desktop
|
||||||
|
svc: edge-desktop
|
||||||
|
namespace: user-space
|
||||||
|
port: 80
|
||||||
|
ops:
|
||||||
|
- POST
|
||||||
|
version: v2
|
||||||
|
status:
|
||||||
|
state: active
|
||||||
|
---
|
||||||
|
apiVersion: sys.bytetrade.io/v1alpha1
|
||||||
|
kind: ApplicationPermission
|
||||||
metadata:
|
metadata:
|
||||||
name: settings
|
name: settings
|
||||||
namespace: user-system-{{ .Values.bfl.username }}
|
namespace: user-system-{{ .Values.bfl.username }}
|
||||||
@@ -1326,3 +1385,32 @@ data:
|
|||||||
add_header Cache-Control "public, max-age=2678400";
|
add_header Cache-Control "public, max-age=2678400";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
studio.conf: |-
|
||||||
|
server {
|
||||||
|
listen 87;
|
||||||
|
# Gzip Settings
|
||||||
|
gzip off;
|
||||||
|
gzip_disable "msie6";
|
||||||
|
gzip_min_length 1k;
|
||||||
|
gzip_buffers 16 64k;
|
||||||
|
gzip_http_version 1.1;
|
||||||
|
gzip_comp_level 6;
|
||||||
|
gzip_types *;
|
||||||
|
root /www/studio;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
add_header Cache-Control "no-store";
|
||||||
|
try_files $uri $uri/index.html /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://studio-server:8080;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-real-ip $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection '$connection_upgrade';
|
||||||
|
proxy_read_timeout 180;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -163,9 +163,9 @@ spec:
|
|||||||
- name: KS_APISERVER_SERVICE_PORT
|
- name: KS_APISERVER_SERVICE_PORT
|
||||||
value: '80'
|
value: '80'
|
||||||
- name: REQUIRE_PERMISSION_APPS
|
- name: REQUIRE_PERMISSION_APPS
|
||||||
value: "vault,desktop,message,wise,search,appstore,notification,dashboard,settings,devbox,profile"
|
value: "vault,desktop,message,wise,search,appstore,notification,dashboard,settings,studio,profile"
|
||||||
- name: SYS_APPS
|
- name: SYS_APPS
|
||||||
value: "analytics,market,auth,citus,desktop,did,docs,files,fsnotify,headscale,infisical,intentprovider,ksserver,message,mongo,monitoring,notifications,profile,redis,wise,recommend,seafile,search,search-admin,settings,systemserver,tapr,vault,video,zinc,accounts,control-hub,dashboard,nitro,system-frontend"
|
value: "analytics,market,auth,citus,desktop,did,docs,files,fsnotify,headscale,infisical,intentprovider,ksserver,message,mongo,monitoring,notifications,profile,redis,wise,recommend,seafile,search,search-admin,settings,systemserver,tapr,vault,video,zinc,accounts,control-hub,dashboard,nitro,system-frontend,studio"
|
||||||
- name: GENERATED_APPS
|
- name: GENERATED_APPS
|
||||||
value: "citus,mongo-cluster-cfg,mongo-cluster-mongos,mongo-cluster-rs0,frp-agent,l4-bfl-proxy,drc-redis-cluster,appdata-backend,argoworkflows,argoworkflow-workflow-controller,velero,kvrocks"
|
value: "citus,mongo-cluster-cfg,mongo-cluster-mongos,mongo-cluster-rs0,frp-agent,l4-bfl-proxy,drc-redis-cluster,appdata-backend,argoworkflows,argoworkflow-workflow-controller,velero,kvrocks"
|
||||||
- name: WS_CONTAINER_IMAGE
|
- name: WS_CONTAINER_IMAGE
|
||||||
|
|||||||
Reference in New Issue
Block a user