Coder Social home page Coder Social logo

cassandra-openshift-quickstart-java's Introduction

Repo layout
=========== 
webapps/ - location for built wars (Details below)
src/ - Maven src structure
pom.xml - Maven build file  
.openshift/ - location for openshift specific files
.openshift/config/ - location for configuration files such as standalone.xml (used to modify jboss config such as datasources) 
.openshift/action_hooks/pre_build - Script that gets run every git push before the build (on the CI system if available)
.openshift/action_hooks/build - Script that gets run every git push as part of the build process (on the CI system if available)
.openshift/action_hooks/deploy - Script that gets run every git push after build but before the app is restarted
.openshift/action_hooks/post_deploy - Script that gets run every git push after the app is restarted
.openshift/action_hooks/pre_start_jbossews-1.0 - Script that gets run prior to starting EWS1.0
.openshift/action_hooks/post_start_jbossews-1.0 - Script that gets run after EWS1.0 is started
.openshift/action_hooks/pre_stop_jbossews-1.0 - Script that gets run prior to stopping EWS1.0
.openshift/action_hooks/post_stop_jbossews-1.0 - Script that gets run after EWS1.0 is stopped


Notes about layout
==================
Note: Every time you push, everything in your remote repo dir gets recreated
      please store long term items (like an sqlite database) in the OpenShift
      data directory, which will persist between pushes of your repo.
      The OpenShift data directory is accessible relative to the remote repo
      directory (../data) or via an environment variable OPENSHIFT_DATA_DIR.


Details about layout and deployment options
==================
There are two options for deploying content to the Tomcat Server within OpenShift. Both options
can be used together (i.e. build one archive from source and others pre-built)

1) (Preferred) You can upload your content in a Maven src structure as is this sample project and on 
git push have the application built and deployed.  For this to work you'll need your pom.xml at the 
root of your repository and a maven-war-plugin like in this sample to move the output from the build
to the webapps directory.  By default the warName is ROOT within pom.xml.  This will cause the 
webapp contents to be rendered at http://app_name-namespace.rhcloud.com/.  If you change the warName in 
pom.xml to app_name, your base url would then become http://app_name-namespace.rhcloud.com/app_name.

Note: If you are building locally you'll also want to add any output wars under webapps 
from the build to your .gitignore file.

Note: If you are running scaled EWS1.0 then you need an application deployed to the root context (i.e. 
http://app_name-namespace.rhcloud.com/) for the HAProxy load-balancer to recognize that the EWS1.0 instance 
is active.

or

2) You can git push pre-built wars into webapps/.  To do this
with the default repo you'll want to first run 'git rm -r src/ pom.xml' from the root of your repo.

Basic workflows for deploying pre-built content (each operation will require associated git add/commit/push operations to take effect):

A) Add new zipped content and deploy it:

1. cp target/example.war webapps/

B) Undeploy currently deployed content:

1. git rm webapps/example.war

C) Replace currently deployed zipped content with a new version and deploy it:

1. cp target/example.war webapps/

Note: You can get the information in the uri above from running 'rhc domain show'

If you have already committed large files to your git repo, you rewrite or reset the history of those files in git
to an earlier point in time and then 'git push --force' to apply those changes on the remote OpenShift server.  A 
git gc on the remote OpenShift repo can be forced with (Note: tidy also does other cleanup including clearing log
files and tmp dirs):

rhc app tidy -a appname


Whether you choose option 1) or 2) the end result will be the application 
deployed into the webapps directory. The webapps directory in the 
Tomcat distribution is the location end users can place 
their deployment content (e.g. war, ear, jar, sar files) to have it 
automatically deployed into the server runtime.

Environment Variables
=====================

OpenShift provides several environment variables to reference for ease
of use.  The following list are some common variables but far from exhaustive:

    System.getenv("OPENSHIFT_APP_NAME")  - Application name
    System.getenv("OPENSHIFT_DATA_DIR")  - For persistent storage (between pushes)
    System.getenv("OPENSHIFT_TMP_DIR")   - Temp storage (unmodified files deleted after 10 days)
    System.getenv("OPENSHIFT_INTERNAL_IP")  - The IP address used to bind EWS1.0

When embedding a database using 'rhc app cartridge add', you can reference environment
variables for username, host and password. For example, when embedding MySQL 5.1, the 
following variables will be available:

    System.getenv("OPENSHIFT_MYSQL_DB_HOST")      - DB host
    System.getenv("OPENSHIFT_MYSQL_DB_PORT")      - DB Port
    System.getenv("OPENSHIFT_MYSQL_DB_USERNAME")  - DB Username
    System.getenv("OPENSHIFT_MYSQL_DB_PASSWORD")  - DB Password

To get a full list of environment variables, simply add a line in your
.openshift/action_hooks/build script that says "export" and push.

cassandra-openshift-quickstart-java's People

Contributors

shekhargulati avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

cassandra-openshift-quickstart-java's Issues

can't read log4j-server.properties: No such file or directory

Hi shekhargulati.
Based in your tutorial . I run success "Part 1 : Installing Cassandra on a DIY application" . But i install "Part 2 : Using Cassandra as an Embedded Cartridge from with in a Java application" I recieve error "can't read log4j-server.properties: No such file or directory" when run file deloy.This is my log.
...
remote: + cd cassandra-data
remote: + mkdir data
remote: + mkdir saved_caches
remote: + mkdir commitlog
remote: + touch system.log
remote: + cd ../cassandra/conf/
remote: + sed -ig 's,/var/lib/cassandra,$HOME/app-root/data/cassandra-data,' cassandra.yaml
remote: + sed -ig s/127.0.0.1//g cassandra.yaml
remote: + sed -ig s/localhost//g cassandra.yaml
remote: + sed -ig s,7000,17000, cassandra.yaml
remote: + sed -ig s,7001,17001, cassandra.yaml
remote: + sed -ig s,9160,19160, cassandra.yaml
remote: + sed -ig s/localhost//g cassandra.yaml
remote: + sed -ig 's,/var/log/cassandra,$HOME/app-root/data/cassandra-data,' log4j-server.properties
remote: sed: can't read log4j-server.properties: No such file or directory
remote: + sed -ig 's,${max_sensible_yg_in_mb}M,256M,' cassandra-env.sh
remote: + sed -ig 's,${desired_yg_in_mb}M,256M,' cassandra-env.sh
remote: + sed -ig '/jmxremote/s/^/#/' cassandra-env.sh
remote: ++ cd /var/lib/openshift/5457307be0b8cd53500001f9/app-root/data//cassandra
remote: ++ bin/cassandra
remote: ++ export CQLSH_HOST=
remote: ++ CQLSH_HOST=
remote: ++ export CQLSH_PORT=19160
remote: ++ CQLSH_PORT=19160
remote: ++ sleep 30
remote: Error occurred during initialization of VM
remote: Could not reserve enough space for object heap
remote: Error: Could not create the Java Virtual Machine.
remote: Error: A fatal exception has occurred. Program will exit.
remote: ++ bin/cassandra-cli -h -p 19160 -f /var/lib/openshift/5457307be0b8cd53500001f9/app-root/runtime/repo//cassandra-tutorial.txt
remote: Missing argument for option:h
...
remote: Git Post-Receive Result: failure
remote: Activation status: failure
remote: Activation failed for the following gears:
remote: 5457307be0b8cd53500001f9 (Error activating gear: CLIENT_ERROR: Failed to execute: 'control start' for /var/lib/openshift/5457307be0b8cd53500001f9/jbossews)
remote: Deployment completed with status: failure
remote: postreceive failed

Can you help me?
Thank.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.