User Tools

Site Tools


wiki:qclug_presentations:cloud_hosting_aws_heroku_openshift

Presentation

OpenShift Demonstration Steps

How to create a Dokuwiki site on OpenShift Online

  • Create a free account at openshift.com
  • Install the OpenShift Client Tools (which is a Ruby Gem):

Step 1: Install Ruby
Step 2: Install RubyGems
Step 3: Install Git
Step 4: Install the client tools

(ruby-full installs the gem binary automatically)

sudo apt-get install ruby-full git-core
sudo gem install rhc

Setup RHC

rhc setup

Step 1: Login to openshift.redhat.com
Step 2: Generate a Public/Private key pair
Step 3: Create your namespace (aka domain)

Install DokuWiki

For ease of deployment use the pre-built dokuwiki-quickstart repository

  • This respository includes most of the deploy scripts that you will need to deploy Dokuwiki into OpenShift so you might as well use it.

https://github.com/openshift/dokuwiki-quickstart

Step 1: Create an empty application
Step 2: Download dokuwiki
Step 3: Push to OpenShift Online

rhc app create dokuwiki php-5.4
cd dokuwiki
git remote add upstream -m master git://github.com/openshift/dokuwiki-quickstart.git
git pull -s recursive -X theirs upstream master

Note: The git pull command above can be used later to pull updates to Dokuwiki

Customize DokuWiki

To customize Dokuwiki you must modify the git repository and the deploy scripts. This way your application customization will remain persistent accross each deployment.

Step 1: Install and configure custom Plugins
Step 2: Modify the Dokuwiki config files
Step 3: Update build and deploy hook scripts
Step 4: Commit locally
Step 5: Push to OpenShift
Step 6: Upload persistent data

Plugins

cd ~/dokuwiki/.openshift
mkdir plugins
cd plugins
wget https://github.com/kettari/authgoogle/archive/master.tar.gz
tar xf master.tar.gz
rm -f master.tar.gz
mv authgoogle-master authgoogle

Config Files

cd ~/dokuwiki/.openshift/conf
cat ~/dokuwiki-2014-05-05a/conf/local.php > local.php
cat ~/dokuwiki-2014-05-05a/conf/acl.auth.php > acl.auth.php
cat ~/dokuwiki-2014-05-05a/conf/users.auth.php > users.auth.php
cd ~/dokuwiki/.openshift
cat ~/dokuwiki-2014-05-05a/.htaccess > .htaccess

Hook scripts

cd ~/dokuwiki/.openshift/action_hooks
vi deploy

Add the following lines to the bottom of the deploy script:

cp -rf ${OPENSHIFT_REPO_DIR}.openshift/conf/* ${dest_dir}/conf/
cp -rf ${OPENSHIFT_REPO_DIR}.openshift/plugins/* ${dest_dir}/lib/plugins/
cp -f ${OPENSHIFT_REPO_DIR}.openshift/.htaccess ${dest_dir}/

Commit and push your changes:

cd ~/dokuwiki
git add .
git commit
git push

Upload Persistent Data

cd ~/dokuwiki-2014-05-05a/data/
tar czf ~/data-3-11-2015.tar.gz ./*
cd
rhc scp dokuwiki upload data-3-11-2015.tar.gz app-root/data/data/

Note: If rhc scp doesn't work, re-install the net-ssh gem specifying version 2.9.2

gem uninstall net-ssh
gem install net-ssh -v 2.9.2
rhc ssh dokuwiki
cd app-root/data/data
tar xf data-3-11-2015.tar.gz
rm -f data-3-11-2015.tar.gz
exit

Add a custom domain (alias)

OpenShift supports custom domain names using its easy to use alias system

Step 1: Add a CNAME alias to your externally hosted DNS configuration
Step 2: Run rhc alias on your application instance

rhc alias add dokuwiki wiki.qclug.com

Misc Notes

You can obtain Secure Shell access to your application (Gear) by running the following command:

rhc ssh dokuwiki

The persistent data storage location for your application can be accessed in your deploy scripts by using the following environment variable:

$OPENSHIFT_DATA_DIRs
  • OpenShift Origin is the upstream Open Source project for OpenShift.
  • This means you can download it and host your own OpenShift cloud!

http://www.openshift.org/

If you want to start over, simply delete your application and your git repository:

rhc app-delete dokuwiki
rm -rf dokuwiki
wiki/qclug_presentations/cloud_hosting_aws_heroku_openshift.txt · Last modified: 2015/03/15 01:35 by Root