You are previewing OpenShift Cookbook.
O'Reilly logo
OpenShift Cookbook

Book Description

Over 100 hands-on recipes that will help you create, deploy, manage, and scale OpenShift applications

In Detail

It is important to hit the ground running with the creation and deployment of your OpenShift applications. This book will start by showing you how to create OpenShift applications, use different databases with your applications, and deal with your applications based on your background as a developer. All bases have been covered with very extensive sections on the Java, Python, and Node platforms. Your enlightening quest into OpenShift will conclude with a discussion on how to continuously integrate and deploy your apps using Jenkins, and how OpenShift can help you build horizontally scalable applications.

This comprehensive cookbook will show the trainee OpenShift developer a huge number of recipes, solutions, tips, and tricks to improve their experience and enhance their expertise.

What You Will Learn

  • Teach you how to create and deploy your own Java EE and Spring applications using OpenShift
  • Help you discover how to host your Node.js applications
  • Guide you through developing and deploying Python web applications
  • Learn the trade of building horizontally scalable applications with OpenShift
  • Show you how to store your periodic database backup to Amazon S3
  • Leverage the rhc command-line tool to become efficient with OpenShift
  • Learn how to effectively use Jenkins with OpenShift applications
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. OpenShift Cookbook
      1. Table of Contents
      2. OpenShift Cookbook
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Getting Started with OpenShift
        1. A brief introduction into OpenShift
        2. Creating an OpenShift Online account
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        3. Creating OpenShift domains using the web console
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        4. Creating a WordPress application using the web console
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Uploading SSH keys using the web console
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        6. Working with the SSH key passphrases
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        7. Cloning the application to the local machine
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        8. Deploying your first change
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        9. Checking the application's gear quota and limits
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        10. Installing the OpenShift rhc command-line client
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        11. Setting up an OpenShift account using rhc
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        12. Enabling the autocomplete feature in an rhc command-line client
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        13. Viewing the account details using rhc
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        14. Specifying a different OpenShift server hostname
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        15. Updating rhc
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
      9. 2. Managing Domains
        1. Introduction
        2. Creating a domain using rhc
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more...
          5. See also
        3. Renaming a domain using rhc
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        4. Viewing domain details using rhc
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
          5. See also
        5. Adding viewer members to a domain using rhc
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        6. Adding an editor member to a domain using rhc
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        7. Adding an admin member to a domain using rhc
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        8. Viewing all the members in a domain using rhc
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        9. Removing members from a domain using rhc
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        10. Restricting gear sizes for a domain using rhc
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        11. Leaving a domain using rhc
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        12. Deleting a domain using rhc
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
      10. 3. Creating and Managing Applications
        1. Introduction
        2. Creating an OpenShift application using the rhc command-line client
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more
          5. See also
        3. Specifying your own template Git repository URL
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        4. Starting/stopping/restarting an application
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Adding and managing add-on cartridges
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See more
        6. Adding a cron cartridge to an application
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        7. Using downloadable cartridges with OpenShift applications
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        8. Viewing application details
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See more
        9. Cloning the application Git repository using rhc
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See more
        10. SSH into the application gear using rhc
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See more
        11. Running a command in the application's SSH session using rhc
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See more
        12. Setting application-specific environment variables
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See more
        13. Taking and restoring application backups
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        14. Tracking and rolling back application deployments
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        15. Configuring the default Git branch for deployment
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        16. Doing manual deployments
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        17. Configuring and doing binary deployments
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        18. Using your own custom domain name
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        19. Cleaning up the application
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        20. Deleting the application
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
      11. 4. Using MySQL with OpenShift Applications
        1. Introduction
        2. Adding a MySQL cartridge to your application
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        3. Adding a phpMyAdmin cartridge to your application
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        4. Accessing a MySQL database from your local machine
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        5. Connecting to a MySQL cartridge from your local machine using MySQL Workbench
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        6. Updating the MySQL max connections setting
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        7. Updating the MySQL configuration settings
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        8. Performing scheduled MySQL database backups
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        9. Using an Amazon RDS MySQL DB instance with OpenShift
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
      12. 5. Using PostgreSQL with OpenShift Applications
        1. Introduction
        2. Adding the PostgreSQL cartridge to your application
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        3. Accessing the PostgreSQL cartridge from your local machine
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        4. Connecting to the PostgreSQL cartridge using pgAdmin from your local machine
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        5. Updating the PostgreSQL max_connections setting
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        6. Using the .psqlrc configuration file to configure the OpenShift application psql shell
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        7. Performing scheduled PostgreSQL database backups
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        8. Using EnterpriseDB PostgreSQL Cloud Database with OpenShift
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        9. Installing PostgreSQL extensions
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
      13. 6. Using MongoDB and Third-party Database Cartridges with OpenShift Applications
        1. Introduction
        2. Adding a MongoDB cartridge to your application
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        3. Adding a RockMongo cartridge to your application
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        4. Accessing a MongoDB cartridge from your local machine
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        5. Connecting to a MongoDB cartridge using Robomongo from your local machine
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        6. Enabling the MongoDB cartridge REST interface
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        7. Performing scheduled MongoDB database backups
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        8. Using MongoLab MongoDB-as-a-Service with OpenShift
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        9. Adding a MariaDB cartridge to your application
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        10. Adding a Redis cartridge to your application
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
      14. 7. OpenShift for Java Developers
        1. Introduction
        2. Creating and deploying Java EE 6 applications using the JBoss EAP and PostgreSQL 9.2 cartridges
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        3. Configuring application security by defining the database login module in standalone.xml
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        4. Installing modules with JBoss cartridges
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        5. Managing JBoss cartridges using the management web interface and CLI
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        6. Creating and deploying Spring applications using the Tomcat 7 cartridge
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        7. Taking thread dumps of Java cartridges
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        8. Choosing between Java 6 and Java 7
          1. How to do it…
          2. How it works…
          3. See also
        9. Enabling hot deployment for Java applications
          1. How to do it…
          2. How it works…
          3. See also
        10. Skipping the Maven build
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        11. Forcing a clean Maven build
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        12. Overriding the default Maven build command
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        13. Installing the JAR file not present in the Maven central repository
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        14. Developing OpenShift Java applications using Eclipse
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        15. Using Eclipse System Explorer to SSH into the application gear
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        16. Debugging Java applications in the Cloud
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
      15. 8. OpenShift for Python Developers
        1. Introduction
        2. Creating your first Python application
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more...
          5. See also
        3. Managing Python application dependencies
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more...
          5. See also
        4. Creating and deploying Flask web applications using Python and PostgreSQL cartridges
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more
          5. See also
        5. Enabling hot deployment for Python applications
          1. How to do it…
          2. How it works…
          3. See also
        6. Forcing a clean Python virtual environment
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        7. Accessing an application's Python virtual environment
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        8. Using Gevent with Python applications
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more...
          5. See also
        9. Installing a custom Python package
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        10. Using the .htaccess file to configure Apache
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
      16. 9. OpenShift for Node.js Developers
        1. Introduction
        2. Creating your first Node.js application
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        3. Configuring Node supervisor options
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        4. Managing Node.js application dependencies
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Using the use_npm marker
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        6. Enabling hot deployment for Node.js applications
          1. How to do it…
          2. How it works…
          3. See also
        7. Creating and deploying Express web applications using Node.js and MongoDB cartridges
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        8. Working with Web Sockets
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        9. Using CoffeeScript with OpenShift Node.js applications
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
      17. 10. Continuous Integration for OpenShift Applications
        1. Introduction
        2. Adding Jenkins CI to your application
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        3. Increasing the slave idle timeout
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        4. Installing Jenkins plugins
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        5. Using Jenkins to build projects hosted on GitHub
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        6. Creating a Jenkins workflow for your OpenShift applications
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        7. Upgrading Jenkins to the latest version
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
      18. 11. Logging and Scaling Your OpenShift Applications
        1. Introduction
        2. Viewing application logs
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        3. Working with JBoss application logs
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        4. Enabling JBoss access logs
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        5. Working with Tomcat application logs
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        6. Working with Python application logs
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        7. Creating scalable applications
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        8. Configuring a different health check URL for HAProxy
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        9. Configuring HAProxy to use a different balance algorithm
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        10. Creating scalable apps from nonscalable apps
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        11. Enabling manual scaling with marker files
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
      19. A. Running OpenShift on a Virtual Machine
      20. Index