-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: Use S3 node store with garage #3498
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
Draft
BYK
wants to merge
14
commits into
master
Choose a base branch
from
byk/feat/s3-nodestore
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+97
−2
Draft
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
364455b
feat: Use S3 node store with garage
BYK 803bef3
lol, fix bash
BYK 58b301c
moar bash
BYK bd414d5
lol
BYK a2ac10d
hate bash
BYK 7b28dfb
fix moar bash
BYK 4a6d337
Add healthcheck to garage service
BYK 595ed68
revert +x
BYK 99576bf
fix healthcheck, fix config
BYK 2a55a40
add env var for garage size
BYK a29cf0b
use better compression level
BYK a0ae9b1
simpler garage config
BYK 20e608b
Merge branch 'master' into byk/feat/s3-nodestore
BYK 8d7c1ff
add migration support
BYK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
metadata_dir = "/var/lib/garage/meta" | ||
data_dir = "/var/lib/garage/data" | ||
db_engine = "sqlite" | ||
BYK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
replication_factor = 1 | ||
# idk why rcp_ is needed without replication but ok | ||
rpc_bind_addr = "[::]:3901" | ||
rpc_public_addr = "0.0.0.0:3901" | ||
# This secret will not ever be used as we are in a single node setup | ||
# so this static value is OK. Don't forget to change it if you ever | ||
# decide to use garage in a multi-node setup. | ||
rpc_secret = "28f2fc651d4f280cea95e166f9113fe589039f9711d6c4f461872c1c5aaf7dec" | ||
|
||
# Setting 0 chooses the default which is 3 for now | ||
compression_level = 0 | ||
|
||
[s3_api] | ||
s3_region = "garage" | ||
api_bind_addr = "[::]:3900" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
echo "${_group}Bootstrapping garage (node store)..." | ||
|
||
$dc up --wait garage postgres | ||
garage="$dc exec garage /garage" | ||
|
||
if [[ $($garage bucket list | tail -1 | awk '{print $1}') != 'nodestore' ]]; then | ||
node_id=$($garage status | tail -1 | awk '{print $1}') | ||
$garage layout assign -z local -c $GARAGE_STORAGE_SIZE "$node_id" | ||
$garage layout apply --version 1 | ||
|
||
# Only touch if no existing nodestore config is found | ||
if ! grep -q "SENTRY_NODESTORE" $SENTRY_CONFIG_PY; then | ||
nodestore_config=$(sed -n '/SENTRY_NODESTORE/,/[}]/{p}' sentry/sentry.conf.example.py) | ||
if [[ $($dc exec postgres psql -qAt -U postgres -c "select exists (select * from nodestore_node limit 1)") = "f" ]]; then | ||
nodestore_config=$(echo -e "$nodestore_config" | sed '$s/\}/ "read_through": True,\n "delete_through": True,\n\}/') | ||
fi | ||
echo "$nodestore_config" >>$SENTRY_CONFIG_PY | ||
fi | ||
|
||
$garage bucket create nodestore | ||
key_info=$($garage key create nodestore-key | head -3 | tail -2) | ||
echo "$key_info" | ||
key_id=$(echo "$key_info" | head -1 | awk '{print $3}') | ||
key_secret=$(echo "$key_info" | tail -1 | awk '{print $3}') | ||
|
||
$garage bucket allow --read --write --owner nodestore --key nodestore-key | ||
|
||
if grep -q "<GARAGE_KEY_ID>" $SENTRY_CONFIG_PY; then | ||
sed -i -e "s/<GARAGE_KEY_ID>/$key_id/" $SENTRY_CONFIG_PY | ||
sed -i -e "s/<GARAGE_SECRET_KEY>/$key_secret/" $SENTRY_CONFIG_PY | ||
echo "Set Garage keys for SENTRY_NODESTORE_OPTIONS in $SENTRY_CONFIG_PY" | ||
fi | ||
else | ||
echo "Node store already exists, skipping..." | ||
fi | ||
|
||
echo "${_endgroup}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
ARG SENTRY_IMAGE | ||
FROM ${SENTRY_IMAGE} | ||
|
||
RUN pip install https://github.com/stayallive/sentry-nodestore-s3/archive/main.zip | ||
|
||
COPY . /usr/src/sentry | ||
|
||
RUN if [ -s /usr/src/sentry/enhance-image.sh ]; then \ | ||
/usr/src/sentry/enhance-image.sh; \ | ||
fi | ||
fi | ||
|
||
RUN if [ -s /usr/src/sentry/requirements.txt ]; then \ | ||
echo "sentry/requirements.txt is deprecated, use sentry/enhance-image.sh - see https://develop.sentry.dev/self-hosted/#enhance-sentry-image"; \ | ||
pip install -r /usr/src/sentry/requirements.txt; \ | ||
fi | ||
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.