Skip to content

Instantly share code, notes, and snippets.

@jschee
Last active April 27, 2020 04:08
Show Gist options
  • Select an option

  • Save jschee/76b77d421ddad49d4628d33d6bb02e47 to your computer and use it in GitHub Desktop.

Select an option

Save jschee/76b77d421ddad49d4628d33d6bb02e47 to your computer and use it in GitHub Desktop.

Revisions

  1. jschee renamed this gist Apr 27, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. jschee revised this gist Apr 27, 2020. No changes.
  3. jschee revised this gist Jan 18, 2020. No changes.
  4. jschee created this gist Jan 18, 2020.
    44 changes: 44 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    #step_1 create migration

    #rails active_storage:install
    #rails db:migrate


    #step_2 add adapter gem of bucket provider

    # e.g. gem 'activestorage/aliyun'
    # bundle install


    #step_3 configuration

    # access keys credentials setup
    # EDITOR=nano rails credentails:edit

    # create bucket on alioss console
    # name of bucket goes to bucket name in credentials
    # url just copy paste domain of bucket, but also add https://
    # grab access key and access seceret from aliyun. generate thorugh profile/avatar
    # copy/paste to credentails
    # save/exit nano

    # storage.yml (add aliyun credentails)

    # aliyun:
    # service:
    # access_key: <%= Rails.application.credentails.dig(:aliyun, :access_key) %>
    # mode: private(or pibic)
    # ...
    # Rails.application.credentials dig at bottom of storage.yml

    # set rails_master_key= to production server
    # eg dokku set:config appname RAILS_MASTER_KEY=...

    # change active storage settings in environments point to :aliyun


    #step_4 set attachment to model

    # has_one_attached :avatar
    # has_many_attached :photos