After migration 10.1.0 to 21.5.1 internal errors FileNotFoundError /avatar/{avatar_id}/

Hello,

A few days ago I have made migration our on-premise Sentry from 10.1.0 to 20.10.1 and next to 21.5.1. Now I got issues in internal project:

FileNotFoundError */avatar/{avatar_id}/*

[Errno 2] No such file or directory: '/data/files/18043/18828/3833d5c8447e46b6ae12e296c163597c'

How can i fix this?

Sounds like you have data or permission issues with your sentry-data volume.

You need these changes fix(data): Use `/data` for persisting files and file caches by BYK · Pull Request #295 · getsentry/onpremise · GitHub

Hi @BYK

Thanks for quick answer. I have checked the files and:

docker-compose.yml - has correct form
sentry/config.yml - has correct form

but my install.sh has:

#!/usr/bin/env bash
set -e
if [[ -n "$MSYSTEM" ]]; then
  echo "Seems like you are using an MSYS2-based system (such as Git Bash) which is not supported. Please use WSL instead.";
  exit 1
fi

source "$(dirname $0)/install/_lib.sh"  # does a `cd .../install/`, among other things

source parse-cli.sh
source error-handling.sh
source check-minimum-requirements.sh
source create-docker-volumes.sh
source ensure-files-from-examples.sh
source generate-secret-key.sh
source replace-tsdb.sh
source update-docker-images.sh
source build-docker-images.sh
source turn-things-off.sh
source set-up-zookeeper.sh
source bootstrap-snuba.sh
source create-kafka-topics.sh
source upgrade-postgres.sh
source set-up-and-migrate-database.sh
source migrate-file-storage.sh
source relay-credentials.sh
source geoip.sh
source wrap-up.sh

Where should I add the migration part, on beginning, or end, or somewhere in de middle?

Your install.sh file is fine. This means it already has the patch in.

What do you mean by “correct form”. Have you checked those variables?

Also can you try running the following manually:

docker run --rm -it -v sentry-data:/data alpine ash -c "mkdir -p /tmp/files; mv /data/* /tmp/files/; mv /tmp/files /data/files"

This means that I have these changes in both files:

sentry/config.yml

################
# File storage #
################

# Uploaded media uses these `filestore` settings. The available
# backends are either `filesystem` or `s3`.

filestore.backend: 'filesystem'
filestore.options:
  location: '/data/files'
dsym.cache-path: '/data/dsym-cache'
releasefile.cache-path: '/data/releasefile-cache'

In docker-compouse.yml

version: "3.4"
x-restart-policy: &restart_policy
  restart: unless-stopped
x-sentry-defaults: &sentry_defaults
  <<: *restart_policy
  image: "$SENTRY_IMAGE"
  depends_on:
    - redis
    - postgres
    - memcached
    - smtp
    - snuba-api
    - snuba-consumer
    - snuba-outcomes-consumer
    - snuba-sessions-consumer
    - snuba-transactions-consumer
    - snuba-subscription-consumer-events
    - snuba-subscription-consumer-transactions
    - snuba-replacer
    - symbolicator
    - kafka
  entrypoint: "/etc/sentry/entrypoint.sh"
  command: ["run", "web"]
  environment:
    PYTHONUSERBASE: "/data/custom-packages"
    SENTRY_CONF: "/etc/sentry"
    SNUBA: "http://snuba-api:1218"
    # Leaving the value empty to just pass whatever is set
    # on the host system (or in the .env file)
    SENTRY_EVENT_RETENTION_DAYS:
  volumes:
    - "sentry-data:/data"
    - "./sentry:/etc/sentry"
    - "./geoip:/geoip:ro"

I will try run the migration manually, as you wrote

1 Like

Hi @BYK

Manually migration didn’t help. I got the error for the same file all time. Can I manually create the file?