github.com/misfo/deis@v1.0.1-0.20141111224634-e0eee0392b8a/docs/using_deis/config-application.rst (about)

     1  :title: Configure an Application on Deis
     2  :description: Instructions for developers using Deis to configure applications.
     3  
     4  .. _config-application:
     5  
     6  Configure an Application
     7  ========================
     8  A Deis application `stores config in environment variables`_.
     9  
    10  Configure the Application
    11  -------------------------
    12  Use ``deis config`` to modify environment variables for a deployed application.
    13  
    14  .. code-block:: console
    15  
    16      $ deis help config
    17      Valid commands for config:
    18  
    19      config:list        list environment variables for an app
    20      config:set         set environment variables for an app
    21      config:unset       unset environment variables for an app
    22      config:pull        extract environment variables to .env
    23  
    24      Use `deis help [command]` to learn more
    25  
    26  When config is changed, a new release is created and deployed automatically.
    27  
    28  Attach to Backing Services
    29  --------------------------
    30  Deis treats backing services like databases, caches and queues as `attached resources`_.
    31  Attachments are performed using environment variables.
    32  
    33  For example, use ``deis config`` to set a `DATABASE_URL` that attaches
    34  the application to an external PostgreSQL database.
    35  
    36  .. code-block:: console
    37  
    38      $ deis config:set DATABASE_URL=postgres://user:pass@example.com:5432/db
    39      === peachy-waxworks
    40      DATABASE_URL: postgres://user:pass@example.com:5432/db
    41  
    42  Detachments can be performed with ``deis config:unset``.
    43  
    44  Custom Domains
    45  --------------
    46  
    47  You can use ``deis domains`` to add or remove custom domains to your application:
    48  
    49  .. code-block:: console
    50  
    51      $ deis domains:add hello.bacongobbler.com
    52      Adding hello.bacongobbler.com to finest-woodshed... done
    53  
    54  Once that's done, you can go into your DNS registrar and set up a CNAME from the new
    55  appname to the old one:
    56  
    57  .. code-block:: console
    58  
    59      $ dig hello.deisapp.com
    60      [...]
    61      ;; ANSWER SECTION:
    62      hello.bacongobbler.com.         1759    IN    CNAME    finest-woodshed.deisapp.com.
    63      finest-woodshed.deisapp.com.    270     IN    A        172.17.8.100
    64  
    65  .. note::
    66  
    67      Setting a CNAME for your root domain can cause issues. Setting your @ record
    68      to be a CNAME causes all traffic to go to the other domain, including mail and the SOA
    69      ("start-of-authority") records. It is highly recommended that you bind a subdomain to
    70      an application, however you can work around this by pointing the @ record to the
    71      address of the load balancer (if any).
    72  
    73  Track Changes
    74  -------------
    75  Each time a build or config change is made to your application, a new :ref:`release` is created.
    76  Track changes to your application using ``deis releases``.
    77  
    78  .. code-block:: console
    79  
    80      $ deis releases
    81      === peachy-waxworks Releases
    82      v4      3 minutes ago                     gabrtv deployed d3ccc05
    83      v3      1 hour 17 minutes ago             gabrtv added DATABASE_URL
    84      v2      6 hours 2 minutes ago             gabrtv deployed 7cb3321
    85      v1      6 hours 2 minutes ago             gabrtv deployed deis/helloworld
    86  
    87  Rollback the Application
    88  ------------------------
    89  Use ``deis rollback`` to revert to a previous release.
    90  
    91  .. code-block:: console
    92  
    93      $ deis rollback v2
    94      Rolled back to v2
    95  
    96      $ deis releases
    97      === folksy-offshoot Releases
    98      v5      Just now                          gabrtv rolled back to v2
    99      v4      4 minutes ago                     gabrtv deployed d3ccc05
   100      v3      1 hour 18 minutes ago             gabrtv added DATABASE_URL
   101      v2      6 hours 2 minutes ago             gabrtv deployed 7cb3321
   102      v1      6 hours 3 minutes ago             gabrtv deployed deis/helloworld
   103  
   104  .. note::
   105  
   106      All releases (including rollbacks) append to the release ledger.
   107  
   108  
   109  .. _`stores config in environment variables`: http://12factor.net/config
   110  .. _`attached resources`: http://12factor.net/backing-services