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 = {
driver = os.getenv("DB_DRIVER");
@ -9,12 +9,11 @@ sql = {
password = os.getenv("DB_PASSWORD");
}
-- make 0.10-distributed mod_mam use sql store
archive_store = "archive2" -- Use the same data store as prosody-modules mod_mam
archive_store = os.getenv("ARCHIVE_STORE")
storage = {
-- 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

View file

@ -2,6 +2,8 @@
set -e
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_MUC=${DOMAIN_MUC:-"conference.$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_SECURITY=${SERVER_CONTACT_INFO_SECURITY:-"xmpp:security@$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:-""}
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:
```yaml
version: '3.7'
version: "3.7"
services:
server:
@ -198,7 +198,7 @@ sudo chown 999:999 ./data
#### Environment variables
| Variable | Description | Type | Default value |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------ | -------------------------- |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------ | -------------------------- |
| **ALLOW_REGISTRATION** | Whether to allow registration of new accounts via Jabber clients | _optional_ | true |
| **DOMAIN** | domain | **required** | null |
| **DOMAIN_HTTP_UPLOAD** | Domain which lets clients upload files over HTTP | _optional_ | upload.**DOMAIN** |
@ -225,7 +225,9 @@ sudo chown 999:999 ./data
| **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**" |
| **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

View file

@ -32,7 +32,27 @@ services:
E2E_POLICY_WHITELIST: "admin@localhost, user1@localhost"
LOG_LEVEL: debug
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:
- ./certs:/usr/local/etc/prosody/certs

View file

@ -64,14 +64,20 @@ registerTestUsers prosody_postgres
runTests prosody_postgres
sudo docker-compose down
# Run tests for second container with SQLite
# Run tests for container with SQLite
sudo docker-compose up -d prosody
registerTestUsers prosody
runTests prosody
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
registerTestUsers prosody_internal_storage
runTests prosody_internal_storage
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_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
}