Aus Wiki
Zur Navigation springen Zur Suche springen

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:

  1. Set up account and configure your domain
  2. Create SSH keys (ssh-keygen) and upload content of ~/.ssh/ to the assigned place.
  3. 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/ The key fingerprint is: XX:XX:XX:::: pfu@latitude The key's randomart image is: +--[ RSA 2048]----+ | | | XX XX XX |  :  :  :  : +-----------------+ pfu@latitude:~$
  4. Create application(s) using the web interface (There is a command line interface as well...)
  5. Install GIT (if not already done)

Deploy a war:

  1. Get GIT repo:
    git clone ssh://
  2. Go into directory and copy war-file into deployments directory:
    cd Test1
    cp <path to>.war ./deployments
  3. 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"
  4. Push to OpenShift:
    git push
  5. Test it out with your browser on:<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:

  1. install packages ruby, ruby1.9.1-full, rubygems1.9.1, ruby1.9.1-dev, libruby-extras(???)
  2. execute on command line: sudo gem install --source --source rhc
  3. 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:

  1. sudo apt-get update
  2. sudo apt-get install build-essential git-core curl
  3. bash -s stable < <(curl -s
  4. echo '-s "$HOME/.rvm/scripts/rvm" && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
  5. . ~/.bashrc
  6. 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
  7. rvm install 1.8.7 (the last of 1.8 / in OpenShift-documentation there was always written from 1.8, not 1.9 (?))
  8. rvm use 1.9.3 (otherwise it won't find ruby at all)
  9. test version with: ruby -v
    Now install Red Hat Cloud tools:
  10. gem install --source --source rhc (without sudo!)
  11. 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