github.com/dahs81/otto@v0.2.1-0.20160126165905-6400716cf085/website/source/intro/getting-started/customization.html.md (about)

     1  ---
     2  layout: "intro"
     3  page_title: "Customization"
     4  sidebar_current: "gettingstarted-customization"
     5  description: |-
     6    Customizations are a way to change the way Otto behaves by default with an application type.
     7  ---
     8  
     9  # Customization
    10  
    11  Otto has a lot of built-in knowledge. It was able to detect that our
    12  example application is a Ruby application, it automatically installed
    13  Ruby in our development environment, it automatically installed an
    14  application server for deployment, etc. Otto is an opinionated tool, making
    15  it incredibly powerful and easy to use out of the box.
    16  
    17  However, real applications often diverge slightly in various ways.
    18  _Customizations_ are a way to change the behavior of Otto.
    19  
    20  ## Customization Configuration
    21  
    22  We'll make a very basic customization with our example
    23  application and change the Ruby version. In the Appfile we created,
    24  add a new section:
    25  
    26  ```
    27  customization {
    28    ruby_version = "2.1"
    29  }
    30  ```
    31  
    32  There can be multiple "customization" blocks in an Appfile. The various
    33  blocks will be merged together in the order they are seen. The exact options
    34  available for customization depend on the application type and are documented
    35  as part of the [application types](/docs/apps).
    36  
    37  For Ruby, there is a "ruby_version" configuration. This sets the Ruby version
    38  to install, and currently defaults to "2.2".
    39  
    40  Let's pretend our application doesn't work with Ruby 2.2, and request
    41  that Otto install Ruby 2.1. This is what we've done in the customization
    42  above.
    43  
    44  ## Applying the Change
    45  
    46  Changes to the Appfile won't take effect until we recompile, so
    47  run an `otto compile` to recompile now. After compiling, let's rebuild
    48  our development environment with the latest Ruby version.
    49  
    50  First, destroy the old environment with `otto dev destroy`. This
    51  should only take a few seconds. Otto doesn't currently allow in-place
    52  updates of changes to the development environment.
    53  
    54  Once it is destroyed, run `otto dev` again. In a few minutes, you
    55  should see output from Otto about the version of Ruby it is installing,
    56  and it should be "2.1".
    57  
    58  You can verify this by going into the development environment:
    59  
    60  ```
    61  $ otto dev ssh
    62  > ruby -v
    63  ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux-gnu]
    64  ```
    65  
    66  It'll be left as an exercise to you to deploy the new Ruby version,
    67  if you want. Note that you'll have to run an `otto build` again since the
    68  Ruby version is built-in to the AMI that was built.
    69  
    70  ## Next
    71  
    72  We showed a basic example of how a customization can alter the behavior
    73  of Otto. Customizations are incredibly powerful, but they're still
    74  high level enough for users of Otto to be productive without having
    75  to know difficult details.
    76  
    77  Next, we'll learn how to develop and deploy applications that
    78  have [dependencies](/intro/getting-started/deps.html).