If the topic of installing WP into the cloud is interesting for you, then here and now we will consider one of the implementation options.
We will consider installing WP to the cloud OpenShift (by RedHat), because of all the options known to me, this one is the simplest and has the most interesting features described in the
article .
Similar articles have already been, but for me they answered not all the questions and solved not all the problems. Because here I will describe my way.
')
The instructions are written with the expectation that the reader has basic skills in working with web applications:
1. Installing WordPress on regular hosting
2. Download code via GIT (but SFTP is also possible)
Let's start with ...
OpenShift account registration
The registration form is extremely simple, which immediately inspires hope for further simplicity and looking ahead to say that these expectations will be met.
We carry out the registration procedure in accordance with the instructions.

Go ahead ... log in and go to the console for settings.
Specify namespace
We start with the Settings section, namely Namespace, where you need to specify the part of the URL in which our applications will be located.

I specified casepress what the URL of the application will look like in the figure is clear.
Configure SSH keys
We need the SSH key to secure access to the application through:
- SSH (secure command line)
- SFTP (secure file upload)
- GIT (synchronization of application code)
Further:
If you already have SSH keys and you know what and how to do, you can manually load the public key on the
Settings page, in the “Public Keys” field.
If there is no understanding and you want a minimum of problems, then just install the client package of tools (
Installing OpenShift RHC Client Tools ), then, as you get to the “rhc setup” command, the system will check the key itself, create it if not and upload it to the server.
The result should be:

Keys can be added more, depending on the number of required connections. Maybe you have colleagues or need to connect from different devices.
Create the first application
Put the base cartridges
Here it is worthwhile to dwell on the fact that OpenShift correctly defines the term “application”, meaning by it, including. CMS WordPress. In contrast to the concepts adopted in Russia, where many terms with fuzzy meanings are introduced: website, web application, service, etc.
Go:1. Go to the “
Create Application ” page.
2. We are offered many ready-made templates, incl. a simple WordPress installation, which we politely refuse, because not looking for easy ways

3. You can try to put WordPress on an OpenShift template, as I did for the first time. It is simple and fast. But I did not like it, because put
reworked WordPress in English from the repository on GitHub , which is very different from the standard by various changes with adaptation to the possibilities of OpenShift. After installing a couple of plug-ins, I had an error with a white screen, I did not understand the reasons and just blew everything.
4. Select PHP 5.3. A form opens in which you need to specify the data of our application and states that the application is based on a PHP 5.3 cartridge (yes, the components in OpenShift are called cartridges). Here all you need is to specify the name of the application. Indicated the name of the test and get the URL: test-casepress.rhcloud.com. Everything. Click “Create Application”. It will take some time.

5. After installing the application, we will be transferred to a page with further instructions. Here it is worth paying attention to the GIT instructions. The bottom line is that the download code here is done via GIT, and not via FTP, as many are used to. This is an important feature, which we will dwell on. While you can not delve.

6. Go to
the “My Applications” page and see the first application in the list:

7. By clicking on the name of the application, we get to the settings page:

8. Here we add another cartridge to this application: MySQL. Completely the same way, just press the “ADD CARTRIDGE” button

We are ready to download WordPress. Go to the next step.
Set up your domain (URL)
If the domain of the appname-namespace.rhcloud.com type you don’t like and want to add your type “mydomen.ru” is beautiful and understandable, for this you need to add aliace:

Download WordPress Files
It is worth noting here that we will upload the code not through FTP, as is customary on hosting, but through GIT.
If you do not have GIT, then it's time to
put it . Good instruction is
here .
I have another GIT client, but for simplicity, I will use the standard GIT GUI in this manual. You can read
how to work with GIT in console mode in the
instructions for OpenShift .
1. Run the GIT GUI, then select the “Clone existing repository” command

2. As the initial position, select the GIT URL of your application with OpenShift, which can be seen on the settings page (item 7, Put the basic cartridges) of the application, and specify the directory in which we want to store a copy of the repository as the destination directory. This can be any convenient directory on your PC. Everything. Click “Clone” and wait until the files load.

3. Must get the following result (GIT shows calm, and in the folder we see the contents of the application):

4. For now we’ll miss the meaning and meaning of these folders, and pay attention to the php folder, this is where the executable files of the application are located, including index.php, here and copy the WordPress files. Should get the following:

5. We changed the contents of the repository. If you open GIT, and click the “Reread” button, you will see the following:

6. Accept changes. Click “Prepare All”, specify the comment about the change, click “Save”, and “Submit”, then in the submission form, click “Submit” again. GIT will start uploading files to the server.

7. After the data is loaded into the server repository (origin), the publishing scripts will automatically run:

Customize WordPress
And here comes the first difference from the traditional work with WordPress, we cannot edit the files on the server in any way other than GIT without consequences.
On the one hand, this is sadness - unnecessary actions, on the other hand, it allows you to simplify changes, they are easy to roll back in case of errors, and it is not replaceable if more than one person works on the application.
Because the standard, simple and familiar dialog to create files wp-config.php we can not see. You have to change it on your PC and upload it to the server via GIT. And it's not easy to change, but to change a little slyly, taking into account the peculiarities of the OpenShift environment.
If you do not really want to learn GIT, you can do this via SFTP. To work with him there is a
video instruction (in English) and a
text (in Russian, with obscenities) . Under Windows, I managed to log in via FileZilla. But you need to understand that you still have to reckon with GIT, if the changes made in some way are not reflected in the GIT, then with the next download via GIT, all changes will be washed away.
Go:1. If you have a new WordPress installation, then you do not have a wp-config file in the folder, but there is a wp-config-sample.php. Take it, copy and rename it to wp-config.php
2. Open the new wp-config.php and specify the key parameters: database name, database user name, database password, database connection address. You do not need to know them, because they are specified as variables. You can bravely and completely copy them from here. I did this:

3. Now you need to manually adjust the salt:
3.1. As stated in the file, for this you need to go to
api.wordpress.org/secret-key/1.1/salt3.2. The result is copied to the appropriate section wp-config.php
4. At the end of the change wp-config.php finished. We save. We are closing. Go to git ...
5. GIT should show that it has detected changes in the wp-config.php file, we accept, commit, push.
6. Now, if you go to the page of our application, you will see that the installation of WordPress immediately begins with the settings of the site name, etc., i.e. we passed the setting of the connection to the database, due to the fact that we did everything through GIT.

7. Further installation occurs as usual.
Brakes in the application
After installation, noticed hard braking. One page was loaded for a very long time (1-4 seconds per page with 30 queries to the database), despite the fact that on a regular virtual hosting, in the same conditions, this figure is: 0.2-0.4 seconds.
Communication on the forum was reduced to the arguments that I live in Siberia. And they are in the USA - because their website with the database is faster
Disassembling the server is not my way. I am looking for simple solutions.
Appeal to the official email allowed to negotiate an increase in resources for my applications to the Medium level (Small is by default given).
I have become available to create an application with the choice of Gears = Medium. Then the site approached the normal parameters: 0.3-0.4 seconds per page.

Features and notes
1. You need to choose a scheme for working with the site:
1.1. traditional (console, SFTP ...)
1.2. GIT - will have to give up all the amenities that you get in WordPress, the ease of adding plug-ins, the ability to add, remove or fix something via SFTP. But in return, you get a full audit and versioning of all changes to the application, without exception, with the ability to track history, rollback, etc. If you choose SFTP, the principles of site administration are not very different from traditional ones, except that if you decide to try GIT, you can accidentally demolish the entire site;
2. To make an archive of the application with all the files is very easy:
2.1. To do this, you must have the Installing OpenShift RHC Client Tools
2.2. further, if we want to get the archive to our D: drive, then we give the following command: “rhc app snapshot save -a {appName} -fd: \ appname.tar.gz”, where {appName} is the name of the application you specified on the page for adding an application (p.4, Put the basic maps).
3. You can set up a phpMyAdmin cartridge for working with MySQL, this can be done easily via the web console on the page of your application.
4. It would be good after all installations to add the .gitignore file to the “/ appname / php /” directory, and exclude wp-content / uploads from there, so that the site’s files do not get into GIT attention.
5. There is a free fare, this is good. But at this tariff the site noticeably slows down (page loading 1-4 seconds with 30 queries to the database), even without any plug-ins compared to regular hosting for 1500-2000 rubles. per year (page load in 0.2-0.4 seconds with 30 queries to the database). The transition to Medium Gears partially solves this problem, but now it is done only through the support service, and in the future it will be a paid option.
If someone knows how to configure the DBMS on OpenShift with the acceleration of work, without switching to Medium mode - I will be very grateful.