Merge pull request #624 from fabianofranz/master

Fixed Commafeed on OpenShift, added deployment instructions to README
This commit is contained in:
Athou
2014-09-13 07:11:58 +02:00
16 changed files with 191 additions and 0 deletions

11
.openshift/action_hooks/build Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
cd $OPENSHIFT_REPO_DIR
export NPM_CONFIG_CACHE="$OPENSHIFT_TMP_DIR/npm/cache"
export MAVEN_OPTS="-Dmaven.repo.local=$OPENSHIFT_TMP_DIR/m2"
export HOME="$OPENSHIFT_TMP_DIR/local"
npm install npm
export PATH="$OPENSHIFT_REPO_DIR/node_modules/.bin:$PATH"
mvn clean package

9
.openshift/action_hooks/deploy Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
cd $OPENSHIFT_REPO_DIR
sed -i 's/@OPENSHIFT_DIY_IP@/'"$OPENSHIFT_DIY_IP"'/g' .openshift/config.mysql.yml
sed -i 's/@OPENSHIFT_DIY_PORT@/'"$OPENSHIFT_DIY_PORT"'/g' .openshift/config.mysql.yml
sed -i 's/@OPENSHIFT_APP_DNS@/'"$OPENSHIFT_APP_DNS"'/g' .openshift/config.mysql.yml
sed -i 's/@OPENSHIFT_APP_NAME@/'"$OPENSHIFT_APP_NAME"'/g' .openshift/config.mysql.yml
sed -i 's/@OPENSHIFT_MYSQL_DB_HOST@/'"$OPENSHIFT_MYSQL_DB_HOST"'/g' .openshift/config.mysql.yml
sed -i 's/@OPENSHIFT_MYSQL_DB_USERNAME@/'"$OPENSHIFT_MYSQL_DB_USERNAME"'/g' .openshift/config.mysql.yml
sed -i 's/@OPENSHIFT_MYSQL_DB_PASSWORD@/'"$OPENSHIFT_MYSQL_DB_PASSWORD"'/g' .openshift/config.mysql.yml

3
.openshift/action_hooks/start Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
cd $OPENSHIFT_REPO_DIR
nohup java -jar target/commafeed.jar server .openshift/config.mysql.yml > ${OPENSHIFT_DIY_LOG_DIR}/commafeed.log 2>&1 &

8
.openshift/action_hooks/stop Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
source $OPENSHIFT_CARTRIDGE_SDK_BASH
if [ -z "$(ps -ef | grep commafeed | grep -v grep)" ]
then
client_result "Application is already stopped"
else
kill `ps -ef | grep commafeed | grep -v grep | awk '{ print $2 }'` > /dev/null 2>&1
fi

107
.openshift/config.mysql.yml Normal file
View File

@@ -0,0 +1,107 @@
# CommaFeed settings
# ------------------
app:
# context path of the application
contextPath: /
# url used to access commafeed
publicUrl: https://@OPENSHIFT_APP_DNS@/
# wether to allow user registrations
allowRegistrations: false
# put your google analytics tracking code here
googleAnalyticsTrackingCode:
# number of http threads
backgroundThreads: 3
# number of database updating threads
databaseUpdateThreads: 1
# settings for sending emails (password recovery)
smtpHost:
smtpPort:
smtpTls: false
smtpUserName:
smtpPassword:
# wether this commafeed instance has a lot of feeds to refresh
# leave this to false in almost all cases
heavyLoad: false
# minimum amount of time commafeed will wait before refreshing the same feed
refreshIntervalMinutes: 15
# wether to enable pubsub
# probably not needed if refreshIntervalMinutes is low
pubsubhubbub: false
# if enabled, images in feed entries will be proxied through the server instead of accessed directly by the browser
# useful if commafeed is usually accessed through a restricting proxy
imageProxyEnabled: false
# database query timeout (in milliseconds), 0 to disable
queryTimeout: 0
# time to keep unread statuses (in days), 0 to disable
keepStatusDays: 0
# cache service to use, possible values are 'noop' and 'redis'
cache: noop
# announcement string displayed on the main page
announcement:
# Database connection
# -------------------
# for MySQL
# driverClass is com.mysql.jdbc.Driver
# url is jdbc:mysql://localhost/commafeed?autoReconnect=true&failOverReadOnly=false&maxReconnects=20&rewriteBatchedStatements=true
#
# for PostgreSQL
# driverClass is org.postgresql.Driver
# url is jdbc:postgresql://localhost:5432/commafeed
#
# for Microsoft SQL Server
# driverClass is net.sourceforge.jtds.jdbc.Driver
# url is jdbc:jtds:sqlserver://localhost:1433/commafeed;instance=<instanceName, remove if not needed>
database:
driverClass: com.mysql.jdbc.Driver
url: jdbc:mysql://@OPENSHIFT_MYSQL_DB_HOST@/@OPENSHIFT_APP_NAME@?autoReconnect=true&failOverReadOnly=false&maxReconnects=20&rewriteBatchedStatements=true
user: @OPENSHIFT_MYSQL_DB_USERNAME@
password: @OPENSHIFT_MYSQL_DB_PASSWORD@
properties:
charSet: UTF-8
maxWaitForConnection: 1s
validationQuery: "/* CommaFeed Health Check */ SELECT 1"
minSize: 1
maxSize: 50
checkConnectionWhileIdle: true
maxConnectionAge: 30m
server:
applicationConnectors:
- type: http
port: @OPENSHIFT_DIY_PORT@
bindHost: @OPENSHIFT_DIY_IP@
adminConnectors:
- type: http
port: 15000
bindHost: @OPENSHIFT_DIY_IP@
logging:
level: WARN
loggers:
com.commafeed: INFO
liquibase: INFO
io.dropwizard.server.ServerFactory: INFO
appenders:
- type: console
- type: file
currentLogFilename: log/commafeed.log
threshold: ALL
archive: true
archivedLogFilenamePattern: log/commafeed-%d.log
archivedFileCount: 5
timeZone: UTC

0
.openshift/cron/daily/.gitignore vendored Normal file
View File

0
.openshift/cron/hourly/.gitignore vendored Normal file
View File

0
.openshift/cron/minutely/.gitignore vendored Normal file
View File

0
.openshift/cron/monthly/.gitignore vendored Normal file
View File

View File

@@ -0,0 +1,16 @@
Run scripts or jobs on a weekly basis
=====================================
Any scripts or jobs added to this directory will be run on a scheduled basis
(weekly) using run-parts.
run-parts ignores any files that are hidden or dotfiles (.*) or backup
files (*~ or *,) or named *.{rpmsave,rpmorig,rpmnew,swp,cfsaved} and handles
the files named jobs.deny and jobs.allow specially.
In this specific example, the chronograph script is the only script or job file
executed on a weekly basis (due to white-listing it in jobs.allow). And the
README and chrono.dat file are ignored either as a result of being black-listed
in jobs.deny or because they are NOT white-listed in the jobs.allow file.
For more details, please see ../README.cron file.

View File

@@ -0,0 +1 @@
Time And Relative D...n In Execution (Open)Shift!

View File

@@ -0,0 +1,3 @@
#!/bin/bash
echo "`date`: `cat $(dirname \"$0\")/chrono.dat`"

View File

@@ -0,0 +1,12 @@
#
# Script or job files listed in here (one entry per line) will be
# executed on a weekly-basis.
#
# Example: The chronograph script will be executed weekly but the README
# and chrono.dat files in this directory will be ignored.
#
# The README file is actually ignored due to the entry in the
# jobs.deny which is checked before jobs.allow (this file).
#
chronograph

View File

@@ -0,0 +1,7 @@
#
# Any script or job files listed in here (one entry per line) will NOT be
# executed (read as ignored by run-parts).
#
README

3
.openshift/settings.xml Normal file
View File

@@ -0,0 +1,3 @@
<settings>
<localRepository>$OPENSHIFT_DATA_DIR</localRepository>
</settings>

View File

@@ -45,6 +45,17 @@ Issue the following command to run the app, the server will listen by default on
java -jar target/commafeed.jar server config.yml
You can use a proxy http server such as nginx or apache.
Deployment on OpenShift
-----------------------------
[OpenShift](https://openshift.redhat.com) is Red Hat's Platform-as-a-Service (PaaS) that allows developers to quickly develop, host, and scale applications in a cloud environment. Commafeed runs perfectly on OpenShift and can even be used in the free tier. Follow the [Getting Started](https://developers.openshift.com/en/getting-started-overview.html) guide and after you sign up and install the Command Line Tools (RHC), do:
rhc create-app commafeed diy-0.1 mysql-5.5
cd commafeed
git remote add upstream -m master https://github.com/Athou/commafeed.git
git pull -s recursive -X theirs upstream master
git push
Local development
-----------------