From 8440bc4877f93b29f77d4e66c1d66ee43c038033 Mon Sep 17 00:00:00 2001 From: everpcpc Date: Wed, 25 Jan 2023 11:21:18 +0800 Subject: [PATCH] fix: log detailed error for bucket checking --- Dockerfile | 8 ++++---- common/runtime/init.go | 4 ++-- storage/datastore/ds_s3/s3_store.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index e7c4939e..e209d470 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,10 +14,6 @@ RUN ./build.sh # Final runtime stage. FROM alpine -RUN mkdir /plugins -COPY --from=builder /opt/bin/plugin_antispam_ocr /plugins/ -COPY --from=builder /opt/bin/media_repo /opt/bin/import_synapse /opt/bin/export_synapse_for_import /opt/bin/gdpr_export /opt/bin/gdpr_import /opt/bin/s3_consistency_check /usr/local/bin/ - RUN apk add --no-cache \ su-exec \ ca-certificates \ @@ -25,6 +21,10 @@ RUN apk add --no-cache \ imagemagick \ ffmpeg +RUN mkdir /plugins +COPY --from=builder /opt/bin/plugin_antispam_ocr /plugins/ +COPY --from=builder /opt/bin/media_repo /opt/bin/import_synapse /opt/bin/export_synapse_for_import /opt/bin/gdpr_export /opt/bin/gdpr_import /opt/bin/s3_consistency_check /usr/local/bin/ + COPY ./config.sample.yaml /etc/media-repo.yaml.sample COPY ./docker/run.sh /usr/local/bin/ RUN dos2unix /usr/local/bin/run.sh diff --git a/common/runtime/init.go b/common/runtime/init.go index 4d6a1c52..e4765540 100644 --- a/common/runtime/init.go +++ b/common/runtime/init.go @@ -2,8 +2,8 @@ package runtime import ( "fmt" - "github.com/getsentry/sentry-go" + "github.com/getsentry/sentry-go" "github.com/sirupsen/logrus" "github.com/turt2live/matrix-media-repo/common/config" "github.com/turt2live/matrix-media-repo/common/rcontext" @@ -73,7 +73,7 @@ func LoadDatastores() { err = s3.EnsureBucketExists() if err != nil { - logrus.Warn("\t\tBucket does not exist!") + logrus.Warn("\t\tBucket does not exist!", err) } err = s3.EnsureTempPathExists() diff --git a/storage/datastore/ds_s3/s3_store.go b/storage/datastore/ds_s3/s3_store.go index f80abcba..21031757 100644 --- a/storage/datastore/ds_s3/s3_store.go +++ b/storage/datastore/ds_s3/s3_store.go @@ -131,7 +131,7 @@ func ParseS3URL(s3url string) (string, string, string, error) { func (s *s3Datastore) EnsureBucketExists() error { found, err := s.client.BucketExists(s.ctx, s.bucket) if err != nil { - return err + return errors.New("error checking if bucket exists: " + err.Error()) } if !found { return errors.New("bucket not found")