Skip to content

Commit

Permalink
feat(devservices): Support new devservices for devenv sync (#81022)
Browse files Browse the repository at this point in the history
bumps devservices to 1.0.3 and supports new devservices for devenv sync
as long as `USE_NEW_DEVSERVICES` is set to `1`
  • Loading branch information
hubertdeng123 authored Nov 19, 2024
1 parent 1d5c98e commit 1922b87
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 14 deletions.
43 changes: 31 additions & 12 deletions devenv/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def main(context: dict[str, str]) -> int:

FRONTEND_ONLY = os.environ.get("SENTRY_DEVENV_FRONTEND_ONLY") is not None

USE_NEW_DEVSERVICES = os.environ.get("USE_NEW_DEVSERVICES") == "1"

from devenv.lib import node

node.install(
Expand Down Expand Up @@ -253,18 +255,35 @@ def main(context: dict[str, str]) -> int:
print("Skipping python migrations since SENTRY_DEVENV_FRONTEND_ONLY is set.")
return 0

# TODO: check healthchecks for redis and postgres to short circuit this
proc.run(
(
f"{venv_dir}/bin/{repo}",
"devservices",
"up",
"redis",
"postgres",
),
pathprepend=f"{reporoot}/.devenv/bin",
exit=True,
)
if USE_NEW_DEVSERVICES:
# Ensure old sentry devservices is not being used, otherwise ports will conflict
proc.run(
(
f"{venv_dir}/bin/{repo}",
"devservices",
"down",
),
pathprepend=f"{reporoot}/.devenv/bin",
exit=True,
)
proc.run(
(f"{venv_dir}/bin/devservices", "up", "--mode", "migrations"),
pathprepend=f"{reporoot}/.devenv/bin",
exit=True,
)
else:
# TODO: check healthchecks for redis and postgres to short circuit this
proc.run(
(
f"{venv_dir}/bin/{repo}",
"devservices",
"up",
"redis",
"postgres",
),
pathprepend=f"{reporoot}/.devenv/bin",
exit=True,
)

if not run_procs(
repo,
Expand Down
7 changes: 7 additions & 0 deletions devservices/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@ x-sentry-service-config:
mode: containerized
postgres:
description: Database used to store Sentry data
redis:
description: Shared instance of redis used by sentry services
remote:
repo_name: sentry-shared-redis
branch: main
repo_link: [email protected]:getsentry/sentry-shared-redis.git
modes:
default: [snuba, postgres, relay]
migrations: [postgres, redis]

services:
postgres:
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev-frozen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ cryptography==43.0.1
cssselect==1.0.3
cssutils==2.9.0
datadog==0.49.1
devservices==1.0.2
devservices==1.0.3
distlib==0.3.8
distro==1.8.0
django==5.1.1
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--index-url https://pypi.devinfra.sentry.io/simple

sentry-devenv>=1.13.0
devservices>=1.0.2
devservices>=1.0.3

covdefaults>=2.3.0
docker>=7
Expand Down

0 comments on commit 1922b87

Please sign in to comment.