ownCloud on OpenShift
Last July, Google shut down Reader, one of my most favorite apps, and to ease off my Reader withdrawal, I decided to host my own RSS reader. There were several alternatives out there, but I opted for ownCloud's News app, hosted on OpenShift. I've outlined the steps I took below.
ownCloud is a cloud storage app that runs on a LAMP stack. OpenShift is Red Hat's Platform as a Service (Paas) offering that allows rapid application deployment using various software stacks.
The steps below have been liberally taken from Isaac Christoffersen's OpenShift ownCloud quickstart. I've also forked Isaac's quickstart that incorporates the steps. Feel free to fork and submit pull requests.
This guide assumes that you have an OpenShift account, and the requisite client tools. This also assumes that the app is located in the project directory.
mkdir -p ~/projects cd ~/projects
- Create app.
rhc app create owncloud php-5.3 mysql-5.1 rhc alias add owncloud your.alias.goes.here rhc app show owncloud rm owncloud/php/*.php
- Get ownCloud.
mkdir ~/projects/owncloud-dist cd ~/projects/owncloud-dist wget http://download.owncloud.org/community/owncloud-5.0.10.tar.bz2 tar xjvf owncloud-5.0.10.tar.bz2 cd owncloud rsync -av . ~/projects/owncloud/php/
- Add script to auto-configure ownCloud.
In
~/projects/owncloud/php/config/autoconfig.php: - Add OpenShift-specific action hooks.
Add the following action hooks to be executed at specific points in the deployment process of the OpenShift app. The scripts are located in
~/projects/owncloud/.openshift/action_hooks.- pre_build - Restores an existing configuration file and removes the autoconfig script above for succeeding pushes.
- deploy - Ensures that the MySQL cartridge is available.
- post_deploy - During the first push, it will autoconfigure the ownCloud instance. For succeeding deployments, it will ensure that an existing configuration is used.
- Use cron.
The News app requires background jobs that need to run regularly, so add OpenShift's Cron cartridge.
rhc cartridge-add cron-1.4 -a owncloud
Cron jobs go in
~/projects/owncloud/.openshift/cron/under the respective periods. Add the following job that runs every 15 minutes (in~/projects/owncloud/.openshift/cron/minutely/owncloud.sh):Make sure to enable the system cron in ownCloud's
Adminsettings page. - Deploy ownCloud.
cd ~/projects/owncloud git add . git commit -a -m "Deploy to OpenShift" git push
- Log in and start using ownCloud on OpenShift.
Go to
https://your.alias.goes.here, and useadmin/OpenShiftAdminas the default first-time credentials. (Make sure to change this ASAP.)
Comments
Post a Comment