From c1aaeb786e2e5d21ab86458bcab926662bc10063 Mon Sep 17 00:00:00 2001 From: Gerhard Lazu Date: Tue, 26 Nov 2024 22:40:42 +0000 Subject: [PATCH] Go back to managing Postgres with asdf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Single tool to rule them all ✊ icu4c seems to be working on macOS 14.7 ARM now. Checked that the new command works as expected. Also confirmed that CI works locally. Also run: npx browserslist@latest --update-db Signed-off-by: Gerhard Lazu --- .envrc | 4 ---- .tool-versions | 1 + assets/yarn.lock | 19 +++++++------------ justfile | 31 +++++++++++++------------------ magefiles/tools/main.go | 4 ++-- 5 files changed, 23 insertions(+), 36 deletions(-) diff --git a/.envrc b/.envrc index 36f4e1991d..acf457f48b 100644 --- a/.envrc +++ b/.envrc @@ -4,10 +4,6 @@ export GITHUB_REF_NAME="master" export IMAGE_OWNER=thechangelog export GHCR_USERNAME=$USER -# Required for Postgres imports to work locally -export PATH=$(brew --prefix)/opt/postgresql@16/bin:$PATH -export PGDATA=$(brew --prefix)/var/postgresql@16 - # Load secrets if configured - only available to changelog.com team members: # https://github.com/orgs/thechangelog/people source_env_if_exists .envrc.secrets diff --git a/.tool-versions b/.tool-versions index 6637ef1256..31c6edd4f4 100644 --- a/.tool-versions +++ b/.tool-versions @@ -7,3 +7,4 @@ flyctl 0.2.65 golang 1.22.4 nodejs 20.14.0 yarn 1.22.22 +postgres 16.5 diff --git a/assets/yarn.lock b/assets/yarn.lock index eceaa8db44..4fcb76f8af 100644 --- a/assets/yarn.lock +++ b/assets/yarn.lock @@ -1479,15 +1479,10 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0: - version "1.0.30001338" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001338.tgz#b5dd7a7941a51a16480bdf6ff82bded1628eec0d" - integrity sha512-1gLHWyfVoRDsHieO+CaeYe7jSo/MT7D7lhaXUiwwbuR5BwQxORs0f1tAwUSQr3YbxRXJvxHM/PA5FfPQRnsPeQ== - -caniuse-lite@^1.0.30001332, caniuse-lite@^1.0.30001426, caniuse-lite@^1.0.30001449: - version "1.0.30001458" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001458.tgz#871e35866b4654a7d25eccca86864f411825540c" - integrity sha512-lQ1VlUUq5q9ro9X+5gOEyH7i3vm+AYVT1WDCVB69XOZ17KZRhnZ9J0Sqz7wTHQaLBJccNCHq8/Ww5LlOIZbB0w== +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001332, caniuse-lite@^1.0.30001426, caniuse-lite@^1.0.30001449: + version "1.0.30001684" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001684.tgz" + integrity sha512-G1LRwLIQjBQoyq0ZJGqGIJUXzJ8irpbjHLpVRXDvBEScFJ9b17sgK6vlx0GAJFE21okD7zXl08rRRUfq6HdoEQ== chalk@^2.0.0: version "2.4.2" @@ -2862,13 +2857,13 @@ pegjs@^0.10.0: integrity sha512-qI5+oFNEGi3L5HAxDwN2LA4Gg7irF70Zs25edhjld9QemOgp0CbvMtbFcMvFtEo1OityPrcCzkQFB8JP/hxgow== "phoenix@file:../deps/phoenix": - version "1.7.11" + version "1.7.14" "phoenix_html@file:../deps/phoenix_html": - version "3.3.3" + version "3.3.4" "phoenix_live_view@file:../deps/phoenix_live_view": - version "0.20.9" + version "0.20.17" picocolors@^1.0.0: version "1.0.0" diff --git a/justfile b/justfile index 2ea38405f0..00d8d00323 100644 --- a/justfile +++ b/justfile @@ -33,11 +33,6 @@ imagemagick: brew @[ -d $(brew --prefix)/opt/imagemagick ] \ || brew install imagemagick -[private] -check-postgres-envs: - @(grep -q postgresql@16 <<< $PATH) \ - || (echo "{{ REDB }}{{ WHITE }}Postgres 16 not present in PATH.{{ RESET }} To fix this, run: {{ GREENB }}{{ WHITE }}direnv allow{{ RESET }}" && exit 127) - export OP_ACCOUNT := "changelog.1password.com" # Create .envrc.secrets with credentials from 1Password @@ -45,16 +40,16 @@ export OP_ACCOUNT := "changelog.1password.com" envrc-secrets: op inject --in-file envrc.secrets.op --out-file .envrc.secrets -[private] -postgres: brew - @[ -d $(brew --prefix)/opt/postgresql@16 ] \ - || brew install postgresql@16 - [private] gpg: brew @[ -d $(brew --prefix)/opt/gpg ] \ || brew install gpg +[private] +icu4c: brew + @brew --prefix icu4c 1> /dev/null 2>&1 \ + || brew install icu4c pkg-config + # https://tldp.org/LDP/abs/html/exitcodes.html [private] asdf: @@ -68,9 +63,9 @@ asdf-shell: brew # Install all system dependencies [group('contributor')] -install: asdf brew imagemagick postgres gpg +install: asdf brew imagemagick gpg icu4c @awk '{ system("asdf plugin-add " $1) }' < .tool-versions - @asdf install + @PKG_CONFIG_PATH="$(brew --prefix icu4c)/lib/pkgconfig:$PKG_CONFIG_PATH" asdf install export ELIXIR_ERL_OPTIONS := if os() == "linux" { "+fnu" } else { "" } @@ -91,25 +86,25 @@ deps: add-oban-pro-repo [private] pg_ctl: @which pg_ctl >/dev/null \ - || (echo "{{ REDB }}{{ WHITE }}Postgres 16 is not installed.{{ RESET }} To fix this, run: {{ GREENB }}{{ WHITE }}just install{{ RESET }}" && exit 127) + || (echo "{{ REDB }}{{ WHITE }}Postgres is not installed.{{ RESET }} To fix this, run: {{ GREENB }}{{ WHITE }}just install{{ RESET }}" && exit 127) # Start Postgres server [group('contributor')] -postgres-up: pg_ctl check-postgres-envs +postgres-up: pg_ctl @(pg_ctl status | grep -q "is running") || pg_ctl start # Stop Postgres server [group('contributor')] -postgres-down: pg_ctl check-postgres-envs +postgres-down: pg_ctl @(pg_ctl status | grep -q "no server running") || pg_ctl stop [private] -postgres-db db: check-postgres-envs +postgres-db db: @(psql --list --quiet --tuples-only | grep -q {{ db }}) \ || createdb {{ db }} -export DB_USER := `whoami` - +export PGUSER := "postgres" +export DB_USER := PGUSER # Delete & replace changelog_dev with a prod db dump [confirm("This DELETEs and REPLACEs changelog_dev with the prod db dump. Are you sure that you want to continue?")] diff --git a/magefiles/tools/main.go b/magefiles/tools/main.go index 2640db000e..1879202894 100644 --- a/magefiles/tools/main.go +++ b/magefiles/tools/main.go @@ -49,9 +49,9 @@ func (v *Versions) Nodejs() string { } // https://www.postgresql.org/docs/release -// Hard-coding & installing via brew (keep hitting icu4c & root permissions with asdf) +// asdf list all postgres func (v *Versions) Postgres() string { - return "16" + return v.toolVersions["postgres"] } // https://github.com/yarnpkg/yarn/releases