ikemonn's blog






適当なディレクトリにダウンロードしてきて解凍すればOKです。 ~/binをmkdirして置きました。

$ cd ~/bin
$ wget -qO- -O tmp.zip https://dl.bintray.com/mitchellh/otto/otto_0.1.1_darwin_amd64.zip && unzip tmp.zip && rm -rf tmp.zip


$ mkdir otto_sample
$ cd otto_sample
$ express otto -e -s



$ cd otto
$ vim Appfile
application {
  name = "otto_sample"
  type = “node"

Ottoにはアプリケーションの環境と設定を自動で判別してくれる機能があり、それらのデータをもとにOttoの設定ファイルを作成するらしいです。 そのためのコメンドがotto compileです。

$ otto compile
==> Loading Appfile...
==> Fetching all Appfile dependencies...
==> Compiling...
    Application:    otto_sample (node)
    Project:        otto_sample
    Infrastructure: aws (simple)

    Compiling infra...
    Compiling foundation: consul
==> Compiling main application...
==> Compilation success!
    This means that Otto is now ready to start a development environment,
    deploy this application, build the supporting infastructure, and
    more. See the help for more information.

    Supporting files to enable Otto to manage your application from
    development to deployment have been placed in the output directory.
    These files can be manually inspected to determine what Otto will do.


$ otto dev
==> Creating local development environment with Vagrant if it doesn't exist...
    Raw Vagrant output will begin streaming in below. Otto does
    not create this output. It is mirrored directly from Vagrant
    while the development environment is being created.

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'hashicorp/precise64' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'hashicorp/precise64'
    default: URL: https://atlas.hashicorp.com/hashicorp/precise64
==> default: Adding box 'hashicorp/precise64' (v1.1.0) for provider: virtualbox
    default: Downloading: https://atlas.hashicorp.com/hashicorp/boxes/precise64/versions/1.1.0/providers/virtualbox.box

==> Caching SSH credentials from Vagrant...
==> Development environment successfully created!
    IP address:

    A development environment has been created for writing a generic Node-based
    application. For this development environment, Node is pre-installed. To
    work on your project, edit files locally on your own machine. The file changes
    will be synced to the development environment.

    When you're ready to build or test your project, run 'otto dev ssh'
    to enter the development environment. You'll be placed directly into the
    working directory where you can run "npm install", "npm run", etc.

    You can access the environment from this machine using the IP address above.
    For example, if your app is running on port 5000, then access it using the
    IP above plus that port.
otto dev  12.77s user 9.26s system 6% cpu 5:20.22 total


$ otto dev ssh 
# vagrant内
$ cd /vagrant/
$ npm install
$ npm start


# Mac上で
$ otto dev address 




$ otto dev vagrant halt


$ otto dev destroy


  • Vagrantでnodeの環境を作るより圧倒的に楽だった
  • Nodeはv4.1.0が入ってたので、バージョンを指定する方法を探す


Otto by HashiCorp ottoでSymfony2を構築してみちゃった