Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Redis Support to Application Creation #5461

Merged
merged 27 commits into from
Mar 18, 2024
Merged
Changes from 4 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
82825b6
Add Redis support
muratugureminoglu Aug 14, 2023
33de3e2
Add usage for redis
muratugureminoglu Aug 21, 2023
ca8de8c
Merge branch 'master' into add_redis_support
Mohit-3196 Aug 21, 2023
eedb3fa
Merge branch 'master' into add_redis_support
muratugureminoglu Oct 2, 2023
e21b8e0
Add t flag and update the script
muratugureminoglu Oct 29, 2023
84f7cef
Merge branch 'master' into add_redis_support
mekya Mar 16, 2024
be57bc7
Refactor create_app.sh to support redis and add test code
mekya Mar 16, 2024
272616e
Fix test case
mekya Mar 16, 2024
c1472d7
Set DB_URL empty for MapDB
mekya Mar 16, 2024
d36b3cd
Revert-back single quote db url check
mekya Mar 16, 2024
cb1a37c
Setup chromedriver before class for StreamFetcherV2Test
mekya Mar 16, 2024
e4d42e6
Install latest chrome
mekya Mar 16, 2024
25e7dcd
Move testAutoStartStop to under FrontEndTest class
mekya Mar 16, 2024
9ce2390
Fix test case
mekya Mar 16, 2024
9f0926e
Write mongo log after failure
mekya Mar 16, 2024
f685654
Use redis in some local tests instead of mongodb
mekya Mar 17, 2024
5d43db2
Use redis://127.0.0.1:6379 instead of redis://localhost:6379
mekya Mar 17, 2024
b227dfd
Fix test case
mekya Mar 17, 2024
21230ed
Fix failing test by changing local ip address
mekya Mar 17, 2024
039091a
Add db connection url if db type is not mapdb
mekya Mar 17, 2024
6f5c192
Replace localhost with 127.0.0.1 for MongoStore
mekya Mar 17, 2024
b25638c
Replace mongo localhost with 127.0.0.1
mekya Mar 17, 2024
c26cf24
Fix test case
mekya Mar 18, 2024
ec24239
Fix test cases
mekya Mar 18, 2024
6afc17c
Increase code coverage
mekya Mar 18, 2024
d3f5f22
Fix test case
mekya Mar 18, 2024
b053df8
Fix test case
mekya Mar 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 33 additions & 14 deletions src/main/server/create_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ usage() {
echo "-m: Mongo DB host. If it's a cluster, it's mandatory. Otherwise optional"
echo "-u: Mongo DB user. If it's a cluster, it's mandatory. Otherwise optional"
echo "-s: Mongo DB password. If it's a cluster, it's mandatory. Otherwise optional"
echo "-h: print this usage"
echo "-h: MongoDB or Redist host. It's either IP address or full connection string such as mongodb://[username:password@]host1[:port1]"
echo "-q: print this usage"
echo "-f: war file path for custom app deployment"
echo " "
echo "Example: "
Expand All @@ -32,18 +33,19 @@ AMS_DIR=/usr/local/antmedia
AS_WAR=false
IS_CLUSTER=false

while getopts 'n:p:w:h:c:m:u:s:f:' option
while getopts 'n:p:w:h:c:m:u:s:f:q:' option
do
case "${option}" in
n) APP_NAME=${OPTARG};;
p) AMS_DIR=${OPTARG};;
w) AS_WAR=${OPTARG};;
c) IS_CLUSTER=${OPTARG};;
h) DATABASE_HOST=${OPTARG};;
m) MONGO_HOST=${OPTARG};;
u) MONGO_USER=${OPTARG};;
s) MONGO_PASS=${OPTARG};;
f) WAR_FILE=${OPTARG};;
h) usage
q) usage
exit 1;;
esac
done
Expand Down Expand Up @@ -79,13 +81,13 @@ if [[ -z "$AS_WAR" ]]; then
AS_WAR="false"
fi

if [[ "$IS_CLUSTER" == "true" ]]; then
if [[ -z "$MONGO_HOST" ]]; then
echo "Please set mongodb host, username and password for cluster mode. "
usage
exit 1
fi
fi
#if [[ "$IS_CLUSTER" == "true" ]]; then
# if [[ ! -z "$MONGO_HOST" || ! -z "$DATABASE_HOST" ]]; then
# echo "Please set mongodb host, username and password for cluster mode. "
# usage
# exit 1
# fi
#fi

case $AMS_DIR in
/*) AMS_DIR=$AMS_DIR;;
Expand Down Expand Up @@ -140,10 +142,27 @@ fi

if [[ "$IS_CLUSTER" == "true" ]]; then
echo "Cluster mode"
sed -i $SED_COMPATIBILITY 's/db.type=.*/db.type='mongodb'/' $RED5_PROPERTIES_FILE
sed -i $SED_COMPATIBILITY 's#db.host=.*#db.host='$MONGO_HOST'#' $RED5_PROPERTIES_FILE
sed -i $SED_COMPATIBILITY 's/db.user=.*/db.user='$MONGO_USER'/' $RED5_PROPERTIES_FILE
sed -i $SED_COMPATIBILITY 's/db.password=.*/db.password='$MONGO_PASS'/' $RED5_PROPERTIES_FILE
if [[ $DATABASE_HOST =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ || $DATABASE_HOST =~ ^localhost$ || $DATABASE_HOST =~ ^mongo.*$ ]]; then
DB_TYPE=mongodb
echo "DB type is mongodb"
elif [[ $DATABASE_HOST =~ ^redis.*$ ]]; then
DB_TYPE=redisdb
echo "DB type is redis"
else
DB_TYPE=redisdb
echo "DB type is redis"
fi

if [[ -n "$MONGO_HOST" ]]; then
sed -i $SED_COMPATIBILITY 's/db.type=.*/db.type='mongodb'/' $RED5_PROPERTIES_FILE
sed -i $SED_COMPATIBILITY 's#db.host=.*#db.host='$MONGO_HOST'#' $RED5_PROPERTIES_FILE
sed -i $SED_COMPATIBILITY 's/db.user=.*/db.user='$MONGO_USER'/' $RED5_PROPERTIES_FILE
sed -i $SED_COMPATIBILITY 's/db.password=.*/db.password='$MONGO_PASS'/' $RED5_PROPERTIES_FILE
elif [[ -n "$DATABASE_HOST" ]]; then
sed -i $SED_COMPATIBILITY "s/db.type=.*/db.type=$DB_TYPE/g" $RED5_PROPERTIES_FILE
sed -i $SED_COMPATIBILITY 's#db.host=.*#db.host='$DATABASE_HOST'#' $RED5_PROPERTIES_FILE
fi

ln -s $WAR_FILE $AMS_DIR/webapps/root/$APP_NAME.war
else
echo "Not cluster mode."
Expand Down