4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

minishift 入れて試す

Last updated at Posted at 2017-11-24

OpenShift の簡易オールインワン版

手元にある環境で手っ取り早く試すために入れてみた。

環境

  • OS: Windows 7 Home Premiun
  • CPU: Core7i
  • Memory: 4GB
  • Virtual box 5.2

セットアップ

c:\drive>minishift.exe start --vm-driver virtualbox
-- Checking if requested hypervisor 'virtualbox' is supported on this platform .
.. OK
-- Checking the ISO URL ... OK
-- Starting profile 'minishift'
-- Starting local OpenShift cluster using 'virtualbox' hypervisor ...
-- Minishift VM will be configured with ...
   Memory:    2 GB
   vCPUs :    2
   Disk size: 20 GB

   Downloading ISO 'https://github.com/minishift/minishift-b2d-iso/releases/down
load/v1.2.0/minishift-b2d.iso'
 40.00 MiB / 40.00 MiB [===========================================] 100.00% 0s
-- Starting Minishift VM .......................................................
....................... OK
-- Checking for IP address ... OK
-- Checking if external host is reachable from the Minishift VM ...
   Pinging 8.8.8.8 ... OK
-- Checking HTTP connectivity from the VM ...
   Retrieving http://minishift.io/index.html ... OK
-- Checking if persistent storage volume is mounted ... OK
-- Checking available disk space ... 0% used OK
-- Downloading OpenShift binary 'oc' version 'v3.6.0'
 33.92 MiB / 33.92 MiB [===========================================] 100.00% 0s-
- Downloading OpenShift v3.6.0 checksums ... OK
-- OpenShift cluster will be configured with ...
   Version: v3.6.0
-- Checking `oc` support for startup flags ...
   routing-suffix ... OK
   host-config-dir ... OK
   host-data-dir ... OK
   host-pv-dir ... OK
   host-volumes-dir ... OK
Starting OpenShift using openshift/origin:v3.6.0 ...
Pulling image openshift/origin:v3.6.0
Pulled 1/4 layers, 26% complete
Pulled 1/4 layers, 74% complete
Pulled 2/4 layers, 84% complete
Pulled 3/4 layers, 88% complete
Pulled 4/4 layers, 100% complete
Extracting
Image pull complete
OpenShift server started.

The server is accessible via web console at:
    https://192.168.99.100:8443

You are logged in as:
    User:     developer
    Password: <any value>

To login as administrator:
    oc login -u system:admin


c:\drive>

アクセス

ブラウザで**https://192.168.99.100:8443**にアクセス。
管理者はID=system、Password=adminでアクセス。

はじめに、プロジェクトを作る。

CLI

cmdでは実行パスを通してからocコマンド利用。

C:\>cd c:\drive

c:\drive>minishift.exe oc-env
SET PATH=C:\Users\hoge\.minishift\cache\oc\v3.6.0\windows;%PATH%
REM Run this command to configure your shell:
REM     @FOR /f "tokens=*" %i IN ('minishift oc-env') DO @call %i

c:\drive>SET PATH=C:\Users\hoge\.minishift\cache\oc\v3.6.0\windows;%PATH%
c:\drive>REM     @FOR /f "tokens=*" %i IN ('minishift oc-env') DO @call %i

c:\drive>oc status
In project My Project (myproject) on server https://192.168.99.100:8443

You have no services, deployment configs, or build configs.
Run 'oc new-app' to create an application.

サンプルアプリを動かす

C:\drive> oc new-app https://github.com/openshift/nodejs-ex -l name=mya
pp
--> Found image 0129e5e (About an hour old) in image stream "openshift/nodejs" u
nder tag "6" for "nodejs"

    Node.js 6
    ---------
    Node.js 6 available as docker container is a base platform for building and
running various Node.js 6 applications and frameworks. Node.js is a platform bui
lt on Chrome's JavaScript runtime for easily building fast, scalable network app
lications. Node.js uses an event-driven, non-blocking I/O model that makes it li
ghtweight and efficient, perfect for data-intensive real-time applications that
run across distributed devices.

    Tags: builder, nodejs, nodejs6

    * The source repository appears to match: nodejs
    * A source build using source code from https://github.com/openshift/nodejs-
ex will be created
      * The resulting image will be pushed to image stream "nodejs-ex:latest"
      * Use 'start-build' to trigger a new build
      * WARNING: this source repository may require credentials.
                 Create a secret with your git credentials and use 'set build-se
cret' to assign it to the build config.
    * This image will be deployed in deployment config "nodejs-ex"
    * Port 8080/tcp will be load balanced by service "nodejs-ex"
      * Other containers can access this service through the hostname "nodejs-ex
"

--> Creating resources with label name=myapp ...
    imagestream "nodejs-ex" created
    buildconfig "nodejs-ex" created
    deploymentconfig "nodejs-ex" created
    service "nodejs-ex" created
--> Success
    Build scheduled, use 'oc logs -f bc/nodejs-ex' to track its progress.
    Run 'oc status' to view your app.

ビルドとデプロイの進捗が確認できる

C:\drive>oc logs -f bc/nodejs-ex
Cloning "https://github.com/openshift/nodejs-ex" ...
        Commit: d1af14dc9fcabc06a5b2987e94de92c730d878f1 (Merge pull request #1
9 from gabemontero/app-label)
        Author: Ben Parees <bparees@users.noreply.github.com>
        Date:   Thu Nov 9 11:13:37 2017 -0500
---> Installing application source ...
---> Building your Node application from source
npm WARN deprecated to-iso-string@0.0.2: to-iso-string has been deprecated, use
@segment/to-iso-string instead.
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install t
e latest version of pug instead of jade
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher
to avoid a RegExp DoS issue
nodejs-ex@0.0.1 /opt/app-root/src

中略

Pushed 8/10 layers, 82% complete
Pushed 8/10 layers, 86% complete
Pushed 8/10 layers, 93% complete
Pushed 8/10 layers, 97% complete
Pushed 9/10 layers, 99% complete
Pushed 10/10 layers, 100% complete
Push successful
c:\drive>oc expose svc/nodejs-ex
route "nodejs-ex" exposed

c:\drive> minishift openshift service nodejs-ex --in-browser
Opening the route/NodePort http://nodejs-ex-myproject.192.168.99.100.nip.io in t
he default browser...

c:\drive>

ブラウザで**http://nodejs-ex-myproject.192.168.99.100.nip.io/**にアクセス。

「Welcome to your Node.js application on OpenShift」のページが現れる。

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?