Skip to content

Commit

Permalink
Allow to use podman instead of docker
Browse files Browse the repository at this point in the history
  • Loading branch information
arcusfelis committed Jan 28, 2022
1 parent a3b5ce9 commit 9adf3d9
Show file tree
Hide file tree
Showing 14 changed files with 252 additions and 176 deletions.
2 changes: 0 additions & 2 deletions .circleci/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ containers:
- &ldap_container
image: osixia/openldap:__LDAP_VERSION__
environment:
- SQL_TEMP_DIR: /tmp/sql
- POSTGRES_PASSWORD: password
- LDAP_DOMAIN: "esl.com"
- LDAP_ADMIN_PASSWORD: "mongooseim_secret"
- LDAP_ORGANISATION: "Erlang Solutions"
Expand Down
10 changes: 9 additions & 1 deletion doc/developers-guide/Testing-MongooseIM.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ The test runner script is used to compile MongooseIM and run tests.

### Docker

Docker must be installed on the local system, and the user executing the tests must have privileges to start new containers (usually achieved by adding the user to the `docker` group).
Docker could be installed on the local system, and the user executing the tests must have privileges to start new containers (usually achieved by adding the user to the `docker` group).

Alternatively, you can use Podman. Here is how to install it on Mac:

```bash
brew install podman
podman machine init
podman machine start
```

### FreeTDS for MSSQL connectivity

Expand Down
14 changes: 1 addition & 13 deletions tools/circle-generate-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,10 @@

OUT_FILE="$1"

echo | base32 -w0 > /dev/null 2>&1
if [ $? -eq 0 ]; then
# GNU coreutils base32, '-w' supported
ENCODER="base32 -w0"
else
# Openssl base32, no wrapping by default
ENCODER="base32"
fi

set -e
source tools/common-vars.sh
source tools/db-versions.sh

function cat32 {
cat "$1" | $ENCODER
}

MYSQL_CNF=$(cat32 tools/db_configs/mysql/mysql.cnf)
MYSQL_SQL=$(cat32 priv/mysql.sql)
MYSQL_SETUP=$(cat32 tools/docker-setup-mysql.sh)
Expand Down
25 changes: 25 additions & 0 deletions tools/common-vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@

TOOLS=`dirname $0`

set +e
echo | base32 -w0 > /dev/null 2>&1
if [ $? -eq 0 ]; then
# GNU coreutils base32, '-w' supported
ENCODER="base32 -w0"
else
# Openssl base32, no wrapping by default
ENCODER="base32"
fi

function cat32 {
cat "$1" | $ENCODER
}
set -e

DOCKER=docker
DOCKER_HEALTH=Health

# There is no smart way to choose between podman and docker
# By default, if both are available, we choose podman
if hash podman; then
DOCKER=podman
DOCKER_HEALTH=Healthcheck
fi

if [ `uname` = "Darwin" ]; then
BASE=$(cd "$TOOLS/.."; pwd -P)
# Don't forget to install gsed command using "brew install gnu-sed"
Expand Down
5 changes: 5 additions & 0 deletions tools/db_configs/cassandra/proxy/replace-ip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

if [ ! -z "$CASSANDRA_IP" ]; then
sed -i "s/\"service-hostname\": \".*\"/\"service-hostname\": \"$CASSANDRA_IP\"/g" "/data/zazkia-routes.json"
fi
6 changes: 0 additions & 6 deletions tools/mssql-shell.sh

This file was deleted.

10 changes: 6 additions & 4 deletions tools/open-test-database-shell.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#!/usr/bin/env bash

cd "$(dirname "$0")/../"
source tools/common-vars.sh
db=$1

case $db in
mysql)
docker exec -e MYSQL_PWD=secret -it mongooseim-mysql mysql -h localhost -u root -D ejabberd
$DOCKER exec -e MYSQL_PWD=secret -it mongooseim-mysql mysql -h localhost -u root -D ejabberd
;;
pgsql)
docker exec -e PGPASSWORD=password -it mongooseim-pgsql psql -U postgres -d ejabberd -h 127.0.0.1
$DOCKER exec -e PGPASSWORD=password -it mongooseim-pgsql psql -U postgres -d ejabberd -h 127.0.0.1
;;
mssql-sqlcmd)
docker exec -it mongooseim-mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P mongooseim_secret+ESL123 -d ejabberd
$DOCKER exec -it mongooseim-mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P mongooseim_secret+ESL123 -d ejabberd
;;
mssql)
docker run --link mongooseim-mssql -it --rm shellmaster/sql-cli mssql --server mongooseim-mssql --user sa --pass mongooseim_secret+ESL123 --database ejabberd
$DOCKER run --link mongooseim-mssql -it --rm shellmaster/sql-cli mssql --server mongooseim-mssql --user sa --pass mongooseim_secret+ESL123 --database ejabberd
;;
*)
echo "Unknown argument $db"
Expand Down
Loading

0 comments on commit 9adf3d9

Please sign in to comment.