Skip to content

Commit

Permalink
Cleanup fs-storage (#1829)
Browse files Browse the repository at this point in the history
  • Loading branch information
nulls authored Feb 6, 2023
1 parent c2fd444 commit f3a8e92
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 93 deletions.
2 changes: 1 addition & 1 deletion docker-compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
- '/home/saveu/configs/TestSuitesToken:/workspace/BOOT-INF/classes/TestSuitesToken'
command: [
"-c",
'mkdir -p /home/cnb/files/ && mkdir -p /home/cnb/config && mkdir -p /home/cnb/certificates &&
'mkdir -p /home/cnb/config && mkdir -p /home/cnb/certificates &&
for cert in /home/cnb/certificates/*; do
find /layers -name jre -type d -exec {}/bin/keytool -keystore {}/lib/security/cacerts -storepass changeit -noprompt -trustcacerts -importcert -alias $${cert%.*} -file $$cert \;
; done && /cnb/process/web'
Expand Down
4 changes: 0 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ services:
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- /home/saveu/configs/sandbox:/home/cnb/config
- save-fs-storage:/home/cnb/files
- save-tmp-resources:/tmp
extra_hosts:
- "host.docker.internal:host-gateway"
Expand All @@ -62,7 +61,6 @@ services:
- db_username
- db_password
volumes:
- save-fs-storage:/home/cnb/files
- /home/saveu/configs/backend:/home/cnb/config
ports:
- "5800:5800"
Expand All @@ -82,7 +80,6 @@ services:
- "SPRING_PROFILES_ACTIVE=${PROFILE}"
volumes:
- save:/home/cnb/
- save-fs-storage:/home/cnb/files
- /home/saveu/configs/preprocessor:/home/cnb/config
ports:
- "5200:5200"
Expand Down Expand Up @@ -179,7 +176,6 @@ networks:

volumes:
save:
save-fs-storage:
grafana-storage:
prometheus-storage:
loki-storage:
Expand Down
41 changes: 1 addition & 40 deletions save-backend/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform

import org.gradle.testing.jacoco.plugins.JacocoTaskExtension

import java.nio.file.Files.isDirectory
import java.nio.file.Paths
import org.gradle.testing.jacoco.plugins.JacocoTaskExtension

plugins {
id("com.saveourtool.save.buildutils.kotlin-jvm-configuration")
Expand Down Expand Up @@ -38,42 +35,6 @@ tasks.register<Copy>("copyLiquibase") {
into("$buildDir/resources/test/db")
}

tasks.register<Exec>("cleanupDbAndStorage") {
dependsOn(":liquibaseDropAll")
val profile = properties["save.profile"] as String?

val userHome = System.getProperty("user.home")
val isWindows = DefaultNativePlatform.getCurrentOperatingSystem().isWindows

val storagePath = when (profile) {
"win" -> "$userHome/.save-cloud/cnb/files"
"mac" -> "/Users/Shared/.save-cloud/cnb/files"
else -> when {
isWindows -> "$userHome/.save-cloud/cnb/files"
else -> "/home/cnb/files"
}
}.let(Paths::get)

/*
* No idea why we should rely on running external commands in order to
* delete a directory, since this can be done in a platform-independent way.
*/
val args = if (profile != "win" && !isWindows) {
arrayOf("rm", "-rf")
} else if (isDirectory(storagePath)) {
/*
* cmd.exe will set a non-zero exit status if the directory doesn't exist.
*/
arrayOf("cmd", "/c", "rmdir", "/s", "/q")
} else {
/*
* Run a dummy command.
*/
arrayOf("cmd", "/c", "echo")
}
commandLine(*args, storagePath)
}

dependencies {
implementation(projects.saveCloudCommon)
implementation(projects.authenticationService)
Expand Down
7 changes: 0 additions & 7 deletions save-cloud-charts/save-cloud/templates/_constants.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
{{- define "backend.constants.storage" -}}
/home/cnb/files
{{- end }}

{{- define "demo.constants.storage" -}}
/home/cnb/files
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ spec:
value: -XX:ReservedCodeCacheSize=48M
volumeMounts:
- {{ include "spring-boot.config-volume-mount" . | indent 14 | trim }}
- name: fs-storage
mountPath: {{ include "backend.constants.storage" . }}
- name: database-secret
mountPath: {{ .Values.mysql.dbPasswordFile }}
- name: s3-secrets
Expand Down Expand Up @@ -105,9 +103,6 @@ spec:
{{ end }}
volumes:
- {{ include "spring-boot.config-volume" (dict "service" .Values.backend) | indent 10 | trim }}
- name: fs-storage
persistentVolumeClaim:
claimName: {{ .Values.backend.name }}-fs-storage
- name: database-secret
secret:
secretName: db-secrets
Expand Down
1 change: 0 additions & 1 deletion save-cloud-charts/save-cloud/templates/demo-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: {{ .Values.demo.name }}-config
data:
application.properties: |
demo.file-storage.location={{ include "demo.constants.storage" . }}
management.endpoints.web.exposure.include=*
management.server.port={{ .Values.demo.managementPort }}
logging.level.org.springframework=DEBUG
Expand Down
5 changes: 0 additions & 5 deletions save-cloud-charts/save-cloud/templates/demo-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ spec:
value: -XX:ReservedCodeCacheSize=48M
volumeMounts:
- {{ include "spring-boot.config-volume-mount" . | indent 14 | trim }}
- name: fs-storage
mountPath: {{ include "demo.constants.storage" . }}
- name: database-secret
mountPath: {{ .Values.mysql.dbPasswordFile }}
- name: s3-secrets
Expand Down Expand Up @@ -102,9 +100,6 @@ spec:
name: database-secret
volumes:
- {{ include "spring-boot.config-volume" (dict "service" .Values.demo) | indent 10 | trim }}
- name: fs-storage
persistentVolumeClaim:
claimName: {{ .Values.demo.name }}-fs-storage
- name: database-secret
secret:
secretName: db-secrets
Expand Down
24 changes: 0 additions & 24 deletions save-cloud-charts/save-cloud/templates/fs-storage-pvc.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ spec:
fieldPath: spec.nodeName
volumeMounts:
- {{ include "spring-boot.config-volume-mount" . | indent 14 | trim }}
- name: fs-storage
mountPath: /home/cnb/files
- name: database-secret
mountPath: {{ .Values.mysql.dbPasswordFile }}
- name: s3-secrets
Expand Down Expand Up @@ -124,9 +122,6 @@ spec:
name: database-secret
volumes:
- {{ include "spring-boot.config-volume" (dict "service" .Values.sandbox) | indent 10 | trim }}
- name: fs-storage
persistentVolumeClaim:
claimName: {{ .Values.sandbox.name }}-fs-storage
- name: database-secret
secret:
secretName: db-secrets
Expand Down
1 change: 0 additions & 1 deletion save-demo/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ spring.jpa.properties.hibernate.order_inserts=true
spring.jpa.properties.hibernate.order_updates=true
spring.liquibase.enabled=false
logging.level.org.hibernate.engine.internal.StatisticalLoggingSessionEventListener=WARN
demo.fileStorage.location=/home/cnb/files
demo.backend=http://backend:5800/internal
demo.s3-storage.endpoint=${s3-storage.endpoint}
demo.s3-storage.bucketName=${s3-storage.bucketName}
Expand Down

0 comments on commit f3a8e92

Please sign in to comment.