HashiCorp Otto 0.2

HashiCorp Otto 0.2

Jan 06, 2016 | Mitchell Hashimoto

We've released Otto 0.2. Otto is a single solution to develop and deploy any application.

Otto 0.1 was released at HashiConf. Otto has ambitious goals and with 0.2 we continue to work towards achieving those goals. Otto 0.2 focuses on developer experience, and the next version will focus on deployment.

We've made Otto 0.2 much easier to extend so that the community can help us in feature support for new and existing environments. For custom workflows, Otto 0.2 has a complete plugin system to add new application type support.

Feature highlights for Otto 0.2:

» New and Improved App Types

Otto works best when it has a deep understanding of the environment it is being used in. Otto 0.2 ships with built-in support for new application types: Python, Java, and Rails. In addition to the new app types, every existing application type has been improved in some way.

For Python applications, Otto will pre-install and configure Python, pip, and VirtualEnv for your environment. You can customize the Python version and the entrypoint for your application.

For Java, Otto will pre-install Java 8, Gradle, and Maven. Further improvements for customizing the Java version and build environment will come in future versions.

For Rails, Otto will pre-configure the database for your application in development. We'll continue to improve Rails heavily in upcoming versions.

Just like any other application type, Otto requires zero configuration and can detect it automatically. For example, if a "requirements.txt" or ".py" file is found, Otto will assume a Python environment.

$ ls

$ otto compile
==> Loading Appfile...
==> No Appfile found! Detecting project information...
==> Compiling...
    Application:    example (python)
    Project:        example
    Infrastructure: aws (simple)

    Compiling infra...
    Compiling foundation: consul
==> Compiling main application...
==> Compilation success!

In addition to the new application types, Otto 0.2 greatly improves almost every existing application type. The improvement highlights are listed below:

  • Ruby now uses ruby-install and chruby to support almost all Ruby versions and runtimes.
  • Ruby detects the proper Ruby version to setup by inspecting ".ruby-version" and "Gemfile" files.
  • Ruby detects more gems with native package dependencies and installs those automatically.
  • PHP can customize what version of PHP to install.
  • PHP now uses nginx when deploying instead of Apache.

The new application types and improvements were mostly contributed by the community. We'd like to thank the community for improving Otto!

You can view the full list of supported application types in the documentation.

» Implicit Dependencies

Otto requires zero configuration. It supports application configuration through an Appfile, but the presence of this file is completely optional. If the file isn't found, Otto will inspect your environment and determine a default configuration automatically.

Otto 0.2 extends this even further by introducing a feature known as "implicit dependencies". In addition to inspecting the environment to determine the type of application, Otto may also now add dependencies automatically as it detects the need for them.

For example, Otto can inspect the database configuration for popular web frameworks and automatically add a dependency on the database system properly configured with the correct user and database name so that the project can access it with zero further configuration.

One example of implicit dependencies in action is with Ruby projects. Otto will inspect the Gemfile and install systems that gems are talking to. For example, if the "redis" gem is detected in a Ruby project, Otto will configure that application to implicitly depend on Redis. You can see this in the compilation output below:

$ cat Gemfile | grep redis
gem "redis", "~> 1.0"

$ otto compile
==> Loading Appfile...
==> No Appfile found! Detecting project information...
==> Fetching all Appfile dependencies...
    Fetching dependency: git::https://github.com/hashicorp/otto.git//examples/redis
==> Compiling...
    Application:    example (rails)
    Project:        example
    Infrastructure: aws (simple)

    Compiling infra...
    Compiling foundation: consul
==> Compiling dependency 'redis'...
==> Compiling main application...
==> Detecting Ruby version to use...
    Detected desired Ruby version: 2.1.6
==> Compilation success!

In the output above you can see that without an Appfile, otto compile fetches Redis as a dependency because it is present in our Gemfile. You can also see it detect the Ruby version from the Gemfile, a feature we highlighted in a prior section.

As time goes on, Otto's detection of implicit dependencies will improve. For Otto 0.2, basic support for Ruby and Wordpress is available. Implicit dependencies can be easily disabled by creating a very simple Appfile.

» Layered Development Environments

Otto 0.2 dramatically decreases the time it takes to setup a development environment by making use of intelligent layering.

For a complete development environment, bringing it up can often take 10 or more minutes. However, most of the steps are identical and shared across multiple environments: installing common packages, compiling software, etc. Otto 0.2 separates each of these steps out into layers to speed this up.

For example, with a Ruby development environment, Ruby is compiled and installed in a layer. If you start another development environment with the same version of Ruby or you recreate that development environment, that entire step can be skipped unless you change the Ruby version.

As an anecdote, on a 2015 MacBook Air building a Ruby environent went from 10 minutes to 30 seconds.

While we plan to further optimize the setup of development environments in future versions, they are currently at the point where focusing on other parts of Otto will be more fruitful.

» App Type Plugins

Otto now has a plugin system for adding new application types.

The plugin system is based on the same plugin system used by Packer and Terraform. Both of these projects have shown that even beginner-level Go developers find it simple to build new plugins. We hope that with such a plugin system in Otto, we lower the barrier to entry to contribute to Otto.

In addition to contributing to open source, the plugin system lets you write custom application types for your in-house application environments. Even if you may be using a language fully supported by Otto, you may have custom practices where you want to change the behavior of Otto. You can now write a custom application type to do this easily.

We've created a complete section dedicated to writing and using plugins in Otto. If you're interested in building an Otto plugin, start there.

» The Future

Otto is a young and ambitious project. It has a long way to go to achieve the vision we have for it. Otto 0.2 is a strong step forward and focuses on developer experience and extensibility.

Otto is smart, and will only get smarter. To get smarter, we need help from the community. With Otto 0.2, it is easy to extend and improve Otto. If you're a domain expert and find that Otto isn't doing something properly, please let us know and contribute your knowledge to improve the project!

We've begun work on Otto 0.3 which focuses on deployment. Otto 0.3 will be the first release we recommend for deploying real environments. It will of course include app type improvements and developer experience improvements as well.

Go download Otto and give it a try!

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now