Skip to content

Brewfile for dependency management#8475

Merged
night-jellyfish merged 4 commits intomainfrom
brittany/brewfile_for_dependency_management
May 30, 2023
Merged

Brewfile for dependency management#8475
night-jellyfish merged 4 commits intomainfrom
brittany/brewfile_for_dependency_management

Conversation

@night-jellyfish
Copy link
Contributor

@night-jellyfish night-jellyfish commented May 23, 2023

🛠 Summary of changes

We're looking at adding a dependency soon, which could cause some issues
with local development for folks if they didn't know they need to
manually install it. We thought adding a Brewfile and having the setup
script run brew bundle would help mitigate the difficulties of that
change. There's a bonus in that it's self documenting too!

It would also:

  • make initial setup for new developers much more straightforward
  • make future changes to dependencies easier to manage
  • prevents a mixture of dependencies installed in different ways (for
    instance, I think when I initially set things up I ended up with one
    version of postgres downloaded manually from the doc-linked site, and
    another via homebrew)

Notes:

  • As pointed out by @pauldoomgov, we use postgres@13 in production,
    so it would be good to encourage use of 13 locally. The method I chose
    to try and enforce this was using brew services stop --all before
    starting the services we want (where I specify 13).
  • I tried various combinations of having these dependencies installed /
    uninstalled before running make setup and the script seems to still
    work. But I don't have a machine without MacOS to test on to make sure
    it works for everyone.
  • While making relevant doc changes, I also fixed up some syntax for
    readability / easy re-ordering of steps

*Summary of changes*

We're looking at adding a dependency soon, which could cause some issues
with local development for folks if they didn't know they need to
manually install it. We thought adding a `Brewfile` and having the setup
script run `brew bundle` would help mitigate the difficulties of that
change. There's a bonus in that it's self documenting too!

It would also:

- make initial setup for new developers much more straightforward
- make future changes to dependencies easier to manage
- prevents a mixture of dependencies installed in different ways (for
instance, I think when I initially set things up I ended up with one
version of postgres downloaded manually from the doc-linked site, and
another via homebrew)

Notes:

- As pointed out by @pauldoomgov, we use [postgres@13 in production](https://github.com/18F/identity-devops/blob/33ba02736b37f3a79c50479892a03c6f3e920041/terraform/app/rds-variables.tf#L82),
so it would be good to encourage use of 13 locally. The method I chose
to try and enforce this was using `brew services stop --all` before
starting the services we want (where I specify 13).
- I tried various combinations of having these dependencies installed /
uninstalled before running `make setup` and the script seems to still
work. But I don't have a machine without MacOS to test on to make sure
it works for everyone.
- While making relevant doc changes, I also fixed up some syntax for
readability / easy re-ordering of steps
@night-jellyfish night-jellyfish force-pushed the brittany/brewfile_for_dependency_management branch from d441f5c to 7566352 Compare May 30, 2023 16:50
@night-jellyfish night-jellyfish marked this pull request as ready for review May 30, 2023 16:54
Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

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

LGTM. I tried it out and it ended up downgrading me from postgres 14 to postgres 13, but it did work! I forget what version we are running in prod

@@ -0,0 +1,6 @@
brew 'postgresql@13'
Copy link
Contributor

Choose a reason for hiding this comment

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

somehow I was on postgres 14 (which I think is what matches prod right?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for trying it out, @zachmargolis ! 🎉 I'm glad it worked for you.

We are actually using postgres@13 in production. In the Slack thread regarding this ticket, it was mentioned that we may be moving to 14 in the coming months but are not there yet.

Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>
@night-jellyfish night-jellyfish merged commit 0ae8aec into main May 30, 2023
@night-jellyfish night-jellyfish deleted the brittany/brewfile_for_dependency_management branch May 30, 2023 19:03
night-jellyfish pushed a commit that referenced this pull request May 31, 2023
In #8475, we chose to keep Postgres at version 13 so that it could
[match production](https://github.com/18F/identity-devops/blob/33ba02736b37f3a79c50479892a03c6f3e920041/terraform/app/rds-variables.tf#L82).

However, when trying to continue on the `postgis` work, I found that
when installing `postgis`, `brew` installs 14 anyway, as a dependency of
`postgis`. There doesn't seem to be an easy way to tell Brew not to
install 14, or postgis to use 13 instead. This becomes an issue then
when the app is using 13, but `postgis` is using 14.

I thought it'd be better to change this now than wait for the postgis
work to be ready, as it would potentially stop folks from installing an
extra version of postgres.

There may be another workaround, but after reading [a homebrew issue
about versioning issues with postgres and postgis](Homebrew/homebrew-core#86709), which included
suggestions like [making your own copy of `postgis` and changing its
dependencies](Homebrew/homebrew-core#86709 (comment)), it seemed like upgrading `postgres` was a
better solution.

While it will mean dev is on a different version than prod, most folks
have been using 14 or even 15, so we don't expect issues to arise.
night-jellyfish added a commit that referenced this pull request Jun 1, 2023
changelog: Internal, Application dependencies, Upgrade postgres to version 14

In #8475, we chose to keep Postgres at version 13 so that it could
[match production](https://github.com/18F/identity-devops/blob/33ba02736b37f3a79c50479892a03c6f3e920041/terraform/app/rds-variables.tf#L82).

However, when trying to continue on the `postgis` work, I found that
when installing `postgis`, `brew` installs 14 anyway, as a dependency of
`postgis`. There doesn't seem to be an easy way to tell Brew not to
install 14, or postgis to use 13 instead. This becomes an issue then
when the app is using 13, but `postgis` is using 14.

I thought it'd be better to change this now than wait for the postgis
work to be ready, as it would potentially stop folks from installing an
extra version of postgres.

There may be another workaround, but after reading [a homebrew issue
about versioning issues with postgres and postgis](Homebrew/homebrew-core#86709), which included
suggestions like [making your own copy of `postgis` and changing its
dependencies](Homebrew/homebrew-core#86709 (comment)), it seemed like upgrading `postgres` was a
better solution.

While it will mean dev is on a different version than prod, most folks
have been using 14 or even 15, so we don't expect issues to arise.
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