--
You received this message because you are subscribed to the Google Groups "Dart Server-side and Cloud Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud+un...@dartlang.org.
Visit this group at http://groups.google.com/a/dartlang.org/group/cloud/.
Yes, using --volume/--volume-from is currently not supported in the gcloud commands. I have cc'ed the managed vm team to let them know about your request.That said I am curious how you would like the --volume/--volume-from feature to work? AFAICT it would require deploying at least two containers? Do you do special setup when using the boot2docker vm or remote deployment?
On Wednesday, November 19, 2014 3:53:03 PM UTC+1, Gustav Wibling wrote:Yes, using --volume/--volume-from is currently not supported in the gcloud commands. I have cc'ed the managed vm team to let them know about your request.That said I am curious how you would like the --volume/--volume-from feature to work? AFAICT it would require deploying at least two containers? Do you do special setup when using the boot2docker vm or remote deployment?I'm just looking for a reasonable development workflow.Deployment is a completely different story.I'm fine with any workaround for deployment (copying files around, or whatever) because this isn't necessary very often. Deploying more than one image won't be necessary.But during development this has to be super fast and reliable for a short development cycle.I expect that --volume/--volume-from would allow me to create a Docker image that mounts a directory (the shared local package) as volume (required the --volume argument) and then mount this volume in the image used by `gcloud preview app run` (require `--volumes-from sharedimage` argument)
Also you may want to consider a stagehand for appengine projects that includes the dockerignore etc
FROM google/dart
WORKDIR /app
ENV DART_SDK /usr/lib/dart
ADD dart_run.sh /dart_runtime/
RUN chmod 755 /dart_runtime/dart_run.sh && \
chown root:root /dart_runtime/dart_run.sh
ADD pubspec.yaml /app/
ADD pubspec.lock /app/
ADD docker/my_shared_package /my_shared_package
RUN pub get
ADD . /app/
RUN pub get --offline
## Expose ports for debugger (5858), application traffic (8080)
## and the observatory (8181)
EXPOSE 8080 8181 5858
CMD []
ENTRYPOINT ["/dart_runtime/dart_run.sh"]
... -v /myhosts/.pub-cache:/wherever/pub-cache -v /myhosts/projects:/app/
Hi there everyone!
We are working on a project with various dependencies in private repos and dependencies provided via path. And of course we ran into the issues described in this thread and I played around with the workarounds and solutions provided here and on stackoverflow. I ended up with a Dockerfile that looks something like this:
FROM google/dart-runtime-base
WORKDIR /app
ENV PUB_CACHE /app/docker/mounts/pub-cache
ADD docker/mounts/path_deps/ /
ADD . /app/
RUN pub get --offline
It's not optimal, local deps are copied twice and the paths are not clean but it works. The only problem I have now is performance. Building the image after a code change takes somewhere around 45-60 seconds, without code changes with the use of cached images it's somewhere around 9s. I tried improving on this with not much success for quite a while. I reordered stuff and only copied selected directories which didn't help a lot. From what I've seen the most time consuming things when building the docker image are (a) copying the context and (b) every single step that is added to the Dockerfile where no cached image can be used adds a pretty much constant amount of time plus the time to execute this one step. I can optimize a bit on (a) but I can't really do anything about (b). As soon as there's any change in the code (be it the project or in any of the local dependencies) it starts to take really long so the development workflow is really tedious. Especially since we've got several modules that have to be started via gcloud.
This wasn't the case in previous gcloud versions with Dart < 1.8 when a Dockerfile for us looked like this:
FROM google/dart-appengine
ADD . /app/
My question now is what a gcloud with Dart >= 1.8 dev setup is supposed to look like to avoid these long container build times. And how did gcloud manage to get all the project files and dependencies in dart < 1.8 where we had a setup that was at least bearable in terms of build time.
For me any setup that takes longer than a few seconds to make code changes take effect is really tedious to work with. And from my perspective the only way to achieve this would be to use some way to tell gcloud to use docker volumes instead of rebuilding the image every time I change my code. I would imagine something that looks and behaves like the docker parameter -v:
gcloud preview app run dispatch.yaml ... -v /myhosts/.pub-cache:/wherever/pub-cache -v /myhosts/projects:/app/
Are there any plans to improve on the dev setup? How is it supposed to look and work right now?
Thanks and regards
daniel
Hi there everyone!
We are working on a project with various dependencies in private repos and dependencies provided via path. And of course we ran into the issues described in this thread and I played around with the workarounds and solutions provided here and on stackoverflow. I ended up with a Dockerfile that looks something like this:
FROM google/dart-runtime-base
WORKDIR /app
ENV PUB_CACHE /app/docker/mounts/pub-cache
ADD docker/mounts/path_deps/ /
ADD . /app/
RUN pub get --offline
It's not optimal, local deps are copied twice and the paths are not clean but it works. The only problem I have now is performance. Building the image after a code change takes somewhere around 45-60
From myown/dart-with-deps
ADD . /app/
RUN pub get --offline
seconds, without code changes with the use of cached images it's somewhere around 9s. I tried improving on this with not much success for quite a while. I reordered stuff and only copied selected directories which didn't help a lot. From what I've seen the most time consuming things when building the docker image are (a) copying the context and (b) every single step that is added to the Dockerfile where no cached image can be used adds a pretty much constant amount of time plus the time to execute this one step. I can optimize a bit on (a) but I can't really do anything about (b). As soon as there's any change in the code (be it the project or in any of the local dependencies) it starts to take really long so the development workflow is really tedious. Especially since we've got several modules that have to be started via gcloud.
This wasn't the case in previous gcloud versions with Dart < 1.8 when a Dockerfile for us looked like this:
FROM google/dart-appengine
ADD . /app/
My question now is what a gcloud with Dart >= 1.8 dev setup is supposed to look like to avoid these long container build times. And how did gcloud manage to get all the project files and dependencies in dart < 1.8 where we had a setup that was at least bearable in terms of build time.
For me any setup that takes longer than a few seconds to make code changes take effect is really tedious to work with. And from my perspective the only way to achieve this would be to use some way to tell gcloud
to use docker volumes instead of rebuilding the image every time I change my code. I would imagine something that looks and behaves like the docker parameter -v:
gcloud preview app run dispatch.yaml ... -v /myhosts/.pub-cache:/wherever/pub-cache -v /myhosts/projects:/app/
gcloud preview app run dispatch.yaml ... --docker-args"-v /myhosts/.pub-cache:/wherever/pub-cache -v /myhosts/projects:/app/"
Hi Günther,One thing that you might do, instead of the volume export/mount, is to create a separate package image which contains your local package. You then use this new package docker image as a base for your application docker image.Basically you create a Dockerfile to build your local package(s) into a separate image. The dockerfile would be similar to the attached which basically mimics the dart-runtime dockerfile except it is adding the package(s) to a well-known location, e.g. /packages/<packagename>You build your docker package image (calling it e.g. local/packages) and then create an application dockerfile which is justFROM local/packageswhen you deploy your application it will have the local packages present at /packages/... since it inherits this from the base image.Your application's pubspec.yaml file could then refer to these packages, by using "path: /packages/..." for the dependency or dependency_overrides.Granted this approach still requires rebuilding both the packages image and the application image if the packages change, but I think this is the same if you use volumes. AFAICT the data volume containing your local packages will have to be updated if your package change requiring you to rebuild the data volume.IMO the most seamless developer experience would be the first approach where you have your local packages in a directory next to your application and build just one docker image when deploying. It trades the multiple docker images for having a local copy of your packages which needs to be sync'ed, e.g. using git locally, with your primary copy.Of course there are many ways to do this and if Docker had support for symlinks that would be ideal:)Cheers,/gustav
Yeah I agree the docker stuff is a real killer for the dev loop speed which is normally super fast w dart and one of the things I love about dart.
I'm luckily rather OC about minimising my dependencies on my paas and have two versions of my app. One that has no gcloud dependencies and works off in memory data. This is how I develop mostly and preserves the fast dev loop.
The second one has the full dependencies and must be run with docker and the gcloud scripts. And you guessed it takes a while to start.
It would be nice if gcloud had a mode where we could keep our server outside of docker and communicate with the gcloud resources like datastore and memcache that are inside a docker container that we keep running.
FROM google/debian:wheezy
MAINTAINER Günter Zöchbauer <guenter@gzoechbauer.com>
ENV DEBIAN_FRONTEND noninteractive
ENV DART_SDK /usr/lib/dart
ENV PATH $DART_SDK/bin:$PATH
ENV DART_VERSION 1.9.0-dev.0.0
RUN \
apt-get -q update && \
DEBIAN_FRONTEND=noninteractive && \
apt-get install --no-install-recommends -y -q \
apt-transport-https \
apt-utils \
apt-show-versions \
ca-certificates \
curl \
git
## (removed net-tools sudo procps telnet apt-show-versions)
RUN \
curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_unstable.list > \
/etc/apt/sources.list.d/dart_unstable.list && \
apt-get update && \
apt-get install dart=$DART_VERSION-1 && \
rm -rf /var/lib/apt/lists/* && \
ADD dart_run.sh /dart_runtime/
RUN \
chmod 755 /dart_runtime/dart_run.sh && \
chown root:root /dart_runtime/dart_run.sh
WORKDIR /app
## Expose ports for debugger (5858), application traffic (8080)
## and the observatory (8181)
EXPOSE 8080 8181 5858
## Colorful bash prompt for `docker exec`
RUN \
echo "alias la='ls -lahFLH --color --group-directories-first'" >> /root/.bashrc && \
echo "PROMPT_COMMAND='PS1=\"\[\e]0;\W\007\e[38;5;69m\]\u@\h \[\e[38;5;36m\]\w\n\[\e[38;5;222m\]\[\e[38;5;47m\] $$\[\e[0m\] \"'" >> /root/.bashrc
CMD []
ENTRYPOINT ["/dart_runtime/dart_run.sh"]
############################################################
### Add the following lines to the Dockerfile that uses this image as base image
## local path dependencies
# ADD some_pkg /bwu_pkg # for each local dependency
##
#RUN pub get
#ADD . /app/
#RUN pub get --offline
############################################################
FROM zoechi/bwu-dart-dev:latest
## Some convenient packages for `docker exec`
RUN \
apt-get update && \
DEBIAN_FRONTEND=noninteractive && \
apt-get install -y \
apt-show-versions \
net-tools \
sudo procps \
telnet
## add path dependency mounted to `docker/bwu_server`
ADD docker/bwu_server /bwu_server
## print current Dart version and whether a newer Dart deb package is available
RUN \
dart --version && \
apt-show-versions dart
ADD pubspec.* /app/
RUN pub get
ADD . /app/
RUN pub get --offline
#!/bin/bash
## Force download of new base image (was useful occasionally)
#docker pull $(awk '/^FROM[ \t\r\n\v\f]/ { print /:/ ? $2 : $2":latest" }' Dockerfile)
# kill older script if still running
if [ $(pgrep --exact -u ${USER} -f -c "/bin/bash tool/run.sh") -eq "2" ]; then
pkill -SIGKILL --exact -u ${USER} -f -o "/bin/bash tool/run.sh"
fi
## change `some-app` with your app name
RUNNING_CONTAINER=`docker ps | grep some-app.default.dev1 | awk '{print $1}'`
if [ -n ${RUNNING_CONTAINER} ]; then
docker stop ${RUNNING_CONTAINER}
fi
gcloud --verbosity debug preview app run app.yaml index.yaml