First, we define:
Redhat OpenShift Container Platform 3.3 (formerly OpenShift Enterprise) is a commercial platform for creating your own spacecraft of the Next Generation Container OS instance, docks here . Generally for immersion in 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. Complete analogy of Fedora / RHEL.
Redhat OpenShift xPaaS contains web consoles versions 2 and 3 (Next Gen). Version 3 is the cloud variation of Redhat OpenShift Container Platform 3.3. Since August 1, 2016, registration of new users for v2 has been discontinued. The difference is enormous. I gave an example of deploying an application for v2. V3 has more opportunities, and it's just another product. Further in the post a simple example to feel the system.
What do we do. We will first 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 quite simple? To reach the difficult. Those who work with Docker know well the general principles of building an environment, that is, a database container is separate, common for several applications, applications themselves can be in other containers and communicate with the database using internal mechanisms. There was declared the possibility of having different applications, say ruby and java, which was impossible in the second version. Cartridges v2 had a lot of restrictions. But it was quite easy to master.
Attention! Be sure to need an account on github.com. That is , they will ask and warn about the trial access here. In general, in the section "Pricing" a training freebie has remained as it was.
After login to the web console in the upper right "?" Help menu with it and start. In the "Command Line Tools" submenu links to the console client. Deliver. This OS is a client of Origin, and not rhc like that of v2. There are also the first steps. Login, creating a project.
$oc login https://api.preview.openshift.com --token=..... ( )
Create on github the project myapp or what another. Clone it yourself, add:
$echo "<?phpinfo(); ?>">index.php
Next, add everything to the repository on the githaba. 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 the web console. But there eyes first run up. CLI is more convenient unification:
oc get -o wide pods
Or services, routes, etc. Same with creation and deletion.
oc get -o wide routes
Dust url, in the browser - output phpinfo ();
Opportunities weight. But to begin to play the application + DB. I will do - accomplish your goal. For activating HAproxy, several pods and other things, I’m afraid there will not be enough freebies, nobody has canceled resource restrictions In the meantime, the real is not expected. You can, of course, expand the trial or expand the origin. It's simple, if the Docker is worth it, then$sudo oc cluster up
.
Launch the origin: latest container, if necessary, download its image. A set of "skillful hands." Origin can be downloaded as a virtualka or compiled, it is hosted on a github.
Using oc will create a local folder ~. / Kube with service information (it also exists in the console). No wonder LDK stands for Linux, Docker, Kubernetes. I would be grateful for corrections, comments and questions.
UPD1 10.27.2016 . It is clear why 30 days is a trial. There is testing and after 30 days the copy is destroyed, in order to release resources for other users. You can register again, but resources will be provided as soon as they become available. You can set yourself origin . Or create your own cloud for docker + kubernetes, with blackjack and women.
Source: https://habr.com/ru/post/312348/
All Articles