Skip to content

Sam/nix and conventional consolidate #1025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

samrose
Copy link
Collaborator

@samrose samrose commented Jul 3, 2024

What kind of change does this PR introduce?

This is a PR against already reviewed changes in #1012 to consolidate ansible configurations, and use vars to switch which tasks are called, and avoid de-duplication of config code for different AMI outcomes.

Goals of this Sub-PR:

  • Dedupe ansible ami building code
  • All existing PR-triggered tests passing including testinfra tests for both versions, osquery permission checks, etc

@samrose samrose requested a review from a team as a code owner July 3, 2024 21:33
@samrose samrose marked this pull request as draft July 5, 2024 18:03
@samrose samrose marked this pull request as ready for review July 9, 2024 15:57
@samrose samrose requested review from pashkinelfe and darora July 9, 2024 16:08
@samrose samrose mentioned this pull request Jul 9, 2024
@@ -1,39 +1,29 @@
- name: ensure services are stopped
community.general.snap:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this removal no longer needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@div yes, this was no longer present at this point in the build

@@ -19,6 +19,7 @@ TimeoutStartSec=86400
Restart=always
RestartSec=5
OOMScoreAdjust=-1000
EnvironmentFile=-/etc/environment.d/postgresql.env
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular concerns, but what gets included in this file and what's populating it? Or is it there just in case it's needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@darora when nix installs the postgresql package, nix doesn't perform a lot of the operations that the debian package performs. So here I am adding the following values so that postgres will know about locales

this file only contains

LOCALE_ARCHIVE=/usr/lib/locale/locale-archive
LANG="en_US.UTF-8"
LANGUAGE="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"

@samrose samrose merged commit 4afe5f0 into sam/nix-and-conventional-ami Jul 12, 2024
11 checks passed
@samrose samrose deleted the sam/nix-and-conventional-consolidate branch July 12, 2024 15:24
samrose added a commit that referenced this pull request Jul 19, 2024
Sam/nix and conventional consolidate (#1025)

* feat: consolidate ansible and use vars to toggle AMI builds

* fix: resolving merge conflict

* chore: merge conflict

* Revert "chore: merge conflict"

This reverts commit ddc6b1d.

* fix: update ansible location for script

* fix: ansible consolidated location

* fix: set up modes on system-setup

* fix: set vars

* fix: python True and False in extra_vars

* fix: adj vars

* fix: set all ami vars

* fix: args as json

* fix: nixpkg_mode

* fix: refining mode rules

* fix: consolidate create dirs

* fix: cleaning up modes

* fix: systemd psql service reload targets

* fix: starting postgres issues

* fix: timing for pgsodium_getkey script

* fix: packer file upload on stage 2

* fix: consolidation of ansible location

* fix: stage2 fix hostname

* fix: limit stage that tasks run on

* fix: setting hosts only on stage 2 nix ami

* fix: rewrite hosts in ansible to allow for re-use of playbook file

* chore: trigger checks

* fix: pgsodium getkey is different for deb vs nix builds

* fix: consolidated files location

* fix: on stage2 postgres server is already started at this point

* fix: without env vars

* fix: vars on the right mode

* fix: dedupe

* fix: locales

* fix: locales

* chore: try step with no env vars

* fix: no need to start pg at this point stage2

* fix: yaml

* fix: more cleanup of modes

* fix: snapd already absent at this point + consolidate tasks

* fix: already absent at this point

* fix: service not present at this stage

* fix: disable different services for first boot depending on mode

* fix: pg already restarted at this point in stage 2

* fix: no start on stage2

* fix: try to start in stage2

* chore: include env vars for stage2

* fix: stop before starting

* fix: debpkg mode only

* fix: should use conventional path

* fix: need to locale-gen prior to initdb

* fix: nix build needs .env

* fix: stage2 treatment of pgsodium_getket

* chore: re-introduce permission checks via osquery

* fix: correct the path to files

---------

Co-authored-by: Sam Rose <samuel@supabase.io>
samrose added a commit that referenced this pull request Jul 19, 2024
* feat: nix-ami-changes

* chore: version bump

* chore: remap branch for ami build

* chore: bump version

* chore: bump version to trigger build

* feat: use /var/lib/postgresql as home for postgres user

* fix: makre sure bashrc exists

* fix: minor refactor

* chore: moving to a different PR

* chore: bump version and remove deprecated workflow

* feat: parallel testinfra-nix just for ami test

* chore: testing just testinfra-nix workflow

* chore: re-run build

* chore: re-trigger testinfra

* fix: wait for AMI to reach available state

* fix: use ami id in stage 3 testinfra ami-test

* fix: env vars

* chore: bump version

* chore: restore packer build

* chore: create a parallel test

* chore: bump version

* fix: capture and use ami name

* fix: aws regions

* chore: capture ami name

* chore: force_deregister all ami prior to create new

* fix: pass same ami name each time

* fix: manage concurrency of testinfra builds

* fix: no args on stage 2

* fix: re-intro original testinfra

* Revert "fix: re-intro original testinfra"

This reverts commit f719e66.

* chore: push to re-trigger build

* chore: update instance name

* fix: location of pg_isready binary

* fix: re-intro conventional ami infra test + more symlinks where expected

* fix: dealing with symlink creation issues

* fix: try concurrency rules on on all large builds

* chore; try with no concurrency rules

* chore: rerun

* chore: rebasing on develop
Sam/nix and conventional consolidate (#1025)

* feat: consolidate ansible and use vars to toggle AMI builds

* fix: resolving merge conflict

* chore: merge conflict

* Revert "chore: merge conflict"

This reverts commit ddc6b1d.

* fix: update ansible location for script

* fix: ansible consolidated location

* fix: set up modes on system-setup

* fix: set vars

* fix: python True and False in extra_vars

* fix: adj vars

* fix: set all ami vars

* fix: args as json

* fix: nixpkg_mode

* fix: refining mode rules

* fix: consolidate create dirs

* fix: cleaning up modes

* fix: systemd psql service reload targets

* fix: starting postgres issues

* fix: timing for pgsodium_getkey script

* fix: packer file upload on stage 2

* fix: consolidation of ansible location

* fix: stage2 fix hostname

* fix: limit stage that tasks run on

* fix: setting hosts only on stage 2 nix ami

* fix: rewrite hosts in ansible to allow for re-use of playbook file

* chore: trigger checks

* fix: pgsodium getkey is different for deb vs nix builds

* fix: consolidated files location

* fix: on stage2 postgres server is already started at this point

* fix: without env vars

* fix: vars on the right mode

* fix: dedupe

* fix: locales

* fix: locales

* chore: try step with no env vars

* fix: no need to start pg at this point stage2

* fix: yaml

* fix: more cleanup of modes

* fix: snapd already absent at this point + consolidate tasks

* fix: already absent at this point

* fix: service not present at this stage

* fix: disable different services for first boot depending on mode

* fix: pg already restarted at this point in stage 2

* fix: no start on stage2

* fix: try to start in stage2

* chore: include env vars for stage2

* fix: stop before starting

* fix: debpkg mode only

* fix: should use conventional path

* fix: need to locale-gen prior to initdb

* fix: nix build needs .env

* fix: stage2 treatment of pgsodium_getket

* chore: re-introduce permission checks via osquery

* fix: correct the path to files

---------

Co-authored-by: Sam Rose <samuel@supabase.io>

* Sam/timescale and wrappers (#1052)

* fix: was using the wrong sha256 hash for version

* chore: updating wrappers version

* itests: make sure we run the current commit on psql bundle test

---------

Co-authored-by: Sam Rose <samuel@supabase.io>

* fix: locale gen and ami deregister on any testinfra run (#1055)

* fix: locale gen and ami deregister on any testinfra run

* fix: use more manual approach

---------

Co-authored-by: Sam Rose <samuel@supabase.io>

* chore: update pg_upgrade initiate.sh to support nix-based upgrades (#1057)

* chore: package nix flake revision in pg_upgrade binaries tarball when building the nix AMI (#1058)

* chore: activate release workflow

* chore: bump version

---------

Co-authored-by: Sam Rose <samuel@supabase.io>
Co-authored-by: Paul Cioanca <paul.cioanca@supabase.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants