smtp and roundcube was added
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-19 15:43:26 +00:00
parent cd75431a03
commit f1bb3492ca
2 changed files with 121 additions and 9 deletions

View File

@@ -15,6 +15,7 @@ if [ "$ORGANIZATION" == "" ]; then
fi
if [[ "$NEXTCLOUD" == "yes" ]]; then
echo "Nextcloud install has started from ssh://$GIT_REPO/$ORGANIZATION/nextcloud.git";
DB_MYSQL="$(echo $RANDOM | md5sum | head -c 8)";
DB_USER="$(echo $RANDOM | md5sum | head -c 8)";
@@ -93,6 +94,7 @@ if [[ "$BITWARDEN" == "yes" ]]; then
fi;
if [[ "$GUACAMOLE" == "yes" ]]; then
echo "Guacamole install has started from ssh://$GIT_REPO/$ORGANIZATION/guacamole.git";
DB_MYSQL="$(echo $RANDOM | md5sum | head -c 8)";
DB_USER="$(echo $RANDOM | md5sum | head -c 8)";
@@ -118,15 +120,44 @@ if [[ "$GUACAMOLE" == "yes" ]]; then
cp -rv /tmp/guacamole/firewall-guacamole.json $SERVICE_DIR/firewall-guacamole.json;
fi;
if [[ "$SMTP" == "yes" ]]; then
echo "SMTP service install has started from ssh://$GIT_REPO/$ORGANIZATION/smtp.git";
git clone ssh://$GIT_REPO/$ORGANIZATION/smtp.git /tmp/smtp
cp -rv /tmp/smtp/smtp-secret.json /etc/user/secret/smtp.json;
cp -rv /tmp/smtp/smtp.json $SERVICE_DIR/smtp.json;
cp -rv /tmp/smtp/firewall-smtp.json $SERVICE_DIR/firewall-smtp.json;
fi;
if [[ "$ROUNDCUBE" == "yes" ]]; then
DB_MYSQL="$(echo $RANDOM | md5sum | head -c 8)";
DB_USER="$(echo $RANDOM | md5sum | head -c 8)";
DB_PASSWORD="$(echo $RANDOM | md5sum | head -c 10)";
DB_ROOT_PASSWORD="$(echo $RANDOM | md5sum | head -c 10)";
git clone ssh://$GIT_REPO/$ORGANIZATION/roundcube.git /tmp/roundcube;
sed -i "s/DEFAULT_HOST/$ROUNDCUBE_IMAP_HOST/g" /tmp/roundcube/roundcube-secret.json
sed -i "s/DEFAULT_PORT/$ROUNDCUBE_IMAP_PORT/g" /tmp/roundcube/roundcube-secret.json
sed -i "s/SMTP_SERVER/$ROUNDCUBE_SMTP_HOST/g" /tmp/roundcube/roundcube-secret.json
sed -i "s/SMTP_PORT/$ROUNDCUBE_SMTP_PORT/g" /tmp/roundcube/roundcube-secret.json
#sed -i "s/SMTP_SECURITY/$SMTP_SECURITY/g" /tmp/roundcube/roundcube-secret.json
#sed -i "s/SMTP_AUTHMECHANISM/$SMTP_AUTH_MECHANISM/g" /tmp/roundcube/roundcube-secret.json
sed -i "s/UPLOAD_MAX_FILESIZE/$ROUNDCUBE_UPLOAD_MAX_FILESIZE/g" /tmp/roundcube/roundcube-secret.json
sed -i "s/DB_MYSQL/$DB_MYSQL/g" /tmp/roundcube/roundcube-secret.json;
sed -i "s/DB_USER/$DB_USER/g" /tmp/roundcube/roundcube-secret.json;
sed -i "s/DB_PASSWORD/$DB_PASSWORD/g" /tmp/roundcube/roundcube-secret.json;
sed -i "s/DB_ROOT_PASSWORD/$DB_ROOT_PASSWORD/g" /tmp/roundcube/roundcube-secret.json;
sed -i "s#DOMAIN#$ROUNDCUBE_DOMAIN#g" /tmp/roundcube/roundcube-secret.json
cp -rv /tmp/roundcube/roundcube-secret.json /etc/user/secret/roundcube.json;
cp -rv /tmp/roundcube/roundcube.json $SERVICE_DIR/roundcube.json;
fi;
#if [[ "$NEXTCLOUD" == "yes" ] || [ "$BITWARDEN" == "yes" ]]; then
# echo "SMTP service install has started from ssh://$GIT_REPO/$ORGANIZATION/smtp.git";
#
# git clone ssh://$GIT_REPO/$ORGANIZATION/smtp.git /tmp/smtp
#
# cp -rv /tmp/smtp/smtp-secret.json /etc/user/secret/smtp.json;
# cp -rv /tmp/smtp/smtp.json $SERVICE_DIR/smtp.json;
# cp -rv /tmp/smtp/firewall-smtp.json $SERVICE_DIR/firewall-smtp.json;
#fi;

View File

@@ -492,6 +492,60 @@ ask_additionals() {
fi;
fi
echo "Do you want to install SMTP server? (Y/n)";
read -r ANSWER;
if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ] || [ "$ANSWER" == "" ]; then
SMTP="yes";
fi;
echo "Do you want to install roundcube? (Y/n)";
read -r ANSWER;
if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ] || [ "$ANSWER" == "" ]; then
ROUNDCUBE="yes";
echo "Please add IMAP HOST: ";
while read -r ROUNDCUBE_IMAP_HOST; do
if [ "$ROUNDCUBE_IMAP_HOST" != "" ]; then
break;
fi;
done
echo "Please add IMAP PORT (default: 143): ";
read -r ROUNDCUBE_IMAP_PORT;
if [ "$ROUNDCUBE_IMAP_PORT" == "" ]; then
ROUNDCUBE_IMAP_PORT="143";
fi;
echo "Please add SMTP HOST: ";
while read -r ROUNDCUBE_SMTP_HOST; do
if [ "$ROUNDCUBE_SMTP_HOST" != "" ]; then
break;
fi;
done
echo "Please add SMTP PORT (587, 465, 25, etc., default: 25): ";
read -r ROUNDCUBE_SMTP_PORT;
if [ "$ROUNDCUBE_SMTP_PORT" == "" ]; then
ROUNDCUBE_SMTP_PORT="25";
fi;
echo "Please add UPLOAD_MAX_FILESIZE (default: 50M): ";
read -r ROUNDCUBE_UPLOAD_MAX_FILESIZE;
if [ "$ROUNDCUBE_UPLOAD_MAX_FILESIZE" == "" ]; then
ROUNDCUBE_UPLOAD_MAX_FILESIZE="50M";
fi;
echo "Please add Roundcube DOMAIN: ";
while read -r ROUNDCUBE_DOMAIN; do
if [ "$ROUNDCUBE_DOMAIN" != "" ]; then
break;
fi;
done
fi;
}
uninstall() {
@@ -806,6 +860,31 @@ if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ] || [ "$ANSWER" == "" ]; then
fi
fi
if [ "$SMTP" == "yes" ]; then
VAR_SMTP="--env SMTP=$SMTP";
echo "Would you like to run SMTP after install? (Y/n)";
read -r ANSWER;
if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ] || [ "$ANSWER" == "" ] ; then
ADDITIONAL_SERVICES="$ADDITIONAL_SERVICES smtp";
fi
fi
if [ "$ROUNDCUBE" == "yes" ]; then
VAR_ROUNDCUBE="--env ROUNDCUBE=$ROUNDCUBE";
VAR_ROUNDCUBE="$VAR_ROUNDCUBE --env ROUNDCUBE_IMAP_HOST=$ROUNDCUBE_IMAP_HOST";
VAR_ROUNDCUBE="$VAR_ROUNDCUBE --env ROUNDCUBE_IMAP_PORT=$ROUNDCUBE_IMAP_PORT";
VAR_ROUNDCUBE="$VAR_ROUNDCUBE --env ROUNDCUBE_SMTP_HOST=$ROUNDCUBE_SMTP_HOST";
VAR_ROUNDCUBE="$VAR_ROUNDCUBE --env ROUNDCUBE_SMTP_PORT=$ROUNDCUBE_SMTP_PORT";
VAR_ROUNDCUBE="$VAR_ROUNDCUBE --env ROUNDCUBE_UPLOAD_MAX_FILESIZE=$ROUNDCUBE_UPLOAD_MAX_FILESIZE";
VAR_ROUNDCUBE="$VAR_ROUNDCUBE --env ROUNDCUBE_DOMAIN=$ROUNDCUBE_DOMAIN";
echo "Would you like to run roundcube after install? (Y/n)";
read -r ANSWER;
if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ] || [ "$ANSWER" == "" ] ; then
ADDITIONAL_SERVICES="$ADDITIONAL_SERVICES roundcube";
fi
fi
# Run installer tool
$SUDO_CMD docker run \
@@ -814,6 +893,8 @@ if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ] || [ "$ANSWER" == "" ]; then
$VAR_NEXTCLOUD \
$VAR_BITWARDEN \
$VAR_GUACAMOLE \
$VAR_SMTP \
$VAR_ROUNDCUBE \
--volume $HOME/.ssh/installer:/root/.ssh/id_rsa \
--volume /etc/user/:/etc/user/ \
--volume /etc/system/:/etc/system/ \