SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Downloaden Sie, um offline zu lesen
openshift [mtchang's wiki]                                                       頁 1 / 16




 簡介
 雲端服務是目前常見對於網路服務應用運作模式的稱謂,大多數的使用者很難清楚的定義何謂雲端?在美國國家
 標準與技術研究院(NIST)對於雲端運算提出了一份明確的定義 [http://www.nist.gov/itl/cloud/index.cfm], 雲
 端運算是一種網路應用的運作模式,其需求能夠方便存取網路上所提供的電腦資源,其包含5種特徵、4種建置模
 式、3項服務,比較常見的有3種服務模式 (SaaS)軟體即服務、(PaaS)平台即服務、(IaaS)基礎設施即服務以
 及4種建置方式 Public cloud(公共雲), Private cloud(私有雲), Community cloud(社區雲), Hybrid cloud
 (混合雲),另外有五種特徵可以評估該服務是不是雲端服務的重要項目,分別是(1)On-demand self-service
 (需要時自助的取得)(2)Broad network access(可以透過標準網路取得)(3)Resource pooling(資源可以動態
 配置)(4)Rapid elasticity,(快速且有彈性)(5)Measured Service(用多少付多少)。




 Red Hat(紅帽)提出新的平台即服務(PaaS)、及架構及服務(IaaS)的解決方案 OpenShift,讓使用者可以專心
 於軟體的應用而不是基礎設施的建設。OpenShift的基礎來源於Red Hat於2010年11月收購的科技公司Makara
 technology。目前OpenShift 提供三種不同的部屬應用程序,開發人員可以快速的透過此服務建立開發平台,
 而無須架設任何伺服器。OpenShift Express 提供用來開發 PHP、Ruby、Python 和 Java 等軟體的應用程式
 環境,另外有 OpenShift FLEX 和 OpenShit Power 等服務,OpenShift FLEX 預計供部署、監控、預備用和
 自動擴充與縮減的應用系統,而 OpenShift Power 是部署自己所建置的 Linux,目前 FLEX 和 Power 服務目
 前是還在開發中,只有 OpenShift FLEX 有開放免費使用,OpenShift Flex 提用試用,而 OpenShift Power
 還在開發中。

 本文目的則以OpenShift Express 的申請及如何使用,並且建立可以用的CMS系統的過程做說明。


 申請OpenShift Express服務
 * OpenShift Express 目前提供有 php-5.3.2, wsgi-3.2.1, rack-1.1.0 and jbossas-7.0.0 三種服務,底
 下已申請一個PHP 應用程式服務為範例。 * 目前系統提供 RHN account 登入,如果你已經有 RHN 帳號可以
 直接登入使用。沒有的使用者請先註冊 成為一個新的使用者。

 *                           註冊新使用者的網址:https://openshift.redhat.com/app/user/new/express
 [https://openshift.redhat.com/app/user/new/express]




file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
openshift [mtchang's wiki]                                                                頁 2 / 16




 * 送出後系統會發出確認信件到你的信箱,確認後會引導到網站並要求你卻認同意此機器的使用規範。。




 * 確認完成後你的信箱會收到一封信件,告訴你下一步該如何做?

 *             同這網址的內容                    https://openshift.redhat.com/app/getting_started/express
 [https://openshift.redhat.com/app/getting_started/express] ,因為這系統仍然不斷的在開發中,你可以透過
 IRC: #openshift on Freenode [http://webchat.freenode.net/] 直接反映問題。

  Thank you for requesting access to OpenShift Express!
  To get started, click on this link:
  https://openshift.redhat.com/app/getting_started/express
  We'd love to hear your feedback, please join us on IRC and our forums.
  Thanks
  The Red Hat OpenShift Team
  IRC: #openshift on Freenode



 使用Express


file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
openshift [mtchang's wiki]                                                     頁 3 / 16




 * 要開始使用 Express account 必須要有些 Client 端應用程式才可以連接到該服務主機,目前只有提供
 command 指令模式的方式。

 * 目前 Client 端有支援的為 RHEL 6 or Fedora or MAC or Windows ,但Mac 需鑰匙用 gem ,Windows
 需要 cygwin 。看起來都很麻煩。

 * Linux 目前只提供 RHEL 6 以上的版本來安裝,所以最後我選擇了 Fedora 15 [http://fedoraproject.org/]
 這個版本來完成下面的實做:




file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
openshift [mtchang's wiki]                                                     頁 4 / 16




file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
openshift [mtchang's wiki]                                                                頁 5 / 16




 Fedora安裝rhc
 * 將底下的 repo 檔案 openshift.repo 放到 /etc/yum.repos.d/ 目錄內

  # 改變目錄
  [root@localhost mtchang]# cd /etc/yum.repos.d/
  # 新增 openshift repo 檔案
  [root@localhost yum.repos.d]# vim openshift.repo
  [openshift-express]
  name=Openshift-express
  baseurl=https://openshift.redhat.com/app/repo/rpms/$releasever/$basearch/
  failovermethod=priority
  skip_if_unavailable=1
  gpgkey=https://openshift.redhat.com/app/repo/RPM-GPG-KEY-redhat-beta
  ggpkey=https://openshift.redhat.com/app/repo/RPM-GPG-KEY-redhat-release
  enabled=1
  gpgcheck=1
  # 安裝 rhc 工具
  [root@localhost mtchang]# yum install rhc


 * 檢查應用程式,系統主要使以 rhc-* 開頭的程式負責這些工作

  [root@localhost ~]# rpm -ql rhc-0.68.5-1.el6.noarch
  /etc/openshift/express.conf <-- 設定檔
  /usr/bin/rhc-create-app <-- 負責應用程式建立
  /usr/bin/rhc-create-domain <-- 負責 Domain 名稱建立及申請
  /usr/bin/rhc-ctl-app <-- 控制應用程式啟動、停止、刪除....
  /usr/bin/rhc-snapshot <-- 把應用程式打包成 gzip
  /usr/bin/rhc-user-info <-- 顯示使用者在 rhcloud.com 的資訊
  ... 略.....



 建立Domain
 * 建立 domain ,使用 /usr/bin/rhc-create-domain 程式在 rhcloud 註冊一個 domain

 * 註冊名稱為 jangmt 在雲端的使用者帳號為 jangmt@gmail.com

  [jangmt@localhost ~]$ rhc-create-domain -n jangmt -l jangmt@gmail.com
  Password: rhcloud的密碼
  Generating Openshift Express ssh key to /home/jangmt/.ssh/libra_id_rsa
  Generating public/private rsa key pair.
  Created directory '/home/jangmt/.ssh'.
  Enter passphrase (empty for no passphrase):
  Enter same passphrase again:
  Your identification has been saved in /home/jangmt/.ssh/libra_id_rsa.
  Your public key has been saved in /home/jangmt/.ssh/libra_id_rsa.pub.
  The key fingerprint is:
  18:25:39:79:b5:88:87:9c:56:ab:35:6e:da:3b:4e:8b jangmt@localhost.localdomain
  The key's randomart image is:
  +--[ RSA 2048]----+
  |      .oo..      |
  |     .+B.o .     |
  |      Bo* .      |
  |     . B .       |
  |      o S        |
  |       +         |
  |      . o        |
  |       o.o       |
  |      E.+.       |
  +-----------------+
  Contacting https://openshift.redhat.com
  Adding rhlogin to /home/jangmt/.openshift/express.conf
  Creation successful

  You may now create an application. Please make note of your local config file
  in /home/jangmt/.openshift/express.conf which has been created and populated for you.


 * 這動作會建立一組 ssh key 來提供程式開發上 git 的存取。


 建立PHP應用程式




file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
openshift [mtchang's wiki]                                                                      頁 6 / 16



 * 建立應用程式 /usr/bin/rhc-create-app ,目前系統提供 php-5.3.2, wsgi-3.2.1, rack-1.1.0 三種選項的
 應用程式可以選擇。

 * 底下為建立一個應用程式 myphp 提供 php-5.3.2 的應用程式功能

  [jangmt@localhost ~]$ rhc-create-app -a myphp -t php-5.3.2 -l jangmt@gmail.com
  Password:

  Please support the developer preview - let #openshift on freenode know of any
  bugs you find

  Creating remote application space: myphp
  Contacting https://openshift.redhat.com

  RESULT:
  Successfully created application: myphp

  Checking ~/.ssh/config
  Contacting https://openshift.redhat.com
  Found rhcloud.com in ~/.ssh/config... No need to adjust
  Now your new domain name is being populated worldwide (this might take a minute)...
  Pulling new repo down
  Warning: Permanently added the RSA host key for IP address '50.17.172.80' to the list of known hosts.
  remote: Counting objects: 23, done.
  remote: Compressing objects: 100% (20/20), done.
  remote: Total 23 (delta 6), reused 0 (delta 0)
  Receiving objects: 100% (23/23), done.
  Resolving deltas: 100% (6/6), done.
  Confirming application myphp is available
    Attempt # 1

  Success!   Your application is now published here:

        http://myphp-jangmt.rhcloud.com/

  The remote repository is located here:

      ssh://a0aaf4b1ba3f4f3dbf7abd14c64fa89f@myphp-jangmt.rhcloud.com/~/git/myphp.git/

  To make changes to your application, commit to myphp/.
  Then run 'git push' to update your Openshift Express space


 * 此程式會將剛剛的金鑰上傳到遠端機器,並且再本機建立一個目錄 ~/myphp 。此目錄可以透過 git 的SCM
 管理方式管理程式碼。

 *    並且建立一個應用程式名稱的對應網域           http://myphp-jangmt.rhcloud.com/ [http://myphp-
 jangmt.rhcloud.com/] ,當修改完程式後只需使用 git push 程式到遠端主機即可完成上傳程式碼的工作。

 *      第一次建立好,都沒有修改的畫面如下:http://myphp-jangmt.rhcloud.com/                               [http://myphp-
 jangmt.rhcloud.com/]




 * 修改 index.php 加上 phpinfo(); 並git push 上 server




file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
openshift [mtchang's wiki]                                                                      頁 7 / 16



  # 本地端產生 ~/myphp 的目錄,程式統一放在 ~/myphp/php 目錄內
  [jangmt@localhost php]$ cd /home/jangmt/myphp/php/
  [jangmt@localhost php]$ pwd
  /home/jangmt/myphp/php

  # 修改程式碼,加入 <?php phpinfo(); ?> 這段做為測試
  [jangmt@localhost php]$ vim index.php
  <html><title>OpenShift!</title>
  <body>
  <h1>Welcome to OpenShift</h1>
  <p>Place your application here</p>
  <p>In order to commit to your new project, go to your projects git repo
   (created with the create_http command). Make your changes, then run:</p>
  <pre>git commit -a -m 'Some commit message'
  git push</pre>
  <p>Then reload this page</p>
  <?php phpinfo(); ?>
  </body>
  </html>


 * 加上 commit 資訊並 git push

  # git commit -a 將所有修改過得檔案都 commit, 但是新增的檔案 還是得要先 add 才可以(git add -A 新增所有變更的檔案)
  # -m 'message' 指的是在這個 commit 加上說明的內容
  [jangmt@localhost php]$ git commit -a -m 'add phpinfo() in index.php'
  [master a7aaf2b] add phpinfo() in index.php
   1 files changed, 1 insertions(+), 0 deletions(-)

  # git-push 更新遠端的檔案物件資訊
  [jangmt@localhost php]$ git push
  Counting objects: 7, done.
  Compressing objects: 100% (4/4), done.
  Writing objects: 100% (4/4), 399 bytes, done.
  Total 4 (delta 2), reused 0 (delta 0)
  remote: tar: README: time stamp 2011-05-31 07:51:47 is 28761.007922033 s in the future
  remote: tar: libs/README: time stamp 2011-05-31 07:51:47 is 28761.00683967 s in the future
  remote: tar: libs: time stamp 2011-05-31 07:51:47 is 28761.006520158 s in the future
  remote: tar: misc/README: time stamp 2011-05-31 07:51:47 is 28761.006146669 s in the future
  remote: tar: misc: time stamp 2011-05-31 07:51:47 is 28761.005907377 s in the future
  remote: tar: php/health_check.php: time stamp 2011-05-31 07:51:47 is 28761.005505289 s in the future
  remote: tar: php/index.php: time stamp 2011-05-31 07:51:47 is 28761.005190215 s in the future
  remote: tar: php: time stamp 2011-05-31 07:51:47 is 28761.004967428 s in the future
  To ssh://a0aaf4b1ba3f4f3dbf7abd14c64fa89f@myphp-jangmt.rhcloud.com/~/git/myphp.git/
     ebb33fa..a7aaf2b master -> master


 * 上傳更新完成,再看一次網頁內容




 * Git 是分散式的版本控制系統,可以方便的用於程式碼的管理。Git目前為很多自由軟體專案的版本控制工具,
 與常用的版本控制工具CVS,Subversion 不同,它採用了分散式版本庫的方式,不必伺服器端軟體也可以存取所
 以使得原始碼的發布和交流更方便。




file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
openshift [mtchang's wiki]                                                                   頁 8 / 16




 安裝Drupal
 * 既然可以使用 php 的功能在伺服器上,這裡以 Drupal 這個很受歡迎的的內容管理系統當作範例,安裝到
 openshift 服務上。 * Drupal 是一個自由開源的內容管理系統,以PHP語言寫成。後端的資料庫為MySQL或
 PostgreSQL,在7.0版本以後開始支援SQLite資料庫。 * 因為此服務沒有提供資料庫的功能,所以直接使用
 SQLite 用檔案型態的資料庫當城後端資料庫。

 * 將檔案放到跟目錄,並且修改設定檔。

  # 抓最新的版本
  [jangmt@localhost php]$ wget wget http://ftp.drupal.org/files/projects/drupal-7.2.tar.gz
  # 解開
  [jangmt@localhost php]$ tar zxf drupal-7.2.tar.gz
  # 搬動
  [jangmt@localhost php]$ mv drupal-7.2/.* .
  mv: cannot move `drupal-7.2/.' to `./.': Device or resource busy
  mv: cannot move `drupal-7.2/..' to `./..': Device or resource busy
  [jangmt@localhost php]$ mv drupal-7.2/* .
  # 刪除
  [jangmt@localhost php]$ rm -rf drupal-7.2 drupal-7.2.tar.gz
  # 修改設定檔
  [jangmt@localhost php]$ vim sites/default/default.settings.php
  $base_url = 'http://myphp-jangmt.rhcloud.com';


 * 更新上傳修改的程式碼

  # 增加有新增的檔案到索引內
  [jangmt@localhost php]$ git add -A
  # 新增修改的的訊息及變動的檔案
  [jangmt@localhost php]$ git commit -a -m "drupal to http://myphp-jangmt.rhcloud.com/"
  [master 36c5a3a] drupal to http://myphp-jangmt.rhcloud.com/
   998 files changed, 290732 insertions(+), 11 deletions(-)
   create mode 100644 php/.gitignore
   create mode 100644 php/.htaccess
  ...skip...
  # 上傳
  [jangmt@localhost php]$ git push
  ...skip...
  remote: tar: php: time stamp 2011-05-31 08:00:29 is 28702.719547983 s in the future
  To ssh://a0aaf4b1ba3f4f3dbf7abd14c64fa89f@myphp-jangmt.rhcloud.com/~/git/myphp.git/
     a7aaf2b..36c5a3a master -> master


 * 完成後,可是在進入剛剛的網址觀看,他即會進入安裝畫面。

 * 請選擇標準安裝 standard




file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
openshift [mtchang's wiki]                                                     頁 9 / 16




 * 選擇安裝的語系,請不要增加中文語系安裝,因為中文語系的翻譯檔有問題安裝到一半會卡住。




 * 資料庫請選擇 SQLite




file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
openshift [mtchang's wiki]                                                    頁 10 / 16




 * 接下來進進入模組的安裝過程了




 * 網站設定頁面




file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
openshift [mtchang's wiki]                                                    頁 11 / 16




file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
openshift [mtchang's wiki]                                                    頁 12 / 16




 * 安裝完成




 * 正式網站頁面




file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
openshift [mtchang's wiki]                                                                      頁 13 / 16




 安裝 dokuwiki
 * dokuwiki 是一套只需要 php 語言支援的 wiki 程式,後端存放資料是以文字檔型態儲存並且可以具有可閱讀
 性,非常適合在這樣的環境中使用。 * 安裝過程

  # 取得軟體,放到根目錄
  [jangmt@localhost php]$   wget http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-2011-05-25.tgz
  # 解開
  [jangmt@localhost php]$   tar zxf dokuwiki-2011-05-25.tgz
  # 更名為 wiki
  [jangmt@localhost php]$   mv dokuwiki-2011-05-25 wiki
  # 刪除原本的檔案及目錄
  [jangmt@localhost php]$   rm dokuwiki-2011-05-25.tgz
  # git 新增檔案
  [jangmt@localhost php]$   git add -A
  # git 新增修改及註解
  [jangmt@localhost php]$   git commit -a -m 'add dukewiki in /wiki/'
  # git 上傳
  [jangmt@localhost php]$   git push


 * 到網站上看看 http://myphp-jangmt.rhcloud.com/wiki/ [http://myphp-jangmt.rhcloud.com/wiki/] ,…
 裝好了…




 * 還真是快呀!!!!!!




file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
openshift [mtchang's wiki]                                                                      頁 14 / 16



 刪除應用程式

 * 目前 Openshift express 只支援使用者同時擁有一個應用程式,所以如果需要測試另外一種應用程式服務,
 只能將這個裝好的服務移除再行安裝。

 * /usr/bin/rhc-ctl-app 指令提供應用程式 (start|stop|restart|reload|status|destroy) 這些功能,底下範
 例為使用 destroy 刪除剛註冊的應用程式。

  [jangmt@localhost ~]$ rhc-ctl-app -c destroy -a myphp -l jangmt@gmail.com
  Password:
  Contacting https://openshift.redhat.com
  !!!! WARNING !!!! WARNING !!!! WARNING !!!!
  You are about to destroy the myphp application.

  This is NOT reversable, all remote data for this application will be removed.
  Do you want to destroy this application (y/n): y
  Contacting https://openshift.redhat.com

  RESULT:
  Successfully destroyed application: myphp


 * 當你 destory 應用程式只會移除雲端的資料,本地端的目錄還是一樣存在不會有任何的異動。


 建立wsgi應用程式
 * Python網頁開發的標準: WSGI,(Python Web Server Gateway Interface,縮寫為WSGI)是為Python
 語言定義的Web伺服器和Web應用程序或框架之間的一種簡單而通用的介面。

 * 建立一個 wsgi 應用程式,這程式會在本機 ~/mywsgi/ 建立一個目錄和上面 php 的開發方式一樣需要透過
 git 更新程式。

  [jangmt@localhost ~]$ rhc-create-app -a mywsgi -t wsgi-3.2.1 -l jangmt@gmail.com
  Password:

  Please support the developer preview - let #openshift on freenode know of any
  bugs you find

  Creating remote application space: mywsgi
  Contacting https://openshift.redhat.com

  RESULT:
  Successfully created application: mywsgi

  Checking ~/.ssh/config
  Contacting https://openshift.redhat.com
  Found rhcloud.com in ~/.ssh/config... No need to adjust
  Now your new domain name is being populated worldwide (this might take a minute)...
  Pulling new repo down
  Warning: Permanently added 'mywsgi-jangmt.rhcloud.com,50.17.156.80' (RSA) to the list of known hosts.
  remote: Counting objects: 30, done.
  remote: Compressing objects: 100% (25/25), done.
  remote: Total 30 (delta 9), reused 0 (delta 0)
  Receiving objects: 100% (30/30), done.
  Resolving deltas: 100% (9/9), done.
  Confirming application mywsgi is available
    Attempt # 1

  Success!   Your application is now published here:

        http://mywsgi-jangmt.rhcloud.com/

  The remote repository is located here:

      ssh://a0aaf4b1ba3f4f3dbf7abd14c64fa89f@mywsgi-jangmt.rhcloud.com/~/git/mywsgi.git/

  To make changes to your application, commit to mywsgi/.
  Then run 'git push' to update your Openshift Express space


 *    建立好的          wsgi      應用程式網站           http://mywsgi-jangmt.rhcloud.com/           [http://mywsgi-
 jangmt.rhcloud.com/]




file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
openshift [mtchang's wiki]                                                                    頁 15 / 16




 * 修改預設的 application 這只程式,成為最簡單的 hello world (透過 wsgi方式呈現)。

  [jangmt@localhost mywsgi]$ pwd
  /home/jangmt/mywsgi

  # 修改程式內容
  [jangmt@localhost mywsgi]$ vim wsgi/application
  def simplestApp(environ, start_response):
      start_response('200 OK',[('Content-type','text/plain')])
      return ['Hello world!']
  # 指定輸出app
  application = simplestApp

  # 更新修改
  [jangmt@localhost mywsgi]$ git commit -a -m 'simplest APP test'
  [master 95b7a2b] simplest APP test
   1 files changed, 5 insertions(+), 36 deletions(-)
   rewrite wsgi/application (99%)

  # git上傳
  [jangmt@localhost mywsgi]$ git push
  Counting objects: 7, done.
  Compressing objects: 100% (3/3), done.
  Writing objects: 100% (4/4), 422 bytes, done.
  Total 4 (delta 1), reused 0 (delta 0)
  remote: tar: README: time stamp 2011-05-31 08:47:47 is 28763.774683407 s in the future
  remote: tar: data/SAFETOREMOVE.txt: time stamp 2011-05-31 08:47:47 is 28763.773869298 s in the future
  remote: tar: data: time stamp 2011-05-31 08:47:47 is 28763.773712804 s in the future
  remote: tar: libs/SAFETOREMOVE.txt: time stamp 2011-05-31 08:47:47 is 28763.773307896 s in the future
  remote: tar: libs: time stamp 2011-05-31 08:47:47 is 28763.773183541 s in the future
  remote: tar: wsgi/application: time stamp 2011-05-31 08:47:47 is 28763.772759805 s in the future
  remote: tar: wsgi: time stamp 2011-05-31 08:47:47 is 28763.772630393 s in the future
  To ssh://a0aaf4b1ba3f4f3dbf7abd14c64fa89f@mywsgi-jangmt.rhcloud.com/~/git/mywsgi.git/
     73ae5b9..95b7a2b master -> master


 * hello world 的結果




file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
openshift [mtchang's wiki]                                                                     頁 16 / 16




 * 自Python提出了WSGI標準,它可重覆利用和有彈性的特性,使得網頁開發可以更專注於更重要的地方。當然
 OpenShift 也就以此為標準讓使用這可以專注於程式上面的開發。


 結論

 *  當系統問題變的簡單,所有的服務都可以在雲端上找到資源。針對MIS人員的存在價值應該也要跟著有所轉
 變,傳統上MIS人員是管看的見的硬體、設備,在雲 端服務下MIS人員只是從管看的見,轉成管虛擬的、Cloud
 上的資源,並且有更多的時間專於IT及組織的問題予以處理改善。雲端服務只是以前的技術應用 的創新,透過基
 礎課程的訓練,瞭解每個細節將來也大多事這些基礎的運作模式用不同的組合搭配出現。底下是上面這些相關資
 訊的延伸參考:

 *    寫給大家的Git教學,Littlebtc(Hsiao-Ting                Yu),http://www.slideshare.net/littlebtc/git-5528339
 [http://www.slideshare.net/littlebtc/git-5528339]

 *       Getting         Git       ,Scott         Chacon,http://www.slideshare.net/chacon/getting-git
 [http://www.slideshare.net/chacon/getting-git]

 * Why Git is Better than X,Scott Chacon ,http://zh-tw.whygitisbetterthanx.com/ [http://zh-
 tw.whygitisbetterthanx.com/](中文翻譯 Kanru Cehn)

 *            RedHat             Document                ,https://www.redhat.com/openshift/documents
 [https://www.redhat.com/openshift/documents]

 *   The   NIST     Definition   of     Cloud    Computing(Draft),NIST   Peter   Mell;Yimothy
 Grance ,http://csrc.nist.gov/publications/drafts/800-145/Draft-SP-800-145_cloud-definition.pdf
 [http://csrc.nist.gov/publications/drafts/800-145/Draft-SP-800-145_cloud-definition.pdf]

 * WSGI,wikipedia,http://zh.wikipedia.org/zh-tw/WSGI [http://zh.wikipedia.org/zh-tw/WSGI]

 * 化整為零的次世代網頁開發標準: WSGI, Victor,http://blog.ez2learn.com/2010/01/27/introduction-
 to-wsgi/ [http://blog.ez2learn.com/2010/01/27/introduction-to-wsgi/]

 * Rack 與 Rack middleware,xdite,http://blog.xdite.net/?p=1557 [http://blog.xdite.net/?p=1557]




file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25

Weitere ähnliche Inhalte

Was ist angesagt?

设置用vim编辑python
设置用vim编辑python设置用vim编辑python
设置用vim编辑pythonKing Hom
 
使用Lua提高开发效率
使用Lua提高开发效率使用Lua提高开发效率
使用Lua提高开发效率gowell
 
Phpconf 2011 introduction_to_codeigniter
Phpconf 2011 introduction_to_codeigniterPhpconf 2011 introduction_to_codeigniter
Phpconf 2011 introduction_to_codeigniterBo-Yi Wu
 
一次详细的渗透Wordpress教程
一次详细的渗透Wordpress教程一次详细的渗透Wordpress教程
一次详细的渗透Wordpress教程WASecurity
 
Yet another introduction to Git - from the bottom up
Yet another introduction to Git - from the bottom upYet another introduction to Git - from the bottom up
Yet another introduction to Git - from the bottom upWen-Tien Chang
 
Git and Github basic with SourceTree
Git and Github basic with SourceTreeGit and Github basic with SourceTree
Git and Github basic with SourceTreeChu-Siang Lai
 
2012 php conf slide PIXNET 如何使用 php
2012 php conf slide   PIXNET 如何使用 php2012 php conf slide   PIXNET 如何使用 php
2012 php conf slide PIXNET 如何使用 phpronnywang_tw
 
makefile20141121
makefile20141121makefile20141121
makefile20141121Kevin Wu
 
成為全能 php 攻城獅
成為全能 php 攻城獅成為全能 php 攻城獅
成為全能 php 攻城獅Shengyou Fan
 
COSCUP 2016 Laravel 部署工作坊 - 部署指南
COSCUP 2016 Laravel 部署工作坊 - 部署指南COSCUP 2016 Laravel 部署工作坊 - 部署指南
COSCUP 2016 Laravel 部署工作坊 - 部署指南Shengyou Fan
 
Introduction to MVC of CodeIgniter 2.1.x
Introduction to MVC of CodeIgniter 2.1.xIntroduction to MVC of CodeIgniter 2.1.x
Introduction to MVC of CodeIgniter 2.1.xBo-Yi Wu
 
Why to choose laravel framework
Why to choose laravel frameworkWhy to choose laravel framework
Why to choose laravel frameworkBo-Yi Wu
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshellNelson Tai
 
Phalcon the fastest php framework 阿土伯
Phalcon   the fastest php framework 阿土伯Phalcon   the fastest php framework 阿土伯
Phalcon the fastest php framework 阿土伯Hash Lin
 
前端工程師一定要知道的 Docker 虛擬化容器技巧
前端工程師一定要知道的 Docker 虛擬化容器技巧前端工程師一定要知道的 Docker 虛擬化容器技巧
前端工程師一定要知道的 Docker 虛擬化容器技巧Chu-Siang Lai
 
微软Bot framework简介
微软Bot framework简介微软Bot framework简介
微软Bot framework简介Zhichao Liang
 
Lucene 全文检索实践
Lucene 全文检索实践Lucene 全文检索实践
Lucene 全文检索实践yiditushe
 

Was ist angesagt? (18)

设置用vim编辑python
设置用vim编辑python设置用vim编辑python
设置用vim编辑python
 
使用Lua提高开发效率
使用Lua提高开发效率使用Lua提高开发效率
使用Lua提高开发效率
 
Phpconf 2011 introduction_to_codeigniter
Phpconf 2011 introduction_to_codeigniterPhpconf 2011 introduction_to_codeigniter
Phpconf 2011 introduction_to_codeigniter
 
一次详细的渗透Wordpress教程
一次详细的渗透Wordpress教程一次详细的渗透Wordpress教程
一次详细的渗透Wordpress教程
 
Yet another introduction to Git - from the bottom up
Yet another introduction to Git - from the bottom upYet another introduction to Git - from the bottom up
Yet another introduction to Git - from the bottom up
 
Git and Github basic with SourceTree
Git and Github basic with SourceTreeGit and Github basic with SourceTree
Git and Github basic with SourceTree
 
2012 php conf slide PIXNET 如何使用 php
2012 php conf slide   PIXNET 如何使用 php2012 php conf slide   PIXNET 如何使用 php
2012 php conf slide PIXNET 如何使用 php
 
makefile20141121
makefile20141121makefile20141121
makefile20141121
 
成為全能 php 攻城獅
成為全能 php 攻城獅成為全能 php 攻城獅
成為全能 php 攻城獅
 
COSCUP 2016 Laravel 部署工作坊 - 部署指南
COSCUP 2016 Laravel 部署工作坊 - 部署指南COSCUP 2016 Laravel 部署工作坊 - 部署指南
COSCUP 2016 Laravel 部署工作坊 - 部署指南
 
Introduction to MVC of CodeIgniter 2.1.x
Introduction to MVC of CodeIgniter 2.1.xIntroduction to MVC of CodeIgniter 2.1.x
Introduction to MVC of CodeIgniter 2.1.x
 
Why to choose laravel framework
Why to choose laravel frameworkWhy to choose laravel framework
Why to choose laravel framework
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshell
 
Phalcon the fastest php framework 阿土伯
Phalcon   the fastest php framework 阿土伯Phalcon   the fastest php framework 阿土伯
Phalcon the fastest php framework 阿土伯
 
OSGi Small Lab
OSGi Small LabOSGi Small Lab
OSGi Small Lab
 
前端工程師一定要知道的 Docker 虛擬化容器技巧
前端工程師一定要知道的 Docker 虛擬化容器技巧前端工程師一定要知道的 Docker 虛擬化容器技巧
前端工程師一定要知道的 Docker 虛擬化容器技巧
 
微软Bot framework简介
微软Bot framework简介微软Bot framework简介
微软Bot framework简介
 
Lucene 全文检索实践
Lucene 全文检索实践Lucene 全文检索实践
Lucene 全文检索实践
 

Andere mochten auch

Lets Talk Poverty (Denise Caron, ChristmasFuture)
Lets Talk Poverty (Denise Caron, ChristmasFuture)Lets Talk Poverty (Denise Caron, ChristmasFuture)
Lets Talk Poverty (Denise Caron, ChristmasFuture)T3.Transformer
 
驛站食堂 西子灣 Menu
驛站食堂 西子灣 Menu驛站食堂 西子灣 Menu
驛站食堂 西子灣 MenuChang Mt
 
устроиства компьютера
устроиства компьютераустроиства компьютера
устроиства компьютераmasjanja92
 
Cloud Crowd - A web 2.0 Trading experience
Cloud Crowd - A web 2.0 Trading experienceCloud Crowd - A web 2.0 Trading experience
Cloud Crowd - A web 2.0 Trading experiencejimliddle
 
кашлева ольга 10а класс
кашлева ольга 10а класскашлева ольга 10а класс
кашлева ольга 10а классmasjanja92
 
20121111 linux intro
20121111 linux intro20121111 linux intro
20121111 linux introChang Mt
 
Enterprise Cloud Content Search
Enterprise Cloud Content SearchEnterprise Cloud Content Search
Enterprise Cloud Content Searchjimliddle
 

Andere mochten auch (7)

Lets Talk Poverty (Denise Caron, ChristmasFuture)
Lets Talk Poverty (Denise Caron, ChristmasFuture)Lets Talk Poverty (Denise Caron, ChristmasFuture)
Lets Talk Poverty (Denise Caron, ChristmasFuture)
 
驛站食堂 西子灣 Menu
驛站食堂 西子灣 Menu驛站食堂 西子灣 Menu
驛站食堂 西子灣 Menu
 
устроиства компьютера
устроиства компьютераустроиства компьютера
устроиства компьютера
 
Cloud Crowd - A web 2.0 Trading experience
Cloud Crowd - A web 2.0 Trading experienceCloud Crowd - A web 2.0 Trading experience
Cloud Crowd - A web 2.0 Trading experience
 
кашлева ольга 10а класс
кашлева ольга 10а класскашлева ольга 10а класс
кашлева ольга 10а класс
 
20121111 linux intro
20121111 linux intro20121111 linux intro
20121111 linux intro
 
Enterprise Cloud Content Search
Enterprise Cloud Content SearchEnterprise Cloud Content Search
Enterprise Cloud Content Search
 

Ähnlich wie Openshift by mtchang

X64服务器 lamp服务器部署标准 new
X64服务器 lamp服务器部署标准 newX64服务器 lamp服务器部署标准 new
X64服务器 lamp服务器部署标准 newYiwei Ma
 
Nagios的安装部署和与cacti的整合(linuxtone)
Nagios的安装部署和与cacti的整合(linuxtone)Nagios的安装部署和与cacti的整合(linuxtone)
Nagios的安装部署和与cacti的整合(linuxtone)Yiwei Ma
 
康盛创想项目部Linux 服务器部署标准(最新版)
康盛创想项目部Linux 服务器部署标准(最新版)康盛创想项目部Linux 服务器部署标准(最新版)
康盛创想项目部Linux 服务器部署标准(最新版)Yiwei Ma
 
Ruby on Rails 開發環境建置 for Ubuntu
Ruby on Rails 開發環境建置 for UbuntuRuby on Rails 開發環境建置 for Ubuntu
Ruby on Rails 開發環境建置 for UbuntuMarsZ Chen
 
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)acqua young
 
Ruby on Rails 開發環境建置 for Mac
Ruby on Rails 開發環境建置 for MacRuby on Rails 開發環境建置 for Mac
Ruby on Rails 開發環境建置 for MacMarsZ Chen
 
张所勇:前端开发工具推荐
张所勇:前端开发工具推荐张所勇:前端开发工具推荐
张所勇:前端开发工具推荐zhangsuoyong
 
GNU Autoconf / Automake #1
GNU Autoconf / Automake #1GNU Autoconf / Automake #1
GNU Autoconf / Automake #1imacat .
 
Nginx+常见应用技术指南
Nginx+常见应用技术指南Nginx+常见应用技术指南
Nginx+常见应用技术指南andy54321
 
PHP 應用之一 socket funion : 偽 WEB Server
PHP 應用之一 socket funion : 偽 WEB ServerPHP 應用之一 socket funion : 偽 WEB Server
PHP 應用之一 socket funion : 偽 WEB Server志賢 黃
 
Oraliux+mysql5单机多实例安装文档
Oraliux+mysql5单机多实例安装文档Oraliux+mysql5单机多实例安装文档
Oraliux+mysql5单机多实例安装文档xuebao_zx
 
利用Cent Os快速构建自己的发行版
利用Cent Os快速构建自己的发行版利用Cent Os快速构建自己的发行版
利用Cent Os快速构建自己的发行版xingsu1021
 
[2]futurewad樹莓派研習會 141127
[2]futurewad樹莓派研習會 141127[2]futurewad樹莓派研習會 141127
[2]futurewad樹莓派研習會 141127CAVEDU Education
 
Linux系统工程师教程
Linux系统工程师教程Linux系统工程师教程
Linux系统工程师教程yiditushe
 
Bypat博客出品-利用cent os快速构建自己的发行版
Bypat博客出品-利用cent os快速构建自己的发行版Bypat博客出品-利用cent os快速构建自己的发行版
Bypat博客出品-利用cent os快速构建自己的发行版redhat9
 
Puppet安装总结
Puppet安装总结Puppet安装总结
Puppet安装总结Yiwei Ma
 
使用Nginx轻松实现开源负载均衡
使用Nginx轻松实现开源负载均衡使用Nginx轻松实现开源负载均衡
使用Nginx轻松实现开源负载均衡cachowu
 
自动化运维管理
自动化运维管理自动化运维管理
自动化运维管理frankwsj
 
Using google appengine_1027
Using google appengine_1027Using google appengine_1027
Using google appengine_1027Wei Sun
 

Ähnlich wie Openshift by mtchang (20)

X64服务器 lamp服务器部署标准 new
X64服务器 lamp服务器部署标准 newX64服务器 lamp服务器部署标准 new
X64服务器 lamp服务器部署标准 new
 
Nagios的安装部署和与cacti的整合(linuxtone)
Nagios的安装部署和与cacti的整合(linuxtone)Nagios的安装部署和与cacti的整合(linuxtone)
Nagios的安装部署和与cacti的整合(linuxtone)
 
康盛创想项目部Linux 服务器部署标准(最新版)
康盛创想项目部Linux 服务器部署标准(最新版)康盛创想项目部Linux 服务器部署标准(最新版)
康盛创想项目部Linux 服务器部署标准(最新版)
 
Ruby on Rails 開發環境建置 for Ubuntu
Ruby on Rails 開發環境建置 for UbuntuRuby on Rails 開發環境建置 for Ubuntu
Ruby on Rails 開發環境建置 for Ubuntu
 
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)
 
How to setup mastodon in chinese
How to setup mastodon in chineseHow to setup mastodon in chinese
How to setup mastodon in chinese
 
Ruby on Rails 開發環境建置 for Mac
Ruby on Rails 開發環境建置 for MacRuby on Rails 開發環境建置 for Mac
Ruby on Rails 開發環境建置 for Mac
 
张所勇:前端开发工具推荐
张所勇:前端开发工具推荐张所勇:前端开发工具推荐
张所勇:前端开发工具推荐
 
GNU Autoconf / Automake #1
GNU Autoconf / Automake #1GNU Autoconf / Automake #1
GNU Autoconf / Automake #1
 
Nginx+常见应用技术指南
Nginx+常见应用技术指南Nginx+常见应用技术指南
Nginx+常见应用技术指南
 
PHP 應用之一 socket funion : 偽 WEB Server
PHP 應用之一 socket funion : 偽 WEB ServerPHP 應用之一 socket funion : 偽 WEB Server
PHP 應用之一 socket funion : 偽 WEB Server
 
Oraliux+mysql5单机多实例安装文档
Oraliux+mysql5单机多实例安装文档Oraliux+mysql5单机多实例安装文档
Oraliux+mysql5单机多实例安装文档
 
利用Cent Os快速构建自己的发行版
利用Cent Os快速构建自己的发行版利用Cent Os快速构建自己的发行版
利用Cent Os快速构建自己的发行版
 
[2]futurewad樹莓派研習會 141127
[2]futurewad樹莓派研習會 141127[2]futurewad樹莓派研習會 141127
[2]futurewad樹莓派研習會 141127
 
Linux系统工程师教程
Linux系统工程师教程Linux系统工程师教程
Linux系统工程师教程
 
Bypat博客出品-利用cent os快速构建自己的发行版
Bypat博客出品-利用cent os快速构建自己的发行版Bypat博客出品-利用cent os快速构建自己的发行版
Bypat博客出品-利用cent os快速构建自己的发行版
 
Puppet安装总结
Puppet安装总结Puppet安装总结
Puppet安装总结
 
使用Nginx轻松实现开源负载均衡
使用Nginx轻松实现开源负载均衡使用Nginx轻松实现开源负载均衡
使用Nginx轻松实现开源负载均衡
 
自动化运维管理
自动化运维管理自动化运维管理
自动化运维管理
 
Using google appengine_1027
Using google appengine_1027Using google appengine_1027
Using google appengine_1027
 

Openshift by mtchang

  • 1. openshift [mtchang's wiki] 頁 1 / 16 簡介 雲端服務是目前常見對於網路服務應用運作模式的稱謂,大多數的使用者很難清楚的定義何謂雲端?在美國國家 標準與技術研究院(NIST)對於雲端運算提出了一份明確的定義 [http://www.nist.gov/itl/cloud/index.cfm], 雲 端運算是一種網路應用的運作模式,其需求能夠方便存取網路上所提供的電腦資源,其包含5種特徵、4種建置模 式、3項服務,比較常見的有3種服務模式 (SaaS)軟體即服務、(PaaS)平台即服務、(IaaS)基礎設施即服務以 及4種建置方式 Public cloud(公共雲), Private cloud(私有雲), Community cloud(社區雲), Hybrid cloud (混合雲),另外有五種特徵可以評估該服務是不是雲端服務的重要項目,分別是(1)On-demand self-service (需要時自助的取得)(2)Broad network access(可以透過標準網路取得)(3)Resource pooling(資源可以動態 配置)(4)Rapid elasticity,(快速且有彈性)(5)Measured Service(用多少付多少)。 Red Hat(紅帽)提出新的平台即服務(PaaS)、及架構及服務(IaaS)的解決方案 OpenShift,讓使用者可以專心 於軟體的應用而不是基礎設施的建設。OpenShift的基礎來源於Red Hat於2010年11月收購的科技公司Makara technology。目前OpenShift 提供三種不同的部屬應用程序,開發人員可以快速的透過此服務建立開發平台, 而無須架設任何伺服器。OpenShift Express 提供用來開發 PHP、Ruby、Python 和 Java 等軟體的應用程式 環境,另外有 OpenShift FLEX 和 OpenShit Power 等服務,OpenShift FLEX 預計供部署、監控、預備用和 自動擴充與縮減的應用系統,而 OpenShift Power 是部署自己所建置的 Linux,目前 FLEX 和 Power 服務目 前是還在開發中,只有 OpenShift FLEX 有開放免費使用,OpenShift Flex 提用試用,而 OpenShift Power 還在開發中。 本文目的則以OpenShift Express 的申請及如何使用,並且建立可以用的CMS系統的過程做說明。 申請OpenShift Express服務 * OpenShift Express 目前提供有 php-5.3.2, wsgi-3.2.1, rack-1.1.0 and jbossas-7.0.0 三種服務,底 下已申請一個PHP 應用程式服務為範例。 * 目前系統提供 RHN account 登入,如果你已經有 RHN 帳號可以 直接登入使用。沒有的使用者請先註冊 成為一個新的使用者。 * 註冊新使用者的網址:https://openshift.redhat.com/app/user/new/express [https://openshift.redhat.com/app/user/new/express] file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
  • 2. openshift [mtchang's wiki] 頁 2 / 16 * 送出後系統會發出確認信件到你的信箱,確認後會引導到網站並要求你卻認同意此機器的使用規範。。 * 確認完成後你的信箱會收到一封信件,告訴你下一步該如何做? * 同這網址的內容 https://openshift.redhat.com/app/getting_started/express [https://openshift.redhat.com/app/getting_started/express] ,因為這系統仍然不斷的在開發中,你可以透過 IRC: #openshift on Freenode [http://webchat.freenode.net/] 直接反映問題。 Thank you for requesting access to OpenShift Express! To get started, click on this link: https://openshift.redhat.com/app/getting_started/express We'd love to hear your feedback, please join us on IRC and our forums. Thanks The Red Hat OpenShift Team IRC: #openshift on Freenode 使用Express file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
  • 3. openshift [mtchang's wiki] 頁 3 / 16 * 要開始使用 Express account 必須要有些 Client 端應用程式才可以連接到該服務主機,目前只有提供 command 指令模式的方式。 * 目前 Client 端有支援的為 RHEL 6 or Fedora or MAC or Windows ,但Mac 需鑰匙用 gem ,Windows 需要 cygwin 。看起來都很麻煩。 * Linux 目前只提供 RHEL 6 以上的版本來安裝,所以最後我選擇了 Fedora 15 [http://fedoraproject.org/] 這個版本來完成下面的實做: file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
  • 4. openshift [mtchang's wiki] 頁 4 / 16 file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
  • 5. openshift [mtchang's wiki] 頁 5 / 16 Fedora安裝rhc * 將底下的 repo 檔案 openshift.repo 放到 /etc/yum.repos.d/ 目錄內 # 改變目錄 [root@localhost mtchang]# cd /etc/yum.repos.d/ # 新增 openshift repo 檔案 [root@localhost yum.repos.d]# vim openshift.repo [openshift-express] name=Openshift-express baseurl=https://openshift.redhat.com/app/repo/rpms/$releasever/$basearch/ failovermethod=priority skip_if_unavailable=1 gpgkey=https://openshift.redhat.com/app/repo/RPM-GPG-KEY-redhat-beta ggpkey=https://openshift.redhat.com/app/repo/RPM-GPG-KEY-redhat-release enabled=1 gpgcheck=1 # 安裝 rhc 工具 [root@localhost mtchang]# yum install rhc * 檢查應用程式,系統主要使以 rhc-* 開頭的程式負責這些工作 [root@localhost ~]# rpm -ql rhc-0.68.5-1.el6.noarch /etc/openshift/express.conf <-- 設定檔 /usr/bin/rhc-create-app <-- 負責應用程式建立 /usr/bin/rhc-create-domain <-- 負責 Domain 名稱建立及申請 /usr/bin/rhc-ctl-app <-- 控制應用程式啟動、停止、刪除.... /usr/bin/rhc-snapshot <-- 把應用程式打包成 gzip /usr/bin/rhc-user-info <-- 顯示使用者在 rhcloud.com 的資訊 ... 略..... 建立Domain * 建立 domain ,使用 /usr/bin/rhc-create-domain 程式在 rhcloud 註冊一個 domain * 註冊名稱為 jangmt 在雲端的使用者帳號為 jangmt@gmail.com [jangmt@localhost ~]$ rhc-create-domain -n jangmt -l jangmt@gmail.com Password: rhcloud的密碼 Generating Openshift Express ssh key to /home/jangmt/.ssh/libra_id_rsa Generating public/private rsa key pair. Created directory '/home/jangmt/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/jangmt/.ssh/libra_id_rsa. Your public key has been saved in /home/jangmt/.ssh/libra_id_rsa.pub. The key fingerprint is: 18:25:39:79:b5:88:87:9c:56:ab:35:6e:da:3b:4e:8b jangmt@localhost.localdomain The key's randomart image is: +--[ RSA 2048]----+ | .oo.. | | .+B.o . | | Bo* . | | . B . | | o S | | + | | . o | | o.o | | E.+. | +-----------------+ Contacting https://openshift.redhat.com Adding rhlogin to /home/jangmt/.openshift/express.conf Creation successful You may now create an application. Please make note of your local config file in /home/jangmt/.openshift/express.conf which has been created and populated for you. * 這動作會建立一組 ssh key 來提供程式開發上 git 的存取。 建立PHP應用程式 file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
  • 6. openshift [mtchang's wiki] 頁 6 / 16 * 建立應用程式 /usr/bin/rhc-create-app ,目前系統提供 php-5.3.2, wsgi-3.2.1, rack-1.1.0 三種選項的 應用程式可以選擇。 * 底下為建立一個應用程式 myphp 提供 php-5.3.2 的應用程式功能 [jangmt@localhost ~]$ rhc-create-app -a myphp -t php-5.3.2 -l jangmt@gmail.com Password: Please support the developer preview - let #openshift on freenode know of any bugs you find Creating remote application space: myphp Contacting https://openshift.redhat.com RESULT: Successfully created application: myphp Checking ~/.ssh/config Contacting https://openshift.redhat.com Found rhcloud.com in ~/.ssh/config... No need to adjust Now your new domain name is being populated worldwide (this might take a minute)... Pulling new repo down Warning: Permanently added the RSA host key for IP address '50.17.172.80' to the list of known hosts. remote: Counting objects: 23, done. remote: Compressing objects: 100% (20/20), done. remote: Total 23 (delta 6), reused 0 (delta 0) Receiving objects: 100% (23/23), done. Resolving deltas: 100% (6/6), done. Confirming application myphp is available Attempt # 1 Success! Your application is now published here: http://myphp-jangmt.rhcloud.com/ The remote repository is located here: ssh://a0aaf4b1ba3f4f3dbf7abd14c64fa89f@myphp-jangmt.rhcloud.com/~/git/myphp.git/ To make changes to your application, commit to myphp/. Then run 'git push' to update your Openshift Express space * 此程式會將剛剛的金鑰上傳到遠端機器,並且再本機建立一個目錄 ~/myphp 。此目錄可以透過 git 的SCM 管理方式管理程式碼。 * 並且建立一個應用程式名稱的對應網域 http://myphp-jangmt.rhcloud.com/ [http://myphp- jangmt.rhcloud.com/] ,當修改完程式後只需使用 git push 程式到遠端主機即可完成上傳程式碼的工作。 * 第一次建立好,都沒有修改的畫面如下:http://myphp-jangmt.rhcloud.com/ [http://myphp- jangmt.rhcloud.com/] * 修改 index.php 加上 phpinfo(); 並git push 上 server file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
  • 7. openshift [mtchang's wiki] 頁 7 / 16 # 本地端產生 ~/myphp 的目錄,程式統一放在 ~/myphp/php 目錄內 [jangmt@localhost php]$ cd /home/jangmt/myphp/php/ [jangmt@localhost php]$ pwd /home/jangmt/myphp/php # 修改程式碼,加入 <?php phpinfo(); ?> 這段做為測試 [jangmt@localhost php]$ vim index.php <html><title>OpenShift!</title> <body> <h1>Welcome to OpenShift</h1> <p>Place your application here</p> <p>In order to commit to your new project, go to your projects git repo (created with the create_http command). Make your changes, then run:</p> <pre>git commit -a -m 'Some commit message' git push</pre> <p>Then reload this page</p> <?php phpinfo(); ?> </body> </html> * 加上 commit 資訊並 git push # git commit -a 將所有修改過得檔案都 commit, 但是新增的檔案 還是得要先 add 才可以(git add -A 新增所有變更的檔案) # -m 'message' 指的是在這個 commit 加上說明的內容 [jangmt@localhost php]$ git commit -a -m 'add phpinfo() in index.php' [master a7aaf2b] add phpinfo() in index.php 1 files changed, 1 insertions(+), 0 deletions(-) # git-push 更新遠端的檔案物件資訊 [jangmt@localhost php]$ git push Counting objects: 7, done. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 399 bytes, done. Total 4 (delta 2), reused 0 (delta 0) remote: tar: README: time stamp 2011-05-31 07:51:47 is 28761.007922033 s in the future remote: tar: libs/README: time stamp 2011-05-31 07:51:47 is 28761.00683967 s in the future remote: tar: libs: time stamp 2011-05-31 07:51:47 is 28761.006520158 s in the future remote: tar: misc/README: time stamp 2011-05-31 07:51:47 is 28761.006146669 s in the future remote: tar: misc: time stamp 2011-05-31 07:51:47 is 28761.005907377 s in the future remote: tar: php/health_check.php: time stamp 2011-05-31 07:51:47 is 28761.005505289 s in the future remote: tar: php/index.php: time stamp 2011-05-31 07:51:47 is 28761.005190215 s in the future remote: tar: php: time stamp 2011-05-31 07:51:47 is 28761.004967428 s in the future To ssh://a0aaf4b1ba3f4f3dbf7abd14c64fa89f@myphp-jangmt.rhcloud.com/~/git/myphp.git/ ebb33fa..a7aaf2b master -> master * 上傳更新完成,再看一次網頁內容 * Git 是分散式的版本控制系統,可以方便的用於程式碼的管理。Git目前為很多自由軟體專案的版本控制工具, 與常用的版本控制工具CVS,Subversion 不同,它採用了分散式版本庫的方式,不必伺服器端軟體也可以存取所 以使得原始碼的發布和交流更方便。 file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
  • 8. openshift [mtchang's wiki] 頁 8 / 16 安裝Drupal * 既然可以使用 php 的功能在伺服器上,這裡以 Drupal 這個很受歡迎的的內容管理系統當作範例,安裝到 openshift 服務上。 * Drupal 是一個自由開源的內容管理系統,以PHP語言寫成。後端的資料庫為MySQL或 PostgreSQL,在7.0版本以後開始支援SQLite資料庫。 * 因為此服務沒有提供資料庫的功能,所以直接使用 SQLite 用檔案型態的資料庫當城後端資料庫。 * 將檔案放到跟目錄,並且修改設定檔。 # 抓最新的版本 [jangmt@localhost php]$ wget wget http://ftp.drupal.org/files/projects/drupal-7.2.tar.gz # 解開 [jangmt@localhost php]$ tar zxf drupal-7.2.tar.gz # 搬動 [jangmt@localhost php]$ mv drupal-7.2/.* . mv: cannot move `drupal-7.2/.' to `./.': Device or resource busy mv: cannot move `drupal-7.2/..' to `./..': Device or resource busy [jangmt@localhost php]$ mv drupal-7.2/* . # 刪除 [jangmt@localhost php]$ rm -rf drupal-7.2 drupal-7.2.tar.gz # 修改設定檔 [jangmt@localhost php]$ vim sites/default/default.settings.php $base_url = 'http://myphp-jangmt.rhcloud.com'; * 更新上傳修改的程式碼 # 增加有新增的檔案到索引內 [jangmt@localhost php]$ git add -A # 新增修改的的訊息及變動的檔案 [jangmt@localhost php]$ git commit -a -m "drupal to http://myphp-jangmt.rhcloud.com/" [master 36c5a3a] drupal to http://myphp-jangmt.rhcloud.com/ 998 files changed, 290732 insertions(+), 11 deletions(-) create mode 100644 php/.gitignore create mode 100644 php/.htaccess ...skip... # 上傳 [jangmt@localhost php]$ git push ...skip... remote: tar: php: time stamp 2011-05-31 08:00:29 is 28702.719547983 s in the future To ssh://a0aaf4b1ba3f4f3dbf7abd14c64fa89f@myphp-jangmt.rhcloud.com/~/git/myphp.git/ a7aaf2b..36c5a3a master -> master * 完成後,可是在進入剛剛的網址觀看,他即會進入安裝畫面。 * 請選擇標準安裝 standard file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
  • 9. openshift [mtchang's wiki] 頁 9 / 16 * 選擇安裝的語系,請不要增加中文語系安裝,因為中文語系的翻譯檔有問題安裝到一半會卡住。 * 資料庫請選擇 SQLite file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
  • 10. openshift [mtchang's wiki] 頁 10 / 16 * 接下來進進入模組的安裝過程了 * 網站設定頁面 file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
  • 11. openshift [mtchang's wiki] 頁 11 / 16 file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
  • 12. openshift [mtchang's wiki] 頁 12 / 16 * 安裝完成 * 正式網站頁面 file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
  • 13. openshift [mtchang's wiki] 頁 13 / 16 安裝 dokuwiki * dokuwiki 是一套只需要 php 語言支援的 wiki 程式,後端存放資料是以文字檔型態儲存並且可以具有可閱讀 性,非常適合在這樣的環境中使用。 * 安裝過程 # 取得軟體,放到根目錄 [jangmt@localhost php]$ wget http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-2011-05-25.tgz # 解開 [jangmt@localhost php]$ tar zxf dokuwiki-2011-05-25.tgz # 更名為 wiki [jangmt@localhost php]$ mv dokuwiki-2011-05-25 wiki # 刪除原本的檔案及目錄 [jangmt@localhost php]$ rm dokuwiki-2011-05-25.tgz # git 新增檔案 [jangmt@localhost php]$ git add -A # git 新增修改及註解 [jangmt@localhost php]$ git commit -a -m 'add dukewiki in /wiki/' # git 上傳 [jangmt@localhost php]$ git push * 到網站上看看 http://myphp-jangmt.rhcloud.com/wiki/ [http://myphp-jangmt.rhcloud.com/wiki/] ,… 裝好了… * 還真是快呀!!!!!! file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
  • 14. openshift [mtchang's wiki] 頁 14 / 16 刪除應用程式 * 目前 Openshift express 只支援使用者同時擁有一個應用程式,所以如果需要測試另外一種應用程式服務, 只能將這個裝好的服務移除再行安裝。 * /usr/bin/rhc-ctl-app 指令提供應用程式 (start|stop|restart|reload|status|destroy) 這些功能,底下範 例為使用 destroy 刪除剛註冊的應用程式。 [jangmt@localhost ~]$ rhc-ctl-app -c destroy -a myphp -l jangmt@gmail.com Password: Contacting https://openshift.redhat.com !!!! WARNING !!!! WARNING !!!! WARNING !!!! You are about to destroy the myphp application. This is NOT reversable, all remote data for this application will be removed. Do you want to destroy this application (y/n): y Contacting https://openshift.redhat.com RESULT: Successfully destroyed application: myphp * 當你 destory 應用程式只會移除雲端的資料,本地端的目錄還是一樣存在不會有任何的異動。 建立wsgi應用程式 * Python網頁開發的標準: WSGI,(Python Web Server Gateway Interface,縮寫為WSGI)是為Python 語言定義的Web伺服器和Web應用程序或框架之間的一種簡單而通用的介面。 * 建立一個 wsgi 應用程式,這程式會在本機 ~/mywsgi/ 建立一個目錄和上面 php 的開發方式一樣需要透過 git 更新程式。 [jangmt@localhost ~]$ rhc-create-app -a mywsgi -t wsgi-3.2.1 -l jangmt@gmail.com Password: Please support the developer preview - let #openshift on freenode know of any bugs you find Creating remote application space: mywsgi Contacting https://openshift.redhat.com RESULT: Successfully created application: mywsgi Checking ~/.ssh/config Contacting https://openshift.redhat.com Found rhcloud.com in ~/.ssh/config... No need to adjust Now your new domain name is being populated worldwide (this might take a minute)... Pulling new repo down Warning: Permanently added 'mywsgi-jangmt.rhcloud.com,50.17.156.80' (RSA) to the list of known hosts. remote: Counting objects: 30, done. remote: Compressing objects: 100% (25/25), done. remote: Total 30 (delta 9), reused 0 (delta 0) Receiving objects: 100% (30/30), done. Resolving deltas: 100% (9/9), done. Confirming application mywsgi is available Attempt # 1 Success! Your application is now published here: http://mywsgi-jangmt.rhcloud.com/ The remote repository is located here: ssh://a0aaf4b1ba3f4f3dbf7abd14c64fa89f@mywsgi-jangmt.rhcloud.com/~/git/mywsgi.git/ To make changes to your application, commit to mywsgi/. Then run 'git push' to update your Openshift Express space * 建立好的 wsgi 應用程式網站 http://mywsgi-jangmt.rhcloud.com/ [http://mywsgi- jangmt.rhcloud.com/] file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
  • 15. openshift [mtchang's wiki] 頁 15 / 16 * 修改預設的 application 這只程式,成為最簡單的 hello world (透過 wsgi方式呈現)。 [jangmt@localhost mywsgi]$ pwd /home/jangmt/mywsgi # 修改程式內容 [jangmt@localhost mywsgi]$ vim wsgi/application def simplestApp(environ, start_response): start_response('200 OK',[('Content-type','text/plain')]) return ['Hello world!'] # 指定輸出app application = simplestApp # 更新修改 [jangmt@localhost mywsgi]$ git commit -a -m 'simplest APP test' [master 95b7a2b] simplest APP test 1 files changed, 5 insertions(+), 36 deletions(-) rewrite wsgi/application (99%) # git上傳 [jangmt@localhost mywsgi]$ git push Counting objects: 7, done. Compressing objects: 100% (3/3), done. Writing objects: 100% (4/4), 422 bytes, done. Total 4 (delta 1), reused 0 (delta 0) remote: tar: README: time stamp 2011-05-31 08:47:47 is 28763.774683407 s in the future remote: tar: data/SAFETOREMOVE.txt: time stamp 2011-05-31 08:47:47 is 28763.773869298 s in the future remote: tar: data: time stamp 2011-05-31 08:47:47 is 28763.773712804 s in the future remote: tar: libs/SAFETOREMOVE.txt: time stamp 2011-05-31 08:47:47 is 28763.773307896 s in the future remote: tar: libs: time stamp 2011-05-31 08:47:47 is 28763.773183541 s in the future remote: tar: wsgi/application: time stamp 2011-05-31 08:47:47 is 28763.772759805 s in the future remote: tar: wsgi: time stamp 2011-05-31 08:47:47 is 28763.772630393 s in the future To ssh://a0aaf4b1ba3f4f3dbf7abd14c64fa89f@mywsgi-jangmt.rhcloud.com/~/git/mywsgi.git/ 73ae5b9..95b7a2b master -> master * hello world 的結果 file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25
  • 16. openshift [mtchang's wiki] 頁 16 / 16 * 自Python提出了WSGI標準,它可重覆利用和有彈性的特性,使得網頁開發可以更專注於更重要的地方。當然 OpenShift 也就以此為標準讓使用這可以專注於程式上面的開發。 結論 * 當系統問題變的簡單,所有的服務都可以在雲端上找到資源。針對MIS人員的存在價值應該也要跟著有所轉 變,傳統上MIS人員是管看的見的硬體、設備,在雲 端服務下MIS人員只是從管看的見,轉成管虛擬的、Cloud 上的資源,並且有更多的時間專於IT及組織的問題予以處理改善。雲端服務只是以前的技術應用 的創新,透過基 礎課程的訓練,瞭解每個細節將來也大多事這些基礎的運作模式用不同的組合搭配出現。底下是上面這些相關資 訊的延伸參考: * 寫給大家的Git教學,Littlebtc(Hsiao-Ting Yu),http://www.slideshare.net/littlebtc/git-5528339 [http://www.slideshare.net/littlebtc/git-5528339] * Getting Git ,Scott Chacon,http://www.slideshare.net/chacon/getting-git [http://www.slideshare.net/chacon/getting-git] * Why Git is Better than X,Scott Chacon ,http://zh-tw.whygitisbetterthanx.com/ [http://zh- tw.whygitisbetterthanx.com/](中文翻譯 Kanru Cehn) * RedHat Document ,https://www.redhat.com/openshift/documents [https://www.redhat.com/openshift/documents] * The NIST Definition of Cloud Computing(Draft),NIST Peter Mell;Yimothy Grance ,http://csrc.nist.gov/publications/drafts/800-145/Draft-SP-800-145_cloud-definition.pdf [http://csrc.nist.gov/publications/drafts/800-145/Draft-SP-800-145_cloud-definition.pdf] * WSGI,wikipedia,http://zh.wikipedia.org/zh-tw/WSGI [http://zh.wikipedia.org/zh-tw/WSGI] * 化整為零的次世代網頁開發標準: WSGI, Victor,http://blog.ez2learn.com/2010/01/27/introduction- to-wsgi/ [http://blog.ez2learn.com/2010/01/27/introduction-to-wsgi/] * Rack 與 Rack middleware,xdite,http://blog.xdite.net/?p=1557 [http://blog.xdite.net/?p=1557] file:///D:/mydoc_sync/mtchang/LCCNET/other/投稿/20110530_lccnet_mtchang_ope... 2012/11/25