├── .openshift ├── action_hooks │ ├── README.md │ ├── build │ ├── deploy │ ├── post_deploy │ ├── pre_build │ ├── start │ └── stop └── cron │ ├── README.cron │ ├── daily │ └── .gitignore │ ├── hourly │ └── .gitignore │ ├── minutely │ └── .gitignore │ ├── monthly │ └── .gitignore │ └── weekly │ ├── README │ ├── chrono.dat │ ├── chronograph │ ├── jobs.allow │ └── jobs.deny ├── README ├── README.md └── misc └── .gitkeep /.openshift/action_hooks/README.md: -------------------------------------------------------------------------------- 1 | For information about action hooks supported by OpenShift, consult the documentation: 2 | 3 | https://github.com/openshift/origin-server/tree/master/node/README.writing_applications.md#action-hooks 4 | -------------------------------------------------------------------------------- /.openshift/action_hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This is a simple build script and will be executed on your CI system if 3 | # available. Otherwise it will execute while your application is stopped 4 | # before the deploy step. This script gets executed directly, so it 5 | # could be python, php, ruby, etc. -------------------------------------------------------------------------------- /.openshift/action_hooks/deploy: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This deploy hook gets executed after dependencies are resolved and the 3 | # build hook has been run but before the application has been started back 4 | # up again. This script gets executed directly, so it could be python, php, 5 | # ruby, etc. 6 | set -x 7 | if [ -d $OPENSHIFT_DATA_DIR/cassandra ] 8 | then 9 | exit 0 10 | else 11 | cd $OPENSHIFT_DATA_DIR 12 | curl -OL http://downloads.datastax.com/community/dsc-cassandra-2.0.9-bin.tar.gz 13 | tar -xzvf dsc-cassandra-2.0.9-bin.tar.gz 14 | rm *.tar.gz 15 | mv dsc-cassandra-* cassandra 16 | mkdir cassandra-data 17 | cd cassandra-data 18 | mkdir data 19 | mkdir saved_caches 20 | mkdir commitlog 21 | touch system.log 22 | cd ../cassandra/conf/ 23 | sed -ig 's,/var/lib/cassandra,$HOME/app-root/data/cassandra-data,' cassandra.yaml 24 | sed -ig 's/127.0.0.1/'$OPENSHIFT_DIY_IP'/g' cassandra.yaml 25 | sed -ig 's/localhost/'$OPENSHIFT_DIY_IP'/g' cassandra.yaml 26 | sed -ig 's,7000,17000,' cassandra.yaml 27 | sed -ig 's,7001,17001,' cassandra.yaml 28 | sed -ig 's,9160,19160,' cassandra.yaml 29 | sed -ig 's/localhost/'$OPENSHIFT_DIY_IP'/g' cassandra.yaml 30 | sed -ig 's,/var/log/cassandra,$HOME/app-root/data/cassandra-data,' log4j-server.properties 31 | sed -ig 's,${max_sensible_yg_in_mb}M,256M,' cassandra-env.sh 32 | sed -ig 's,${desired_yg_in_mb}M,256M,' cassandra-env.sh 33 | sed -ig '/jmxremote/s/^/#/' cassandra-env.sh 34 | fi 35 | -------------------------------------------------------------------------------- /.openshift/action_hooks/post_deploy: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This is a simple post deploy hook executed after your application 3 | # is deployed and started. This script gets executed directly, so 4 | # it could be python, php, ruby, etc. -------------------------------------------------------------------------------- /.openshift/action_hooks/pre_build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This is a simple script and will be executed on your CI system if 3 | # available. Otherwise it will execute while your application is stopped 4 | # before the build step. This script gets executed directly, so it 5 | # could be python, php, ruby, etc. -------------------------------------------------------------------------------- /.openshift/action_hooks/start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # The logic to start up your application should be put in this 3 | # script. The application will work only if it binds to 4 | # $OPENSHIFT_INTERNAL_IP:8080 5 | set -x 6 | max_memory_bytes=`oo-cgroup-read memory.limit_in_bytes` 7 | max_memory_mb=`expr $max_memory_bytes / 1048576` 8 | CASSANDRA_JVM_HEAP_RATIO=0.5 9 | CASSANDRA_JVM_HEAP_NEWSIZE=0.25 10 | max_heap_size_in_mb=$( echo "$max_memory_mb * $CASSANDRA_JVM_HEAP_RATIO" | bc | awk '{print int($1+0.5)}') 11 | heap_newsize_in_mb=$( echo "$max_memory_mb * $CASSANDRA_JVM_HEAP_NEWSIZE" | bc | awk '{print int($1+0.5)}') 12 | MAX_HEAP_SIZE="${max_heap_size_in_mb}M" 13 | HEAP_NEWSIZE="${heap_newsize_in_mb}M" 14 | export MAX_HEAP_SIZE 15 | export HEAP_NEWSIZE 16 | cd $OPENSHIFT_DATA_DIR/cassandra 17 | bin/cassandra 18 | export CQLSH_HOST=$OPENSHIFT_DIY_IP 19 | export CQLSH_PORT=19160 20 | sleep 30 21 | -------------------------------------------------------------------------------- /.openshift/action_hooks/stop: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # The logic to stop your application should be put in this script. 3 | set -x 4 | kill `ps -ef | grep cassandra | grep -v grep | awk '{ print $2 }'` > /dev/null 2>&1 5 | exit 0 -------------------------------------------------------------------------------- /.openshift/cron/README.cron: -------------------------------------------------------------------------------- 1 | Run scripts or jobs on a periodic basis 2 | ======================================= 3 | Any scripts or jobs added to the minutely, hourly, daily, weekly or monthly 4 | directories will be run on a scheduled basis (frequency is as indicated by the 5 | name of the directory) using run-parts. 6 | 7 | run-parts ignores any files that are hidden or dotfiles (.*) or backup 8 | files (*~ or *,) or named *.{rpmsave,rpmorig,rpmnew,swp,cfsaved} 9 | 10 | The presence of two specially named files jobs.deny and jobs.allow controls 11 | how run-parts executes your scripts/jobs. 12 | jobs.deny ===> Prevents specific scripts or jobs from being executed. 13 | jobs.allow ===> Only execute the named scripts or jobs (all other/non-named 14 | scripts that exist in this directory are ignored). 15 | 16 | The principles of jobs.deny and jobs.allow are the same as those of cron.deny 17 | and cron.allow and are described in detail at: 18 | http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Automating_System_Tasks.html#s2-autotasks-cron-access 19 | 20 | See: man crontab or above link for more details and see the the weekly/ 21 | directory for an example. 22 | 23 | -------------------------------------------------------------------------------- /.openshift/cron/daily/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekhargulati/cassandra-openshift-quickstart/1eb398e40acd12dc44b0ca7b245ffbdde42cc360/.openshift/cron/daily/.gitignore -------------------------------------------------------------------------------- /.openshift/cron/hourly/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekhargulati/cassandra-openshift-quickstart/1eb398e40acd12dc44b0ca7b245ffbdde42cc360/.openshift/cron/hourly/.gitignore -------------------------------------------------------------------------------- /.openshift/cron/minutely/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekhargulati/cassandra-openshift-quickstart/1eb398e40acd12dc44b0ca7b245ffbdde42cc360/.openshift/cron/minutely/.gitignore -------------------------------------------------------------------------------- /.openshift/cron/monthly/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekhargulati/cassandra-openshift-quickstart/1eb398e40acd12dc44b0ca7b245ffbdde42cc360/.openshift/cron/monthly/.gitignore -------------------------------------------------------------------------------- /.openshift/cron/weekly/README: -------------------------------------------------------------------------------- 1 | Run scripts or jobs on a weekly basis 2 | ===================================== 3 | Any scripts or jobs added to this directory will be run on a scheduled basis 4 | (weekly) using run-parts. 5 | 6 | run-parts ignores any files that are hidden or dotfiles (.*) or backup 7 | files (*~ or *,) or named *.{rpmsave,rpmorig,rpmnew,swp,cfsaved} and handles 8 | the files named jobs.deny and jobs.allow specially. 9 | 10 | In this specific example, the chronograph script is the only script or job file 11 | executed on a weekly basis (due to white-listing it in jobs.allow). And the 12 | README and chrono.dat file are ignored either as a result of being black-listed 13 | in jobs.deny or because they are NOT white-listed in the jobs.allow file. 14 | 15 | For more details, please see ../README.cron file. 16 | 17 | -------------------------------------------------------------------------------- /.openshift/cron/weekly/chrono.dat: -------------------------------------------------------------------------------- 1 | Time And Relative D...n In Execution (Open)Shift! 2 | -------------------------------------------------------------------------------- /.openshift/cron/weekly/chronograph: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "`date`: `cat $(dirname \"$0\")/chrono.dat`" 4 | -------------------------------------------------------------------------------- /.openshift/cron/weekly/jobs.allow: -------------------------------------------------------------------------------- 1 | # 2 | # Script or job files listed in here (one entry per line) will be 3 | # executed on a weekly-basis. 4 | # 5 | # Example: The chronograph script will be executed weekly but the README 6 | # and chrono.dat files in this directory will be ignored. 7 | # 8 | # The README file is actually ignored due to the entry in the 9 | # jobs.deny which is checked before jobs.allow (this file). 10 | # 11 | chronograph 12 | 13 | -------------------------------------------------------------------------------- /.openshift/cron/weekly/jobs.deny: -------------------------------------------------------------------------------- 1 | # 2 | # Any script or job files listed in here (one entry per line) will NOT be 3 | # executed (read as ignored by run-parts). 4 | # 5 | 6 | README 7 | 8 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Feel free to change or remove this file, it is informational only. 2 | 3 | Get started 4 | =========== 5 | 1. Add framework of choice to your repo. 6 | 2. Modify .openshift/action_hooks/start to start your application. 7 | The application is required to bind to $OPENSHIFT_INTERNAL_IP:8080. 8 | 3. Modify .openshift/action_hooks/stop to stop your application. 9 | 4. Commit and push your changes. 10 | 11 | Repo layout 12 | =========== 13 | static/ - Externally exposed static content goes here 14 | .openshift/action_hooks/start - Script that gets run to start your application 15 | .openshift/action_hooks/stop - Script that gets run to stop your application 16 | .openshift/action_hooks/pre_build - Script that gets run every git push before the build 17 | .openshift/action_hooks/build - Script that gets run every git push as part of the build process (on the CI system if available) 18 | .openshift/action_hooks/deploy - Script that gets run every git push after build but before the app is restarted 19 | .openshift/action_hooks/post_deploy - Script that gets run every git push after the app is restarted 20 | 21 | Notes about layout 22 | ================== 23 | Please leave the static directory in place (alter but do not delete) but feel 24 | free to create additional directories if needed. 25 | 26 | Note: Every time you push, everything in your remote repo dir gets recreated 27 | please store long term items (like an sqlite database) in the OpenShift 28 | data directory, which will persist between pushes of your repo. 29 | The OpenShift data directory is accessible relative to the remote repo 30 | directory (../data) or using a path constructed as 31 | $OPENSHIFT_HOMEDIR/app-root/data. 32 | 33 | 34 | Environment Variables 35 | ===================== 36 | 37 | OpenShift provides several environment variables to reference for ease 38 | of use. The following list are some common variables but far from exhaustive: 39 | 40 | $OPENSHIFT_INTERNAL_IP - IP Address assigned to the application 41 | $OPENSHIFT_APP_NAME - Application name 42 | $OPENSHIFT_HOMEDIR/diy-0.1 - Application dir 43 | $OPENSHIFT_HOMEDIR/app-root/data - For persistent storage (between pushes) 44 | $OPENSHIFT_TMP_DIR - Temp storage (unmodified files deleted after 10 days) 45 | 46 | To get a full list of environment variables, simply add a line in your 47 | .openshift/action_hooks/build script that says "export" and push. 48 | 49 | 50 | Additional information 51 | ====================== 52 | 53 | Link to additional information will be here, when we have it :) 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Started from https://github.com/shekhargulati/cassandra-openshift-quickstart 2 | 3 | It seems to have this isssue: 4 | https://github.com/shekhargulati/cassandra-openshift-quickstart/issues/2 5 | 6 | Usage is the same as described in *How To Configure and Run Cassandra on OpenShift* 7 | https://blog.openshift.com/cassandra-on-openshift/ the only difference is the command: 8 | 9 | `git remote add upstream https://github.com/MassimoCappellano/cassandra-openshift-quickstart.git` 10 | 11 | The OpenShift `diy` cartridge documentation can be found at: 12 | 13 | https://github.com/openshift/origin-server/tree/master/cartridges/openshift-origin-cartridge-diy/README.md 14 | -------------------------------------------------------------------------------- /misc/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekhargulati/cassandra-openshift-quickstart/1eb398e40acd12dc44b0ca7b245ffbdde42cc360/misc/.gitkeep --------------------------------------------------------------------------------