Allow using s3 storage when self_hosted

This commit is contained in:
Justin Lex-Hammarskjöld 2025-06-26 01:10:52 +02:00
parent 131e0eb345
commit e314579cec
No known key found for this signature in database
4 changed files with 13 additions and 4 deletions

View file

@ -98,5 +98,7 @@ Rails.application.configure do
config.lograge.enabled = true config.lograge.enabled = true
config.lograge.formatter = Lograge::Formatters::Json.new config.lograge.formatter = Lograge::Formatters::Json.new
config.active_storage.service = ENV['SELF_HOSTED'] == 'true' ? :local : :s3 # Store uploaded files either on the local file system or in S3-compatible object storage
# (see config/storage.yml for options).
config.active_storage.service = ENV.fetch('STORAGE_BACKEND', local)
end end

View file

@ -42,8 +42,9 @@ Rails.application.configure do
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
# Store uploaded files on the local file system (see config/storage.yml for options). # Store uploaded files either on the local file system or in S3-compatible object storage
config.active_storage.service = ENV['SELF_HOSTED'] == 'true' ? :local : :s3 # (see config/storage.yml for options).
config.active_storage.service = ENV.fetch('STORAGE_BACKEND', local)
config.silence_healthcheck_path = '/api/v1/health' config.silence_healthcheck_path = '/api/v1/health'

View file

@ -7,13 +7,14 @@ local:
root: <%= Rails.root.join("storage") %> root: <%= Rails.root.join("storage") %>
# Only load S3 config if not in test environment # Only load S3 config if not in test environment
<% if !Rails.env.test? && ENV['AWS_ACCESS_KEY_ID'] && ENV['AWS_SECRET_ACCESS_KEY'] && ENV['AWS_REGION'] && ENV['AWS_BUCKET'] %> <% if !Rails.env.test? && ENV['AWS_ACCESS_KEY_ID'] && ENV['AWS_SECRET_ACCESS_KEY'] && ENV['AWS_REGION'] && ENV['AWS_BUCKET'] && ENV['AWS_ENDPOINT_URL'] %>
s3: s3:
service: S3 service: S3
access_key_id: <%= ENV.fetch("AWS_ACCESS_KEY_ID") %> access_key_id: <%= ENV.fetch("AWS_ACCESS_KEY_ID") %>
secret_access_key: <%= ENV.fetch("AWS_SECRET_ACCESS_KEY") %> secret_access_key: <%= ENV.fetch("AWS_SECRET_ACCESS_KEY") %>
region: <%= ENV.fetch("AWS_REGION") %> region: <%= ENV.fetch("AWS_REGION") %>
bucket: <%= ENV.fetch("AWS_BUCKET") %> bucket: <%= ENV.fetch("AWS_BUCKET") %>
endpoint: <%= ENV.fetch("AWS_ENDPOINT_URL") %>
<% end %> <% end %>
# Remember not to checkin your GCS keyfile to a repository # Remember not to checkin your GCS keyfile to a repository

View file

@ -160,6 +160,11 @@ spec:
value: photon.komoot.io value: photon.komoot.io
- name: PHOTON_API_USE_HTTPS - name: PHOTON_API_USE_HTTPS
value: "true" value: "true"
# If you have s3-compatible object storage, (e.g. minio or ceph),
# you can set this to "s3" and set the necessary "AWS_" environment variables
# to use s3 storage for imports and exports
- name: STORAGE_BACKEND
value: "local"
image: freikin/dawarich:latest image: freikin/dawarich:latest
imagePullPolicy: Always imagePullPolicy: Always
volumeMounts: volumeMounts: