Book Image

Heroku Cookbook

By : Mike Coutermarsh
Book Image

Heroku Cookbook

By: Mike Coutermarsh

Overview of this book

Heroku is a Platform as a Service that enables developers to rapidly deploy and scale their web applications. Heroku is designed for developer happiness, freeing developers from doing system administrative tasks such as configuring servers and setting up load balancers. Developers are able to focus on what they do best, building web applications, while leaving the details of deployment and scaling to the experts at Heroku. This practical guide is packed with step-by-step solutions to problems faced by every production-level web application hosted on Heroku. You'll quickly get comfortable with managing your Heroku applications from the command line and then learn everything you need to know to deploy and administer production-level web applications.
Table of Contents (17 chapters)
Heroku Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Managing domains from the command line


Heroku makes it simple for us to manage our domains and subdomains from the CLI. In this recipe, we'll learn the steps to add and remove domains from the command line.

How to do it…

To start, let's open up a new terminal and navigate to one of our Heroku applications. We can add --app application-name to the end of any of the following commands to run them for a specific application:

  1. First, let's list our application's existing domains:

    $ heroku domains
    === demo-app Domain Names
    demo2.example.org
    example.com
    
  2. Next, let's try to add a custom domain to our application. We can do this with the domains:add command:

    $ heroku domains:add example-domain.com
    
  3. We can add subdomains using the same command. Refer to the following example:

    $ heroku domains:add testing.example-domain.com
    
  4. If we want to avoid adding subdomains one by one, we can use a wildcard:

    $ heroku domains:add *.example-domain.com
    
  5. Removing an existing domain is simple. Let's try this now:

    $ heroku...