From fbe1994b4ddd4c8981f69f1f10223a465571b115 Mon Sep 17 00:00:00 2001 From: devsjc <47188100+devsjc@users.noreply.github.com> Date: Fri, 27 Feb 2026 16:48:24 +0000 Subject: [PATCH 1/2] chore(workflows): Buld postgres container --- .github/workflows/build.yml | 52 +++++++++++++++++++++- internal/server/postgres/dataserverimpl.go | 4 +- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b9ef32..bf4481f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,6 @@ on: env: REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} jobs: build-container: @@ -18,6 +17,9 @@ jobs: contents: read packages: write + env: + IMAGE_NAME: ${{ github.repository }} + steps: - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -81,3 +83,51 @@ jobs: env: DOCKER_BUILD_RECORD_RETENTION_DAYS: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && '0' || '7' }} + build-postgres-container: + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + env: + IMAGE_NAME: ${{ github.repository }}-pgdb + + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Log in to the Container registry + uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Buildx + id: setup-buildx + uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 + + - name: Extract metadata (tags, labels) for Container + id: meta + uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + + - name: Build and push Docker images + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 6.18.0 + with: + context: . + file: internal/server/postgres/infra/Containerfile + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + env: + DOCKER_BUILD_RECORD_RETENTION_DAYS: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && '0' || '7' }} + diff --git a/internal/server/postgres/dataserverimpl.go b/internal/server/postgres/dataserverimpl.go index 26b80a4..5226a64 100644 --- a/internal/server/postgres/dataserverimpl.go +++ b/internal/server/postgres/dataserverimpl.go @@ -306,8 +306,8 @@ func (s *DataPlatformDataServiceServerImpl) GetLatestForecasts( ForecasterName: fc.ForecasterName, ForecasterVersion: fc.ForecasterVersion, }, - LocationUuid: fc.GeometryUuid.String(), - Metadata: fc.Metadata, + LocationUuid: fc.GeometryUuid.String(), + Metadata: fc.Metadata, CreatedTimestampUtc: timestamppb.New(fc.CreatedAtUtc.Time), } } From b567e25fdc30353ab69c53d99aa2f09bead77cbc Mon Sep 17 00:00:00 2001 From: devsjc <47188100+devsjc@users.noreply.github.com> Date: Mon, 2 Mar 2026 10:28:40 +0000 Subject: [PATCH 2/2] fix(postgres): Use pg_cron in container --- examples/docker-compose.yml | 8 ++++---- internal/server/postgres/infra/Containerfile | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index b01cb4c..e13a2c0 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -11,7 +11,7 @@ services: api: build: - context: api + context: .. dockerfile: Containerfile ports: - "50051:50051" @@ -27,8 +27,8 @@ services: database: build: - context: api/src/internal/repository/postgres/infra - dockerfile: Containerfile + context: .. + dockerfile: internal/server/postgres/infra/Containerfile environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres @@ -75,5 +75,5 @@ configs: lc_numeric = 'en_US.utf8' # locale for number formatting lc_time = 'en_US.utf8' # locale for time formatting default_text_search_config = 'pg_catalog.english' - shared_preload_libraries = 'pg_partman_bgw' + shared_preload_libraries = 'pg_cron' diff --git a/internal/server/postgres/infra/Containerfile b/internal/server/postgres/infra/Containerfile index 27cee03..f91f4dc 100644 --- a/internal/server/postgres/infra/Containerfile +++ b/internal/server/postgres/infra/Containerfile @@ -9,3 +9,4 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends postgresql-18-cron \ && rm -rf /var/lib/apt/lists/* +CMD [ "postgres","-c","shared_preload_libraries=pg_cron" ]