From 7d7774883393f376d503a6e4e23c3ff6c7e25e9f Mon Sep 17 00:00:00 2001 From: Frank Jogeleit Date: Fri, 3 Mar 2023 11:07:25 +0100 Subject: [PATCH] Tweak SQLite config, enable shared cache and busy_timeout Signed-off-by: Frank Jogeleit --- .github/workflows/image.yaml | 1 + Dockerfile | 4 ++-- pkg/sqlite3/store.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/image.yaml b/.github/workflows/image.yaml index 931eb223..b1b7d532 100644 --- a/.github/workflows/image.yaml +++ b/.github/workflows/image.yaml @@ -3,6 +3,7 @@ on: push: tags: - v* + - dev jobs: push-policy-reporter: diff --git a/Dockerfile b/Dockerfile index 4fd192b4..9948f865 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ RUN go env RUN go get -d -v \ && go install -v -RUN CGO_ENABLED=1 go build -ldflags="${LD_FLAGS}" -o /app/build/policyreporter -v +RUN CGO_ENABLED=1 go build -ldflags="${LD_FLAGS}" -tags="sqlite_unlock_notify" -o /app/build/policyreporter -v FROM scratch LABEL MAINTAINER="Frank Jogeleit " @@ -29,6 +29,6 @@ COPY --from=builder /app/build/policyreporter /app/policyreporter # copy the debian's trusted root CA's to the final image COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt -EXPOSE 2112 +EXPOSE 8080 ENTRYPOINT ["/app/policyreporter", "run"] diff --git a/pkg/sqlite3/store.go b/pkg/sqlite3/store.go index 461dcff9..9535887a 100644 --- a/pkg/sqlite3/store.go +++ b/pkg/sqlite3/store.go @@ -1441,7 +1441,7 @@ func NewDatabase(dbFile string) (*sql.DB, error) { } file.Close() - return sql.Open("sqlite3", dbFile) + return sql.Open("sqlite3", dbFile+"?cache=shared&_busy_timeout=5000") } func chunkSlice(slice []v1alpha2.PolicyReportResult, chunkSize int) [][]v1alpha2.PolicyReportResult {