Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: update postgres embeding (#804)
Danny Xud128148fa9c8
diff --git a/Dockerfile b/Dockerfileindex 998bd7596c..d466bb57ba 100644--- a/Dockerfile+++ b/Dockerfile@@ -20,7 +20,6 @@ RUN yarn release-dockerFROM golang:1.16.5-alpine3.13 as backend-ARG MODE="release"ARG VERSION="development"ARG GO_VERSION="1.16.5"ARG GIT_COMMIT="unknown"@@ -40,7 +39,7 @@ COPY --from=frontend /frontend-build/dist ./server/dist# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug information# go-sqlite3 requires CGO_ENABLEDRUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \- --tags ${MODE} \+ --tags "release alpine" \-ldflags="-w -s -X 'github.com/bytebase/bytebase/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/bin/server/cmd.goversion=${GO_VERSION}' -X 'github.com/bytebase/bytebase/bin/server/cmd.gitcommit=${GIT_COMMIT}' -X 'github.com/bytebase/bytebase/bin/server/cmd.buildtime=${BUILD_TIME}' -X 'github.com/bytebase/bytebase/bin/server/cmd.builduser=${BUILD_USER}'" \-o bytebase \./bin/server/main.godiff --git a/Dockerfile.render b/Dockerfile.renderindex 2d81031057..52f99f34d1 100644--- a/Dockerfile.render+++ b/Dockerfile.render@@ -17,7 +17,6 @@ RUN yarn release-dockerFROM golang:1.16.5-alpine3.13 as backend-ARG MODE="release"ARG VERSION="development"ARG GO_VERSION="unknown"ARG RENDER_GIT_COMMIT="unknown"@@ -40,7 +39,7 @@ COPY ./scripts .# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug information# go-sqlite3 requires CGO_ENABLEDRUN STAGING_VERSION=`cat ./VERSION`-${RENDER_GIT_COMMIT:0:5} && CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \- --tags ${MODE} \+ --tags "release alpine" \-ldflags="-w -s -X 'github.com/bytebase/bytebase/bin/server/cmd.version=${STAGING_VERSION}' -X 'github.com/bytebase/bytebase/bin/server/cmd.goversion=${GO_VERSION}' -X 'github.com/bytebase/bytebase/bin/server/cmd.gitcommit=${RENDER_GIT_COMMIT}' -X 'github.com/bytebase/bytebase/bin/server/cmd.buildtime=${BUILD_TIME}' -X 'github.com/bytebase/bytebase/bin/server/cmd.builduser=${BUILD_USER}'" \-o bytebase \./bin/server/main.go;diff --git a/resources/postgres/postgres.go b/resources/postgres/postgres.goindex 35f5c0737e..344669ca5d 100644--- a/resources/postgres/postgres.go+++ b/resources/postgres/postgres.go@@ -150,6 +150,10 @@ func initDB(pgBinDir, pgDataDir, pgUser string) error {}initDBBinary := filepath.Join(pgBinDir, "bin", "initdb")p := exec.Command(initDBBinary, args...)+ p.Env = append(os.Environ(),+ "LC_ALL=en_US.UTF-8",+ "LC_CTYPE=en_US.UTF-8",+ )p.Stderr = os.Stderrp.Stdout = os.Stdoutdiff --git a/resources/postgres/resources_release.go b/resources/postgres/resources_alpine.gosimilarity index 74%rename from resources/postgres/resources_release.gorename to resources/postgres/resources_alpine.goindex bddd7c53f9..cbbabfe856 100644--- a/resources/postgres/resources_release.go+++ b/resources/postgres/resources_alpine.go@@ -1,5 +1,5 @@-//go:build release-// +build release+//go:build alpine+// +build alpinepackage postgresdiff --git a/resources/postgres/resources_darwin.go b/resources/postgres/resources_darwin.gonew file mode 100644index 0000000000..2c001c3f17--- /dev/null+++ b/resources/postgres/resources_darwin.go@@ -0,0 +1,9 @@+//go:build darwin+// +build darwin++package postgres++import "embed"++//go:embed postgres-darwin-x86_64.txz+var resources embed.FSdiff --git a/resources/postgres/resources_dev.go b/resources/postgres/resources_dev.godeleted file mode 100644index 15cd94f9f7..0000000000--- a/resources/postgres/resources_dev.go+++ /dev/null@@ -1,9 +0,0 @@-//go:build !release-// +build !release--package postgres--import "embed"--//go:embed postgres-darwin-x86_64.txz postgres-linux-x86_64-alpine_linux.txz postgres-linux-x86_64.txz-var resources embed.FSdiff --git a/resources/postgres/resources_linux.go b/resources/postgres/resources_linux.gonew file mode 100644index 0000000000..5d56016085--- /dev/null+++ b/resources/postgres/resources_linux.go@@ -0,0 +1,9 @@+//go:build linux+// +build linux++package postgres++import "embed"++//go:embed postgres-linux-x86_64.txz+var resources embed.FSdiff --git a/scripts/.air.toml b/scripts/.air.tomlindex dcf6f31a8e..4f345c3477 100644--- a/scripts/.air.toml+++ b/scripts/.air.toml@@ -3,7 +3,7 @@ tmp_dir = ".air"[build]bin = "./.air/bytebase --port 8080 --frontend-port 3000 --data ."- cmd = "go build -o ./.air/bytebase ./bin/server/main.go"+ cmd = "go build --tags \"darwin\" -o ./.air/bytebase ./bin/server/main.go"delay = 1000exclude_dir = [".air", "vendor", "frontend", "docs"]exclude_file = []diff --git a/scripts/.air_debug.toml b/scripts/.air_debug.tomlindex c3fd284855..ecd8f8afe1 100644--- a/scripts/.air_debug.toml+++ b/scripts/.air_debug.toml@@ -3,7 +3,7 @@ tmp_dir = ".air"[build]bin = "./.air/bytebase --port 8080 --frontend-port 3000 --debug --data ."- cmd = "go build --tags \"sqlite_trace\" -o ./.air/bytebase ./bin/server/main.go"+ cmd = "go build --tags \"darwin\" -o ./.air/bytebase ./bin/server/main.go"delay = 1000exclude_dir = [".air", "vendor", "frontend", "docs"]exclude_file = []diff --git a/scripts/.air_demo.toml b/scripts/.air_demo.tomlindex 628d5415c2..ca94cc62be 100644--- a/scripts/.air_demo.toml+++ b/scripts/.air_demo.toml@@ -3,7 +3,7 @@ tmp_dir = ".air"[build]bin = "./.air/bytebase --demo --port 8080 --frontend-port 3000 --data ."- cmd = "go build -o ./.air/bytebase ./bin/server/main.go"+ cmd = "go build --tags \"darwin\" -o ./.air/bytebase ./bin/server/main.go"delay = 1000exclude_dir = [".air", "vendor", "frontend", "docs"]exclude_file = []diff --git a/scripts/build.sh b/scripts/build.shindex 2566f0f8b8..9395e2ab1f 100755--- a/scripts/build.sh+++ b/scripts/build.sh@@ -66,7 +66,7 @@ flags="-X 'github.com/bytebase/bytebase/bin/server/cmd.version=${VERSION}'-X 'github.com/bytebase/bytebase/bin/server/cmd.builduser=$(id -u -n)'"# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug information-go build --tags "release" -ldflags "-w -s $flags" -o ${OUTPUT_BINARY} ./bin/server/main.go+go build --tags "release linux" -ldflags "-w -s $flags" -o ${OUTPUT_BINARY} ./bin/server/main.goecho "Completed building bytebase backend."