diff --git a/config/environments/development.rb b/config/environments/development.rb index 9d8c02c9..91ca11e5 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -98,5 +98,7 @@ Rails.application.configure do config.lograge.enabled = true 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 diff --git a/config/environments/production.rb b/config/environments/production.rb index 4d6d0330..d10e3d5b 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -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-Accel-Redirect" # for NGINX - # Store uploaded files on the local file system (see config/storage.yml for options). - 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) config.silence_healthcheck_path = '/api/v1/health' diff --git a/config/storage.yml b/config/storage.yml index 0d9a1fec..78b402ab 100644 --- a/config/storage.yml +++ b/config/storage.yml @@ -7,13 +7,14 @@ local: root: <%= Rails.root.join("storage") %> # 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: service: S3 access_key_id: <%= ENV.fetch("AWS_ACCESS_KEY_ID") %> secret_access_key: <%= ENV.fetch("AWS_SECRET_ACCESS_KEY") %> region: <%= ENV.fetch("AWS_REGION") %> bucket: <%= ENV.fetch("AWS_BUCKET") %> + endpoint: <%= ENV.fetch("AWS_ENDPOINT_URL") %> <% end %> # Remember not to checkin your GCS keyfile to a repository diff --git a/docs/How_to_install_Dawarich_in_k8s.md b/docs/How_to_install_Dawarich_in_k8s.md index fa108f15..94333b2a 100644 --- a/docs/How_to_install_Dawarich_in_k8s.md +++ b/docs/How_to_install_Dawarich_in_k8s.md @@ -160,6 +160,11 @@ spec: value: photon.komoot.io - name: PHOTON_API_USE_HTTPS 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 imagePullPolicy: Always volumeMounts: