Skip to content

Commit

Permalink
Minor updates including docs for wildfly openshift cart
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrossley3 committed Dec 18, 2014
1 parent dfa8fdf commit 593e52c
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .openshift/.leinrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
export LEIN_HOME="${OPENSHIFT_DATA_DIR}/.lein"
export LEIN_JVM_OPTS="-Duser.home=${LEIN_HOME}"
export JVM_OPTS="-Dport=${OPENSHIFT_DIY_PORT} -Dhost=${OPENSHIFT_DIY_IP} -Dhornetq.netty.port=15000 -Dhornetq.netty.host=${OPENSHIFT_DIY_IP}"
export JVM_OPTS="-Dhornetq.netty.port=15000 -Dhornetq.netty.host=${OPENSHIFT_DIY_IP}"
export DEMO_WEB_HOST=${OPENSHIFT_DIY_IP}
export DEMO_WEB_PORT=${OPENSHIFT_DIY_PORT}

if [ ! -d ${LEIN_HOME} ]; then
echo "Installing Leiningen"
Expand Down
2 changes: 1 addition & 1 deletion .openshift/action_hooks/pre_deploy_wildfly
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ source ${OPENSHIFT_REPO_DIR}/.openshift/.leinrc

cd ${OPENSHIFT_REPO_DIR}
mkdir -p deployments
${OPENSHIFT_DATA_DIR}/lein do clean, immutant war -o deployments
${OPENSHIFT_DATA_DIR}/lein do clean, immutant war -o deployments -n ROOT
45 changes: 39 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,11 @@ And to open the app in the browser:
## On OpenShift

The app includes `start` and `stop` *action hooks* beneath the
`.openshift` directory that enable it to be deployed on
`.openshift/` directory that enable it to be deployed on
[OpenShift](http://openshift.com) using the
[DIY](https://developers.openshift.com/en/diy-overview.html)
cartridge.
[DIY cartridge](https://developers.openshift.com/en/diy-overview.html).

After installing the
[client tools](https://developers.openshift.com/en/getting-started-client-tools.html),
create an application named `demo` like so:
We'll call our application `demo`:

rhc app-create demo diy --from-code https://github.com/immutant/feature-demo

Expand All @@ -145,3 +142,39 @@ Once the app is up, visit
`http://demo-<YOUR_DOMAIN>.rhcloud.com:8000/`. The port, 8000, is
optional for all but the WebSocket example, because OpenShift only
supports WebSockets on port 8000.

### In a WildFly cluster on OpenShift

We'll use the
[WildFly cartridge](https://developers.openshift.com/en/wildfly-overview.html)
to create a
[scaled application](https://developers.openshift.com/en/overview-platform-features.html#scaling)
named `wf`. The `pre_deploy_wildfly` action hook will create our war
file in a directory monitored by the app server.

rhc app-create wf wildfly --scaling --gear-size medium --from-code https://github.com/immutant/feature-demo

Note we set the `--scaling` option and a medium `--gear-size`. It will
take a few minutes for the command to complete. Once it does, monitor
the log output:

cd wf
rhc tail

View the web examples at `http://wf-<YOUR_DOMAIN>.rhcloud.com:8000/`

Try scaling the app up to 3 gears:

rhc cartridge-scale wildfly 3

View the gears for your app to obtain their ssh URL's:

rhc app-show --gears

Login to your gear[s] to monitor/control it:

rhc ssh
help
gear restart
tail_all

4 changes: 2 additions & 2 deletions src/demo/scheduling.clj
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@

;; singleton jobs require an id
(sch/schedule #(println "I run on ONE node")
(-> every-5s
(-> (sch/every 10 :seconds)
(sch/id :a_singleton)))

(sch/schedule #(println "I run on EVERY node")
(-> every-5s
(-> (sch/every 9 :seconds)
(sch/singleton false)))))
2 changes: 1 addition & 1 deletion src/demo/web.clj
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@
;; wrap the handler with websocket support
;; websocket requests will go to the callbacks, ring requests to the handler
(ws/wrap-websocket websocket-callbacks))
(merge {"host" (env :host), "port" (env :port)}
(merge {"host" (env :demo-web-host), "port" (env :demo-web-port)}
args)))

0 comments on commit 593e52c

Please sign in to comment.