Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update postgres crate for 0.8 and test-env #10

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
20 changes: 16 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
target
doc
checkout
logs
/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
94 changes: 78 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,85 @@
# Pallet crate for postgres
[Repository](https://github.com/pallet/postgres-crate) ·
[Issues](https://github.com/pallet/postgres-crate/issues) ·
[API docs](http://palletops.com/postgres-crate/0.8/api) ·
[Annotated source](http://palletops.com/postgres-crate/0.8/annotated/uberdoc.html) ·
[Release Notes](https://github.com/pallet/postgres-crate/blob/develop/ReleaseNotes.md)

A Pallet crate to install and configure postgres.

### Dependency Information

```clj
:dependencies [[com.palletops/postgres-crate "0.8.0-alpha.1"]]
```

### 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-beta.6</th>
<td>0.8.0-alpha.1</td>
<td>clojars</td>
<td>com.palletops</td>
<td><a href='https://github.com/pallet/postgres-crate/blob/0.8.0-alpha.1/ReleaseNotes.md'>Release Notes</a></td>
<td><a href='https://github.com/pallet/postgres-crate/blob/0.8.0-alpha.1/'>Source</a></td>
</tr>
<tr>
<th>0.7.2</th>
<td>0.7.0-beta.2</td>
<td>clojars</td>
<td>com.palletops</td>
<td><a href='https://github.com/pallet/postgres-crate/blob/0.7.0-beta.2/ReleaseNotes.md'>Release Notes</a></td>
<td><a href='https://github.com/pallet/postgres-crate/blob/0.7.0-beta.2/'>Source</a></td>
</tr>
</tbody>
</table>

## Usage

The `server-spec` function provides a convenient pallet server spec for
postgres. It takes a single map as an argument, specifying configuration
choices, as described below for the `settings` function. You can use this
in your own group or server specs in the :extends clause.

```clj
(require '[pallet/crate/postgres :as postgres])
(group-spec my-postgres-group
:extends [(postgres/server-spec {})])
```

While `server-spec` provides an all-in-one function, you can use the individual
plan functions as you see fit.

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 postgres.

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

The `configure` function writes the postgres configuration file, using the form
passed to the :config key in the `settings` function.

This a crate to install and run postgres via [Pallet](http://pallet.github.com/pallet).

[Release Notes](ReleaseNotes.md)

## Server Spec

The postgres crate defines the `postgres` function, that takes a settings map
and returns a server-spec for installing postgres.

## Settings

The postgres crate uses the following settings:

* `:version`
a string to specify the point version of PostgreSQL (e.g., `"9.1"`). The default is the version provided by the system's packaging system
* `:version`
a string to specify the point version of PostgreSQL (e.g., `"9.1"`). The
default is the version provided by the system's packaging system

* `:components`
a set of one or more recognized keywords. The set of every component is `#{:server :libs :client}`.
a set of one or more recognized keywords. The set of every component is
`#{:server :libs :client}`.

* `:strategy`
allows override of the install strategy (`:packages`, `:package-source`, or `:rpm`)
allows override of the install strategy (`:packages`, `:package-source`, or
`:rpm`)

* `:packages`
the packages that are used to install
Expand All @@ -29,7 +88,9 @@ The postgres crate uses the following settings:
a non-default package source for the packages

* `:rpm`
takes a map of [`remote-file` options](http://palletops.com/pallet/api/0.7/pallet.action.remote-file.html) specifying an RPM file to install
takes a map of
[`remote-file` options](http://palletops.com/pallet/api/0.7/pallet.action.remote-file.html)
specifying an RPM file to install

* `:default-cluster-name`
name of the default cluster created by the installer
Expand All @@ -44,7 +105,8 @@ The postgres crate uses the following settings:
path to `postgresql.conf`

* `:has-pg-wrapper`
boolean flag for availability of a wrapper allowing command execution against a specified cluster.
boolean flag for availability of a wrapper allowing command execution against
a specified cluster.

* `:has-multicluster-service`
boolean flag specifying whether the init service is multi-cluster capable.
Expand Down Expand Up @@ -74,4 +136,4 @@ The postgres crate uses the following settings:

Licensed under [EPL](http://www.eclipse.org/legal/epl-v10.html)

Copyright 2010, 2011, 2012 Hugo Duncan.
Copyright 2013 Hugo Duncan.
116 changes: 116 additions & 0 deletions dev-resources/logback-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<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">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - %msg%n</pattern>
</encoder>
</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>

<appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">
<discriminator>
<key>target</key>
<defaultValue>unspecified</defaultValue>
</discriminator>
<sift>
<appender name="FILE-${target}" class="ch.qos.logback.core.FileAppender">
<file>logs/target-${target}.log</file>
<append>false</append>
<encoder>
<pattern>%msg%n</pattern>
</encoder>
</appender>
</sift>
</appender>

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

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

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

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

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

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

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

<logger name="net.schmizz" level="WARN"/>
<logger name="clj-ssh" level="DEBUG"/>
<logger name="pallet.action-plan" level="DEBUG"/>
<logger name="pallet.algo.fsm" level="WARN"/>
<logger name="pallet.algo.fsmop" level="WARN"/>
<logger name="pallet.core.primitives" level="DEBUG"/>
<!-- <logger name="pallet.execute.default-executor" level="TRACE"/> -->

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


</configuration>
10 changes: 10 additions & 0 deletions doc-src/FOOTER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Support

[On the group](http://groups.google.com/group/pallet-clj), or
[#pallet](http://webchat.freenode.net/?channels=#pallet) on freenode irc.

## License

Licensed under [EPL](http://www.eclipse.org/legal/epl-v10.html)

Copyright 2013 Hugo Duncan.
88 changes: 88 additions & 0 deletions doc-src/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
## Usage

The `server-spec` function provides a convenient pallet server spec for
postgres. It takes a single map as an argument, specifying configuration
choices, as described below for the `settings` function. You can use this
in your own group or server specs in the :extends clause.

```clj
(require '[pallet/crate/postgres :as postgres])
(group-spec my-postgres-group
:extends [(postgres/server-spec {})])
```

While `server-spec` provides an all-in-one function, you can use the individual
plan functions as you see fit.

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 postgres.

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

The `configure` function writes the postgres configuration file, using the form
passed to the :config key in the `settings` function.


## Settings

The postgres crate uses the following settings:

* `:version`
a string to specify the point version of PostgreSQL (e.g., `"9.1"`). The
default is the version provided by the system's packaging system

* `:components`
a set of one or more recognized keywords. The set of every component is
`#{:server :libs :client}`.

* `:strategy`
allows override of the install strategy (`:packages`, `:package-source`, or
`:rpm`)

* `:packages`
the packages that are used to install

* `:package-source`
a non-default package source for the packages

* `:rpm`
takes a map of
[`remote-file` options](http://palletops.com/pallet/api/0.7/pallet.action.remote-file.html)
specifying an RPM file to install

* `:default-cluster-name`
name of the default cluster created by the installer

* `:bin`
path to binaries

* `:owner`
unix owner for Postgres files

* `:postgresql_file`
path to `postgresql.conf`

* `:has-pg-wrapper`
boolean flag for availability of a wrapper allowing command execution against
a specified cluster.

* `:has-multicluster-service`
boolean flag specifying whether the init service is multi-cluster capable.

* `:initdb-via`
whether to use the initdb (`:initdb`), or service (`:service`) to run initdb

* `:options`
A map of options:
- `:data_directory`
path to storage location
- `:hba_file`
path to `pg_hba.conf` location
- `:ident_file`
path to `pg_ident.conf` location
- `:external_pid_file`
path to pid file
- `:unix_socket_directory`
path to directory for unix sockets
13 changes: 13 additions & 0 deletions pallet.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
;;; Pallet project configuration file

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

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

This file was deleted.

Loading