Renamed STORAGE to DEFAULT_STORAGE. Added ARCHIVE_STORE and STORAGE_ARCHIVE2.

This commit is contained in:
Sara Aimée Smiseth 2022-08-24 17:10:54 +02:00
parent eb572d8180
commit bce67be67d
7 changed files with 93 additions and 38 deletions

View file

@ -1,4 +1,4 @@
default_storage = os.getenv("STORAGE") default_storage = os.getenv("DEFAULT_STORAGE")
sql = { sql = {
driver = os.getenv("DB_DRIVER"); driver = os.getenv("DB_DRIVER");
@ -9,12 +9,11 @@ sql = {
password = os.getenv("DB_PASSWORD"); password = os.getenv("DB_PASSWORD");
} }
-- make 0.10-distributed mod_mam use sql store archive_store = os.getenv("ARCHIVE_STORE")
archive_store = "archive2" -- Use the same data store as prosody-modules mod_mam
storage = { storage = {
-- this makes mod_mam use the sql storage backend -- this makes mod_mam use the sql storage backend
archive2 = os.getenv("STORAGE"); archive2 = os.getenv("STORAGE_ARCHIVE2");
} }
-- https://modules.prosody.im/mod_mam.html -- https://modules.prosody.im/mod_mam.html

View file

@ -2,6 +2,8 @@
set -e set -e
export ALLOW_REGISTRATION=${ALLOW_REGISTRATION:-true} export ALLOW_REGISTRATION=${ALLOW_REGISTRATION:-true}
export ARCHIVE_STORE=${ARCHIVE_STORE:-"archive2"}
export DEFAULT_STORAGE=${DEFAULT_STORAGE:-"sql"}
export DOMAIN_HTTP_UPLOAD=${DOMAIN_HTTP_UPLOAD:-"upload.$DOMAIN"} export DOMAIN_HTTP_UPLOAD=${DOMAIN_HTTP_UPLOAD:-"upload.$DOMAIN"}
export DOMAIN_MUC=${DOMAIN_MUC:-"conference.$DOMAIN"} export DOMAIN_MUC=${DOMAIN_MUC:-"conference.$DOMAIN"}
export DOMAIN_PROXY=${DOMAIN_PROXY:-"proxy.$DOMAIN"} export DOMAIN_PROXY=${DOMAIN_PROXY:-"proxy.$DOMAIN"}
@ -21,7 +23,7 @@ export SERVER_CONTACT_INFO_FEEDBACK=${SERVER_CONTACT_INFO_FEEDBACK:-"xmpp:feedba
export SERVER_CONTACT_INFO_SALES=${SERVER_CONTACT_INFO_SALES:-"xmpp:sales@$DOMAIN"} export SERVER_CONTACT_INFO_SALES=${SERVER_CONTACT_INFO_SALES:-"xmpp:sales@$DOMAIN"}
export SERVER_CONTACT_INFO_SECURITY=${SERVER_CONTACT_INFO_SECURITY:-"xmpp:security@$DOMAIN"} export SERVER_CONTACT_INFO_SECURITY=${SERVER_CONTACT_INFO_SECURITY:-"xmpp:security@$DOMAIN"}
export SERVER_CONTACT_INFO_SUPPORT=${SERVER_CONTACT_INFO_SUPPORT:-"xmpp:support@$DOMAIN"} export SERVER_CONTACT_INFO_SUPPORT=${SERVER_CONTACT_INFO_SUPPORT:-"xmpp:support@$DOMAIN"}
export STORAGE=${STORAGE:-"sql"} export STORAGE_ARCHIVE2=${STORAGE_ARCHIVE2:-"sql"}
export PROSODY_ADMINS=${PROSODY_ADMINS:-""} export PROSODY_ADMINS=${PROSODY_ADMINS:-""}
if [[ "$1" != "prosody" ]]; then if [[ "$1" != "prosody" ]]; then

View file

@ -150,7 +150,7 @@ Check [Volumes permissions](#volumes-permissions) as well.
I recommend using a `docker-compose.yml` file: I recommend using a `docker-compose.yml` file:
```yaml ```yaml
version: '3.7' version: "3.7"
services: services:
server: server:
@ -197,35 +197,37 @@ sudo chown 999:999 ./data
#### Environment variables #### Environment variables
| Variable | Description | Type | Default value | | Variable | Description | Type | Default value |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------ | -------------------------- | | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------ | -------------------------- |
| **ALLOW_REGISTRATION** | Whether to allow registration of new accounts via Jabber clients | _optional_ | true | | **ALLOW_REGISTRATION** | Whether to allow registration of new accounts via Jabber clients | _optional_ | true |
| **DOMAIN** | domain | **required** | null | | **DOMAIN** | domain | **required** | null |
| **DOMAIN_HTTP_UPLOAD** | Domain which lets clients upload files over HTTP | _optional_ | upload.**DOMAIN** | | **DOMAIN_HTTP_UPLOAD** | Domain which lets clients upload files over HTTP | _optional_ | upload.**DOMAIN** |
| **DOMAIN_MUC** | Domain for Multi-user chat (MUC) for allowing you to create hosted chatrooms/conferences for XMPP users | _optional_ | conference.**DOMAIN** | | **DOMAIN_MUC** | Domain for Multi-user chat (MUC) for allowing you to create hosted chatrooms/conferences for XMPP users | _optional_ | conference.**DOMAIN** |
| **DOMAIN_PROXY** | Domain for SOCKS5 bytestream proxy for server-proxied file transfers | _optional_ | proxy.**DOMAIN** | | **DOMAIN_PROXY** | Domain for SOCKS5 bytestream proxy for server-proxied file transfers | _optional_ | proxy.**DOMAIN** |
| **DOMAIN_PUBSUB** | Domain for a XEP-0060 pubsub service | _optional_ | pubsub.**DOMAIN** | | **DOMAIN_PUBSUB** | Domain for a XEP-0060 pubsub service | _optional_ | pubsub.**DOMAIN** |
| **DB_DRIVER** | May also be "PostgreSQL" or "MySQL" or "SQLite3" (case sensitive!) | _optional_ | SQLite3 | | **DB_DRIVER** | May also be "PostgreSQL" or "MySQL" or "SQLite3" (case sensitive!) | _optional_ | SQLite3 |
| **DB_DATABASE** | The database name to use. For SQLite3 this the database filename (relative to the data storage directory). | _optional_ | prosody.sqlite | | **DB_DATABASE** | The database name to use. For SQLite3 this the database filename (relative to the data storage directory). | _optional_ | prosody.sqlite |
| **DB_HOST** | The address of the database server | _optional_ | | | **DB_HOST** | The address of the database server | _optional_ | |
| **DB_PORT** | Port on which the database is listening | _optional_ | | | **DB_PORT** | Port on which the database is listening | _optional_ | |
| **DB_USERNAME** | The username to authenticate to the database | _optional_ | | | **DB_USERNAME** | The username to authenticate to the database | _optional_ | |
| **DB_PASSWORD** | The password to authenticate to the database | _optional_ | | | **DB_PASSWORD** | The password to authenticate to the database | _optional_ | |
| **E2E_POLICY_CHAT** | Policy for chat messages. Possible values: "none", "optional" and "required". | _optional_ | "required" | | **E2E_POLICY_CHAT** | Policy for chat messages. Possible values: "none", "optional" and "required". | _optional_ | "required" |
| **E2E_POLICY_MUC** | Policy for MUC messages. Possible values: "none", "optional" and "required". | _optional_ | "required" | | **E2E_POLICY_MUC** | Policy for MUC messages. Possible values: "none", "optional" and "required". | _optional_ | "required" |
| **E2E_POLICY_WHITELIST** | Make this module ignore messages sent to and from this JIDs or MUCs. | _optional_ | "" | | **E2E_POLICY_WHITELIST** | Make this module ignore messages sent to and from this JIDs or MUCs. | _optional_ | "" |
| **LOG_LEVEL** | Min log level. Change to debug for more information | _optional_ | info | | **LOG_LEVEL** | Min log level. Change to debug for more information | _optional_ | info |
| **C2S_REQUIRE_ENCRYPTION** | Whether to force all client-to-server connections to be encrypted or not | _optional_ | true | | **C2S_REQUIRE_ENCRYPTION** | Whether to force all client-to-server connections to be encrypted or not | _optional_ | true |
| **S2S_REQUIRE_ENCRYPTION** | Whether to force all server-to-server connections to be encrypted or not | _optional_ | true | | **S2S_REQUIRE_ENCRYPTION** | Whether to force all server-to-server connections to be encrypted or not | _optional_ | true |
| **S2S_SECURE_AUTH** | Require encryption and certificate authentication | _optional_ | true | | **S2S_SECURE_AUTH** | Require encryption and certificate authentication | _optional_ | true |
| **SERVER_CONTACT_INFO_ABUSE** | A list of strings. Each string should be an URI. See [here](https://prosody.im/doc/modules/mod_server_contact_info). | _optional_ | "xmpp:abuse@**DOMAIN**" | | **SERVER_CONTACT_INFO_ABUSE** | A list of strings. Each string should be an URI. See [here](https://prosody.im/doc/modules/mod_server_contact_info). | _optional_ | "xmpp:abuse@**DOMAIN**" |
| **SERVER_CONTACT_INFO_ADMIN** | A list of strings. Each string should be an URI. See [here](https://prosody.im/doc/modules/mod_server_contact_info). | _optional_ | "xmpp:admin@**DOMAIN**" | | **SERVER_CONTACT_INFO_ADMIN** | A list of strings. Each string should be an URI. See [here](https://prosody.im/doc/modules/mod_server_contact_info). | _optional_ | "xmpp:admin@**DOMAIN**" |
| **SERVER_CONTACT_INFO_FEEDBACK** | A list of strings. Each string should be an URI. See [here](https://prosody.im/doc/modules/mod_server_contact_info). | _optional_ | "xmpp:feedback@**DOMAIN**" | | **SERVER_CONTACT_INFO_FEEDBACK** | A list of strings. Each string should be an URI. See [here](https://prosody.im/doc/modules/mod_server_contact_info). | _optional_ | "xmpp:feedback@**DOMAIN**" |
| **SERVER_CONTACT_INFO_SALES** | A list of strings. Each string should be an URI. See [here](https://prosody.im/doc/modules/mod_server_contact_info). | _optional_ | "xmpp:sales@**DOMAIN**" | | **SERVER_CONTACT_INFO_SALES** | A list of strings. Each string should be an URI. See [here](https://prosody.im/doc/modules/mod_server_contact_info). | _optional_ | "xmpp:sales@**DOMAIN**" |
| **SERVER_CONTACT_INFO_SECURITY** | A list of strings. Each string should be an URI. See [here](https://prosody.im/doc/modules/mod_server_contact_info). | _optional_ | "xmpp:security@**DOMAIN**" | | **SERVER_CONTACT_INFO_SECURITY** | A list of strings. Each string should be an URI. See [here](https://prosody.im/doc/modules/mod_server_contact_info). | _optional_ | "xmpp:security@**DOMAIN**" |
| **SERVER_CONTACT_INFO_SUPPORT** | A list of strings. Each string should be an URI. See [here](https://prosody.im/doc/modules/mod_server_contact_info). | _optional_ | "xmpp:support@**DOMAIN**" | | **SERVER_CONTACT_INFO_SUPPORT** | A list of strings. Each string should be an URI. See [here](https://prosody.im/doc/modules/mod_server_contact_info). | _optional_ | "xmpp:support@**DOMAIN**" |
| **PROSODY_ADMINS** | Specify who is an administrator. List of adresses. Eg. "me@example.com", "admin@example.net" | _optional_ | "" | | **PROSODY_ADMINS** | Specify who is an administrator. List of adresses. Eg. "me@example.com", "admin@example.net" | _optional_ | "" |
| **STORAGE** | Select the storage backend to load with the 'storage' configuration option. See [here](https://prosody.im/doc/storage). | _optional_ | "sql" | | **DEFAULT_STORAGE** | Select the storage backend to load with the 'storage' configuration option. See [here](https://prosody.im/doc/storage). | _optional_ | "sql" |
| **ARCHIVE_STORE** | Select the archive store. 'archive' or 'archive2'. See [here](https://prosody.im/doc/storage). | _optional_ | "archive2" |
| **STORAGE_ARCHIVE2** | Select the storage backend to load with the 'storage.archive2' configuration option. See [here](https://prosody.im/doc/storage). | _optional_ | "sql" |
#### DNS #### DNS

View file

@ -32,7 +32,27 @@ services:
E2E_POLICY_WHITELIST: "admin@localhost, user1@localhost" E2E_POLICY_WHITELIST: "admin@localhost, user1@localhost"
LOG_LEVEL: debug LOG_LEVEL: debug
PROSODY_ADMINS: "admin@localhost, admin2@localhost" PROSODY_ADMINS: "admin@localhost, admin2@localhost"
STORAGE: "internal" DEFAULT_STORAGE: "internal"
STORAGE_ARCHIVE2: "internal"
volumes:
- ./certs:/usr/local/etc/prosody/certs
prosody_internal_storage_archive:
image: prosody
restart: unless-stopped
ports:
- "5000:5000"
- "5222:5222"
- "5223:5223"
- "5269:5269"
- "5281:5281"
environment:
DOMAIN: localhost
E2E_POLICY_WHITELIST: "admin@localhost, user1@localhost"
LOG_LEVEL: debug
PROSODY_ADMINS: "admin@localhost, admin2@localhost"
DEFAULT_STORAGE: "internal"
ARCHIVE_STORE: "archive"
volumes: volumes:
- ./certs:/usr/local/etc/prosody/certs - ./certs:/usr/local/etc/prosody/certs

View file

@ -64,14 +64,20 @@ registerTestUsers prosody_postgres
runTests prosody_postgres runTests prosody_postgres
sudo docker-compose down sudo docker-compose down
# Run tests for second container with SQLite # Run tests for container with SQLite
sudo docker-compose up -d prosody sudo docker-compose up -d prosody
registerTestUsers prosody registerTestUsers prosody
runTests prosody runTests prosody
sudo docker-compose down sudo docker-compose down
# Run tests for third container with internal storage # Run tests for container with internal storage and archive store archive2
sudo docker-compose up -d prosody_internal_storage sudo docker-compose up -d prosody_internal_storage
registerTestUsers prosody_internal_storage registerTestUsers prosody_internal_storage
runTests prosody_internal_storage runTests prosody_internal_storage
sudo docker-compose down sudo docker-compose down
# Run tests for container with internal storage and archive store archive
sudo docker-compose up -d prosody_internal_storage_archive
registerTestUsers prosody_internal_storage_archive
runTests prosody_internal_storage_archive
sudo docker-compose down

View file

@ -0,0 +1,21 @@
# For tests with pipes see: https://github.com/sstephenson/bats/issues/10
load 'bats/bats-support/load'
load 'bats/bats-assert/load'
# TODO
#@test "Should use internal storage" {
# run bash -c "sudo docker-compose logs $batsContainerName | grep -E \"Connecting to \[SQLite3\] \/usr\/local\/var\/lib\/prosody\/prosody\.sqlite\.\.\.\""
# assert_failure
# assert_output
#}
@test "Should not use sqlite" {
run bash -c "sudo docker-compose logs $batsContainerName | grep -E \"Connecting to \[SQLite3\] \/usr\/local\/var\/lib\/prosody\/prosody\.sqlite\.\.\.\""
assert_failure
}
@test "Should not use postgres" {
run bash -c "sudo docker-compose logs $batsContainerName | grep -E \"Connecting to \[PostgreSQL\] prosody\.\.\.\""
assert_failure
}

View file

@ -86,3 +86,8 @@ load 'bats/bats-assert/load'
assert_success assert_success
assert_output assert_output
} }
@test "Should not have any sql errors" {
run bash -c "sudo docker-compose logs $batsContainerName | grep --ignore-case Error in SQL transaction"
assert_failure
}