diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d2339e..5258059 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,30 @@ +## [1.0.0](https://github.com/fgrehm/devstep/compare/v0.4.0...v1.0.0) (2016-03-10) + +BREAKING CHANGES: + + - baseimage: Removed tmux + - addons: Removed `docker` + - buildpacks: Removed `bats` and `phantomjs` + +IMPROVEMENTS: + + - buildpacks/golang: Bump default Go to 1.6 + - buildpacks/golang: Pass in `-t` to `go get` [[GH-96]] + - buildpacks/inline: Support strings for the `provision` config on `devstep.yml` files + - buildpacks/inline: Always run inline `provision` commands at the end of the build process, after all of the other buildpacks have kicked in. + - buildpacks/python: Bump default Python to 2.7.11 + +BUG FIXES: + + - buildpacks/golang: Nicely handle blanky `git remote`s [[GH-94]] + - buildpacks/inline: Improve `devstep.yml` `provision` config handling [[GH-97]] + - buildpacks/inline: Return the same exit code returned by the `provision` command [[GH-99]] + +[GH-94]: https://github.com/fgrehm/devstep/issues/94 +[GH-96]: https://github.com/fgrehm/devstep/issues/96 +[GH-97]: https://github.com/fgrehm/devstep/issues/97 +[GH-99]: https://github.com/fgrehm/devstep/issues/99 + ## [0.4.0](https://github.com/fgrehm/devstep/compare/v0.3.1...v0.4.0) (2015-07-06) BREAKING CHANGES: diff --git a/Dockerfile b/Dockerfile index 2004661..cf2951c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,33 +9,16 @@ ENV HOME=/home/devstep \ LC_ALL=en_US.UTF-8 \ LC_CTYPE=en_US.UTF-8 -##################################################################### -# Copy over our build scripts ADD image/ /tmp/build - -##################################################################### -# Install required packages and do some additional setup RUN /tmp/build/prepare.sh -##################################################################### -# Devstep goodies (ADDed at the end to increase image "cacheability") ADD stack $DEVSTEP_PATH -RUN for script in $DEVSTEP_PATH/buildpacks/*/bin/install-dependencies; do \ - $script; \ - done - -##################################################################### -# Fix permissions and set up init -RUN /tmp/build/fix-permissions.sh +RUN for script in $DEVSTEP_PATH/buildpacks/*/bin/install-dependencies; do $script; done \ + && /tmp/build/fix-permissions.sh -##################################################################### -# Setup default user USER developer ENV USER developer -##################################################################### -# Use our init ENTRYPOINT ["/opt/devstep/bin/entrypoint"] -# Start a bash session by default CMD ["/bin/bash"] diff --git a/LICENSE b/LICENSE index a4c9bc4..006a992 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 Fabio Rehm +Copyright (c) 2014-2016 Fabio Rehm Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/devstep.yml b/devstep.yml deleted file mode 100644 index 42eea87..0000000 --- a/devstep.yml +++ /dev/null @@ -1,11 +0,0 @@ -privileged: true -volumes: - # FIXME: This only work on my machine - - '{{env "HOME"}}/devstep/development/docker:/var/lib/docker' - - '{{env "HOME"}}/projects/oss/devstep-examples:/devstep-examples' - - '{{env "HOME"}}/projects/oss/devstep-cli/build/linux_amd64:/home/devstep/bin/devstep' -commands: - make: - # No custom options -provision: - - ['configure-addons', 'docker'] diff --git a/docs/addons/docker.md b/docs/addons/docker.md deleted file mode 100644 index af31e66..0000000 --- a/docs/addons/docker.md +++ /dev/null @@ -1,13 +0,0 @@ -# Docker Addon --------------- - -This addon will install Docker 1.3.0 from https://get.docker.io/builds/Linux/x86_64 -and will set things up for running nested Docker containers based on https://github.com/jpetazzo/dind. - -In order to use it, you need to provide both the `--privileged` flag and because -`/var/lib/docker` cannot be on AUFS, so we need to make it a volume with `-v /var/lib/docker`. - -To install it you can run `configure-addons docker` from within the container. - -To specify a Docker version, use the the `DEVSTEP_DOCKER_VERSION` environmental -variable. diff --git a/docs/buildpacks/bats.md b/docs/buildpacks/bats.md deleted file mode 100644 index 0defe90..0000000 --- a/docs/buildpacks/bats.md +++ /dev/null @@ -1,5 +0,0 @@ -# Bats buildpack ----------------- - -This buildpack will install the latest release of [Bats](https://github.com/sstephenson/bats) -if a file with the `.bats` extension is found. diff --git a/docs/buildpacks/golang.md b/docs/buildpacks/golang.md index 6136f08..46561fa 100644 --- a/docs/buildpacks/golang.md +++ b/docs/buildpacks/golang.md @@ -9,9 +9,8 @@ If a `Godep` dir is found, this buildpack will download and install [godep](http into your `$PATH` and will parse the `GoVersion` and `ImportPath` attributes when setting things up. -Since currently devstep [does not support](https://github.com/fgrehm/devstep/issues/51) -setting the workspace directory used inside the container, this buildpack will -attempt to parse your project's import path for you using the following approach: +This buildpack will attempt to identify your project's import path for you using +the following priority: 1. `ImportPath` from Godep configs 2. `.godir` file @@ -19,9 +18,15 @@ attempt to parse your project's import path for you using the following approach 4. `GO_PROJECT_NAME` environmental variable After identifying the import path, the buildpack will symlink your project sources -into the appropriate path under the `$GOPATH/src` dir. +into the appropriate path under the `$GOPATH/src` dir. You can also configure +the `working_dir` to an appropriate path on your [project's `devstep.yml`](cli/configuration): -If godep is configured, the buildpack will attempt a `godep go build` for you, +```yml +# The directory where project sources should be mounted inside the container. +working_dir: '/home/devstep/gocode/src/github.com/fgrehm/devstep-cli' +``` + +If godep is configured, the buildpack will attempt a `godep go install` for you, otherwise it will download project's dependencies with `go get` so you can start hacking right away. diff --git a/docs/buildpacks/phantomjs.md b/docs/buildpacks/phantomjs.md deleted file mode 100644 index 05a30a9..0000000 --- a/docs/buildpacks/phantomjs.md +++ /dev/null @@ -1,12 +0,0 @@ -# PhantomJS buildpack ---------------------- - -This buildpack will install the latest release of [PhantomJS](http://phantomjs.org) -and currently does provide automatic detection. - -In order to use it, you'll need to manually invoke it with `build-project -b phantomjs` -from within your image or from a `Dockerfile`. - -By default it will install the 1.9.7 version but a specific version can be installed -by specifying the `PHANTOMJS_VERSION` env var during the build. For example: -`PHANTOMJS_VERSION='1.9.6' build-project -b phantomjs` will install PhantomJS 1.9.6. diff --git a/docs/buildpacks/python.md b/docs/buildpacks/python.md index 931efd2..a55bb9c 100644 --- a/docs/buildpacks/python.md +++ b/docs/buildpacks/python.md @@ -14,7 +14,7 @@ You can also provide arbitrary releases Python with a `runtime.txt` file. Runtime options include: -- python-2.7.10 (default) +- python-2.7.11 (default) - python-3.4.1 - pypy-1.9 (experimental) diff --git a/docs/buildpacks/ruby.md b/docs/buildpacks/ruby.md index 7e02ec2..8a5e5e3 100644 --- a/docs/buildpacks/ruby.md +++ b/docs/buildpacks/ruby.md @@ -6,8 +6,8 @@ use [Bundler](http://bundler.io/) for dependency management. It will be used if a `Gemfile` is found. The installed Ruby will be the same one that gets installed on Heroku's Cedar 14 -stack with a fallback to a Ruby from the Cedar stack. By default Ruby 2.2.2 and -Bundler 1.10.5 will be installed. +stack with a fallback to a Ruby from the Cedar stack. By default Ruby 2.3.0 and +Bundler 1.11.2 will be installed. To specify a Ruby version, use the [`ruby` directive](http://bundler.io/v1.6/gemfile_ruby.html) of your project's `Gemfile`, the `DEVSTEP_RUBY_VERSION` environmental variable or diff --git a/docs/cli/aliases-and-binstubs.md b/docs/cli/aliases-and-binstubs.md deleted file mode 100644 index 1c3dcfa..0000000 --- a/docs/cli/aliases-and-binstubs.md +++ /dev/null @@ -1,29 +0,0 @@ -# CLI Aliases and Binstubs - -The [`commands` configurations set from `devstep.yml` files](configuration) -can be used to enable some powerful aliases in case you need to frequently -run one off commands against a previously build project image. - -For example, you can keep a terminal session with a Rails server running on a -tab and on a separate tab you can keep a `devstep hack` session open for -development tasks so you can easily run tests or execute some `rake` tasks. - -By specifying the following command on your `devstep.yml` you'll be able to -`devstep run server` instead of `devstep run -p 3000:3000 -- bundle exec rails server`: - -```yaml -commands: - server: - cmd: ["bundle", "exec", "rails", "server"] - publish: ["3000:3000"] -``` - -## Using binstubs - -Given the configuration above, you might also want to skip the `devstep run` -part from `devstep run server` while keeping the specified configs like published -ports or volumes specified on `devstep.yml` files. - -By running the `devstep binstubs` command from your project's root, a bash script -will be created under `.devstep/bin` for each specified command, so you are a `export PATH=".devstep/bin:$PATH"` -away from running just `server` using the configs outlined above. diff --git a/docs/cli/commands.md b/docs/cli/commands.md index ad281ef..73af3f0 100644 --- a/docs/cli/commands.md +++ b/docs/cli/commands.md @@ -3,7 +3,7 @@ 1. [Hack](#user-content-hack) 1. [Build](#user-content-build) -1. [Boostrap](#user-content-bootstrap) +1. [Bootstrap](#user-content-bootstrap) 1. [Other commands](#user-content-other-commands) -------------- @@ -15,7 +15,7 @@ This is the easiest way to get started with Devstep. By running the command from your project's root, Devstep will: -1. Create a Docker container based on `fgrehm/devstep:v0.4.0` with project +1. Create a Docker container based on `fgrehm/devstep:v1.0.0` with project sources bind mounted at `/workspace`. 2. Detect and install project's dependencies on the new container using the available buildpacks. @@ -44,7 +44,7 @@ devstep hack -p 80:8080 --link postgres:db --link memcached:mc -e DEVSTEP_BUNDLE By running the command from your project's root, Devstep will: -1. Create a Docker container based on `fgrehm/devstep:v0.4.0` with project +1. Create a Docker container based on `fgrehm/devstep:v1.0.0` with project sources bind mounted at `/workspace`. 2. Detect and install project's dependencies on the new container using the available buildpacks. @@ -53,7 +53,7 @@ By running the command from your project's root, Devstep will: The `devstep/` images act like snapshots of your project dependencies and will be used as the source image for subsequent `devstep` commands instead -of the `fgrehm/devstep:v0.4.0` image. +of the `fgrehm/devstep:v1.0.0` image. For example, running a `devstep hack` after building the image will use `devstep/:latest` as the base container for new "hacking sessions" so that you don't have to build @@ -129,7 +129,6 @@ of choice. * `info` - Show information about the current environment * `run` - Run a one off command against the current base image * `exec` - Run a one off command against the last container created for the current project -* `binstubs` - Generate binstubs for the commands specified on devstep.yml * `clean` - Remove previously built images for the current environment * `pristine` - Rebuild project image from scratch * `help, h` - Shows a list of commands or help for one command diff --git a/docs/cli/configuration.md b/docs/cli/configuration.md index 246ada9..1cc3d18 100644 --- a/docs/cli/configuration.md +++ b/docs/cli/configuration.md @@ -12,7 +12,7 @@ The available options are described below: repository: 'repo/name' # The image used by devstep when building environments from scratch -# DEFAULT: 'fgrehm/devstep:v0.4.0' +# DEFAULT: 'fgrehm/devstep:v1.0.0' source_image: 'source/image:tag' # The host cache dir that gets mounted inside the container at `/home/devstep/cache` @@ -43,25 +43,6 @@ volumes: environment: RAILS_ENV: "development" -# Custom command aliases that can be used with `devstep run` to save some -# typing. It is also used for generating project specific binstubs. -# DEFAULT: -commands: - # This can be run with `devstep run server` - server: - cmd: ["rails", "server"] - # Here you can use some of the configs described above - publish: ["3000:3000"] - volumes: - - '{{env "HOME"}}/certs/some-certificate.crt:/home/devstep/some-certificate.crt' - - '{{env "HOME"}}/projects/some-gem-sources:/home/devstep/some-gem-sources' - links: - - 'redis:redis' - environment: - RAILS_ENV: "hacking" - ruby: - # No custom options, used only for generating binstubs - # Custom provisioning steps that can be used when the available buildpacks are not # enough. Use it to configure addons or run additional commands during the build. # DEFAULT: diff --git a/docs/cli/installation.md b/docs/cli/installation.md index 27900ae..fd25980 100644 --- a/docs/cli/installation.md +++ b/docs/cli/installation.md @@ -1,40 +1,43 @@ # CLI Installation ------------------ -The CLI is [written in Golang](https://github.com/fgrehm/devstep-cli) and precompiled -binaries are available for each GitHub tagged release. Installing it is a matter -of downloading it from GitHub, placing the binary on a directory available on your -`PATH` and making it executable. - -This one liner can handle it for you assuming that `$HOME/bin` is available -on your `PATH`: +Precompiled binaries are available for each GitHub tagged release: ```sh -L=$HOME/bin/devstep && curl -sL https://github.com/fgrehm/devstep-cli/releases/download/v0.4.0/linux_amd64 > $L && chmod +x $L +# On Linux (assumes `$HOME/bin` is on your `PATH`) +L=$HOME/bin/devstep && curl -sL https://github.com/fgrehm/devstep-cli/releases/download/v1.0.0/linux_amd64 > $L && chmod +x $L + +# On OSX +brew tap fgrehm/devstep +brew install devstep ``` -Please note that the CLI is currently limited to connecting to a local `/var/run/docker.sock` +Please note that the CLI currently defaults to connecting to a local `/var/run/docker.sock` socket only and the user that runs `devstep` commands will need [non-root access to it](http://docs.docker.io/installation/ubuntulinux/#giving-non-root-access). -Support for execution over TCP is likely to be added at some point. - +On OSX we rely on the environmental variables set by `docker-machine` (like +`DOCKER_HOST` and `DOCKER_CERT_PATH` for example) and also on the fact that the +`$HOME` dir is automagically shared with the VM that runs the docker daemon. > **IMPORTANT**: A `developer` user will be used by Devstep and it assumes your -user and group ids are equal to `1000` when using the CLI or the container's init -process will be aborted. This is to guarantee that files created within Docker -containers have the appropriate permissions so that you can manipulate them -on the host without the need to use `sudo`. This is currently a Devstep limitation -that will be worked around in case there is enough demand or will be fixed once -Docker adds support for user namespaces. +user and group ids are equal to `1000` when using the CLI. This is to guarantee +that files created within Docker containers have the appropriate permissions so +that you can manipulate them on the host without the need to use `sudo`. This is +currently a Devstep limitation that will be handled on a future release. > The `1000` id was chosen because it is the default uid / gid of Ubuntu Desktop users that are created during the installation process. To work around this limitation you can build your own image with the appropriate ids and add a `source_image: ':'` line to your `~/devstep.yml` so that the image is used as a source for your projects. +> When on OSX using dinghy, this should not be a problem thanks to how it sets up +NFS shares. + ## Bash autocomplete -An autocompletion script can be installed using the one liner below: +An autocompletion script for Linux can be installed using the one liner below: ```sh curl -sL https://github.com/codegangsta/cli/raw/master/autocomplete/bash_autocomplete | sed 's/$PROG/devstep/' | sudo tee /etc/bash_completion.d/devstep ``` + +On OSX it gets installed automatically thanks to Homebrew. diff --git a/docs/getting-started.md b/docs/getting-started.md index 81f3854..4846985 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -4,7 +4,7 @@ Devstep comes in two flavors, you can either use the provided CLI or you can build on top of the provided images from `Dockerfile`s. -Regardless of the flavor you choose, it is a good idea to `docker pull fgrehm/devstep:v0.4.0` +Regardless of the flavor you choose, it is a good idea to `docker pull fgrehm/devstep:v1.0.0` before creating your first container / image for a better user experience. Docker will download that image as needed when using `Dockerfile`s but the Devstep CLI won't. @@ -12,37 +12,44 @@ will download that image as needed when using `Dockerfile`s but the Devstep CLI --------------- This project is being developed and tested on an Ubuntu 14.04 host with Docker -1.7.0, while it is likely to work on other distros / Docker versions / -[boot2docker](http://boot2docker.io/), I'm not sure how it will behave on the wild. +1.9.0+ and on OSX using [dinghy VMs](https://github.com/codekitchen/dinghy) powered +by the [xhyve docker-machine driver](https://github.com/zchee/docker-machine-driver-xhyve). +While it is likely to work on other distros / Docker versions / boot2docker setups, +I'm not sure how it will behave on the wild. -Please note that the CLI is currently limited to connecting to a local `/var/run/docker.sock` +Please note that the CLI currently defaults to connecting to a local `/var/run/docker.sock` socket only and the user that runs `devstep` commands will need [non-root access to it](http://docs.docker.io/installation/ubuntulinux/#giving-non-root-access). -Support for execution over TCP is likely to be added at some point in the future. +On OSX we rely on the environmental variables set by `docker-machine` (like +`DOCKER_HOST` and `DOCKER_CERT_PATH` for example) and also on the fact that the +`$HOME` dir is automagically shared with the VM that runs the docker daemon. ## Getting started with the CLI ------------------------------- > **IMPORTANT**: A `developer` user will be used by Devstep and it assumes your -user and group ids are equal to `1000` when using the CLI or the container's init -process will be aborted. This is to guarantee that files created within Docker -containers have the appropriate permissions so that you can manipulate them -on the host without the need to use `sudo`. This is currently a Devstep limitation -that will be worked around in case there is enough demand or will be fixed once -Docker adds support for user namespaces. +user and group ids are equal to `1000` when using the CLI. This is to guarantee +that files created within Docker containers have the appropriate permissions so +that you can manipulate them on the host without the need to use `sudo`. This is +currently a Devstep limitation that will be handled on a future release. > The `1000` id was chosen because it is the default uid / gid of Ubuntu Desktop users that are created during the installation process. To work around this limitation you can build your own image with the appropriate ids and add a `source_image: ':'` line to your `~/devstep.yml` so that the image is used as a source for your projects. -To install the CLI, you can run the one liner below and read on for more: +> When on OSX using dinghy, this should not be a problem thanks to how it sets up +NFS shares. + +To install the CLI: ```sh -L=$HOME/bin/devstep && curl -sL https://github.com/fgrehm/devstep-cli/releases/download/v0.4.0/linux_amd64 > $L && chmod +x $L -``` +# On Linux (assumes `$HOME/bin` is on your `PATH`) +L=$HOME/bin/devstep && curl -sL https://github.com/fgrehm/devstep-cli/releases/download/v1.0.0/linux_amd64 > $L && chmod +x $L -_The snippet above assumes `$HOME/bin` is on your `PATH`, change `$HOME/bin` to -an appropriate path in case your system is not configured like that._ +# On OSX +brew tap fgrehm/devstep +brew install devstep +``` ### Doing a quick hack on a project @@ -50,7 +57,8 @@ With the CLI and Docker in place, just `cd` into your project and run `devstep h it should be all you need to start working on your project. Devstep will create a Docker container, will install your project dependencies in it and at the end you'll be dropped on a `bash` session inside the container with project sources -available at `/workspace`. +available at `/workspace`. **Don't forget to `eval $(docker-machine env )` / +`eval $(dinghy env)` in case you are on OSX.** From inside the container, you can do your work as you would on your own machine. For example, you can use `rake test` to run your Ruby tests or `go build` to @@ -84,8 +92,8 @@ devstep hack -p 8080:8080 ``` And it will redirect the `8080` port on your host to the `8080` port within the -container so you can just hit `http://localhost:8080` on your browser to see your -app running after it is up. +container so you can just hit `http://localhost:8080` (or `http://DOCKER_HOST:8080`) +on your browser to see your app running after it is up. ### Using databases or other services from within containers @@ -180,7 +188,7 @@ The `fgrehm/devstep` image is the base image used for Devstep environments and requires you to manually trigger the build: ```Dockerfile -FROM fgrehm/devstep:v0.4.0 +FROM fgrehm/devstep:v1.0.0 # Add project to the image and build it ADD . /workspace diff --git a/docs/introduction.md b/docs/introduction.md index 5b1359f..7c0fb5a 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -52,8 +52,8 @@ Heroku apps) will be available for `fgrehm/devstep` environments. On top of `heroku/cedar:14`, we: * Create a `developer` user to avoid using `root` and creating files with wrong permissions during development. -* Install some extra devel packages (like `libyaml-dev`) and other "nice to have" - packages and utilities (like `tmux` and `vim`). +* Install some extra devel packages (like `libreadline`) and other "nice to have" + packages and utilities (like `vim` and `sqlite3`). * Configure PostgreSQL and MySQL clients. * Set the image `ENTRYPOINT` to our own init system and the default command to a `bash` login shell. * Configure a couple of startup scripts (like automatic port forwading to linked containers). @@ -64,11 +64,9 @@ _For more information please have a look at the [Dockerfile](https://github.com/ ## Supported buildpacks -* [Bats](buildpacks/bats) * [Golang](buildpacks/golang) * [Inline](buildpacks/inline) * [Node.js](buildpacks/nodejs) -* [PhantomJS](buildpacks/phantomjs) * [Python](buildpacks/python) * [Ruby](buildpacks/ruby) diff --git a/docs/template.html b/docs/template.html index 833aa71..f675346 100644 --- a/docs/template.html +++ b/docs/template.html @@ -110,7 +110,6 @@
  • Installation
  • Commands
  • Configuration Options
  • -
  • Aliases and Binstubs
  • Plugins
  • Tips and tricks
  • @@ -118,11 +117,9 @@