Skip to content

Commit ffc3051

Browse files
author
josh
authored
feat: direnv setup instructions (#1499)
1 parent f4ab58d commit ffc3051

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

src/collections/_documentation/development/contribute/environment.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ sidebar_order: 1
99

1010
Follow [the Docker file in the repository](https://github.com/getsentry/sentry/blob/master/docker/Dockerfile) but instead of creating and installing a wheel, install the package in editable mode (`pip install . -e`).
1111

12-
### Macintosh OS X
12+
### macOS
1313

1414
{% capture __alert_content -%}
1515
macOS Catalina will recommend that you use the zsh shell, instead of bash. While the differences are minimal, this guide only covers bash, so for best results please use bash. You can verify this by typing `echo $SHELL`, which should result in `/bin/bash`.
@@ -36,7 +36,7 @@ It's important that you remain in the repo's root directory for the rest of the
3636
%}
3737

3838

39-
### Macintosh OS X - System Dependencies
39+
### macOS - System Dependencies
4040

4141
Install [Homebrew](http://brew.sh), and then run `brew bundle` to install the various system packages as listed in sentry's `Brewfile`.
4242

@@ -45,7 +45,7 @@ One thing that requires manual attention is `docker`, which should have just bee
4545
You can verify that docker is running by running `docker ps`. If it doesn't error with something like `Error response from daemon: dial unix docker.raw.sock: connect: connection refused`, you're good to continue.
4646

4747

48-
### Macintosh OS X - Python
48+
### macOS - Python
4949

5050
Unfortunately, homebrew recently removed Python 2. While some versions of macOS ship with Python 2, it's recommended to not use the system's installation. Sentry also requires a specific version of Python, as shown in the file `.python-version`, and this may differ from the system's python.
5151

@@ -76,7 +76,7 @@ PATH="" exec /bin/bash -l
7676
If it worked, running `which python` should result in something like `/Users/you/.pyenv/shims/python`.
7777

7878

79-
### Macintosh OS X - NodeJS
79+
### macOS - NodeJS
8080

8181
Sentry also requires a specific version of NodeJS. Like pyenv, we recommend using [volta](https://github.com/volta-cli/volta) to install and manage node versions. Unfortunately, brew doesn't provide volta yet, but installation is quite easy. Run:
8282

@@ -108,7 +108,7 @@ node -v
108108
Volta intercepts this and automatically downloads and installs the node version in sentry's `package.json`.
109109

110110

111-
### Macintosh OS X - Python (virtual environment)
111+
### macOS - Python (virtual environment)
112112

113113
You're now ready to create a python virtual environment. Run:
114114

@@ -126,7 +126,7 @@ source .venv/bin/activate
126126
If everything worked, running `which python` should now result in something like `/Users/you/whereever-you-cloned-sentry/.venv/bin/python`.
127127

128128

129-
### Macintosh OS X - Final Bootstrap
129+
### macOS - Final Bootstrap
130130

131131
The last step is to run `make bootstrap`. This will take a long time, as it basically installs sentry and all of its dependencies, starts up external services, and preps databases.
132132

@@ -139,6 +139,25 @@ The last step is to run `make bootstrap`. This will take a long time, as it basi
139139
%}
140140

141141

142+
### macOS - direnv (optional, but recommended)
143+
144+
We have a [direnv](https://github.com/direnv/direnv) configuration for Sentry. It automatically sets some helpful environment variables for you, automatically activates your virtual environment, and does some simple state checking to guide you towards the expected development environment.
145+
146+
To install it, run `brew install direnv`. You'll want to add this to the end of your `~/.bashrc` file:
147+
148+
```bash
149+
eval "$(direnv hook bash)"
150+
```
151+
152+
And after doing that, reload your shell:
153+
154+
```bash
155+
PATH="" exec /bin/bash -l
156+
```
157+
158+
Now, direnv should automatically execute (or you might need to type `direnv allow`). If you've followed this guide correctly, it should succeed.
159+
160+
142161
## Running the Development Server
143162

144163
{% capture __alert_content -%}

0 commit comments

Comments
 (0)