Skip to content

Commit 0ccfe65

Browse files
committed
Merge pull request #256 from buddycloud/docker
Build a docker image
2 parents b3766d9 + 4d8d711 commit 0ccfe65

File tree

14 files changed

+416
-194
lines changed

14 files changed

+416
-194
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ logs
1313
*.BASE.*
1414
*.LOCAL.*
1515
*.REMOTE.*
16+
!src/main/resources/log4j.properties

Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
################################################################################
2+
# Build a dockerfile for buddycloud-server-java
3+
# Based on ubuntu
4+
################################################################################
5+
6+
FROM dockerfile/java:openjdk-7-jdk
7+
8+
MAINTAINER Lloyd Watkin <[email protected]>
9+
10+
RUN apt-get update
11+
RUN apt-get upgrade -y
12+
RUN apt-get install -y maven
13+
14+
RUN git clone https://github.com/buddycloud/buddycloud-server-java.git
15+
RUN cd buddycloud-server-java && mvn package
16+
ADD src/main/resources/log4j.properties /data/buddycloud-server-java/
17+
ADD contrib/docker/start.sh /data/
18+
RUN chmod +x start.sh
19+
CMD ./start.sh

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@ Please see [the example configuration file](https://github.com/buddycloud/buddyc
9595
| sync.purge-on-start | false | | Purge remote data on server start |
9696
| users.presence.persist | false | | If **true** then user presence status is stored in the database rather than in memory |
9797

98+
### Database based configuration
99+
100+
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:
101+
102+
```
103+
DATABASE="jdbc:postgresql://localhost:5432/buddycloud-server?user=buddycloud&password=tellnoone"
104+
```
105+
106+
The server will then use the database values to configure itself, the `configuration.properties` file will be ignored.
107+
98108
## Additional content-type plugins
99109
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.
100110

contrib/docker/start.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
OPTS=""
4+
5+
if [ "$DATABASE" != "" ]; then
6+
OPTS=" $OPTS -DDATABASE=\"$DATABASE\""
7+
fi
8+
9+
cd buddycloud-server-java
10+
java $OPTS -jar target/channelserver-jar-with-dependencies.jar

postgres/upgrade-8.sql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
BEGIN TRANSACTION;
2+
3+
CREATE TABLE "configuration" ("key" TEXT NOT NULL,
4+
"value" TEXT NOT NULL,
5+
"updated" TIMESTAMP);
6+
7+
INSERT INTO schema_version (version, "when", description)
8+
VALUES (8, 'now', 'Added configuration table');
9+
10+
COMMIT;

src/main/java/org/buddycloud/channelserver/ChannelsEngine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void initialize(JID jid, ComponentManager manager) throws ComponentExcept
7272

7373
private void sendConnectionNotification(JID jid2) throws ComponentException {
7474
ArrayList<JID> sendTo =
75-
Configuration.getInstance().getNotificationsList(
75+
this.configuration.getNotificationsList(
7676
Configuration.NOTIFICATIONS_CONNECTED);
7777
Message message = new Message();
7878
message.setFrom(jid);

0 commit comments

Comments
 (0)