-
Notifications
You must be signed in to change notification settings - Fork 1
/
jaseci-studio.yaml
170 lines (161 loc) · 3.89 KB
/
jaseci-studio.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
apiVersion: v1
kind: Service
metadata:
name: jaseci-studio-app
spec:
selector:
pod: jaseci-studio-app
ports:
- protocol: TCP
port: 80
targetPort: 3000
---
apiVersion: v1
kind: ConfigMap
metadata:
name: jaseci-studio-up
namespace: default
data:
prod_up: |-
apk add --update --no-cache git make g++
apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python
python3 -m ensurepip
pip3 install --no-cache --upgrade pip setuptools
git clone https://github.com/Jaseci-Labs/jaseci-webkit.git
cd jaseci-webkit/builder;
git config pull.ff only
git checkout main
yarn add npm-run-all --dev
yarn install
yarn install -D
# create environment file
echo "DATABASE_URL=postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@jaseci-studio-db:5432/postgres" >> .env
echo "SESSION_SECRET=somevalue" >> .env
export DATABASE_URL=postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@jaseci-studio-db:5432/postgres
export SESSION_SECRET=somevalue
yarn prisma migrate deploy
# set up cronjob to update every hour
crontab /jaseci-webkit/cronjob
/usr/sbin/crond
# build and start the app
yarn build
yarn start
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: jaseci-studio-app
spec:
replicas: 1
selector:
matchLabels:
pod: jaseci-studio-app
template:
metadata:
labels:
pod: jaseci-studio-app
name: jaseci-studio-app
spec:
containers:
- name: jaseci-studio-app
image: node:16-alpine
imagePullPolicy: IfNotPresent
command: [sh, -c, "source script/prod_up"]
ports:
- containerPort: 3000
env:
- name: POSTGRES_USERNAME
valueFrom:
secretKeyRef:
name: postgres-config
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-config
key: password
- name: POSTGRES_HOST
value: jaseci-studio-db
- name: POSTGRES_PORT
value: "5432"
- name: NODE_ENV
value: production
volumeMounts:
- name: prod-script
mountPath: /script
volumes:
- name: prod-script
configMap:
name: jaseci-studio-up
---
kind: Service
apiVersion: v1
metadata:
name: jaseci-studio-db
spec:
selector:
pod: jaseci-studio-db
ports:
- protocol: TCP
port: 5432
targetPort: 5432
---
apiVersion: v1
kind: Secret
metadata:
name: postgres-config
type: Opaque
data:
username: cG9zdGdyZXM=
password: UHIwZE4xbmo0
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: jaseci-studio-db-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: jaseci-studio-db
spec:
replicas: 1
selector:
matchLabels:
pod: jaseci-studio-db
template:
metadata:
labels:
pod: jaseci-studio-db
spec:
containers:
- name: jaseci-studio-db
image: postgres:alpine
imagePullPolicy: IfNotPresent
env:
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: postgres-config
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-config
key: password
ports:
- containerPort: 5432
volumeMounts:
- name: jaseci-studio-db-volume
mountPath: /var/lib/postgresql/data
subPath: jaseci
volumes:
- name: jaseci-studio-db-volume
persistentVolumeClaim:
claimName: jaseci-studio-db-pvc