Skip to content

Commit

Permalink
feat: add download module (#214)
Browse files Browse the repository at this point in the history
* download

* download

* download

* download

* knowledge
  • Loading branch information
kaki-admin authored Jul 13, 2024
1 parent 2b058a8 commit 105d628
Show file tree
Hide file tree
Showing 9 changed files with 292 additions and 3 deletions.
Binary file added apps/download/.DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions apps/download/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# vault

https://github.com/beclab/analytic
Binary file not shown.
Binary file not shown.
23 changes: 23 additions & 0 deletions apps/download/config/user/helm-charts/download/.helmignore
Original file line number Diff line number Diff line change
@@ -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 changes: 26 additions & 0 deletions apps/download/config/user/helm-charts/download/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: v2
name: download
description: A Helm chart for Kubernetes
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.0.1

# 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: "1.16.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
{{- $namespace := printf "%s%s" "user-system-" .Values.bfl.username -}}
{{- $download_secret := (lookup "v1" "Secret" $namespace "rss-secrets") -}}

{{- $pg_password := "" -}}
{{ if $download_secret -}}
{{ $pg_password = (index $download_secret "data" "pg_password") }}
{{ else -}}
{{ $pg_password = randAlphaNum 16 | b64enc }}
{{- end -}}

---
apiVersion: v1
kind: Secret
metadata:
name: download-secrets
namespace: user-system-{{ .Values.bfl.username }}
type: Opaque
data:
pg_password: {{ $pg_password }}
---
apiVersion: apr.bytetrade.io/v1alpha1
kind: MiddlewareRequest
metadata:
name: download-pg
namespace: user-system-{{ .Values.bfl.username }}
spec:
app: download
appNamespace: {{ .Release.Namespace }}
middleware: postgres
postgreSQL:
user: knowledge_{{ .Values.bfl.username }}
password:
valueFrom:
secretKeyRef:
key: pg_password
name: download-secrets
databases:
- name: knowledge


---


apiVersion: apps/v1
kind: Deployment
metadata:
name: download
namespace: {{ .Release.Namespace }}
labels:
app: download
applications.app.bytetrade.io/author: bytetrade.io
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: download
template:
metadata:
labels:
app: download
spec:
containers:
- name: aria2
image: "cesign/aria2-pro"
imagePullPolicy: IfNotPresent
ports:
- containerPort: 6800
- containerPort: 6888
env:
- name: RPC_SECRET
value: kubespider
- name: PUID
value: "0"
- name: PGID
value: "0"
volumeMounts:
- name: config-dir
mountPath: /config
- name: download-dir
mountPath: /downloads
resources:
requests:
cpu: 20m
memory: 50Mi
limits:
cpu: "1"
memory: 300Mi
- name: yt-dlp
image: "beclab/yt-dlp:v0.0.1"
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3082
env:
- name: PG_USERNAME
value: knowledge_{{ .Values.bfl.username }}
- name: PG_PASSWORD
value: {{ $pg_password | b64dec }}
- name: PG_HOST
value: citus-master-svc.user-system-{{ .Values.bfl.username }}
- name: PG_PORT
value: "5432"
- name: PG_DATABASE
value: user_space_{{ .Values.bfl.username }}_knowledge
volumeMounts:
- name: config-dir
mountPath: /app/config
- name: download-dir
mountPath: /app/downloads
resources:
requests:
cpu: 20m
memory: 50Mi
limits:
cpu: "1"
memory: 300Mi

- name: download-spider
image: "beclab/download-spider:v0.0.1"
imagePullPolicy: IfNotPresent
env:
- name: PG_USERNAME
value: knowledge_{{ .Values.bfl.username }}
- name: PG_PASSWORD
value: {{ $pg_password | b64dec }}
- name: PG_HOST
value: citus-master-svc.user-system-{{ .Values.bfl.username }}
- name: PG_PORT
value: "5432"
- name: PG_DATABASE
value: user_space_{{ .Values.bfl.username }}_knowledge

ports:
- containerPort: 3080
resources:
requests:
cpu: 20m
memory: 50Mi
limits:
cpu: "1"
memory: 300Mi

volumes:
- name: config-dir
hostPath:
type: DirectoryOrCreate
path: {{ .Values.userspace.userData }}/Download/config
- name: download-dir
hostPath:
type: DirectoryOrCreate
path: {{ .Values.userspace.userData }}/Download


---
apiVersion: v1
kind: Service
metadata:
name: download-svc
namespace: {{ .Release.Namespace }}
spec:
type: ClusterIP
selector:
app: download
ports:
- name: "download-spider"
protocol: TCP
port: 3080
targetPort: 3080
- name: "aria2-server"
protocol: TCP
port: 6800
targetPort: 6800

---
apiVersion: v1
kind: Service
metadata:
name: download-api
namespace: user-system-{{ .Values.bfl.username }}
spec:
type: ClusterIP
selector:
app: systemserver
ports:
- protocol: TCP
name: download-api
port: 3080
targetPort: 3080


43 changes: 43 additions & 0 deletions apps/download/config/user/helm-charts/download/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

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
wise:
appKey: '${ks[0]}'
appSecret: test
search:
appKey: '${ks[0]}'
appSecret: test
search2:
appKey: '${ks[0]}'
appSecret: test
kubesphere:
redis_password: ""
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ spec:
spec:
containers:
- name: knowledge
image: "beclab/knowledge-base-api:v0.1.31"
image: "beclab/knowledge-base-api:v0.1.32"
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3010
Expand Down Expand Up @@ -136,6 +136,8 @@ spec:
value: "5432"
- name: PG_DATABASE
value: user_space_{{ .Values.bfl.username }}_knowledge
- name: DOWNLOAD_URL
value: http://download-svc.user-system-{{ .Values.bfl.username }}:3080
volumeMounts:
- name: watch-dir
mountPath: /data/Home/Documents
Expand All @@ -149,7 +151,7 @@ spec:
memory: 1Gi

- name: backend-server
image: "beclab/recommend-backend:v0.0.5"
image: "beclab/recommend-backend:v0.0.6"
imagePullPolicy: IfNotPresent
env:
- name: LISTEN_ADDR
Expand Down Expand Up @@ -188,8 +190,9 @@ spec:
value: "5432"
- name: PG_DATABASE
value: user_space_{{ .Values.bfl.username }}_knowledge
- name: DOWNLOAD_API_URL
value: http://download-svc.user-system-{{ .Values.bfl.username }}:3080/api/termius/download


ports:
- containerPort: 8080
resources:
Expand Down

0 comments on commit 105d628

Please sign in to comment.