diff --git a/.goreleaser.yml b/.goreleaser.yml index 6affac7..02578c7 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -112,141 +112,51 @@ changelog: - title: Others order: 999 -dockers: - - dockerfile: cmd/pgconfigctl/Dockerfile - id: pgconfigctl-amd64 - ids: - - pgconfigctl - goarch: amd64 - image_templates: - - "docker.io/pgconfig/pgconfigctl:amd64-v{{ .Commit }}" - - "ghcr.io/pgconfig/pgconfigctl:amd64-v{{ .Commit }}" - - build_flag_templates: - - "--label=org.opencontainers.image.created={{.Date}}" - - "--label=org.opencontainers.image.title=pgconfig-{{.ProjectName}}" - - "--label=org.opencontainers.image.website=pgconfig.org" - - "--label=org.opencontainers.image.revision={{.FullCommit}}" - - "--label=org.opencontainers.image.version={{.Version}}" - - "--platform=linux/amd64" - - dockerfile: cmd/pgconfigctl/Dockerfile - id: pgconfigctl-arm64 +dockers_v2: + - id: pgconfigctl ids: - pgconfigctl - goarch: arm64 - image_templates: - - "docker.io/pgconfig/pgconfigctl:arm64-v{{ .Commit }}" - - "ghcr.io/pgconfig/pgconfigctl:arm64-v{{ .Commit }}" - + dockerfile: cmd/pgconfigctl/Dockerfile + use: buildx build_flag_templates: - - "--label=org.opencontainers.image.created={{.Date}}" - - "--label=org.opencontainers.image.title=pgconfig-{{.ProjectName}}" - - "--label=org.opencontainers.image.website=pgconfig.org" - - "--label=org.opencontainers.image.revision={{.FullCommit}}" - - "--label=org.opencontainers.image.version={{.Version}}" - - "--platform=linux/arm64" + - "--platform=linux/amd64,linux/arm64" + images: + - "docker.io/pgconfig/pgconfigctl" + - "ghcr.io/pgconfig/pgconfigctl" + tags: + - "v{{ .Version }}" + - "v{{ .Major }}.{{ .Minor }}" + - "v{{ .Major }}" + - "latest" + labels: + "org.opencontainers.image.created": "{{.Date}}" + "org.opencontainers.image.title": "pgconfig-{{.ProjectName}}" + "org.opencontainers.image.website": "pgconfig.org" + "org.opencontainers.image.revision": "{{.FullCommit}}" + "org.opencontainers.image.version": "{{.Version}}" - - dockerfile: cmd/api/Dockerfile - goarch: arm64 - id: api-arm64 - ids: - - api - image_templates: - - "docker.io/pgconfig/api:arm64-v{{ .Commit }}" - - "ghcr.io/pgconfig/api:arm64-v{{ .Commit }}" - - build_flag_templates: - - "--label=org.opencontainers.image.created={{.Date}}" - - "--label=org.opencontainers.image.title=pgconfig-{{.ProjectName}}" - - "--label=org.opencontainers.image.website=pgconfig.org" - - "--label=org.opencontainers.image.revision={{.FullCommit}}" - - "--label=org.opencontainers.image.version={{.Version}}" - - "--platform=linux/arm64" - - extra_files: - - rules.yml - - pg-docs.yml - - dockerfile: cmd/api/Dockerfile - goarch: amd64 - id: api-amd64 + - id: api ids: - api - image_templates: - - "docker.io/pgconfig/api:amd64-v{{ .Commit }}" - - "ghcr.io/pgconfig/api:amd64-v{{ .Commit }}" - - "registry.heroku.com/{{ .Env.HEROKU_APP_NAME }}/web:latest" + dockerfile: cmd/api/Dockerfile + use: buildx build_flag_templates: - - "--label=org.opencontainers.image.created={{.Date}}" - - "--label=org.opencontainers.image.title=pgconfig-{{.ProjectName}}" - - "--label=org.opencontainers.image.website=pgconfig.org" - - "--label=org.opencontainers.image.revision={{.FullCommit}}" - - "--label=org.opencontainers.image.version={{.Version}}" - - "--platform=linux/amd64" + - "--platform=linux/amd64,linux/arm64" extra_files: - rules.yml - pg-docs.yml -docker_manifests: - - name_template: docker.io/pgconfig/api:v{{ .Tag }} - image_templates: - - "docker.io/pgconfig/api:arm64-v{{ .Commit }}" - - "docker.io/pgconfig/api:amd64-v{{ .Commit }}" - - name_template: "docker.io/pgconfig/api:v{{ .Major }}.{{ .Minor }}" - image_templates: - - "docker.io/pgconfig/api:arm64-v{{ .Commit }}" - - "docker.io/pgconfig/api:amd64-v{{ .Commit }}" - - name_template: "docker.io/pgconfig/api:v{{ .Major }}" - image_templates: - - "docker.io/pgconfig/api:arm64-v{{ .Commit }}" - - "docker.io/pgconfig/api:amd64-v{{ .Commit }}" - - name_template: "docker.io/pgconfig/api:latest" - image_templates: - - "docker.io/pgconfig/api:arm64-v{{ .Commit }}" - - "docker.io/pgconfig/api:amd64-v{{ .Commit }}" - - name_template: "docker.io/pgconfig/pgconfigctl:v{{ .Tag }}" - image_templates: - - "docker.io/pgconfig/pgconfigctl:arm64-v{{ .Commit }}" - - "docker.io/pgconfig/pgconfigctl:amd64-v{{ .Commit }}" - - name_template: "docker.io/pgconfig/pgconfigctl:v{{ .Major }}.{{ .Minor }}" - image_templates: - - "docker.io/pgconfig/pgconfigctl:arm64-v{{ .Commit }}" - - "docker.io/pgconfig/pgconfigctl:amd64-v{{ .Commit }}" - - name_template: "docker.io/pgconfig/pgconfigctl:v{{ .Major }}" - image_templates: - - "docker.io/pgconfig/pgconfigctl:arm64-v{{ .Commit }}" - - "docker.io/pgconfig/pgconfigctl:amd64-v{{ .Commit }}" - - name_template: "docker.io/pgconfig/pgconfigctl:latest" - image_templates: - - "docker.io/pgconfig/pgconfigctl:arm64-v{{ .Commit }}" - - "docker.io/pgconfig/pgconfigctl:amd64-v{{ .Commit }}" - - name_template: ghcr.io/pgconfig/api:v{{ .Tag }} - image_templates: - - "ghcr.io/pgconfig/api:arm64-v{{ .Commit }}" - - "ghcr.io/pgconfig/api:amd64-v{{ .Commit }}" - - name_template: "ghcr.io/pgconfig/api:v{{ .Major }}.{{ .Minor }}" - image_templates: - - "ghcr.io/pgconfig/api:arm64-v{{ .Commit }}" - - "ghcr.io/pgconfig/api:amd64-v{{ .Commit }}" - - name_template: "ghcr.io/pgconfig/api:v{{ .Major }}" - image_templates: - - "ghcr.io/pgconfig/api:arm64-v{{ .Commit }}" - - "ghcr.io/pgconfig/api:amd64-v{{ .Commit }}" - - name_template: "ghcr.io/pgconfig/api:latest" - image_templates: - - "ghcr.io/pgconfig/api:arm64-v{{ .Commit }}" - - "ghcr.io/pgconfig/api:amd64-v{{ .Commit }}" - - name_template: "ghcr.io/pgconfig/pgconfigctl:v{{ .Tag }}" - image_templates: - - "ghcr.io/pgconfig/pgconfigctl:arm64-v{{ .Commit }}" - - "ghcr.io/pgconfig/pgconfigctl:amd64-v{{ .Commit }}" - - name_template: "ghcr.io/pgconfig/pgconfigctl:v{{ .Major }}.{{ .Minor }}" - image_templates: - - "ghcr.io/pgconfig/pgconfigctl:arm64-v{{ .Commit }}" - - "ghcr.io/pgconfig/pgconfigctl:amd64-v{{ .Commit }}" - - name_template: "ghcr.io/pgconfig/pgconfigctl:v{{ .Major }}" - image_templates: - - "ghcr.io/pgconfig/pgconfigctl:arm64-v{{ .Commit }}" - - "ghcr.io/pgconfig/pgconfigctl:amd64-v{{ .Commit }}" - - name_template: "ghcr.io/pgconfig/pgconfigctl:latest" - image_templates: - - "ghcr.io/pgconfig/pgconfigctl:arm64-v{{ .Commit }}" - - "ghcr.io/pgconfig/pgconfigctl:amd64-v{{ .Commit }}" + images: + - "docker.io/pgconfig/api" + - "ghcr.io/pgconfig/api" + - "registry.heroku.com/{{ .Env.HEROKU_APP_NAME }}/web" + tags: + - "v{{ .Version }}" + - "v{{ .Major }}.{{ .Minor }}" + - "v{{ .Major }}" + - "latest" + labels: + "org.opencontainers.image.created": "{{.Date}}" + "org.opencontainers.image.title": "pgconfig-{{.ProjectName}}" + "org.opencontainers.image.website": "pgconfig.org" + "org.opencontainers.image.revision": "{{.FullCommit}}" + "org.opencontainers.image.version": "{{.Version}}" diff --git a/cmd/api/Dockerfile b/cmd/api/Dockerfile index d1e8107..f2c979a 100644 --- a/cmd/api/Dockerfile +++ b/cmd/api/Dockerfile @@ -1,12 +1,13 @@ FROM alpine:3.13 as builder FROM scratch +ARG TARGETPLATFORM EXPOSE 3000 ENV PORT=3000 COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ WORKDIR /app - COPY api /app + COPY ${TARGETPLATFORM}/api /app COPY *.yml /app ENTRYPOINT [ "/app/api" ] diff --git a/cmd/api/main.go b/cmd/api/main.go index 1e5781d..0a7c8f7 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -32,7 +32,7 @@ func getDefaultPort(envName string) int { return out } -func init() { +func initAPI() { flag.IntVar(&port, "port", getDefaultPort("PORT"), "Listen port") flag.StringVar(&rulesFile, "rules-file", "./rules.yml", "Rules file") flag.StringVar(&docsFile, "docs-file", "./pg-docs.yml", "Rules file") @@ -42,6 +42,8 @@ func init() { } func main() { + initAPI() + log.Printf("PGConfig API - %s\n", version.Pretty()) app := routes.New() diff --git a/cmd/pgconfigctl/Dockerfile b/cmd/pgconfigctl/Dockerfile index 57e24b2..2d1048c 100644 --- a/cmd/pgconfigctl/Dockerfile +++ b/cmd/pgconfigctl/Dockerfile @@ -1,3 +1,4 @@ FROM scratch -COPY pgconfigctl / +ARG TARGETPLATFORM +COPY ${TARGETPLATFORM}/pgconfigctl / CMD ["/pgconfigctl"] \ No newline at end of file diff --git a/rules.yml b/rules.yml index 7df031a..8a5ca46 100644 --- a/rules.yml +++ b/rules.yml @@ -68,18 +68,18 @@ categories: io_method: abstract: Controls the asynchronous I/O implementation used by PostgreSQL. Options are "worker" (dedicated I/O worker processes), "io_uring" (Linux io_uring interface), and "sync" (traditional synchronous I/O). recomendations: - Tuning AIO in PostgreSQL 18 - Tomas Vondra: https://vondra.me/posts/tuning-aio-in-postgresql-18/ - Waiting for Postgres 18: Accelerating Disk Reads with Asynchronous I/O - pganalyze: https://pganalyze.com/blog/postgres-18-async-io - PostgreSQL 18: Better I/O performance with AIO - Cybertec: https://www.cybertec-postgresql.com/en/postgresql-18-better-i-o-performance-with-aio/ - PostgreSQL 18 Asynchronous I/O - Neon: https://neon.com/postgresql/postgresql-18/asynchronous-io - PostgreSQL 18: The AIO Revolution - dev.to: https://dev.to/mattleads/postgresql-18-the-aio-revolution-uuidv7-and-the-path-to-unprecedented-performance-415m + "Tuning AIO in PostgreSQL 18 - Tomas Vondra": https://vondra.me/posts/tuning-aio-in-postgresql-18/ + "Waiting for Postgres 18: Accelerating Disk Reads with Asynchronous I/O - pganalyze": https://pganalyze.com/blog/postgres-18-async-io + "PostgreSQL 18: Better I/O performance with AIO - Cybertec": https://www.cybertec-postgresql.com/en/postgresql-18-better-i-o-performance-with-aio/ + "PostgreSQL 18 Asynchronous I/O - Neon": https://neon.com/postgresql/postgresql-18/asynchronous-io + "PostgreSQL 18: The AIO Revolution - dev.to": https://dev.to/mattleads/postgresql-18-the-aio-revolution-uuidv7-and-the-path-to-unprecedented-performance-415m io_workers: abstract: Number of background I/O worker processes used when io_method is set to "worker". Determines how many concurrent I/O operations can be performed asynchronously. recomendations: - Tuning AIO in PostgreSQL 18 - Tomas Vondra: https://vondra.me/posts/tuning-aio-in-postgresql-18/ - Waiting for Postgres 18: Accelerating Disk Reads with Asynchronous I/O - pganalyze: https://pganalyze.com/blog/postgres-18-async-io - PostgreSQL 18: Better I/O performance with AIO - Cybertec: https://www.cybertec-postgresql.com/en/postgresql-18-better-i-o-performance-with-aio/ - PostgreSQL 18 Asynchronous I/O - Neon: https://neon.com/postgresql/postgresql-18/asynchronous-io + "Tuning AIO in PostgreSQL 18 - Tomas Vondra": https://vondra.me/posts/tuning-aio-in-postgresql-18/ + "Waiting for Postgres 18: Accelerating Disk Reads with Asynchronous I/O - pganalyze": https://pganalyze.com/blog/postgres-18-async-io + "PostgreSQL 18: Better I/O performance with AIO - Cybertec": https://www.cybertec-postgresql.com/en/postgresql-18-better-i-o-performance-with-aio/ + "PostgreSQL 18 Asynchronous I/O - Neon": https://neon.com/postgresql/postgresql-18/asynchronous-io maintenance_io_concurrency: abstract: Sets the number of concurrent I/O operations that PostgreSQL expects can be executed simultaneously during maintenance operations such as VACUUM and CREATE INDEX. io_combine_limit: @@ -91,20 +91,20 @@ categories: abstract: Server-wide limit that clamps io_combine_limit, controlling the largest I/O size in operations that combine I/O. recomendations: "Allow io_combine_limit up to 1MB": https://www.postgresql.org/message-id/CA+hUKGKd=U1zSFYNjwBBrXV3NsqR2U8dCUrCBVeB0DQ8Vb8Dwg@mail.gmail.com - Tuning AIO in PostgreSQL 18 - Tomas Vondra: https://vondra.me/posts/tuning-aio-in-postgresql-18/ - Waiting for Postgres 18: Accelerating Disk Reads with Asynchronous I/O - pganalyze: https://pganalyze.com/blog/postgres-18-async-io - PostgreSQL 18: Better I/O performance with AIO - Cybertec: https://www.cybertec-postgresql.com/en/postgresql-18-better-i-o-performance-with-aio/ - PostgreSQL 18 Asynchronous I/O - Neon: https://neon.com/postgresql/postgresql-18/asynchronous-io + "Tuning AIO in PostgreSQL 18 - Tomas Vondra": https://vondra.me/posts/tuning-aio-in-postgresql-18/ + "Waiting for Postgres 18: Accelerating Disk Reads with Asynchronous I/O - pganalyze": https://pganalyze.com/blog/postgres-18-async-io + "PostgreSQL 18: Better I/O performance with AIO - Cybertec": https://www.cybertec-postgresql.com/en/postgresql-18-better-i-o-performance-with-aio/ + "PostgreSQL 18 Asynchronous I/O - Neon": https://neon.com/postgresql/postgresql-18/asynchronous-io The Ultimate PostgreSQL 18 Asynchronous I/O Tuning Checklist (With Examples): https://www.cybrosys.com/research-and-development/postgres/the-ultimate-postgresql-18-asynchronous-io-tuning-checklist-with-examples PostgreSQL 18 Asynchronous Disk I/O - Deep Dive Into Implementation: https://www.credativ.de/en/blog/postgresql-en/postgresql-18-asynchronous-disk-i-o-deep-dive-into-implementation/ io_max_concurrency: abstract: Maximum number of concurrent I/O requests that can be in flight at once. recomendations: "PostgreSQL 18 Beta 1 io_max_concurrency": https://www.postgresql.org/message-id/9673.1747250758@sss.pgh.pa.us - Tuning AIO in PostgreSQL 18 - Tomas Vondra: https://vondra.me/posts/tuning-aio-in-postgresql-18/ - Waiting for Postgres 18: Accelerating Disk Reads with Asynchronous I/O - pganalyze: https://pganalyze.com/blog/postgres-18-async-io - PostgreSQL 18: Better I/O performance with AIO - Cybertec: https://www.cybertec-postgresql.com/en/postgresql-18-better-i-o-performance-with-aio/ - PostgreSQL 18 Asynchronous I/O - Neon: https://neon.com/postgresql/postgresql-18/asynchronous-io + "Tuning AIO in PostgreSQL 18 - Tomas Vondra": https://vondra.me/posts/tuning-aio-in-postgresql-18/ + "Waiting for Postgres 18: Accelerating Disk Reads with Asynchronous I/O - pganalyze": https://pganalyze.com/blog/postgres-18-async-io + "PostgreSQL 18: Better I/O performance with AIO - Cybertec": https://www.cybertec-postgresql.com/en/postgresql-18-better-i-o-performance-with-aio/ + "PostgreSQL 18 Asynchronous I/O - Neon": https://neon.com/postgresql/postgresql-18/asynchronous-io The Ultimate PostgreSQL 18 Asynchronous I/O Tuning Checklist (With Examples): https://www.cybrosys.com/research-and-development/postgres/the-ultimate-postgresql-18-asynchronous-io-tuning-checklist-with-examples PostgreSQL 18 Asynchronous Disk I/O - Deep Dive Into Implementation: https://www.credativ.de/en/blog/postgresql-en/postgresql-18-asynchronous-disk-i-o-deep-dive-into-implementation/ file_copy_method: