ember-cli / rfcs

Archive of RFCs for changes to ember-cli (for current RFC repo see https://github.com/emberjs/rfcs)
45 stars 54 forks source link

configurable tmp directory [Docker] #111

Closed jamesarosen closed 5 years ago

jamesarosen commented 7 years ago

We run ember-cli within a Docker container for development. (This issue is less meaningful for Dockerized Ember FastBoot running in production.)

Standard Docker practice is to have a container that

  1. has libraries like node and watchman installed
  2. has a checkout of the application code at a certain git SHA
  3. shadows the host file system atop (2) so the developer can edit files on their OS (e.g. using the text editor of their choice), then sync those to the container

Normally, this might look something like

$ docker run -v "/Users/me/code/my-app:/www/my-app"

The problem with that mount is that it also syncs /Users/me/code/my-app/tmp/**/*.*, which can be very expensive. That's because Docker waits for all syncs to happen before triggering the file-system event(s). In our tests, the time between saving a single file and ember-cli starting a rebuild is 30 seconds, up from less than a second when we exclude my-app/tmp.

Unfortunately, there's no syntax in Docker for excluding a particular subdirectory, so we end up mounting parts of the app individually:


$ docker run \
  -v "/Users/me/code/my-app/app:/www/my-app/app" \
  -v "/Users/me/code/my-app/config:/www/my-app/config" \
  -v "/Users/me/code/my-app/package.json:/www/my-app/package.json" \
  -v "/Users/me/code/my-app/tests:/www/my-app/tests"
  ...

It would be lovely if we could configure ember-cli's tmp directory to be e.g. /tmp so that it's not part of the mount.

We can do this for broccoli addons that extend broccoli-persistent-filter by setting BROCCOLI_PERSISTENT_FILTER_CACHE_ROOT, but that's far from everything that an ember-cli application puts in ./tmp.

rwjblue commented 7 years ago

:+1: - I totally agree that this is something we need to fix. The major blocker is upgrading to broccoli@1.0.0, which moves tmp out of <project-root>/tmp and into $TMPDIR (the systems default temp directory location but allows it to be configurable.

thommahoney commented 7 years ago

Is there an issue to track the upgrade to broccoli@1.0.0?

rwjblue commented 7 years ago

AFAIK, no. But we should make one so we can have a single place to point folks to track progress (or pitch in and help)...

simonihmig commented 5 years ago

I think this can be closed, as support for Broccoli 2 and system /tmp has landed, right?

rwjblue commented 5 years ago

Yep, thank you!