Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
akulkarni7a committed Sep 24, 2024
0 parents commit 88edb61
Show file tree
Hide file tree
Showing 14,371 changed files with 4,048,651 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
22 changes: 22 additions & 0 deletions .craft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
minVersion: '0.23.1'
releaseBranchPrefix: releases
changelog: CHANGES
changelogPolicy: auto
statusProvider:
name: github
config:
contexts:
- 'self-hosted'
artifactProvider:
name: none
targets:
- id: release
name: docker
source: ghcr.io/getsentry/sentry-self-hosted
target: getsentry/sentry
- id: latest
name: docker
source: ghcr.io/getsentry/sentry-self-hosted
target: getsentry/sentry
targetFormat: '{{{target}}}:latest'
- name: github
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/.devenv
/.dockerignore
/.git
/.gitignore
/.venv
/fixtures
/node_modules
/tests
208 changes: 208 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
#!/not/executable/bash
# This is the .envrc for sentry, for use with direnv.
# It's responsible for enforcing a standard dev environment by checking as much state as possible, and either performing
# initialization (e.g. activating the venv) or giving recommendations on how to reach the desired state.
# It also sets useful environment variables.
# If you'd like to override or set any custom environment variables, this .envrc will read a .env file at the end.
set -e

# Upgrading Mac can uninstall the Command Line Tools, thus, removing our access to git
# The message talks about xcrun, however, we can use the lack of git as a way to know that we need this
# xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools),
# missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
if [ "$(uname -s)" == "Darwin" ] && [ ! -f "/Library/Developer/CommandLineTools/usr/bin/git" ]; then
echo -e "$(tput setaf 1)\nERROR: Complete the interactive installation (10+ mins) of the Command Line Tools.$(tput sgr0)"
xcode-select --install
return 1
fi

SENTRY_ROOT="$(
cd "$(dirname "${BASH_SOURCE[0]}")"
pwd -P
)"

source "${SENTRY_ROOT}/scripts/lib.sh"

# XXX: we can't trap bash EXIT, because it'll override direnv's finalizing routines.
# consequently, using "exit" anywhere will skip this notice from showing.
# so need to use set -e, and return 1.
trap notice ERR

complete_success="yup"

help_message() {
cat <<EOF
For more help run: make direnv-help
EOF
}

failure_message() {
cat <<EOF
${red}${bold}direnv wasn't able to complete execution.
You may have been given some recommendations in the error message.
Follow them, and then you'll need to re-run direnv by running "direnv allow".${reset}
EOF
help_message
}

notice() {
[ $? -eq 0 ] && return
failure_message
}

debug() {
if [ "${SENTRY_DIRENV_DEBUG-}" ]; then
echo -e "${@}"
fi
}

info() {
echo -e "${bold}${*}${reset}"
}

warn() {
echo -e "${yellow}${*}${reset}" >&2
complete_success="nope"
}

die() {
echo -e "${red}${bold}FATAL: ${*}${reset}" >&2
return 1
}

show_commands_info() {
echo -e "\n${red}Run the following commands to bring your environment up-to-date:"
for cmd in "${commands_to_run[@]}"; do
warn " ${red}$cmd"
done
echo ""
}

### Environment ###

commands_to_run=()

# Always write stdout immediately. Very helpful for debugging
export PYTHONUNBUFFERED=1

# make sure we don't have any conflicting PYTHONPATH
unset PYTHONPATH

# don't check pypi for a potential new pip version; low-hanging fruit to save a bit of time
export PIP_DISABLE_PIP_VERSION_CHECK=on

# increase node's memory limit, required for our webpacking
export NODE_OPTIONS=--max-old-space-size=4096

# Frontend hot module reloader using `react-refresh`
# Enable this by default for development envs (CI/deploys do not use envrc)
export SENTRY_UI_HOT_RELOAD=1

### You can override the exported variables with a .env file
# All exports should happen before here unless they're safeguarded (see devenv error reporting below)
if [ -f "${SENTRY_ROOT}/.env" ]; then
info "Loading variables from ${SENTRY_ROOT}/.env"
dotenv "${SENTRY_ROOT}/.env"
fi

## Notify of reporting to Sentry
if [ -n "${SENTRY_DEVENV_NO_REPORT+x}" ]; then
debug "No development environment errors will be reported (since you've defined SENTRY_DEVENV_NO_REPORT)."
_SENTRY_LOG_FILE=''
else
# Since direnv traps the EXIT signal we place the temp file under /tmp for the odd time
# the script will use the EXIT path
_SENTRY_LOG_FILE=$(mktemp /tmp/sentry.envrc.$$.out || mktemp /tmp/sentry.envrc.XXXXXXXX.out)
exec > >(tee "$_SENTRY_LOG_FILE")
exec 2>&1
debug "Development errors will be reported to Sentry.io. If you wish to opt-out, set SENTRY_DEVENV_NO_REPORT as an env variable."
# This will allow `sentry devservices` errors to be reported
export SENTRY_DEVSERVICES_DSN=https://23670f54c6254bfd9b7de106637808e9@o1.ingest.sentry.io/1492057
fi


### System ###

for pkg in \
make \
docker \
chromedriver \
openssl; do
if ! require "$pkg"; then
die "You seem to be missing the system dependency: ${pkg}
Please install homebrew, and run brew bundle."
fi
done

### Python ###

if [ -f .venv/bin/devenv ]; then
DEVENV=.venv/bin/devenv
else
DEVENV=devenv
fi

export SENTRY_DEVENV_HOME="${SENTRY_DEVENV_HOME:-$XDG_DATA_HOME/sentry-devenv}"
PATH_add "${SENTRY_DEVENV_HOME}/bin"
if ! command -v "$DEVENV" >/dev/null; then
die '
Please install the devenv tool:
https://github.com/getsentry/devenv#install
'
fi

PATH_add .venv/bin
export VIRTUAL_ENV="$PWD/.venv"

if ! require sentry; then
warn "Your virtualenv is activated, but sentry doesn't seem to be installed."
commands_to_run+=("devenv sync")
fi

# this is the standard repo-local bin root
PATH_add "${PWD}/.devenv/bin"

### pre-commit ###

debug "Checking pre-commit..."

if ! require pre-commit; then
warn "Looks like you don't have pre-commit installed."
commands_to_run+=("devenv sync")
fi

python3 -m tools.docker_memory_check

### Node ###

debug "Checking node..."

if ! require node; then
die "You don't seem to have node installed. Please run devenv sync."
fi

if ! node -pe "process.exit(Number(!(process.version == 'v' + require('./.volta.json').volta.node )))"; then
die "Unexpected $(command -v node) version. Please run devenv sync."
fi

if [ ! -x "node_modules/.bin/webpack" ]; then
die "You don't seem to have yarn packages installed. Please run devenv sync."
fi

PATH_add node_modules/.bin

# These are commands that can take a significant amount of time
if [ ${#commands_to_run[@]} -ne 0 ]; then
show_commands_info
fi

if [ "${complete_success}" != "yup" ]; then
help_message
warn "\nPartial success. The virtualenv is active, however, you're not fully up-to-date (see messages above)."
else
echo "${green}${bold}SUCCESS!${reset}"
fi

# Since we can't use an EXIT routine we need to guarantee we delete the file here
[ -z "$_SENTRY_LOG_FILE" ] || rm -f "$_SENTRY_LOG_FILE"
9 changes: 9 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**/dist/**/*
**/vendor/**/*
**/tests/**/fixtures/**/*
!.github
*.d.ts
config/chartcuterie/config.js
fixtures/profiles/embedded.js
fixtures/artifact_bundle_debug_ids/**/*
fixtures/artifact_bundle_duplicated_debug_ids/**/*
Loading

0 comments on commit 88edb61

Please sign in to comment.