Here are some notes on setting up Plone instances on OpenShift based on https://github.com/kagesenshi/plone-openshift-quickstart documentation.
First, get your OpenShift client installed.
$sudo apt-get install git-core openssh-client ruby ruby-dev rubygems libopenssl-ruby
$ sudo su -
# gem install --source http://gems.rubyforge.org --source https://openshift.redhat.com/app/repo/ rhc
===========================================================================
If this is your first time installing the RHC tools, please run 'rhc setup'
===========================================================================
$ rhc app create -a openplone -t diy-0.1
Starting Interactive Setup for OpenShift's command line interface
It looks like you have not configured or used OpenShift client tools
on this computer. We'll help you configure the client tools with
a few quick questions. You can skip this in the future by copying
your configuration files to other machines you use to manage
your OpenShift account:
/home/marr/.openshift/express.conf
/home/marr/.ssh/
To connect to openshift.redhat.com enter your OpenShift login
(email or Red Hat login id): marr
Password: ********
Created local config file: /home/marr/.openshift/express.conf
The express.conf file contains user configuration,
and can be transferred to different computers.
We will now check to see if you have the necessary client tools installed.
Checking for git ... found
Checking for your namespace ... found namespace:
marr
Checking for applications ... found
* py - http://py-marr.rhcloud.com/
The OpenShift client tools have been configured on your computer.
You can run this setup wizard at any time by using the command
'rhc setup' We will now execute your original command
(rhc app create -a openplone -t diy-0.1)
Password: ********
Creating application: openplone in marr
Now your new domain name is being propagated worldwide
(this might take a minute)...
The authenticity of host 'openplone-marr.rhcloud.com (50.16.52.158)'
can't be established.
RSA key fingerprint is cf:ee:77:cb:0e:fc:02:d7:27:7e:ae:90:c0:90:88:a7.
Are you sure you want to continue connecting (yes/no)? yes
Enter passphrase for key '/home/marr/.ssh/id_rsa':
Checking if the application is available #1
Application openplone is available at: http://openplone-marr.rhcloud.com/
Git URL: ssh://2abab67cb28b4684ab722d0064554394@
openplone-marr.rhcloud.com/~/git/openplone.git/
Disclaimer: This is an experimental cartridge that provides a way
to try unsupported languages, frameworks, and middleware on Openshift.
接著就進去新建的 openplone 目錄:
$ cd openplone
$ git remote add upstream -m master \
git@github.com:kagesenshi/plone-openshift-quickstart
$ git pull -s recursive -X theirs upstream master
Enter passphrase for key '/home/marr/.ssh/id_rsa':
warning: no common commits
remote: Counting objects: 67, done.
remote: Compressing objects: 100% (47/47), done.
remote: Total 67 (delta 26), reused 59 (delta 18)
Unpacking objects: 100% (67/67), done.
From github.com:kagesenshi/plone-openshift-quickstart
* branch master -> FETCH_HEAD
Auto-merging .openshift/action_hooks/stop
Auto-merging .openshift/action_hooks/start
Auto-merging .openshift/action_hooks/deploy
Auto-merging .openshift/action_hooks/build
Merge made by the 'recursive' strategy.
.openshift/action_hooks/build | 3 +-
.openshift/action_hooks/deploy | 51 ++++++++++-
.openshift/action_hooks/start | 15 +++-
.openshift/action_hooks/stop | 14 +++-
README.rst | 76 +++++++++++++++++
bootstrap.py | 181 ++++++++++++++++++++++++++++++++++++++++
buildout.cfg | 40 +++++++++
7 files changed, 371 insertions(+), 9 deletions(-)
create mode 100644 README.rst
create mode 100644 bootstrap.py
create mode 100644 buildout.cfg
檢查 domain 的話,會看到所有的 app 資訊:
$ rhc domain
Password: ********
Applications in marr:
py @ http://py-marr.rhcloud.com/
================================
Created: 2:08 AM
Git URL:
ssh://26cc6f56ea4744c19c2ad6a43cc7a8a2@py-marr.rhcloud.com/~/git/py.git/
Cartridges:
python-2.6
openplone @ http://openplone-marr.rhcloud.com/
==============================================
Created: 2:38 AM
Git URL:
ssh://2abab67cb28b4684ab722d0064554494@openplone-marr.rhcloud.com/~/git/ope
nplone.git/
Cartridges:
diy-0.1
.git/config 內容長得像這樣,為了版面,我用了 \ 符號:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = ssh://2abab67cb28b4684ab722d0064554394@ \
openplone-marr.rhcloud.com/~/git/openplone.git/
fetch = +refs/heads/*:refs/remotes/upstream/*
[branch "master"]
remote = origin
merge = refs/heads/master
執行 git push 後,buildout 就會執行,這會花一段時間,我跑了至少 40分鐘。
$ git push
...
remote: ~/git/openplone.git
remote: Starting application...
remote: . . . . . . . . . . .
remote: daemon manager not running
remote: Done
remote: Running .openshift/action_hooks/post_deploy
打開瀏覽器,在 http://openplone-marr.rhcloud.com/ 看得到起始畫面。利用 ssh 也看得到檔案系統。
$ ssh 2abab67cb28b4684ab722d0064554394@openplone-marr.rhcloud.com "ls -l app-root/data/filestorage"
設定 Virtual Hosting 的資訊:
$ rhc app add-alias -a openplone --alias plone.mydomain.org
Password: ********
RESULT:
Success
$ rhc-port-forward -a openplone
Warning: This command is deprecated and will be removed in the future. Please use 'rhc port-forward' instead.
Password: ********
Checking available ports...
Enter passphrase for /home/marr/.ssh/id_rsa:
Binding python -> 127.7.35.1:8080...
Enter passphrase for /home/marr/.ssh/id_rsa:
Use ctl + c to stop
Error trying to forward ports. You can try to forward manually by running:
ssh -N -L 127.7.35.1:8080:127.7.35.1:8080 2abab67cb28b4684ab722d0064554394@openplone-marr.rhcloud.com
再設定 DNS entry 和 ZMI 裡的 VHM 就行了: