Skip to content

Commit

Permalink
Update to pallet 0.8.0-RC.3 and lein
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoduncan committed Oct 31, 2013
1 parent 4891b6e commit 5a09be5
Show file tree
Hide file tree
Showing 12 changed files with 577 additions and 212 deletions.
18 changes: 17 additions & 1 deletion .gitignore
@@ -1 +1,17 @@
target
/target
/lib
/classes
/checkouts
/logs
/doc
doc-src/VERSIONS.md
doc-src/INTRO.md
pom.xml
pom.xml.asc
*.jar
*.class
.lein-deps-sum
.lein-failures
.lein-plugins
.lein-repl-history
.nrepl-port
92 changes: 85 additions & 7 deletions README.md
@@ -1,15 +1,93 @@
# Pallet crate for haproxy
[Repository](https://github.com/pallet/haproxy-crate) ·
[Issues](https://github.com/pallet/haproxy-crate/issues) ·
[API docs](http://palletops.com/haproxy-crate/0.8/api) ·
[Annotated source](http://palletops.com/haproxy-crate/0.8/annotated/uberdoc.html) ·
[Release Notes](https://github.com/pallet/haproxy-crate/blob/develop/ReleaseNotes.md)

This a crate to install and run haproxy via [Pallet](http://pallet.github.com/pallet).
A [pallet](http://palletops.com/) crate to install and configure
[haproxy](http://haproxy.1wt.eu/).

[Release Notes](ReleaseNotes.md)
### Dependency Information

## Support
```clj
:dependencies [[com.palletops/haproxy-crate "0.8.0-SNAPSHOT"]]
```

[On the group](http://groups.google.com/group/pallet-clj), or #pallet on freenode irc.
### Releases

<table>
<thead>
<tr><th>Pallet</th><th>Crate Version</th><th>Repo</th><th>GroupId</th></tr>
</thead>
<tbody>
<tr>
<th>0.8.0-RC.3</th>
<td>0.8.0-SNAPSHOT</td>
<td>clojars</td>
<td>com.palletops</td>
<td><a href='https://github.com/pallet/haproxy-crate/blob/0.8.0-SNAPSHOT/ReleaseNotes.md'>Release Notes</a></td>
<td><a href='https://github.com/pallet/haproxy-crate/blob/0.8.0-SNAPSHOT/'>Source</a></td>
</tr>
</tbody>
</table>

## Usage

The haproxy crate provides a `server-spec` function that returns a
server-spec. This server spec will install and run the haproxy server.
You pass a map of options to configure haproxy, as specified in
`settings`.

The `server-spec` provides an easy way of using the crate functions, and you can
use the following crate functions directly if you need to.

The `settings` function provides a plan function that should be called
in the `:settings` phase. The function puts the configuration options
into the pallet session, where they can be found by the other crate
functions, or by other crates wanting to interact with haproxy.

The `:proxy-group` keyword can be used to provide a logical name the
haproxy instance, and defaults to pallet group name.

The haproxy configuration file is based on the `:config` key in the
settings map, and has four sub-keys, The `:listen` sub-key is used to
specific a map of applications to proxy, where the key is a keyword
naming the application, and the values are a map of configuration
options for the listen clause for that application.

For example, this would configure a `:my-app` application, listening
on port 80.

```clj
{:proxy-group :myproxy
:config {:listen {:myapp {:server-address "0.0.0.0:80"}}}}
```

The `proxied-by` function should be called in the settings phase of
services that want to be proxied behind haproxy. The `:proxy-group`
setting, which defaults to the group-name for the current target,
should match the `proxy-group-name` argument passed to `proxied-by`.

For example, this would add the current target as a backend for the
`:my-app` application, contactable on the 8080 port.

```clj
(haproxy/proxied-by :proxy-group :myapp {:server-port 8080})
```

The `install` function is responsible for actually installing haproxy.

## Live test on vmfest

For example, to run the live test on VMFest, using Ubuntu 13:

```sh
lein with-profile +vmfest pallet up --selectors ubuntu-13
lein with-profile +vmfest pallet down --selectors ubuntu-13
```

## License

Licensed under [EPL](http://www.eclipse.org/legal/epl-v10.html)
Copyright (C) 2012, 2013 Hugo Duncan

Copyright 2010, 2011 Hugo Duncan.
Distributed under the Eclipse Public License.
101 changes: 101 additions & 0 deletions dev-resources/logback-test.xml
@@ -0,0 +1,101 @@
<configuration scan="true" scanPeriod="1 seconds" debug="false">
<!-- <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> -->

<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>

<appender name="COMPUTEFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/jclouds-compute.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/old/jclouds-compute.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>3</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
</encoder>
</appender>

<appender name="WIREFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/jclouds-wire.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/old/jclouds-wire.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>3</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
</encoder>
</appender>

<appender name="PALLETFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/pallet.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/old/pallet.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>3</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date %level [%thread] %logger{10} %msg%n</pattern>
</encoder>
</appender>

<appender name="VMFESTFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/vmfest.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/old/vmfest.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>3</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date %level [%thread] %logger{10} %msg%n</pattern>
</encoder>
</appender>

<logger name="jclouds.headers" level="ERROR">
<appender-ref ref="WIREFILE" />
</logger>

<logger name="jclouds.wire" level="ERROR">
<appender-ref ref="WIREFILE" />
</logger>

<logger name="jclouds.compute" level="ERROR">
<appender-ref ref="COMPUTEFILE" />
</logger>

<logger name="jclouds.ssh" level="ERROR">
<appender-ref ref="COMPUTEFILE" />
</logger>

<logger name="pallet" level="DEBUG">
<appender-ref ref="PALLETFILE" />
</logger>

<logger name="vmfest" level="DEBUG">
<appender-ref ref="VMFESTFILE" />
</logger>

<logger name="pallet.configure" level="ERROR"/>
<logger name="pallet.executors" level="DEBUG"/>
<logger name="pallet.stevedore" level="ERROR"/>
<logger name="pallet.action-plan" level="ERROR"/>
<logger name="pallet.algo.fsm" level="ERROR"/>
<logger name="pallet.algo.fsmop" level="ERROR"/>
<logger name="pallet.action-plan" level="ERROR"/>
<logger name="pallet.execute" level="DEBUG"/>
<logger name="pallet.core.api" level="ERROR"/>
<logger name="pallet.core.primitives" level="ERROR"/>
<logger name="pallet.core.operations" level="ERROR"/>
<logger name="pallet.transport" level="ERROR"/>
<logger name="clj-ssh.ssh" level="ERROR"/>
<!-- <logger name="pallet.execute.default-executor" level="TRACE"/> -->

<root level="ERROR">
<appender-ref ref="CONSOLE" />
</root>


</configuration>
5 changes: 5 additions & 0 deletions doc-src/FOOTER.md
@@ -0,0 +1,5 @@
## License

Copyright (C) 2012, 2013 Hugo Duncan

Distributed under the Eclipse Public License.
54 changes: 54 additions & 0 deletions doc-src/USAGE.md
@@ -0,0 +1,54 @@
## Usage

The haproxy crate provides a `server-spec` function that returns a
server-spec. This server spec will install and run the haproxy server.
You pass a map of options to configure haproxy, as specified in
`settings`.

The `server-spec` provides an easy way of using the crate functions, and you can
use the following crate functions directly if you need to.

The `settings` function provides a plan function that should be called
in the `:settings` phase. The function puts the configuration options
into the pallet session, where they can be found by the other crate
functions, or by other crates wanting to interact with haproxy.

The `:proxy-group` keyword can be used to provide a logical name the
haproxy instance, and defaults to pallet group name.

The haproxy configuration file is based on the `:config` key in the
settings map, and has four sub-keys, The `:listen` sub-key is used to
specific a map of applications to proxy, where the key is a keyword
naming the application, and the values are a map of configuration
options for the listen clause for that application.

For example, this would configure a `:my-app` application, listening
on port 80.

```clj
{:proxy-group :myproxy
:config {:listen {:myapp {:server-address "0.0.0.0:80"}}}}
```

The `proxied-by` function should be called in the settings phase of
services that want to be proxied behind haproxy. The `:proxy-group`
setting, which defaults to the group-name for the current target,
should match the `proxy-group-name` argument passed to `proxied-by`.

For example, this would add the current target as a backend for the
`:my-app` application, contactable on the 8080 port.

```clj
(haproxy/proxied-by :proxy-group :myapp {:server-port 8080})
```

The `install` function is responsible for actually installing haproxy.

## Live test on vmfest

For example, to run the live test on VMFest, using Ubuntu 13:

```sh
lein with-profile +vmfest pallet up --selectors ubuntu-13
lein with-profile +vmfest pallet down --selectors ubuntu-13
```
12 changes: 12 additions & 0 deletions pallet.clj
@@ -0,0 +1,12 @@
;;; Pallet project configuration file

(require
'[pallet.crate.haproxy-test :refer [test-spec]]
'[pallet.crates.test-nodes :refer [node-specs]])

(defproject haproxy-crate
:provider node-specs ; supported pallet nodes
:groups [(group-spec "haproxy-live-test"
:extends [with-automated-admin-user
test-spec]
:roles #{:live-test :default})])
33 changes: 0 additions & 33 deletions pom.xml

This file was deleted.

40 changes: 40 additions & 0 deletions profiles.clj
@@ -0,0 +1,40 @@
{:dev
{:dependencies [[com.palletops/pallet "0.8.0-RC.3" :classifier "tests"]
[com.palletops/crates "0.1.1"]
[ch.qos.logback/logback-classic "1.0.9"]]
:plugins [[com.palletops/pallet-lein "0.8.0-alpha.1"]
[com.palletops/lein-pallet-crate "0.1.0"]
[lein-set-version "0.3.0"]
[lein-resource "0.3.2"]
[codox/codox.leiningen "0.6.4"]
[lein-marginalia "0.7.1"]]
:aliases {"live-test-up"
["pallet" "up"
;; "--phases" "install,configure,test"
;; "--selector" "live-test"
]
"live-test-down" ["pallet" "down"]
"live-test" ["do" "live-test-up," "live-test-down"]}
:test-selectors {:default (complement :live-test)
:live-test :live-test
:all (constantly true)}}
:doc {:dependencies [[com.palletops/pallet-codox "0.1.0"]]
:plugins [[codox/codox.leiningen "0.6.4"]
[lein-marginalia "0.7.1"]]
:codox {:writer codox-md.writer/write-docs
:output-dir "doc/0.8/api"
:src-dir-uri "https://github.com/pallet/haproxy-crate/blob/develop"
:src-linenum-anchor-prefix "L"}
:aliases {"marg" ["marg" "-d" "doc/0.8/annotated"]
"codox" ["doc"]
"doc" ["do" "codox," "marg"]}}
:release
{:set-version
{:updates [{:path "README.md" :no-snapshot true}]}}
:jclouds {:dependencies [[org.cloudhoist/pallet-jclouds "1.5.2"]
[org.jclouds/jclouds-allblobstore "1.5.5"]
[org.jclouds/jclouds-allcompute "1.5.5"]
[org.jclouds.driver/jclouds-slf4j "1.5.5"
:exclusions [org.slf4j/slf4j-api]]
[org.jclouds.driver/jclouds-sshj "1.5.5"]]}
:vmfest {:dependencies [[com.palletops/pallet-vmfest "0.3.0-beta.2"]]}}
11 changes: 11 additions & 0 deletions project.clj
@@ -0,0 +1,11 @@
(defproject com.palletops/haproxy-crate "0.8.0-SNAPSHOT"
:description "Crate for haproxy installation"
:url "http://github.com/pallet/haproxy-crate"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.4.0"]
[com.palletops/pallet "0.8.0-SNAPSHOT"]]
:resource {:resource-paths ["doc-src"]
:target-path "target/classes/pallet_crate/haproxy_crate/"
:includes [#"doc-src/USAGE.*"]}
:prep-tasks ["resource" "crate-doc"])
11 changes: 11 additions & 0 deletions resources/pallet_crate/haproxy_crate/meta.edn
@@ -0,0 +1,11 @@
{:header "haproxy"
:title
"A [pallet](http://palletops.com/) crate to install and configure
[haproxy](http://haproxy.1wt.eu/)."
:git-repo "https://github.com/pallet/haproxy-crate"
:api-docs "http://palletops.com/haproxy-crate/0.8/api"
:annotated-docs "http://palletops.com/haproxy-crate/0.8/annotated/uberdoc.html"
:tag-prefix ""
:artifact-id "haproxy-crate"
:source-path "src/pallet/crate/haproxy.clj"
:versions [{:pallet "0.8.0-RC.3" :version "0.8.0-SNAPSHOT"}]}

0 comments on commit 5a09be5

Please sign in to comment.