OpenShift xPaaS version 3. "Hello, world"
First we decide:
Redhat OpenShift Container Platform 3.3 (formerly OpenShift Enterprise) is a commercial platform for creating your own
spacecraft instance of the Next Generation Container OS, docks here . Generally for diving deep into the depths of the Linux Atomic Host and this post . Everything is in English.
OpenShift Origin - Open Source project, a free version of the above product. The complete Fedora / RHEL analogy.
Redhat OpenShift xPaaS contains web consoles version 2 and 3 (Next Gen). version 3 is the cloud variation of Redhat OpenShift Container Platform 3.3. From August 1, 2016, registration of new users under v2 is terminated. The difference is enormous. I gave an example of application deployment for v2. V3 has more features, and it's just a different product. Further in the post a simple example to feel the system.
What will we do. For starters, we will create and publish a php application using the console client. Consisting of index.php with phpinfo () call; This will be our conditional "Hello, world". Why is it so simple? To get to the difficult. Those who work with Docker know well the general principles of building the environment, that is, the database container is separate, common to several applications, the applications themselves can be in other containers and communicate with the database using internal mechanisms. Here declared the ability to have different applications, say ruby and java, which in the second version was impossible. Cartridges v2 had a lot of limitations. But it was pretty easy to master.
Create an account
Attention! Necessarily need an account on github.com. That is , they will ask about it and warn about trial access here. In general, in the "Pricing" section, the training freebie has remained so.
Create a local environment (example for CentOS 7.2)
After login in the web console in the upper right "?" help menu from it and start. In the "Command Line Tools" submenu links to the console client. Put it. This os is an Origin client, not rhc like v2. There are also the first steps. Login, create a project.
$oc login https://api.preview.openshift.com --token=..... (на сайте найдете)
Create a myapp project on github or whatever. Clone it yourself, add:
Next, add everything to the github repository. Everything is ready to create a project:
$oc new-project myapp
Now using project "myapp" on server "https://api.preview.openshift.com:443". You can add applications to this project with the 'new-app' command. For example, try: oc new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-ex.git to build a new example application in Ruby.
Follow the advice:
$oc new-app php~http://github.com/myrepo/myapp.git
--> Found image 276fc18 (4 weeks old) in image stream "php" in project "openshift" under tag "5.6" for "php" Apache 2.4 with PHP 5.6 ----------------------- Platform for building and running PHP 5.6 applications Tags: builder, php, php56, rh-php56 * A source build using source code from https://github.com/zirf0/v3.git will be created * The resulting image will be pushed to image stream "myapp:latest" * Use 'start-build' to trigger a new build * This image will be deployed in deployment config "myapp" * Port 8080/tcp will be load balanced by service "myapp" * Other containers can access this service through the hostname "myapp" --> Creating resources with label app=myapp ... imagestream "myapp" created buildconfig "myapp" created deploymentconfig "myapp" created service "myapp" created --> Success Build scheduled, use `'oc logs -f bc/myapp'` to track its progress. Run 'oc status' to view your app.
Here comes an interesting moment. You need to publish the application on the web. In v3 terminology, create a route. In the web console "Applications" → "Routes" → "Create Route". From the command line:
oc create route edge --service myapp route myapp created
View project elements in a web console. But there, at first, the eyes widen. CLI is more convenient with uniformity:
oc get -o wide pods
Or services, routes, etc. Same thing with creating and deleting.
oc get -o wide routes
Will give url, in the browser - phpinfo () output;
Conclusion and plans
There are a lot of possibilities. But first, play the application + database. I'll do it - unsubscribe. To enable HAproxy, several hearths and other things, I'm afraid there will not be enough freebies; no one has canceled resource limits. In the meantime, nothing real is foreseen. You can, of course, deploy the trial or deploy the origin. It's simple, if Docker is worth it, then
$sudo oc cluster up.
It starts the container origin: latest, if necessary, deflating its image. Skillful hands set. Origin can be downloaded as a virtual machine or assembled, it is hosted on a github.
Using oc will create a local ~. / Kube folder with service information (it also exists in the console). No wonder LDK means Linux, Docker, Kubernetes. I would be grateful for clarification corrections, comments and questions.
UPD1 10/27/2016. It’s clear why 30 days is a trial. Testing is ongoing and after 30 days the instance is destroyed in order to free resources for other users. You can register again, but the resources will be provided as soon as they become free. You can put yourself origin . Or create your own cloud based on docker + kubernetes, with blackjack and women.