Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ghelleks/huginn into open…
Browse files Browse the repository at this point in the history
…shift

Conflicts:
	Gemfile
	Gemfile.lock
  • Loading branch information
cantino committed Apr 21, 2014
2 parents 261929e + c9e7c50 commit 038d990
Show file tree
Hide file tree
Showing 33 changed files with 418 additions and 79 deletions.
97 changes: 97 additions & 0 deletions .env.example.openshift
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# ==== Required configuration settings for Huginn ====

# Replace the following with the output from "rake secret"
# (unnecessary, since we'll be using the OpenShift-provided secret)
# APP_SECRET_TOKEN=REPLACE_ME_NOW!

# This is the domain where your Huginn instance will be running. The default should work
# for development, but it needs to be changed to your Huginn domain when you deploy to a
# production environment (e.g., yourdomain.com, possibly including a port).
DOMAIN=$OPENSHIFT_APP_DNS

# Optionally set an asset host
# ASSET_HOST=http://assets.example.com

############################
# Database Setup #
############################

DATABASE_ADAPTER=mysql2
DATABASE_ENCODING=utf8
DATABASE_RECONNECT=true
DATABASE_NAME=$OPENSHIFT_APP_NAME
DATABASE_POOL=5
DATABASE_USERNAME=$OPENSHIFT_MYSQL_DB_USERNAME
DATABASE_PASSWORD=$OPENSHIFT_MYSQL_DB_PASSWORD
DATABASE_HOST=$OPENSHIFT_MYSQL_DB_HOST
DATABASE_PORT=$OPENSHIFT_MYSQL_DB_PORT
#DATABASE_SOCKET=$OPENSHIFT_MYSQL_DB_SOCKET

# ==== Additional required production settings ====

# Configure Rails environment. This should only be needed in production and may cause errors in development.
# RAILS_ENV=production

#############################
# Email Configuration #
#############################

# Outgoing email settings. To use Gmail or Google Apps, put your Google Apps domain or gmail.com
# as the SMTP_DOMAIN and your Gmail username and password as the SMTP_USER_NAME and SMTP_PASSWORD.
#
# PLEASE NOTE: In order to enable emails locally (e.g., when not in the production Rails environment),
# you must also change config.action_mailer.perform_deliveries in config/environments/development.rb.

SMTP_DOMAIN=your-domain-here.com
SMTP_USER_NAME=you@gmail.com
SMTP_PASSWORD=somepassword
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
SMTP_AUTHENTICATION=plain
SMTP_ENABLE_STARTTLS_AUTO=true

# The address from which system emails will appear to be sent.
EMAIL_FROM_ADDRESS=from_address@gmail.com

############################
# Allowing Signups #
############################

# This invitation code will be required for users to signup with your Huginn installation.
# You can see its use in user.rb.
INVITATION_CODE=try-huginn

###########################
# Agent Logging #
###########################

# Number of lines of log messages to keep per Agent
AGENT_LOG_LENGTH=200

#############################
# AWS and Mechanical Turk #
#############################

# AWS Credentials for MTurk
AWS_ACCESS_KEY_ID="your aws access key id"
AWS_ACCESS_KEY="your aws access key"

# Set AWS_SANDBOX to true if you're developing Huginn code.
AWS_SANDBOX=false

########################
# Various Settings #
########################

# Allow JSONPath eval expresions. i.e., $..price[?(@ < 20)]
# You should not allow this on a shared Huginn box because it is not secure.
ALLOW_JSONPATH_EVAL=false

# Enable this setting to allow insecure Agents like the ShellCommandAgent. Only do this
# when you trust everyone using your Huginn installation.
ENABLE_INSECURE_AGENTS=false

# Use Graphviz for generating diagrams instead of using Google Chart
# Tools. Specify a dot(1) command path built with SVG support
# enabled.
#USE_GRAPHVIZ_DOT=dot
5 changes: 5 additions & 0 deletions .openshift/action_hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
# This is a simple build script and will be executed on your CI system if
# available. Otherwise it will execute while your application is stopped
# before the deploy step. This script gets executed directly, so it
# could be python, php, ruby, etc.
9 changes: 9 additions & 0 deletions .openshift/action_hooks/deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# This deploy hook gets executed after dependencies are resolved and the
# build hook has been run but before the application has been started back
# up again. This script gets executed directly, so it could be python, php,
# ruby, etc.

pushd ${OPENSHIFT_REPO_DIR} > /dev/null
bundle exec rake db:migrate RAILS_ENV="production"
popd > /dev/null
4 changes: 4 additions & 0 deletions .openshift/action_hooks/post_deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
# This is a simple post deploy hook executed after your application
# is deployed and started. This script gets executed directly, so
# it could be python, php, ruby, etc.
15 changes: 15 additions & 0 deletions .openshift/action_hooks/post_start_ruby-1.9
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# The pre_start_cartridge and pre_stop_cartridge hooks are *SOURCED*
# immediately before (re)starting or stopping the specified cartridge.
# They are able to make any desired environment variable changes as
# well as other adjustments to the application environment.

# The post_start_cartridge and post_stop_cartridge hooks are executed
# immediately after (re)starting or stopping the specified cartridge.

# Exercise caution when adding commands to these hooks. They can
# prevent your application from stopping cleanly or starting at all.
# Application start and stop is subject to different timeouts
# throughout the system.

14 changes: 14 additions & 0 deletions .openshift/action_hooks/post_stop_ruby-1.9
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# The pre_start_cartridge and pre_stop_cartridge hooks are *SOURCED*
# immediately before (re)starting or stopping the specified cartridge.
# They are able to make any desired environment variable changes as
# well as other adjustments to the application environment.

# The post_start_cartridge and post_stop_cartridge hooks are executed
# immediately after (re)starting or stopping the specified cartridge.

# Exercise caution when adding commands to these hooks. They can
# prevent your application from stopping cleanly or starting at all.
# Application start and stop is subject to different timeouts
# throughout the system.
22 changes: 22 additions & 0 deletions .openshift/action_hooks/pre_build
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
# This is a simple script and will be executed on your CI system if
# available. Otherwise it will execute while your application is stopped
# before the build step. This script gets executed directly, so it
# could be python, php, ruby, etc.

STORED_ASSETS="${OPENSHIFT_DATA_DIR}/assets"
LIVE_ASSETS="${OPENSHIFT_REPO_DIR}/public/assets"

# Ensure our stored assets directory exists
if [ ! -d "${STORED_ASSETS}" ]; then
echo " Creating permanent assets directory"
mkdir "${STORED_ASSETS}"
fi

# Create symlink to stored assets unless we're uploading our own assets
if [ -d "${LIVE_ASSETS}" ]; then
echo " WARNING: Assets included in git repository, not using stored assets"
else
echo " Restoring stored assets"
ln -s "${STORED_ASSETS}" "${LIVE_ASSETS}"
fi
36 changes: 36 additions & 0 deletions .openshift/action_hooks/pre_start_ruby-1.9
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# The pre_start_cartridge and pre_stop_cartridge hooks are *SOURCED*
# immediately before (re)starting or stopping the specified cartridge.
# They are able to make any desired environment variable changes as
# well as other adjustments to the application environment.

# The post_start_cartridge and post_stop_cartridge hooks are executed
# immediately after (re)starting or stopping the specified cartridge.

# Exercise caution when adding commands to these hooks. They can
# prevent your application from stopping cleanly or starting at all.
# Application start and stop is subject to different timeouts
# throughout the system.

if [ -f ${OPENSHIFT_REPO_DIR}/.env ]
then
echo " Loading .env file"
while read -r line; do
if [[ $line =~ ^\s*(#|$) ]]
then
continue
else
export "$line"
fi
done < ${OPENSHIFT_REPO_DIR}/.env
else
cat <<EOM
***
*
* WARNING: No .env file found. Things like email probably won't work.
* You should consider making one. See .env.example.openshift.
*
***
EOM
fi
14 changes: 14 additions & 0 deletions .openshift/action_hooks/pre_stop_ruby-1.9
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# The pre_start_cartridge and pre_stop_cartridge hooks are *SOURCED*
# immediately before (re)starting or stopping the specified cartridge.
# They are able to make any desired environment variable changes as
# well as other adjustments to the application environment.

# The post_start_cartridge and post_stop_cartridge hooks are executed
# immediately after (re)starting or stopping the specified cartridge.

# Exercise caution when adding commands to these hooks. They can
# prevent your application from stopping cleanly or starting at all.
# Application start and stop is subject to different timeouts
# throughout the system.
22 changes: 22 additions & 0 deletions .openshift/cron/README.cron
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Run scripts or jobs on a periodic basis
=======================================
Any scripts or jobs added to the minutely, hourly, daily, weekly or monthly
directories will be run on a scheduled basis (frequency is as indicated by the
name of the directory) using run-parts.

run-parts ignores any files that are hidden or dotfiles (.*) or backup
files (*~ or *,) or named *.{rpmsave,rpmorig,rpmnew,swp,cfsaved}

The presence of two specially named files jobs.deny and jobs.allow controls
how run-parts executes your scripts/jobs.
jobs.deny ===> Prevents specific scripts or jobs from being executed.
jobs.allow ===> Only execute the named scripts or jobs (all other/non-named
scripts that exist in this directory are ignored).

The principles of jobs.deny and jobs.allow are the same as those of cron.deny
and cron.allow and are described in detail at:
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Automating_System_Tasks.html#s2-autotasks-cron-access

See: man crontab or above link for more details and see the the weekly/
directory for an example.

Empty file.
Empty file.
Empty file.
Empty file.
16 changes: 16 additions & 0 deletions .openshift/cron/weekly/README
Original file line number Diff line number Diff line change
@@ -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.

1 change: 1 addition & 0 deletions .openshift/cron/weekly/chrono.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Time And Relative D...n In Execution (Open)Shift!
3 changes: 3 additions & 0 deletions .openshift/cron/weekly/chronograph
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

echo "`date`: `cat $(dirname \"$0\")/chrono.dat`"
12 changes: 12 additions & 0 deletions .openshift/cron/weekly/jobs.allow
Original file line number Diff line number Diff line change
@@ -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

7 changes: 7 additions & 0 deletions .openshift/cron/weekly/jobs.deny
Original file line number Diff line number Diff line change
@@ -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

8 changes: 8 additions & 0 deletions .openshift/markers/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Markers
===========

Adding marker files to this directory will have the following effects:

force_clean_build - Previous output from bundle install --deployment will be
removed and all gems will be reinstalled according to the current
Gemfile/Gemfile.lock.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ gem 'geokit-rails3', '~> 0.1.5'

gem 'kramdown', '~> 1.1.0'
gem 'typhoeus', '~> 0.6.3'
gem 'nokogiri', '~> 1.6.0'
gem 'nokogiri', '1.6.2rc2'

gem 'wunderground', '~> 1.1.0'
gem 'forecast_io', '~> 2.0.0'
Expand Down
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ GEM
multipart-post (2.0.0)
mysql2 (0.3.15)
naught (1.0.0)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
nokogiri (1.6.2.rc2)
mini_portile (~> 0.5.2)
multi_xml (~> 0.5)
rack (~> 1.2)
oauth2 (0.9.3)
faraday (>= 0.8, < 0.10)
jwt (~> 0.1.8)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (~> 1.2)
orm_adapter (0.5.0)
polyglot (0.3.4)
pry (0.9.12.6)
Expand Down Expand Up @@ -327,7 +327,7 @@ DEPENDENCIES
kaminari (~> 0.14.1)
kramdown (~> 1.1.0)
mysql2 (~> 0.3.13)
nokogiri (~> 1.6.0)
nokogiri (= 1.6.2rc2)
pry
rails (= 3.2.17)
rr
Expand Down
3 changes: 3 additions & 0 deletions OPENSHIFT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
You can find instructions for using this branch on our upstream wiki:

https://github.com/cantino/huginn/wiki/Deploying-on-OpenShift
3 changes: 2 additions & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Procfile for development:
web: bundle exec rails server
# removed 'web' for OpenShift, per https://github.com/cantino/huginn/issues/110#issuecomment-40561461
# web: bundle exec rails server
schedule: bundle exec rails runner bin/schedule.rb
twitter: bundle exec rails runner bin/twitter_stream.rb
dj: bundle exec script/delayed_job run
Expand Down
Loading

0 comments on commit 038d990

Please sign in to comment.