diff --git a/README.md b/README.md index 96fbeab..3b0f3ff 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,10 @@ See the "How it's built" section below if you want to understand how this was do 1. Make sure you have docker and docker-compose installed 2. Create a local Openfire docker image, tagged `openfire:latest` that contains the version of Openfire that you want to run - 1. run `docker build -tag openfire:latest .` in the root of the Openfire repository () + 1. run `docker build --tag openfire:latest .` in the root of the Openfire repository () 3. Launch the environment 1. use `./start.sh` if you want two **federated** Openfire instances, or - 2. use `./start.sh -c` if you want two **clustered** Openfire instances. + 2. use `./start.sh -c` if you want three **clustered** Openfire instances. ## Federated configuration @@ -77,31 +77,36 @@ Running `./start.sh -c` will perform some cleanup then start the containers in a When running, the system looks like this: ``` - +---------------------------------------------+ - | 172.60.0.99 | - | +----------------+ | - | | | | -(XMPP-C2S) 55222 -|-------| Load Balancer |+-------+ | -(BOSH) 57070 -| | | | | -(BOSHS) 57443 -| +----------------+ | | - | | | | - | | | | - | 172.60.0.10 172.60.0.20 | - | +--------+ +--------+ | -(XMPP-C2S) 5221 -| | | | | |- 5222 (XMPP-C2S) -(XMPP-S2S) 5261 -|------| XMPP 1 +============+ XMPP 2 |-------|- 5262 (XMPP-S2S) -(HTTP-Admin) 9091 -| | | | | |- 9092 (HTTP-Admin) -(BOSH) 7071 -| +----+---+ +----+---+ |- 7072 (BOSH) - | | | | - | | | | - | +---+--+ | | - | | | | | -(Database) 5432 -|-------| DB +------------------+ | - | | | | - | +------+ | - | 172.60.0.11 | - | | - +----------------172.60.0.0/24----------------+ + +--------------------------------------------------+ + | 172.60.0.99 | + | +----------------+ | + | | |+--------------+ | +(XMPP-C2S) 55222 -|-------| Load Balancer |+-------+ | | +(BOSH) 57070 -| | | | | | +(BOSHS) 57443 -| +----------------+ | | | + | | | 172.60.0.30 | + | | | +--------+ | + | | +=============+ | |- 5223 (XMPP-C2S) + | | | | | XMPP 3 |----|- 5263 (XMPP-S2S) + | | | | | | |- 9093 (HTTP-Admin) + | | | | +------+-+ |- 7073 (BOSH) + | | | | | | + | 172.60.0.10 | 172.60.0.20 | | + | +--------+ | +--------+ | | +(XMPP-C2S) 5221 -| | +======+ | |=====+ |- 5222 (XMPP-C2S) +(XMPP-S2S) 5261 -|------| XMPP 1 +============+ XMPP 2 | |- 5262 (XMPP-S2S) +(HTTP-Admin) 9091 -| | | | |------------|- 9092 (HTTP-Admin) +(BOSH) 7071 -| +----+---+ +----+---+ |- 7072 (BOSH) + | | | | + | | | | + | +---+--+ | | + | | | | | +(Database) 5432 -|-------| DB +------------------+ | + | | | | + | +------+ | + | 172.60.0.11 | + | | + +----------------172.60.0.0/24---------------------+ ``` Note that the load balancer is intentionally configured to be "flappy" to simulate simple round-robin DNS load balancing, but that ports from individual servers are exposed and can be hit directly. @@ -114,6 +119,7 @@ Openfire is configured with the following hostnames: * `xmpp1.localhost.example` * `xmpp2.localhost.example` +* `xmpp3.localhost.example` The following users are configured: diff --git a/docker-compose-clustered.yml b/docker-compose-clustered.yml index 79b533e..8b65dc3 100644 --- a/docker-compose-clustered.yml +++ b/docker-compose-clustered.yml @@ -47,10 +47,12 @@ services: openfire-clustered-net: ipv4_address: 172.60.0.10 extra_hosts: - - "xmpp1.localhost.example:172.50.0.10" - - "conference.xmpp1.localhost.example:172.50.0.10" - - "xmpp2.localhost.example:172.50.0.20" - - "conference.xmpp2.localhost.example:172.50.0.20" + - "xmpp1.localhost.example:172.60.0.10" + - "conference.xmpp1.localhost.example:172.60.0.10" + - "xmpp2.localhost.example:172.60.0.20" + - "conference.xmpp2.localhost.example:172.60.0.20" + - "xmpp3.localhost.example:172.60.0.30" + - "conference.xmpp3.localhost.example:172.60.0.30" xmpp2: image: "openfire:${OPENFIRE_TAG}" @@ -71,10 +73,38 @@ services: openfire-clustered-net: ipv4_address: 172.60.0.20 extra_hosts: - - "xmpp1.localhost.example:172.50.0.10" - - "conference.xmpp1.localhost.example:172.50.0.10" - - "xmpp2.localhost.example:172.50.0.20" - - "conference.xmpp2.localhost.example:172.50.0.20" + - "xmpp1.localhost.example:172.60.0.10" + - "conference.xmpp1.localhost.example:172.60.0.10" + - "xmpp2.localhost.example:172.60.0.20" + - "conference.xmpp2.localhost.example:172.60.0.20" + - "xmpp3.localhost.example:172.60.0.30" + - "conference.xmpp3.localhost.example:172.60.0.30" + + xmpp3: + image: "openfire:${OPENFIRE_TAG}" + ports: + - "5223:5222" + - "5263:5269" + - "7073:7070" + - "7443:7443" + - "9093:9090" + depends_on: + - "db" + volumes: + - ./_data/xmpp/clustered/3/conf:/var/lib/openfire/conf + - ./_data/xmpp/clustered/3/plugins/hazelcast.jar:/var/lib/openfire/plugins/hazelcast.jar + - ./wait-for-it.sh:/wait-for-it.sh + command: ["/wait-for-it.sh", "db:5432", "--", "/sbin/entrypoint.sh"] + networks: + openfire-clustered-net: + ipv4_address: 172.60.0.30 + extra_hosts: + - "xmpp1.localhost.example:172.60.0.10" + - "conference.xmpp1.localhost.example:172.60.0.10" + - "xmpp2.localhost.example:172.60.0.20" + - "conference.xmpp2.localhost.example:172.60.0.20" + - "xmpp3.localhost.example:172.60.0.30" + - "conference.xmpp3.localhost.example:172.60.0.30" networks: openfire-clustered-net: diff --git a/nginx/clustered/nginx.conf b/nginx/clustered/nginx.conf index 0ad1d5b..089b47b 100644 --- a/nginx/clustered/nginx.conf +++ b/nginx/clustered/nginx.conf @@ -4,6 +4,7 @@ stream { upstream xmpp { server 172.60.0.10:5222; server 172.60.0.20:5222; + server 172.60.0.30:5222; } server { listen 55222; @@ -16,6 +17,7 @@ stream { upstream bosh { server 172.60.0.10:7070; server 172.60.0.20:7070; + server 172.60.0.30:7070; } server { listen 57070; @@ -28,6 +30,7 @@ stream { upstream boshs { server 172.60.0.10:7443; server 172.60.0.20:7443; + server 172.60.0.30:7443; } server { listen 57443; @@ -38,4 +41,4 @@ stream { } } -events {} \ No newline at end of file +events {} diff --git a/xmpp/clustered/3/conf/available-plugins.xml b/xmpp/clustered/3/conf/available-plugins.xml new file mode 100644 index 0000000..2c9650a --- /dev/null +++ b/xmpp/clustered/3/conf/available-plugins.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/xmpp/clustered/3/conf/crowd.properties b/xmpp/clustered/3/conf/crowd.properties new file mode 100644 index 0000000..d43a8ba --- /dev/null +++ b/xmpp/clustered/3/conf/crowd.properties @@ -0,0 +1,42 @@ +# +# This file defines the configuration properties required +# when using the Atlassian Crowd integration for Openfire. +# +# https://confluence.atlassian.com/display/CROWD/The+crowd.properties+file +# +# To activate the Crowd integration for Openfire, you must define +# the following Openfire system properties: +# +# provider.admin.className org.jivesoftware.openfire.crowd.CrowdAdminProvider +# provider.auth.className org.jivesoftware.openfire.crowd.CrowdAuthProvider +# provider.group.className org.jivesoftware.openfire.crowd.CrowdGroupProvider +# provider.user.className org.jivesoftware.openfire.crowd.CrowdUserProvider +# provider.vcard.className org.jivesoftware.openfire.crowd.CrowdVCardProvider +# +# In addition, you may customize the Crowd provider using the following Openfire +# system properties: +# +# admin.authorizedGroups +# crowd.groups.cache.ttl.seconds 3600 +# crowd.users.cache.ttl.seconds 3600 +# + +# The REST URL for your Crowd server. +crowd.server.url=https://YOUR-CROWD-SERVER:8095/crowd/ + +# These properties are required to authenticate with the Crowd server. +# They must match the values specified in the Crowd configuration. +application.name=openfire +application.password= + +# Other optional configuration properties. + +#http.proxy.host= +#http.proxy.port= +#http.proxy.username= +#http.proxy.password= + +# These properties can be used to tune the Crowd integration. +#http.max.connections=20 +#http.timeout=5000 +#http.socket.timeout=20000 diff --git a/xmpp/clustered/3/conf/hazelcast-local-config.xml b/xmpp/clustered/3/conf/hazelcast-local-config.xml new file mode 100644 index 0000000..8747d87 --- /dev/null +++ b/xmpp/clustered/3/conf/hazelcast-local-config.xml @@ -0,0 +1,60 @@ + + + + openfire + openfire + + + 5701 + + 0 + + + + + 224.2.2.3 + 54327 + + + + + + + 10.10.1.* + + + + + + PBEWithMD5AndDES + + thesalt + + thepass + + 19 + + + diff --git a/xmpp/clustered/3/conf/openfire-demoboot.xml b/xmpp/clustered/3/conf/openfire-demoboot.xml new file mode 100644 index 0000000..313425f --- /dev/null +++ b/xmpp/clustered/3/conf/openfire-demoboot.xml @@ -0,0 +1,54 @@ + + + + 9090 + 9091 + + + org.jivesoftware.database.EmbeddedConnectionProvider + + + true + en + + + true + + example.org + example.org + + + embedded + + + admin@example.com + admin + + + + john + secret + John Doe + john.doe@example.com + + + jane@example.org + Jane + + + + + jane + secret + Jane Doe + jane.doe@example.com + + + john@example.org + John + + + + + + diff --git a/xmpp/clustered/3/conf/openfire.xml b/xmpp/clustered/3/conf/openfire.xml new file mode 100644 index 0000000..8e9fbfd --- /dev/null +++ b/xmpp/clustered/3/conf/openfire.xml @@ -0,0 +1,67 @@ + + + + + + + + 9090 + 9091 + + en + + + + + + org.jivesoftware.database.DefaultConnectionProvider + + + + org.postgresql.Driver + jdbc:postgresql://db:5432/openfire + 10d847caed2654fbb1fe6cefac0f381893323ae6b5eea27d31503d5880091fca + 30c1893796e0110fc4607c8b1bca0d0e54f10b270c4615d3 + select 1 + false + false + 500 + 30000 + 900000 + 500 + 5 + 25 + 1.0 + + + true + xmpp3.localhost.example + + true + + diff --git a/xmpp/clustered/3/conf/security.xml b/xmpp/clustered/3/conf/security.xml new file mode 100644 index 0000000..4185021 --- /dev/null +++ b/xmpp/clustered/3/conf/security.xml @@ -0,0 +1,66 @@ + + + + + + + Blowfish + + + + + + + database.defaultProvider.username + database.defaultProvider.password + + + + diff --git a/xmpp/clustered/3/conf/security/archive/readme.txt b/xmpp/clustered/3/conf/security/archive/readme.txt new file mode 100644 index 0000000..62573a5 --- /dev/null +++ b/xmpp/clustered/3/conf/security/archive/readme.txt @@ -0,0 +1 @@ +This directory is used as a default location in which Openfire stores backups of keystore files. diff --git a/xmpp/clustered/3/conf/security/client.truststore b/xmpp/clustered/3/conf/security/client.truststore new file mode 100644 index 0000000..c408465 Binary files /dev/null and b/xmpp/clustered/3/conf/security/client.truststore differ diff --git a/xmpp/clustered/3/conf/security/keystore b/xmpp/clustered/3/conf/security/keystore new file mode 100644 index 0000000..8ac6ed6 Binary files /dev/null and b/xmpp/clustered/3/conf/security/keystore differ diff --git a/xmpp/clustered/3/conf/security/truststore b/xmpp/clustered/3/conf/security/truststore new file mode 100644 index 0000000..cc04a65 Binary files /dev/null and b/xmpp/clustered/3/conf/security/truststore differ diff --git a/xmpp/clustered/3/conf/server-update.xml b/xmpp/clustered/3/conf/server-update.xml new file mode 100644 index 0000000..11d4ace --- /dev/null +++ b/xmpp/clustered/3/conf/server-update.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/xmpp/clustered/3/plugins/hazelcast.jar b/xmpp/clustered/3/plugins/hazelcast.jar new file mode 100644 index 0000000..dec3c11 Binary files /dev/null and b/xmpp/clustered/3/plugins/hazelcast.jar differ