From 719613ecd406ca161eccf15a8871bd03efd00ff6 Mon Sep 17 00:00:00 2001 From: Andrey Melnikov Date: Thu, 28 Oct 2021 14:44:29 -0700 Subject: [PATCH 1/2] feat: cvat 1.6.0 workspace migration --- db/go/20211028205201_cvat_1_6.go | 26 ++++ db/go/db.go | 1 + .../workspaces/cvat_1_6_0/20211028205201.yaml | 143 ++++++++++++++++++ 3 files changed, 170 insertions(+) create mode 100644 db/go/20211028205201_cvat_1_6.go create mode 100644 db/yaml/workspaces/cvat_1_6_0/20211028205201.yaml diff --git a/db/go/20211028205201_cvat_1_6.go b/db/go/20211028205201_cvat_1_6.go new file mode 100644 index 00000000..8004a742 --- /dev/null +++ b/db/go/20211028205201_cvat_1_6.go @@ -0,0 +1,26 @@ +package migration + +import ( + "database/sql" + "github.com/pressly/goose" + "path/filepath" +) + +func initialize20211028205201() { + if _, ok := initializedMigrations[20211028205201]; !ok { + goose.AddMigration(Up20211028205201, Down20211028205201) + initializedMigrations[20211028205201] = true + } +} + +func Up20211028205201(tx *sql.Tx) error { + // This code is executed when the migration is applied. + return createWorkspaceTemplate( + filepath.Join("workspaces", "cvat_1_6_0", "20211028205201.yaml"), + "CVAT_1.6.0", + "Powerful and efficient Computer Vision Annotation Tool (CVAT)") +} + +func Down20211028205201(tx *sql.Tx) error { + return archiveWorkspaceTemplate("CVAT_1.6.0") +} diff --git a/db/go/db.go b/db/go/db.go index 9d2a0adb..13211952 100644 --- a/db/go/db.go +++ b/db/go/db.go @@ -96,6 +96,7 @@ func Initialize() { initialize20210329194731() initialize20210414165510() initialize20210719190719() + initialize20211028205201() if err := client.DB.Close(); err != nil { log.Printf("[error] closing db %v", err) diff --git a/db/yaml/workspaces/cvat_1_6_0/20211028205201.yaml b/db/yaml/workspaces/cvat_1_6_0/20211028205201.yaml new file mode 100644 index 00000000..0b404f89 --- /dev/null +++ b/db/yaml/workspaces/cvat_1_6_0/20211028205201.yaml @@ -0,0 +1,143 @@ +metadata: + name: CVAT + kind: Workspace + version: 20211028205201 + action: create + description: "Powerful and efficient Computer Vision Annotation Tool (CVAT 1.6.0)" +spec: + containers: + - name: cvat-db + image: postgres:10-alpine + env: + - name: POSTGRES_USER + value: root + - name: POSTGRES_DB + value: cvat + - name: POSTGRES_HOST_AUTH_METHOD + value: trust + - name: PGDATA + value: /var/lib/psql/data + ports: + - containerPort: 5432 + name: tcp + volumeMounts: + - name: db + mountPath: /var/lib/psql + - name: cvat-redis + image: redis:4.0-alpine + ports: + - containerPort: 6379 + name: tcp + - name: cvat + image: onepanel/cvat:v1.0.2_cvat.1.6.0 + env: + - name: DJANGO_MODWSGI_EXTRA_ARGS + value: "" + - name: ALLOWED_HOSTS + value: '*' + - name: CVAT_REDIS_HOST + value: localhost + - name: CVAT_POSTGRES_HOST + value: localhost + - name: CVAT_SHARE_URL + value: /cvat/data + - name: CVAT_SHARE_DIR + value: /share + - name: CVAT_DATA_DIR + value: /cvat/data + - name: CVAT_MEDIA_DATA_DIR + value: /cvat/data/data + - name: CVAT_KEYS_DIR + value: /cvat/data/keys + - name: CVAT_MODELS_DIR + value: /cvat/data/models + - name: CVAT_LOGS_DIR + value: /cvat/logs + - name: CVAT_ANNOTATIONS_OBJECT_STORAGE_PREFIX + value: 'artifacts/$(ONEPANEL_RESOURCE_NAMESPACE)/annotations/' + - name: CVAT_ONEPANEL_WORKFLOWS_LABEL + value: 'key=used-by,value=cvat' + - name: NVIDIA_VISIBLE_DEVICES + value: all + - name: NVIDIA_DRIVER_CAPABILITIES + value: compute,utility + - name: NVIDIA_REQUIRE_CUDA + value: "cuda>=10.0 brand=tesla,driver>=384,driver<385 brand=tesla,driver>=410,driver<411" + - name: ONEPANEL_MAIN_CONTAINER + value: 'true' + - name: CVAT_SERVERLESS + value: True + ports: + - containerPort: 8080 + name: http + volumeMounts: + - name: cvat-data + mountPath: /cvat + - name: share + mountPath: /share + - name: sys-namespace-config + mountPath: /etc/onepanel + readOnly: true + - name: cvat-ui + image: onepanel/cvat-ui:v1.0.2_cvat.1.6.0 + ports: + - containerPort: 80 + name: http + - name: sys-filesyncer + image: onepanel/filesyncer:v1.0.0 + imagePullPolicy: Always + args: + - server + - -server-prefix=/sys/filesyncer + volumeMounts: + - name: share + mountPath: /share + - name: sys-namespace-config + mountPath: /etc/onepanel + readOnly: true + ports: + - name: cvat-ui + port: 80 + protocol: TCP + targetPort: 80 + - name: cvat + port: 8080 + protocol: TCP + targetPort: 8080 + - name: fs + port: 8888 + protocol: TCP + targetPort: 8888 + routes: + - match: + - uri: + prefix: /sys/filesyncer + route: + - destination: + port: + number: 8888 + - match: + - uri: + regex: \/?api.*|\/?git.*|\/?tensorflow.*|\/?onepanelio.*|\/?tracking.*|\/?auto_annotation.*|\/?analytics.*|\/?static.*|\/?admin.*|\/?documentation.*|\/?dextr.*|\/?reid.*|\/?django-rq.* + - queryParams: + id: + regex: \d+.* + route: + - destination: + port: + number: 8080 + - match: + - uri: + prefix: / + route: + - destination: + port: + number: 80 + volumeClaimTemplates: + - metadata: + name: db + spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: 20Gi \ No newline at end of file From 4d1aff5c5be72deeae12a26a1ef0fa7f2f2f0755 Mon Sep 17 00:00:00 2001 From: Andrey Melnikov Date: Thu, 28 Oct 2021 14:45:55 -0700 Subject: [PATCH 2/2] fix: method comments --- db/go/20211028205201_cvat_1_6.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/go/20211028205201_cvat_1_6.go b/db/go/20211028205201_cvat_1_6.go index 8004a742..a06d9ffb 100644 --- a/db/go/20211028205201_cvat_1_6.go +++ b/db/go/20211028205201_cvat_1_6.go @@ -13,6 +13,7 @@ func initialize20211028205201() { } } +// Up20211028205201 creates the new cvat 1.6.0 workspace template func Up20211028205201(tx *sql.Tx) error { // This code is executed when the migration is applied. return createWorkspaceTemplate( @@ -21,6 +22,7 @@ func Up20211028205201(tx *sql.Tx) error { "Powerful and efficient Computer Vision Annotation Tool (CVAT)") } +// Down20211028205201 archives the new cvat 1.6.0 workspace template func Down20211028205201(tx *sql.Tx) error { return archiveWorkspaceTemplate("CVAT_1.6.0") }