mirror of
https://github.com/getAlby/hub.git
synced 2026-08-13 12:33:39 +02:00
chore: build db_migrate entrypoint (#1348)
* feat: build migrate entrypoint and copy it to final image * fix: db_migrate/main.go path * fix: -o db_migrate * fix: copy db_migrate * fix: add LdkVssEnabled check
This commit is contained in:
parent
9b6e88f1cc
commit
9071bd49b7
2 changed files with 22 additions and 0 deletions
|
|
@ -38,6 +38,9 @@ RUN GOARCH=$(echo "$TARGETPLATFORM" | cut -d'/' -f2) go build \
|
|||
-ldflags="-X 'github.com/getAlby/hub/version.Tag=$TAG'" \
|
||||
-o main cmd/http/main.go
|
||||
|
||||
RUN GOARCH=$(echo "$TARGETPLATFORM" | cut -d'/' -f2) go build \
|
||||
-o db_migrate cmd/db_migrate/main.go
|
||||
|
||||
COPY ./build/docker/copy_dylibs.sh .
|
||||
RUN chmod +x copy_dylibs.sh
|
||||
RUN ./copy_dylibs.sh $(echo "$TARGETPLATFORM" | cut -d'/' -f2)
|
||||
|
|
@ -51,5 +54,6 @@ ENV LD_LIBRARY_PATH=/usr/lib/nwc
|
|||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
COPY --from=builder /build/libldk_node.so /usr/lib/nwc/
|
||||
COPY --from=builder /build/main /bin/
|
||||
COPY --from=builder /build/db_migrate /bin/
|
||||
|
||||
ENTRYPOINT [ "/bin/main" ]
|
||||
|
|
|
|||
|
|
@ -70,6 +70,24 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Check if VSS is enabled in the source database
|
||||
var vssConfig db.UserConfig
|
||||
result := fromDB.Where("key = ?", "LdkVssEnabled").First(&vssConfig)
|
||||
if result.Error != nil {
|
||||
if result.Error == gorm.ErrRecordNotFound {
|
||||
logger.Logger.Error("LdkVssEnabled config not found in source DB. Migration will not proceed.")
|
||||
} else {
|
||||
logger.Logger.WithError(result.Error).Error("failed to query LdkVssEnabled config from source DB")
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if vssConfig.Value != "true" {
|
||||
logger.Logger.Error("VSS is not enabled in the source DB (LdkVssEnabled is not 'true'). Migration will not proceed.")
|
||||
os.Exit(1)
|
||||
}
|
||||
logger.Logger.Info("LdkVssEnabled check passed.")
|
||||
|
||||
logger.Logger.Info("migrating...")
|
||||
err = migrateDB(fromDB, toDB)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue