minioをインストール
docker pull minio/minio:edge
docker run -p 9000:9000 minio/minio:edge server /data
Dockerfile
RUN mkdir -p /tmps3
docker-compose.yaml
minio:
image: minio/minio:latest
ports:
- "9000:9000"
volumes:
- "./tmps3:/export"
command: server /data
environment:
- "{AccessKey}"
- "{SecretKey}"
Gemfile
gem 'asset_sync'
asset_sync.yaml
defaults: &defaults
fog_provider: 'AWS'
aws_access_key_id: '{AccessKey}'
aws_secret_access_key: '{SecretKey}'
# To use AWS reduced redundancy storage.
# aws_reduced_redundancy: true
fog_directory: "new-bucket" # バケット名を指定
development:
<<: *defaults
enabled: false
test:
<<: *defaults
enabled: false
staging:
<<: *defaults
fog_directory: "staging-hogehoge"
production:
<<: *defaults
fog_directory: "production-hogehoge"
development.rb
# s3 route
config.action_controller.asset_host = '//localhost:9000/minio/new-bucket/'
dockerを起動
docker-compose up
ローカルからminioにファイルをアップロード
# s3cmdをインストール
brew install s3cmd
# 設定
s3cmd --configure
Access Key S3のアクセスキー指定
Secret Key S3のシークレットアクセスキーを指定
Encryption password GPG encryptionを用いる事でデータを暗号化してくれる。(とりあえず空欄でおk)
Path to GPG program [/usr/bin/gpg] GPGの場所を指定。(とりあえず空欄でおk)
Use HTTPS protocol [No] S3への通信をHTTPSにするか否か
HTTP Proxy server name Proxyを使う場合はその指定
# s3cmdが使えることを確認
s3cmd ls
# アップロード
s3cmd put --recursive stylesheets/ s3://zeroone-views/assets/stylesheets/