Cloud9 and OpenShift. The development and deployment of applications in the clouds

mercredi 23 janvier 2013

It so happens that I now receive training in a company, where a very hard knock simple program to your desktop, and even more IDE, sometimes it even turns into a whole week quests. But at the same time, free time, I love to experiment. Reading the article about online IDE and having Account OpenShift decided nevertheless to try to create and deploy a Yii application in the clouds.

Just say, that article is for beginners. Who cares go!

Associate Cloud9 IDE and OpenShift .

As an IDE, I decided to stop at Cloud9, design and functionality with me. Plus the fact that you can run the application directly in the IDE, negative - not supported database hosting, so try to arrange access to the database that we will create in OpenShift.

And yet, I smiled because of the presence of Cloud9 terminal (Alt + T), albeit limited, though.



Step 0. Create an account if you do not.

I personally use the free features.
Cloud9 is for public workers Wednesday to 128MB + one + one private limited terminal.
To OpenShift is 3 small cartridge, each 512MB RAM and 1GB disk. Cartridges are components that can be added to an application, such as a database (MySQL, PosgreSQL and MondoDB) and administration tools (phpMyAdmin, RockMongo, Cron, etc.).
For small experiments quite well.

Step 1. Adding to OpenShift SSH key from Cloud9

SSH keys are known to be used for a secure connection, that's a good article
In Cloud9 key can be found in paragraph Show SSH key in Your Account.



Copy it and paste this key in OpenShift, for this is in the Your Account Public Keys



Step 2. Create a working environment in the Cloud9 and add applications to OpenShift

It's simple, the main thing - to create applications in Cloud9 choose git version of the work environment. Git will continue our faithful companion.



In OpenShift slight movement of the mouse to create an application with PHP 5.3.



Step 3. Adding a git repository of applications into production OpenShift Cloud9

After creating the application you will see its OpenShift git repository.



To link this repository to the working environment in the Cloud9 use the following command:

git remote add openshift -m master ssh://******.git/ git pull -s recursive -X theirs openshift master 


Step 4. Loadable Yii in the work environment and create Cloud9 application framework yii

To download the application yii freymovrka use it git repository, adding it as a submodule:

 git submodule add git://github.com/yiisoft/yii.git yii git commit -m "added yii repository as submodule" 


In the repository you want us to upload release:

 cd yii git checkout 1.1.13 cd .. git add yii git commit -m "Use yii v1.1.13" 


Now, create the application framework yii. This is usually used script webapp, but run it just as a shell will not work. Instead, we will use the php version of the script, and yes, we need a global way to our directory.
Execute the following command, and obtain global path:

 pwd 


We have something like this:



Now run the script in this way to create an application framework:

 php yii/framework/yiic.php webapp /var/lib/stickshift/ffa13067224647beb05863058997082a/app-root/data/354172/php git 


Add all received:

 git add php git commit -m "created yii skeleton app" 


Trial run php / index.php from Cloud9 show us a warning:

date (): It is not safe to rely on the system's timezone settings.

We solve this by adding a php / protected / config / main.php following:

 <?php // uncomment the following to define a path alias // Yii::setPathOfAlias('local','path/to/local-folder'); date_default_timezone_set( 'UTC' ); 


And do not forget to commit:

 git commit -a -m "set the default timezone to UTC" 


I want to note that the problem exists only in Cloud9, in Openshift application starts without any warning.



Step 5. Creating a database to set up the connection and OpenShift

Of course, you can get the database sqlite, but for the sake of self-interest set up MySQL, add the cartridge on the application page.



UPD1: Be sure to note issued before the end of the password, as after that I could not find a way to repair or change the password: (. As its Urchr to comment , login and password are stored in environment variables. To receive them, you can use the terminal Cloud9 and remotely connect to the application via SSH. login using the standard - admin, and the password is taken from the $ OPENSHIFT_MYSQL_DB_PASSWORD.
UPD2: Address and port of the database, I was able to find out just putting phpMyAdmin cartridge is also available through the console environment variables $ OPENSHIFT_MYSQL_DB_HOST and $ OPENSHIFT_MYSQL_DB_PORT.

For administrative purposes, will also supply toner phpMyAdmin.



In the same php / protected / config / main.php configure the connection to MySQL.

That's it!

The application is now ready for action. All this can be done using only a browser, anywhere with Internet access.

0 commentaires:

Enregistrer un commentaire

 
© Copyright 2010-2011 GARMOBI All Rights Reserved.
Template Design by Herdiansyah Hamzah | Published by Borneo Templates | Powered by Blogger.com.