Skip to content

Commit

Permalink
Merge pull request #256 from buddycloud/docker
Browse files Browse the repository at this point in the history
Build a docker image
  • Loading branch information
lloydwatkin committed Oct 16, 2014
2 parents b3766d9 + 4d8d711 commit 0ccfe65
Show file tree
Hide file tree
Showing 14 changed files with 416 additions and 194 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ logs
*.BASE.*
*.LOCAL.*
*.REMOTE.*
!src/main/resources/log4j.properties
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
################################################################################
# Build a dockerfile for buddycloud-server-java
# Based on ubuntu
################################################################################

FROM dockerfile/java:openjdk-7-jdk

MAINTAINER Lloyd Watkin <[email protected]>

RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y maven

RUN git clone https://github.com/buddycloud/buddycloud-server-java.git
RUN cd buddycloud-server-java && mvn package
ADD src/main/resources/log4j.properties /data/buddycloud-server-java/
ADD contrib/docker/start.sh /data/
RUN chmod +x start.sh
CMD ./start.sh
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ Please see [the example configuration file](https://github.com/buddycloud/buddyc
| sync.purge-on-start | false | | Purge remote data on server start |
| users.presence.persist | false | | If **true** then user presence status is stored in the database rather than in memory |

### Database based configuration

If you prefer to load your configuration from a database then this is possible. Simply load all your configuration key/values into the "configuration" table within the database (__note:__ **jdbc.proxool.driver-url**, **jdbc.user**, and **jdbc.password** values will be ignored). When starting the server set an evironment variable of __DATABASE__ to the Postgres connection string which will connect to your database. For example:

```
DATABASE="jdbc:postgresql://localhost:5432/buddycloud-server?user=buddycloud&password=tellnoone"
```

The server will then use the database values to configure itself, the `configuration.properties` file will be ignored.

## Additional content-type plugins
The buddycloud server supports validation of custom content types by means of a plugin system. By default the buddycloud server supports Atom content. Additional content types can be supported by creating an appropriate validator and packaging it as a plugin.

Expand Down
10 changes: 10 additions & 0 deletions contrib/docker/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

OPTS=""

if [ "$DATABASE" != "" ]; then
OPTS=" $OPTS -DDATABASE=\"$DATABASE\""
fi

cd buddycloud-server-java
java $OPTS -jar target/channelserver-jar-with-dependencies.jar
10 changes: 10 additions & 0 deletions postgres/upgrade-8.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
BEGIN TRANSACTION;

CREATE TABLE "configuration" ("key" TEXT NOT NULL,
"value" TEXT NOT NULL,
"updated" TIMESTAMP);

INSERT INTO schema_version (version, "when", description)
VALUES (8, 'now', 'Added configuration table');

COMMIT;
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void initialize(JID jid, ComponentManager manager) throws ComponentExcept

private void sendConnectionNotification(JID jid2) throws ComponentException {
ArrayList<JID> sendTo =
Configuration.getInstance().getNotificationsList(
this.configuration.getNotificationsList(
Configuration.NOTIFICATIONS_CONNECTED);
Message message = new Message();
message.setFrom(jid);
Expand Down
Loading

0 comments on commit 0ccfe65

Please sign in to comment.