OpenShift
OpenShift is an PaaS-Cloud provided by Red Hat. Not surprisingly, it is based on Red Hat Linux. OpenShift is a platform for PHP-, Python-, Java-, Perl-, Ruby-web applications. At the moment there are 2 variants:
- Express : Shared hosting; free
- Flex : Clustered servers; at the moment free
I started with the Express version:
- Set up account and configure your domain
- Create SSH keys (ssh-keygen) and upload content of ~/.ssh/id_rsa.pub to the assigned place. pfu@latitude:~$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/pfu/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/pfu/.ssh/id_rsa. Your public key has been saved in /home/pfu/.ssh/id_rsa.pub. The key fingerprint is: XX:XX:XX:::: pfu@latitude The key's randomart image is: +--[ RSA 2048]----+ | | | XX XX XX | : : : : +-----------------+ pfu@latitude:~$
- Create application(s) using the web interface (There is a command line interface as well...)
- Install GIT (if not already done)
Deploy a war:
- Get GIT repo:
- Go into directory and copy war-file into deployments directory:
- cd Test1
- cp <path to>.war ./deployments
- Add .war to GIT and commit changes to GIT repository:
- git add . (It's ok if pwd is Test1 but war is added to Test1/deployments)
- git commit -m "war-file added"
- Push to OpenShift:
- git push
- Test it out with your browser on: http://test1-neshendra.rhcloud.com/<war-filename (without extension)> (see [1])
- war-filename can be get rid off if war is named ROOT.war (OK ?).
Red Hat Cloud Control Tools
For installation on Ubuntu see [2]: Don't do:
- install packages ruby, ruby1.9.1-full, rubygems1.9.1, ruby1.9.1-dev, libruby-extras(???)
- execute on command line: sudo gem install --source http://gems.rubyforge.org --source https://openshift.redhat.com/app/repo/ rhc
- Place /var/lib/gems/1.9.1/bin into path: Edit /etc/environment, otherwise rhc-tools cannot be called from the command line.
Go on better like this from Ruby Guru:
- sudo apt-get update
- sudo apt-get install build-essential git-core curl
- bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
- echo '-s "$HOME/.rvm/scripts/rvm" && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
- . ~/.bashrc
- sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
- rvm install 1.8.7 (the last of 1.8 / in OpenShift-documentation there was always written from 1.8, not 1.9 (?))
- rvm use 1.9.3 (otherwise it won't find ruby at all)
- test version with: ruby -v
- Now install Red Hat Cloud tools:
- gem install --source http://gems.rubyforge.org --source https://openshift.redhat.com/app/repo/ rhc (without sudo!)
- Update ~./openshift/express.conf by configuring the correct rsa-file, e.g.
- #ssh_key_file = '~/ssh/id_rsa'
- Now test configuration, e.g.: rhc-domain-info -l <username>
Check status: rhc-ctl-app -a Test1 -l <username> -p <password> -c status