Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
OPENSHIFT COOKBOOK

You're reading from   OPENSHIFT COOKBOOK Over 100 hands-on recipes that will help you create, deploy, manage, and scale OpenShift applications

Arrow left icon
Product type Paperback
Published in Oct 2014
Publisher Packt
ISBN-13 9781783981205
Length 430 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Shekhar Gulati Shekhar Gulati
Author Profile Icon Shekhar Gulati
Shekhar Gulati
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Getting Started with OpenShift FREE CHAPTER 2. Managing Domains 3. Creating and Managing Applications 4. Using MySQL with OpenShift Applications 5. Using PostgreSQL with OpenShift Applications 6. Using MongoDB and Third-party Database Cartridges with OpenShift Applications 7. OpenShift for Java Developers 8. OpenShift for Python Developers 9. OpenShift for Node.js Developers 10. Continuous Integration for OpenShift Applications 11. Logging and Scaling Your OpenShift Applications A. Running OpenShift on a Virtual Machine
Index

Cloning the application to the local machine

Every OpenShift application has a private Git repository that houses the application source code. OpenShift uses Git not only as a version control system but also to build and deploy the application using Git's action hooks. In this recipe, you will learn how to get the source code of the OpenShift application on your local machine.

Getting ready

You will need Git installed on the operating system before stepping through this recipe. For Debian-based Linux distributions, you can install Git with apt-get install git as the root. If you are on Fedora or any other Red Hat-based system, you can install Git with yum install git-core as the root. Mac and Windows users can download the Git package from the official download site at http://git-scm.com/downloads.

This recipe will use the WordPress application created in the Creating a WordPress application using the web console recipe.

How to do it…

Perform the following steps to clone the repository:

  1. Go to the Applications tab in the web console at https://openshift.redhat.com/app/console/applications and click on the application to view its details, as shown in the following screenshot:
    How to do it…
  2. Copy the Git repository URL mentioned on the application detail web page, as shown in the following screenshot:
    How to do it…
  3. Open a command-line terminal, go to a convenient location on your machine, and execute the git clone command. Replace the repository URL with your application Git URL:
    $ git clone ssh://52b823b34382ec52670003f6@blog-osbook.rhcloud.com/~/git/blog.git/
    

How it works…

The first and second steps helped us to locate the application Git repository URL. As discussed in the preceding section, OpenShift uses Git as revision control and a source code management system. Every application has a private Git repository. A Git repository contains all the information needed to retain and manage the revisions and history of a project. OpenShift uses the SSH transport protocol to work with Git repositories. To create a secure communication channel between the local machine and application gear, Git uses the SSH key setup discussed in the Uploading SSH keys using the web console recipe. Nobody will be able to clone your application repository unless you add their public SSH key to your account.

In step 3, you cloned the application Git repository using the clone command. The git clone command created a new Git repository based on the original application repository URL. The difference between Git and other version control systems is that Git clones the full copy of the repository, in addition to the working copy, of all the files in the repository. The clone command will create a new directory on your local filesystem with the same name as the application.

There's more…

You can also specify a different folder name with the git clone command. Suppose you want to clone the application in the myapp folder. To do this, execute the following command:

$ git clone ssh://52b823b34382ec52670003f6@blog-osbook.rhcloud.com/~/git/blog.git/ myapp

If you want to allow any of your friends or team members to clone your repository, just add their public key to your account. Follow the Uploading SSH keys using the web console recipe to upload the public SSH key. We will discuss team collaboration in detail in Chapter 2, Managing Domains.

See also

  • The Deploying your first change recipe
You have been reading a chapter from
OPENSHIFT COOKBOOK
Published in: Oct 2014
Publisher: Packt
ISBN-13: 9781783981205
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image