Skip to content

Commit

Permalink
Different approach to editing permissions of docker volumes (#3084)
Browse files Browse the repository at this point in the history
* different approach to editing permissions of docker volumes
  • Loading branch information
hubertdeng123 committed May 29, 2024
1 parent ede1e6f commit 0dabb5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ jobs:
uses: actions/checkout@v4

- name: Install current ref
run: |
# Hacky way to get around permissioning issues in update-docker-volume-permissions.sh script
sudo -E ./install.sh
run: ./install.sh

integration-test:
if: github.repository_owner == 'getsentry'
Expand Down
11 changes: 2 additions & 9 deletions install/update-docker-volume-permissions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,8 @@ echo "${_group}Ensuring Kafka and Zookeeper volumes have correct permissions ...

# Only supporting platforms on linux x86 platforms and not apple silicon. I'm assuming that folks using apple silicon are doing it for dev purposes and it's difficult
# to change permissions of docker volumes since it is run in a VM.
if [[ "$DOCKER_PLATFORM" = "linux/amd64" && -n "$(docker volume ls -q -f name=sentry-zookeeper)" && -n "$(docker volume ls -q -f name=sentry-kafka)" ]]; then
docker_root_dir=$(docker info --format '{{.DockerRootDir}}')
zookeeper_data_dir="${docker_root_dir}/volumes/sentry-zookeeper/_data"
kafka_data_dir="${docker_root_dir}/volumes/sentry-kafka/_data"
zookeeper_log_data_dir="${docker_root_dir}/volumes/${COMPOSE_PROJECT_NAME}_sentry-zookeeper-log/_data"
chmod -R a+w $zookeeper_data_dir $kafka_data_dir $zookeeper_log_data_dir && returncode=$? || returncode=$?
if [[ $returncode == "1" ]]; then
echo "WARNING: Error when setting appropriate permissions for zookeeper, kafka, and zookeeper log docker volumes. This may corrupt your self-hosted install. See https://github.com/confluentinc/kafka-images/issues/127 for context on why this was added."
fi
if [[ -n "$(docker volume ls -q -f name=sentry-zookeeper)" && -n "$(docker volume ls -q -f name=sentry-kafka)" ]]; then
docker run --rm -v "sentry-zookeeper:/sentry-zookeeper-data" -v "sentry-kafka:/sentry-kafka-data" -v "${COMPOSE_PROJECT_NAME}_sentry-zookeeper-log:/sentry-zookeeper-log-data" busybox chmod -R a+w /sentry-zookeeper-data /sentry-kafka-data /sentry-zookeeper-log-data
fi

echo "${_endgroup}"

1 comment on commit 0dabb5a

@stumbaumr
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just saw that unconditional chmod...
...how about handling it like suggested here for the chown...

Please sign in to comment.