diff --git a/ansible/manifest-playbook.yml b/ansible/manifest-playbook.yml index 5c1c65053..5d23038c1 100644 --- a/ansible/manifest-playbook.yml +++ b/ansible/manifest-playbook.yml @@ -26,7 +26,7 @@ get_url: url: "https://github.com/PostgREST/postgrest/releases/download/v{{ postgrest_release }}/postgrest-v{{ postgrest_release }}-ubuntu-aarch64.tar.xz" dest: /tmp/postgrest-{{ postgrest_release }}-arm64.tar.xz - checksum: "{{ postgrest_arm_release_checksum }}" + checksum: "{{ postgrest_release_checksum }}" timeout: 60 - name: Download adminapi archive diff --git a/ansible/tasks/setup-postgrest.yml b/ansible/tasks/setup-postgrest.yml index a98d1990f..5f5de4609 100644 --- a/ansible/tasks/setup-postgrest.yml +++ b/ansible/tasks/setup-postgrest.yml @@ -1,68 +1,18 @@ - name: PostgREST - system user user: name=postgrest -- name: PostgREST - add Postgres PPA gpg key - apt_key: - url: https://www.postgresql.org/media/keys/ACCC4CF8.asc - state: present - -- name: PostgREST - add Postgres PPA - apt_repository: - repo: "deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg {{ postgresql_major }}" - state: present - -- name: PostgREST - update apt cache - apt: - update_cache: yes - -# libpq is a C library that enables user programs to communicate with -# the PostgreSQL database server. -- name: PostgREST - system dependencies - apt: - pkg: - - libpq5 - - libnuma-dev - -- name: PostgREST - remove Postgres PPA gpg key - apt_key: - url: https://www.postgresql.org/media/keys/ACCC4CF8.asc - state: absent - -- name: PostgREST - remove Postgres PPA - apt_repository: - repo: "deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg {{ postgresql_major }}" - state: absent - -- name: postgis - ensure dependencies do not get autoremoved +- name: PostgREST - install from nix postgrest flakes + become: yes shell: | - set -e - apt-mark manual libpq5* - apt-mark manual libnuma* - apt-mark auto libnuma*-dev - -- name: PostgREST - download ubuntu binary archive (arm) - get_url: - url: "https://github.com/PostgREST/postgrest/releases/download/v{{ postgrest_release }}/postgrest-v{{ postgrest_release }}-ubuntu-aarch64.tar.xz" - dest: /tmp/postgrest.tar.xz - checksum: "{{ postgrest_arm_release_checksum }}" - timeout: 60 - when: platform == "arm64" - -- name: PostgREST - download ubuntu binary archive (x86) - get_url: - url: "https://github.com/PostgREST/postgrest/releases/download/v{{ postgrest_release }}/postgrest-v{{ postgrest_release }}-linux-static-x64.tar.xz" - dest: /tmp/postgrest.tar.xz - checksum: "{{ postgrest_x86_release_checksum }}" - timeout: 60 - when: platform == "amd64" - -- name: PostgREST - unpack archive in /opt - unarchive: - remote_src: yes - src: /tmp/postgrest.tar.xz - dest: /opt - owner: postgrest - mode: '0755' + sudo -u postgrest bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install --accept-flake-config github:postgrest/postgrest/v{{ postgrest_release }}" + when: stage2_nix + +- name: Create symlink for PostgREST from Nix profile to /opt + ansible.builtin.file: + src: /home/postgrest/.nix-profile/bin/postgrest + dest: /opt/postgrest + state: link + force: yes # This will replace existing file/symlink if it exists - name: create directories file: diff --git a/ansible/vars.yml b/ansible/vars.yml index 9473fe44e..16a3e1e91 100644 --- a/ansible/vars.yml +++ b/ansible/vars.yml @@ -9,20 +9,18 @@ postgres_major: # Full version strings for each major version postgres_release: - postgresorioledb-17: "17.0.1.092-orioledb" - postgres17: "17.4.1.042" - postgres15: "15.8.1.099" + postgresorioledb-17: "17.0.1.092-orioledb-pgrst13" + postgres17: "17.4.1.042-pgrst13" + postgres15: "15.8.1.099-pgrst13" # Non Postgres Extensions pgbouncer_release: "1.19.0" pgbouncer_release_checksum: sha256:af0b05e97d0e1fd9ad45fe00ea6d2a934c63075f67f7e2ccef2ca59e3d8ce682 -# to get these use -# wget https://github.com/PostgREST/postgrest/releases/download/v12.2.3/postgrest-v12.2.3-ubuntu-aarch64.tar.xz -q -O- | sha1sum -# wget https://github.com/PostgREST/postgrest/releases/download/v12.2.3/postgrest-v12.2.3-linux-static-x64.tar.xz -q -O- | sha1sum -postgrest_release: "12.2.3" -postgrest_arm_release_checksum: sha1:fbfd6613d711ce1afa25c42d5df8f1b017f396f9 -postgrest_x86_release_checksum: sha1:61c513f91a8931be4062587b9d4a18b42acf5c05 +# to get the checksum use +# wget https://github.com/PostgREST/postgrest/releases/download/v13.0.2/postgrest-v13.0.2-ubuntu-aarch64.tar.xz -q -O- | sha1sum +postgrest_release: "13.0.2" +postgrest_release_checksum: sha1:ea184ea392544b8374c1c21bbe278f55959ae62a gotrue_release: 2.175.0 gotrue_release_checksum: sha1:4e2a41e08936195daf443c60201691c1bd991709 diff --git a/scripts/nix-provision.sh b/scripts/nix-provision.sh index 6515ecae9..46ccdb503 100644 --- a/scripts/nix-provision.sh +++ b/scripts/nix-provision.sh @@ -24,8 +24,8 @@ function install_packages { function install_nix() { sudo su -c "curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --no-confirm \ - --extra-conf \"substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com\" \ - --extra-conf \"trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=% cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=\" " -s /bin/bash root + --extra-conf \"substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com https://postgrest.cachix.org\" \ + --extra-conf \"trusted-public-keys = postgrest.cachix.org-1:icgW4R15fz1+LqvhPjt4EnX/r19AaqxiVV+1olwlZtI= nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=% cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=\" " -s /bin/bash root . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh } diff --git a/testinfra/test_ami_nix.py b/testinfra/test_ami_nix.py index 1975818d6..1ea1180c5 100644 --- a/testinfra/test_ami_nix.py +++ b/testinfra/test_ami_nix.py @@ -309,6 +309,9 @@ def gzip_then_base64_encode(s: str) -> str: sleep(5) instance.reload() + print('---------------- InstanceID: ----------------') + print('---------------- ', instance.id) + # Create single SSH connection ssh = get_ssh_connection( instance.public_ip_address,