WIP Install postgres and mysql dependencies. Add postgres to test, TODO Test all combinations postgres, sqlite and mysql/mariadb

This commit is contained in:
Sara Aimée Smiseth 2021-05-01 18:25:44 +02:00
parent d3f5a603e5
commit 3302ef9f0d
6 changed files with 30 additions and 26 deletions

View file

@ -3,7 +3,7 @@
## Unreleased
* Updated luarocks to version 3.7.0.
* Create environment variables for database settings. It is now possible to use MariaDB or Postgres instead of SQLite.
* Create environment variables for database settings. It is now possible to use MariaDB or Postgres instead of SQLite. SQLite is the default.
## v1.1.4

View file

@ -27,13 +27,15 @@ RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
libevent-dev `# this is no build dependency, but needed for luaevent` \
libidn11 \
libpq-dev \
libsqlite3-0 \
lua5.2 \
lua-bitop \
lua-dbi-mysql \
lua-expat \
lua-filesystem \
lua-socket \
lua-sec \
sqlite3 \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
@ -65,6 +67,8 @@ RUN buildDeps='gcc git libc6-dev libidn11-dev liblua5.2-dev libsqlite3-dev libss
\
&& luarocks install luaevent \
&& luarocks install luadbi \
`#&& luarocks install luadbi-mysql MYSQL_INCDIR=/usr/include/mariadb/` \
&& luarocks install luadbi-postgresql POSTGRES_INCDIR=/usr/include/postgresql/ \
&& luarocks install luadbi-sqlite3 \
&& luarocks install stringy \
\

View file

@ -1,21 +1,13 @@
default_storage = "sql"
-- TODO change if
--if DB_DRIVER then
sql = {
driver = os.getenv("DB_DRIVER"); -- May also be "PostgreSQL" or "MySQL" or "SQLite3" (case sensitive!)
database = os.getenv("DB_DATABASE"); -- The database name to use. For SQLite3 this the database filename (relative to the data storage directory).
host = os.getenv("DB_HOST"); -- The address of the database server (delete this line for Postgres)
port = os.getenv("DB_PORT"); -- 3306 - For databases connecting over TCP
username = os.getenv("DB_USERNAME"); -- The username to authenticate to the database
password = os.getenv("DB_PASSWORD"); -- The password to authenticate to the database
driver = os.getenv("DB_DRIVER");
database = os.getenv("DB_DATABASE");
host = os.getenv("DB_HOST");
port = os.getenv("DB_PORT");
username = os.getenv("DB_USERNAME");
password = os.getenv("DB_PASSWORD");
}
--else
--sql = {
--driver = "SQLite3";
--database = "prosody.sqlite";
--}
--end
-- make 0.10-distributed mod_mam use sql store
archive_store = "archive2" -- Use the same data store as prosody-modules mod_mam

View file

@ -194,12 +194,12 @@ Inspect logs: ```docker-compose logs -f```.
| **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_PUBSUB** | Domain for a XEP-0060 pubsub service | *optional* | pubsub.**DOMAIN** |
|**DB_DRIVER** | May also be "PostgreSQL" or "MySQL" or "SQLite3" (case sensitive!)|
|**DB_DATABASE** | The database name to use. For SQLite3 this the database filename (relative to the data storage directory).|
|**DB_HOST** | The address of the database server (delete this line for Postgres)|
|**DB_PORT** | 3306 - For databases connecting over TCP|
|**DB_USERNAME** | The username to authenticate to the database|
|**DB_PASSWORD** | The password to authenticate to the database|
| **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_HOST** | The address of the database server | *optional* | |
| **DB_PORT** | Port on which the database is listening | *optional* | |
| **DB_USERNAME** | The username 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_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* | "" |

View file

@ -15,8 +15,13 @@ services:
E2E_POLICY_WHITELIST: "admin@localhost, user1@localhost"
LOG_LEVEL: debug
PROSODY_ADMINS: "admin@localhost, admin2@localhost"
#DB_DRIVER: "SQLite3"
#DB_DATABASE: "prosody.sqlite"
#DB_DRIVER: "MySQL"
#DB_DRIVER: "PostgreSQL"
#DB_DATABASE: "prosody"
#DB_HOST: "postgres"
#DB_PORT: "5432"
#DB_USERNAME: "prosody"
#DB_PASSWORD: "prosody"
extra_hosts:
- "conference.localhost:127.0.0.1"
- "pubsub.localhost:127.0.0.1"

View file

@ -21,7 +21,10 @@ generateCert "proxy.localhost"
generateCert "pubsub.localhost"
generateCert "upload.localhost"
# Start postgres first and wait for 10 seconds before starting prosody.
sudo docker-compose down \
&& sudo docker-compose up -d postgres \
&& sleep 10 \
&& sudo docker-compose up -d \
\
&& sudo docker exec tests_prosody_1 /bin/bash -c "/entrypoint.sh register admin localhost 12345678" \