Hi everyone
I have a question about adding path_prefix in docker-compose for aws s3
I know how to add it in file_store.yml
so I use this configuration to save files from CANVAS LMS to dir-A directory :
development:
storage: s3
path_prefix: attachments/dir-A/
what I need it’s to change this path_prefix for every docker-compose to tell every organization where to save files in aws s3
for example :
Organization A => s3://bucket-name/account_1/attachments/dir-A/ Organization B => s3://bucket-name/account_1/attachments/dir-B/ Organization C => s3://bucket-name/account_1/attachments/dir-C/
So like I said above, I know how to save files in from first organization to his directory dir-A, but I used by Dockerfile by building images with amazon_s3.yml and file_store.yml
And now I need to change just the path_prefix for every organization
is that possible and how please?
docker-compose used :
version: ‘3.5’
services:
db:
image: postgres:9.6
environment:
- POSTGRES_USER=foo
- POSTGRES_PASSWORD=foo
- POSTGRES_DB=foo
volumes:
- db:/var/lib/postgresql/data
redis:
image: redis:3.2.4
command: redis-server --appendonly yes
volumes:
- ./.data/redis:/data
app: &app
image: registry/image:1.1
command: bash -c "./wait-for-it.sh -t 40 db:5432 && /usr/src/entrypoint"
environment:
- RAILS_ENV=production
- DB_DRIVER=postgresql
- DB_HOST=db
- DB_PORT=5432
- DB_USERNAME=foo
- DB_PASSWORD=foo
- DB_NAME=foo
- REDIS_SERVER=redis://redis:6379
- MAIL_SERVER=in-v3.mailjet.com
- MAIL_PORT=587
- MAIL_USERNAME=foo
- MAIL_PASSWORD=foo
- MAIL_DOMAIN=in-v3.mailjet.com
- MAIL_DEFAULT_SENDER_ADDRESS=************
- MAIL_DEFAULT_SENDER_NAME=*******
- DOMAIN=*******
- DOMAIN_RCE=*******
- PASSENGER_STARTUP_TIMEOUT=300
depends_on:
- db
- redis
volumes:
- theme:/usr/src/app/public/dist/brandable_css
- files:/usr/src/app/data/files
- ./.data/tmp:/usr/src/app/tmp
worker:
<<: *app
command: bundle exec script/delayed_job run
volumes:
db:
driver: local
theme:
driver: local
files:
driver: local
amazon_s3.yml :
development:
bucket_name: MyBucket
access_key_id: ******
secret_access_key: ******
region: eu-central-1
test:
bucket_name: MyBucket
access_key_id: ******
secret_access_key: ******
region: eu-central-1
production:
bucket_name: MyBucket
access_key_id: ******
secret_access_key: ******
region: eu-central-1
file_store.yml :
development:
storage: s3
path_prefix: attachments/dir-A/
test:
storage: s3
path_prefix: attachments/dir-A/
production:
storage: s3
path_prefix: attachments/dir-A/
## amazon storage example. requires valid amazon_s3.yml
#
# production:
# storage: s3
Dockerfile :
FROM registry/image:1.1
ENV APP_HOME /usr/src/app
COPY --chown=docker:docker ./amazon_s3.yml ${APP_HOME}/config/amazon_s3.yml
COPY --chown=docker:docker ./file_store.yml ${APP_HOME}/config/file_store.yml