dokku-chrome icon indicating copy to clipboard operation
dokku-chrome copied to clipboard

How to change download path

Open JNajera opened this issue 2 years ago • 1 comments

Hello! I'm using Watir with dokku chrome and so far it's amazing. But I have an issue of how to store the download files or change the default. I enable a storage folder on the app that is linked to store the files. Any help will be appreciated.

An example of how I'm running the test:

chrome_url = ENV['CHROME_URL']
@download_directory = Rails.env.production? ? "#{Rails.root.to_s}/storage" : "#{Rails.root.to_s}/tmp"
prefs = {
   'download' => {
      'default_directory' => @download_directory,
      'prompt_for_download' => false,
      'directory_upgrade' => true,
   },
}

args = [ '--headless', '--no-sandbox']

@browser = Watir::Browser.new(:chrome, options: {prefs: prefs, args: args}, url: "#{chrome_url}/webdriver")
@browser.goto "https://www.dwsamplefiles.com/?dl_id=176"

JNajera avatar Mar 23 '23 21:03 JNajera

Hmm. I'm not sure there's any way to get this to work at the moment: the instance of Chrome is running within a Docker container, and there's no shared storage between that container and any of the other containers (including your app). I don't think dokku's own storage plugin will let you mount volumes in services either, only in your app containers, so I don't think that's a workaround either.

So the short version is, to support sharing a download folder between your app and chrome, you'd need to change this plugin to support mounting volumes in the chrome service container, and then sharing that volume with your app.

lazyatom avatar Mar 24 '23 16:03 lazyatom