Skip to content
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

Enable team members to replace changelog_dev with a prod db dump #533

Merged
merged 2 commits into from
Nov 27, 2024

Conversation

gerhard
Copy link
Member

@gerhard gerhard commented Nov 24, 2024

There is a single command to run:

just restore-dev-db-from-prod

This implies that:

  • direnv.net is hooked into the shell -just envrc-secrets has already run & .envrc.secrets exists
  • Posgres 16.5 has installed using just install

Part of this change we exposed a few more private recipes and made it clear who they are meant for:

  • contributor means anyone that wants to play with this repo locally
  • team means Adam, Jerod & Gerhard

We also added just add-oban-pro-repo so that we make this integration easier for team members - I always forget about it!


How does this work on a fresh Mac 💻 ?

just-restore-dev-db-from-prod.mp4

@gerhard gerhard requested a review from jerodsanto November 24, 2024 19:45
@gerhard gerhard force-pushed the restore-dev-db-from-prod branch from c8feadf to 680d89f Compare November 24, 2024 19:55
@gerhard
Copy link
Member Author

gerhard commented Nov 24, 2024

Anything that you would like me to change about the DX @adamstac @jerodsanto before merging?

@jerodsanto
Copy link
Member

Overall this LGTM but I'm curious about the Postgres stuff. I have pg installed via asdf so I think the homebrew path stuff won't cut it...

@gerhard
Copy link
Member Author

gerhard commented Nov 26, 2024

Would you be OK to also install Postgres using Homebrew in addition to asdf?

If not, that's OK, I can try to get this to work with an already installed Postgres.

While I didn't capture this in #521, the reason why I removed Postgres install via asdf is that the icu4c dependency stopped working on macOS 14.7. I was hitting the same compilation issues on both ARM & Intel. I could try it out Postgres 16 via asdf again in case the issue was fixed, but since brew install postgres@16 was there & it worked, that was the path of least resistance at the time.

@jerodsanto
Copy link
Member

I'd prefer we focus in on just one installer and since we're using .tool-versions I think it should be asdf. I do have postgres 16 installed via asdf, btw, and no issues with icu4c, fwiw...

@gerhard
Copy link
Member Author

gerhard commented Nov 26, 2024

OK, I'll try Postgres 16 via asdf again. What macOS version are you running? I am assuming that it's ARM.

FWIW, we still need to install imagemagick using Homebrew since it never worked using asdf.

@gerhard
Copy link
Member Author

gerhard commented Nov 26, 2024

OK, Postgres 16.5 (same as prod) is now managed by asdf.

Want to try running this locally now @jerodsanto ?

There is a single command to run:

    just restore-dev-db-from-prod

This implies that:
- direnv.net is hooked into the shell
-`just envrc-secrets` has already run & `.envrc.secrets` exists
- Posgres 16 has been installed using `just postgres`

Part of this change we exposed a few more private recipes and made it
clear who they are meant for:
- `contributor` means anyone that wants to play with this repo locally
- `team` means Adam, Jerod & Gerhard

We also added `just add-oban-pro-repo` so that we make this integration
easier for team members - I always forget about it!

Signed-off-by: Gerhard Lazu <gerhard@changelog.com>
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 <gerhard@changelog.com>
@jerodsanto jerodsanto force-pushed the restore-dev-db-from-prod branch from 44ca44d to c1aaeb7 Compare November 27, 2024 16:19
@jerodsanto
Copy link
Member

It works!

@jerodsanto jerodsanto merged commit 3440f5e into thechangelog:master Nov 27, 2024
4 checks passed
@gerhard gerhard deleted the restore-dev-db-from-prod branch November 29, 2024 07:08
gerhard added a commit to gerhard/changelog.com that referenced this pull request Nov 29, 2024
    just dev-with-neon-branch gerhard-2024-11-29

To create a new Neon branch, run:

    just neon-create-branch

All the new commands that go well together:

    [team]
    dev-with-neon-branch branch                  # Run app in dev mode with $branch
    neon-branch-connection branch *ARGS          # Show $branch connection details
    neon-branches                                # List prod db branches
    neon-create-branch                           # Create a new branch off the prod db

This is a follow-up to:
- thechangelog#533
- thechangelog#508

Signed-off-by: Gerhard Lazu <gerhard@changelog.com>
gerhard added a commit to gerhard/changelog.com that referenced this pull request Nov 29, 2024
Single command:

    just dev-with-neon-branch gerhard-2024-11-29

The above uses a branch that I created on the 29th of November. You can
create a new Neon db branch today, using your $USER, with the following
command:

    just neon-create-branch

This will create e.g. `USER-YYYY-MM-DD` prod db branch.

Here is a list of all the new commands that go well together:

    [team]
    dev-with-neon-branch branch                  # Run app in dev mode with $branch
    neon-branch-connection branch *ARGS          # Show $branch connection details
    neon-branches                                # List prod db branches
    neon-create-branch                           # Create a new branch off the prod db

This change also removes the now redundant way of creating Neon db branches.

This is a follow-up to:
- thechangelog#533
- thechangelog#508

Signed-off-by: Gerhard Lazu <gerhard@changelog.com>
gerhard added a commit to gerhard/changelog.com that referenced this pull request Nov 29, 2024
Single command:

    just dev-with-neon-branch gerhard-2024-11-29

The above uses a branch that I created on the 29th of November. You can
create a new Neon db branch today, using your `$USER`, with the following
command:

    just neon-create-branch

This will create e.g. `USER-YYYY-MM-DD` prod db branch.

Here is a list of all the new commands that go well together:

    [team]
    dev-with-neon-branch branch                  # Run app in dev mode with $branch
    neon-branch-connection branch *ARGS          # Show $branch connection details
    neon-branches                                # List prod db branches
    neon-create-branch                           # Create a new branch off the prod db

This change also removes the now redundant way of creating Neon db branches.

Follow-up to:
- thechangelog#533
- thechangelog#508

Signed-off-by: Gerhard Lazu <gerhard@changelog.com>
jerodsanto pushed a commit that referenced this pull request Dec 5, 2024
Single command:

    just dev-with-neon-branch gerhard-2024-11-29

The above uses a branch that I created on the 29th of November. You can
create a new Neon db branch today, using your `$USER`, with the following
command:

    just neon-create-branch

This will create e.g. `USER-YYYY-MM-DD` prod db branch.

Here is a list of all the new commands that go well together:

    [team]
    dev-with-neon-branch branch                  # Run app in dev mode with $branch
    neon-branch-connection branch *ARGS          # Show $branch connection details
    neon-branches                                # List prod db branches
    neon-create-branch                           # Create a new branch off the prod db

This change also removes the now redundant way of creating Neon db branches.

Follow-up to:
- #533
- #508

Signed-off-by: Gerhard Lazu <gerhard@changelog.com>
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.

2 participants