Skip to content

Commit 331e85f

Browse files
authored
Merge pull request #2254 from codalab/develop
Merge Develop into Master (v1.25)
2 parents 62b37a0 + 837042f commit 331e85f

File tree

79 files changed

+2418
-1491
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2418
-1491
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969

7070
- run:
7171
name: "Tests: Run unit/integration tests (excluding e2e)"
72-
command: docker compose exec django py.test src/ -m "not e2e"
72+
command: docker compose exec django py.test src/
7373

7474
# We give the name of the test files manually because we need test_auth.py to be run before the others for state.json file to be created
7575
# CI="true" to skip some tests that fail in the CI for now

.env_circleci

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
SECRET_KEY=change-this-secret
2-
31
DB_HOST=db
42
DB_NAME=postgres
53
DB_USERNAME=postgres
@@ -35,4 +33,4 @@ DJANGO_SUPERUSER_EMAIL=test@test.com
3533
DJANGO_SUPERUSER_USERNAME=codabench
3634
DOMAIN_NAME=localhost:80
3735
TLS_EMAIL=your@email.com
38-
SUBMISSIONS_API_URL=http://django:8000/api
36+
SUBMISSIONS_API_URL=http://django:8000/api

.env_sample

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
SECRET_KEY=change-this-secret
2-
31
# For local setup and debug
4-
DEBUG=True
2+
DEBUG=False
53

64
# Database
75
DB_HOST=db
@@ -71,7 +69,7 @@ AWS_STORAGE_PRIVATE_BUCKET_NAME=private
7169
AWS_S3_ENDPOINT_URL=http://minio:9000/
7270
AWS_QUERYSTRING_AUTH=False
7371
# Optional URL rewriting in compute worker, format: FROM | TO
74-
#WORKER_BUNDLE_URL_REWRITE=http://localhost:9000|http://minio:9000
72+
#WORKER_BUNDLE_URL_REWRITE=http://localhost:9000/|http://minio:9000/
7573

7674

7775
# -----------------------------------------------------------------------------

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ src/static/generated/*
2424
db.sqlite3
2525

2626
celerybeat-schedule
27+
celerybeat-schedule-shm
28+
celerybeat-schedule-wal
2729
celerybeat-schedule.db
2830
package-lock.json
2931
artifacts/
@@ -44,3 +46,4 @@ caddy_data/
4446
home_page_counters.json
4547
my-postgres.conf
4648
tests/config/state.json
49+

charts/Chart.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apiVersion: v2
2+
name: codabench-chart
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "1.16.0"
25+
26+
dependencies:
27+
- name: rabbitmq
28+
version: "14.7.0"
29+
repository: "oci://registry-1.docker.io/bitnamicharts"
30+
condition: rabbitmq.enabled
31+
- name: redis
32+
version: "19.5.4"
33+
repository: "oci://registry-1.docker.io/bitnamicharts"
34+
condition: redis.enabled
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: PersistentVolumeClaim
3+
metadata:
4+
name: {{ .Values.appState.pvcName }}
5+
spec:
6+
accessModes:
7+
- ReadWriteMany
8+
resources:
9+
requests:
10+
storage: {{ .Values.appState.storage }}
11+
storageClassName: {{ .Values.appState.storageClass }}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{{- range .Values.compute_worker.brokers }}
2+
{{- $isDefault := eq .name "default" }}
3+
---
4+
apiVersion: apps/v1
5+
kind: Deployment
6+
metadata:
7+
name: compute-worker{{ if not $isDefault }}-{{ .name }}{{ end }}
8+
labels:
9+
app: compute-worker
10+
spec:
11+
replicas: 1
12+
selector:
13+
matchLabels:
14+
app: compute-worker
15+
template:
16+
metadata:
17+
labels:
18+
app: compute-worker
19+
spec:
20+
serviceAccountName: compute-worker-sa
21+
containers:
22+
- name: compute-worker
23+
image: "{{ $.Values.compute_worker.image.repository }}:{{ $.Values.compute_worker.image.tag }}"
24+
imagePullPolicy: {{ $.Values.compute_worker.image.pullPolicy | default "IfNotPresent" }}
25+
command:
26+
- bash
27+
- -c
28+
- >
29+
watchmedo auto-restart -p '*.py' --recursive -- celery -A compute_worker worker -l info -Q compute-worker -n compute-worker{{ if not $isDefault }}-{{ .name }}{{ end }}@%n
30+
workingDir: /app
31+
env:
32+
- name: BROKER_URL
33+
value: "{{ if .url }}{{ .url }}{{ else }}pyamqp://{{ $.Values.env.RABBITMQ_DEFAULT_USER }}:{{ $.Values.env.RABBITMQ_DEFAULT_PASS }}@{{ $.Values.env.RABBITMQ_HOST }}:{{ $.Values.env.RABBITMQ_PORT }}//{{ end }}"
34+
- name: CODALAB_IGNORE_CLEANUP_STEP
35+
value: "1"
36+
{{- range $key, $value := $.Values.env }}
37+
- name: {{ $key }}
38+
value: "{{ $value }}"
39+
{{- end }}
40+
resources:
41+
{{- toYaml $.Values.compute_worker.resources | nindent 12 }}
42+
volumeMounts:
43+
- name: docker-socket
44+
mountPath: /var/run/docker.sock
45+
- name: codabench-storage
46+
mountPath: /codabench
47+
volumes:
48+
- name: docker-socket
49+
hostPath:
50+
path: /var/run/docker.sock
51+
type: Socket
52+
- name: codabench-storage
53+
persistentVolumeClaim:
54+
claimName: {{ $.Values.compute_worker.volumes.pvcName }}
55+
{{- end }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: compute-worker-sa
5+
namespace: {{ .Release.Namespace }}
6+
---
7+
apiVersion: rbac.authorization.k8s.io/v1
8+
kind: Role
9+
metadata:
10+
name: compute-worker-role
11+
namespace: {{ .Release.Namespace }}
12+
rules:
13+
- apiGroups: ["batch"]
14+
resources: ["jobs"]
15+
verbs: ["create", "get", "list", "watch", "delete"]
16+
- apiGroups: [""]
17+
resources: ["pods"]
18+
verbs: ["get", "list", "watch", "delete"]
19+
- apiGroups: [""]
20+
resources: ["pods/exec", "pods/log"]
21+
verbs: ["create", "get", "list"]
22+
---
23+
apiVersion: rbac.authorization.k8s.io/v1
24+
kind: RoleBinding
25+
metadata:
26+
name: compute-worker-bind
27+
namespace: {{ .Release.Namespace }}
28+
subjects:
29+
- kind: ServiceAccount
30+
name: compute-worker-sa
31+
namespace: {{ .Release.Namespace }}
32+
roleRef:
33+
kind: Role
34+
name: compute-worker-role
35+
apiGroup: rbac.authorization.k8s.io
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: django
5+
spec:
6+
replicas: {{ .Values.django.replicas }}
7+
selector:
8+
matchLabels:
9+
app: django
10+
template:
11+
metadata:
12+
labels:
13+
app: django
14+
spec:
15+
containers:
16+
- name: django
17+
image: "{{ .Values.django.image.repository }}:{{ .Values.django.image.tag }}"
18+
imagePullPolicy: {{ .Values.django.image.pullPolicy }}
19+
command:
20+
- bash
21+
- -c
22+
- >
23+
python manage.py migrate --no-input &&
24+
python manage.py collectstatic --no-input &&
25+
cd {{ .Values.django.workingDir }} &&
26+
watchmedo auto-restart -p '*.py' --recursive --
27+
python3 ./gunicorn_run.py
28+
env:
29+
{{- range $key, $value := .Values.env }}
30+
- name: {{ $key }}
31+
value: "{{ $value }}"
32+
{{- end }}
33+
- name: DATABASE_URL
34+
value: "postgres://{{ .Values.db.username }}:{{ .Values.db.password }}@{{ .Values.db.host }}:{{ .Values.db.port }}/{{ .Values.db.name }}"
35+
volumeMounts:
36+
- name: app-state
37+
mountPath: /app/app-state
38+
volumes:
39+
- name: app-state
40+
persistentVolumeClaim:
41+
claimName: {{ .Values.appState.pvcName }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: django
5+
spec:
6+
selector:
7+
app: django
8+
ports:
9+
- protocol: TCP
10+
port: 8000
11+
targetPort: 8000
12+

0 commit comments

Comments
 (0)