From 99b018ded8696f51abf2368c21106620cdfef661 Mon Sep 17 00:00:00 2001 From: Manuel Mendez Date: Mon, 8 Jun 2026 16:44:01 -0400 Subject: [PATCH] git: clean up .gitignore file Bunch of clean ups for a tidier file. I dropped individual hidden files/dirs in favor of a blanket `.*` with whitelists for known files. This way any new hidden files are automatically ignored. I also got rid of most of the things in docker/ because they no longer apply, also updated the relevant docs. I dropped the github actions example because it was too explicit, the snippets later show how to use it and we have a real working example in .github that can be looked over. Finally got rid of testinfra-aio-container-logs.log because its no longer being written since commit 12d65840. --- .coderabbit.yaml | 2 +- .gitignore | 43 ++++------ README.md | 2 - docker/Dockerfile | 78 ------------------- docker/docker-compose.yml | 9 --- docker/nix/Dockerfile | 16 ---- docker/nix/build_nix.sh | 9 --- nix/docs/image-size-analyzer-usage.md | 64 --------------- .../conf.d => nix/docs/site}/.gitkeep | 0 nix/docs/site/.keep | 0 testinfra/README.md | 33 -------- 11 files changed, 17 insertions(+), 239 deletions(-) delete mode 100644 docker/Dockerfile delete mode 100644 docker/docker-compose.yml delete mode 100644 docker/nix/Dockerfile delete mode 100755 docker/nix/build_nix.sh rename {ansible/files/postgresql_config/conf.d => nix/docs/site}/.gitkeep (100%) delete mode 100644 nix/docs/site/.keep diff --git a/.coderabbit.yaml b/.coderabbit.yaml index 46731a51a8..62de3abe6f 100644 --- a/.coderabbit.yaml +++ b/.coderabbit.yaml @@ -22,7 +22,7 @@ reviews: - label: "nix" instructions: "Apply when PR modifies Nix packaging: flake.nix, flake.lock, nix/*.nix, overlays, or postgresql derivations." - label: "docker" - instructions: "Apply when PR changes Dockerfiles (Dockerfile-*), docker/ directory, or container build configuration." + instructions: "Apply when PR changes Dockerfiles (Dockerfile-*), or container build configuration." - label: "ami" instructions: "Apply when PR modifies Packer templates (*.pkr.hcl), AMI builds, QEMU image configuration, or ebssurrogate/." - label: "security" diff --git a/.gitignore b/.gitignore index 37d63dbec4..28491bced6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,35 +1,24 @@ -.DS_Store -.python-version -.mise.toml -venv/ -*.swp -docker/cache/ +.* +!.env +!.gitignore +!.gitkeep +!/.claude/ +!/.coderabbit.yaml +!/.envrc.recommended +!/.github/ +/.claude/settings.local.json +# ansible related ansible/image-manifest*.json -testinfra-aio-container-logs.log -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] +# python related *$py.class +*.py[cod] +__pycache__/ +venv/ #nix related -result* -.env-local -.history -.envrc -.direnv -.nixos-test-history - -#IDE -.idea/ -.vscode/ - -db/schema.sql common-nix.vars.pkr.hcl - -# pre-commit config is managed in nix -.pre-commit-config.yaml +db/schema.sql nixos.qcow2 -.lsp -.clj-kondo +result* diff --git a/README.md b/README.md index 01a413571a..5adf578078 100644 --- a/README.md +++ b/README.md @@ -67,8 +67,6 @@ Here's a comprehensive overview of the project's directory structure: | migrations/tests/database/ | Database-specific migration tests | | migrations/tests/storage/ | Storage-related migration tests | | migrations/tests/extensions/ | Extension migration tests | -| **docker/** | Container definitions and Docker-related files | -| docker/nix/ | Nix-based Docker build configurations | | Dockerfile-15 | Docker image definition for PostgreSQL 15 | | Dockerfile-17 | Docker image definition for PostgreSQL 17 | | **tests/** | Integration and system tests | diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 53a96029ee..0000000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,78 +0,0 @@ -ARG ubuntu_release=noble -FROM ubuntu:${ubuntu_release} as base - -ARG ubuntu_release=flocal -ARG ubuntu_release_no=24.04 -ARG postgresql_major=15 -ARG postgresql_release=${postgresql_major}.1 - -FROM base as pg-source - -# Install build dependencies -RUN apt-get update && apt-get install -y --no-install-recommends \ - gnupg \ - dpkg-dev \ - ca-certificates \ - && rm -rf /var/lib/apt/lists/* - -# Add Postgres PPA -# In the off-chance that the key in the repository expires, it can be replaced by running the following in the repository's root: -# gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys $NEW_POSTGRESQL_GPG_KEY -# gpg --export --armor $NEW_POSTGRESQL_GPG_KEY > postgresql.gpg.key -COPY postgresql.gpg.key /tmp/postgresql.gpg.key -RUN apt-key add /tmp/postgresql.gpg.key && \ - echo "deb https://apt-archive.postgresql.org/pub/repos/apt ${ubuntu_release}-pgdg-archive main" > /etc/apt/sources.list.d/pgdg.list && \ - echo "deb-src https://apt-archive.postgresql.org/pub/repos/apt ${ubuntu_release}-pgdg-archive main" > /etc/apt/sources.list.d/pgdg.list - -# Create local PPA -WORKDIR /tmp/build -RUN echo "deb [ trusted=yes ] file:///tmp/build ./" > /etc/apt/sources.list.d/temp.list && \ - dpkg-scanpackages . > Packages && \ - apt-get -o Acquire::GzipIndexes=false update - -ENV DEBIAN_FRONTEND=noninteractive -ENV PYTHONDONTWRITEBYTECODE=1 -ENV DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" - -# Configure processor optimised build -ARG CPPFLAGS="" -ENV DEB_CPPFLAGS_APPEND="${CPPFLAGS} -fsigned-char" -ENV DEB_CFLAGS_APPEND="-g3" -ARG DEB_BUILD_PROFILES="pkg.postgresql.nozstd" -ENV DEB_BUILD_PROFILES="${DEB_BUILD_PROFILES}" - -RUN apt-get -o Acquire::GzipIndexes=false update && apt-get build-dep -y postgresql-common pgdg-keyring && \ - apt-get source --compile postgresql-common pgdg-keyring && \ - dpkg-scanpackages . > Packages && \ - apt-get -o Acquire::GzipIndexes=false update - -RUN apt-get build-dep -y "postgresql-${postgresql_major}=${postgresql_release}-1.pgdg${ubuntu_release_no}+1" && \ - apt-get source --compile "postgresql-${postgresql_major}=${postgresql_release}-1.pgdg${ubuntu_release_no}+1" && \ - dpkg-scanpackages . > Packages && \ - apt-get -o Acquire::GzipIndexes=false update - -# Remove source directories -RUN rm -rf /tmp/build/*/ - -FROM base as pg - -# Inherit args from base stage -ARG postgresql_major -ARG postgresql_release - -COPY --from=pg-source /tmp/build /tmp/build - -ENV DEBIAN_FRONTEND=noninteractive -RUN echo "deb [ trusted=yes ] file:///tmp/build ./" > /etc/apt/sources.list.d/temp.list && \ - apt-get -o Acquire::GzipIndexes=false update && \ - apt-get install -y --no-install-recommends postgresql-common && \ - sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf && \ - apt-get install -y --no-install-recommends "postgresql-${postgresql_major}=${postgresql_release}-1.pgdg${ubuntu_release_no}+1" && \ - rm -rf /var/lib/apt/lists/* && \ - rm -rf /tmp/build /etc/apt/sources.list.d/temp.list - -ENV PATH $PATH:/usr/lib/postgresql/${postgresql_major}/bin - -FROM scratch as pg-deb - -COPY --from=pg-source /tmp/build /tmp diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml deleted file mode 100644 index 8775d6b8a3..0000000000 --- a/docker/docker-compose.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: "3" - -services: - db: - image: supabase/postgres - ports: - - "5432:5432" - environment: - POSTGRES_PASSWORD: postgres diff --git a/docker/nix/Dockerfile b/docker/nix/Dockerfile deleted file mode 100644 index 89e5d81786..0000000000 --- a/docker/nix/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM nixpkgs/nix-flakes - -RUN echo "substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com" >> /etc/nix/nix.conf - -RUN echo "trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=" >> /etc/nix/nix.conf - - -USER $USER - -RUN mkdir -p /workspace - -COPY ./ /workspace - -RUN chmod +x /workspace/docker/nix/build_nix.sh - -RUN chown -R $USER:$USER /workspace \ No newline at end of file diff --git a/docker/nix/build_nix.sh b/docker/nix/build_nix.sh deleted file mode 100755 index 018075d78f..0000000000 --- a/docker/nix/build_nix.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/env bash -set -eou pipefail - -nix --version -if [ -d "/workspace" ]; then - cd /workspace -fi - -nix run "github:Mic92/nix-fast-build?rev=b1dae483ab7d4139a6297e02b6de9e5d30e43d48" -- --skip-cached --no-nom --flake ".#checks" diff --git a/nix/docs/image-size-analyzer-usage.md b/nix/docs/image-size-analyzer-usage.md index dc5845b060..bef0fc735e 100644 --- a/nix/docs/image-size-analyzer-usage.md +++ b/nix/docs/image-size-analyzer-usage.md @@ -63,70 +63,6 @@ diff before.json after.json ## CI Usage -### GitHub Actions Example - -```yaml -name: Image Size Analysis - -on: - pull_request: - paths: - - 'docker/**' - - 'nix/**' - workflow_dispatch: - -jobs: - analyze-image-size: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Install Nix - uses: cachix/install-nix-action@v27 - with: - extra_nix_config: | - extra-substituters = https://nix-postgres-artifacts.s3.amazonaws.com - extra-trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI= - - - name: Analyze image sizes - run: | - nix run .#image-size-analyzer -- --json > image-sizes.json - - - name: Upload size report - uses: actions/upload-artifact@v4 - with: - name: image-size-report - path: image-sizes.json - - - name: Comment PR with sizes - if: github.event_name == 'pull_request' - uses: actions/github-script@v7 - with: - script: | - const fs = require('fs'); - const report = JSON.parse(fs.readFileSync('image-sizes.json', 'utf8')); - - let comment = '## Docker Image Size Report\n\n'; - for (const image of report.images) { - const sizeGB = (image.total_size_bytes / 1073741824).toFixed(2); - comment += `### ${image.dockerfile}: ${sizeGB} GB\n\n`; - - comment += '**Top 5 Nix Packages:**\n'; - for (const pkg of image.nix_packages.slice(0, 5)) { - const sizeMB = (pkg.size_bytes / 1048576).toFixed(1); - comment += `- ${pkg.name}: ${sizeMB} MB\n`; - } - comment += '\n'; - } - - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: comment - }); -``` - ### Size Threshold Check Add a job that fails if images exceed a size threshold: diff --git a/ansible/files/postgresql_config/conf.d/.gitkeep b/nix/docs/site/.gitkeep similarity index 100% rename from ansible/files/postgresql_config/conf.d/.gitkeep rename to nix/docs/site/.gitkeep diff --git a/nix/docs/site/.keep b/nix/docs/site/.keep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/testinfra/README.md b/testinfra/README.md index f486c34aaa..8b1aa55165 100644 --- a/testinfra/README.md +++ b/testinfra/README.md @@ -16,39 +16,6 @@ pip3 install boto3 boto3-stubs[essential] docker ec2instanceconnectcli pytest py ```sh set -euo pipefail # cwd: repo root -# docker must be running - -# build extensions & pg binaries -docker buildx build \ - $(yq 'to_entries | map(select(.value|type == "!!str")) | map(" --build-arg " + .key + "=" + .value) | join("")' 'ansible/vars.yml') \ - --target=extensions \ - --tag=supabase/postgres:extensions \ - --platform=linux/arm64 \ - --load \ - . -mkdir -p /tmp/extensions ansible/files/extensions -docker save supabase/postgres:extensions | tar xv -C /tmp/extensions -for layer in /tmp/extensions/*/layer.tar; do - tar xvf "$layer" -C ansible/files/extensions --strip-components 1 -done -docker buildx build \ - --build-arg ubuntu_release=noble \ - --build-arg ubuntu_release_no=24.04 \ - --build-arg postgresql_major=15 \ - --build-arg postgresql_release=15.1 \ - --build-arg CPPFLAGS=-mcpu=neoverse-n1 \ - --build-arg CFLAGS=-g3 - --file=docker/Dockerfile \ - --target=pg-deb \ - --tag=supabase/postgres:deb \ - --platform=linux/arm64 \ - --load \ - . -mkdir -p /tmp/build ansible/files/postgres -docker save supabase/postgres:deb | tar xv -C /tmp/build -for layer in /tmp/build/*/layer.tar; do - tar xvf "$layer" -C ansible/files/postgres --strip-components 1 -done # build AMI AWS_PROFILE=supabase-dev packer build \