[GH-ISSUE #688] Update/redeployment script #641

Closed
opened 2026-02-27 11:12:47 +03:00 by kerem · 16 comments
Owner

Originally created by @piwats on GitHub (Feb 7, 2015).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/688

Hello there,

this is a script I wrote for myself to easily update/upgrade/redeploy modoboa, so I don't have to do it manually....

I use uwsgi to run modoboa via nginx in a subfolder - this is why I sed som elines in the settings.py file...

It is very simple and probably self-explaining:

#!/bin/bash

DATE=$(date +%Y-%m-%d-%H%M%S)

MAINDB="modoboa_db"
MAINDBUSER="modoboa_user"
MAINDBPW="modoboa_pw"

AMAVISDB="amavis_db"
AMAVISDBUSER="amavis_user"
AMAVISDBPW="amavis_pw"

HOST="somehost"
PORT="someport"
DOMAIN="SOMEDOMAIN"
LANG="de"
TZ="Europe/Berlin"

DIR="admin"
SYSDIR="/var/www/"


MCONF="settings.py"
R1="/sitestatic/"
N1="/modoboa/sitestatic/"
R2="/media/"
N2="/modoboa/media/"

LOGO="logo.png"

VERSION=$2

function backup {
        mv $DIR backup/$DIR-$DATE
}

function modoboa_update {
        pip install modoboa==$VERSION
}


function modoboa_upgrade {
        pip install --upgrade modoboa==$VERSION
}

function redeploy {
        modoboa-admin.py deploy $DIR --dbaction upgrade --collectstatic --with-amavis --dburl mysql://$MAINDBUSER:$MAINDBPW@$HOST:$PORT/$MAINDB --amavis_dburl mysql://$AMAVISDBUSER:$AMAVISDBPW@$HOST:$PORT/$AMAVISDB --domain $DOMAIN --lang $LANG --timezone $TZ
}


function settings {
        sed -i "s,${R1},${N1},g" $SYSDIR/$DIR/$DIR/$MCONF
        sed -i "s,${R2},${N2},g" $SYSDIR/$DIR/$DIR/$MCONF

        echo "" >> $SYSDIR/$DIR/$DIR/$MCONF
        echo "LOGIN_URL = '/modoboa/accounts/login/'" >> $SYSDIR/$DIR/$DIR/$MCONF
        echo 'MODOBOA_CUSTOM_LOGO = os.path.join(MEDIA_URL, "logo.png")' >> $SYSDIR/$DIR/$DIR/$MCONF

        cp $LOGO $SYSDIR/$DIR/media/.
}

function uwsgi_restart {
        /etc/init.d/uwsgi restart
}

function std {
        backup
        redeploy
        settings
        uwsgi_restart
}

function update {
        backup
        modoboa_update
        redeploy
        settings
        uwsgi_restart
}

function upgrade {
        backup
        modoboa_upgrade
        redeploy
        settings
        uwsgi_restart
}

function help {
        echo "Options:"
        echo "std               backup, redeploy and patch settings"
        echo "update X.X.X      reinstall modoboa via pip install modoboa==X.X.X additionaly to std"
        echo "upgrade X.X.X     reinstall modoboa via pip install --upgrade modoboa==X.X.X additionaly to std"
}

if [ -z "$1" ]
        then help
elif [ $1 == "update" ]
        then update
elif [ $1 == "upgrade" ]
        then upgrade
fi
Originally created by @piwats on GitHub (Feb 7, 2015). Original GitHub issue: https://github.com/modoboa/modoboa/issues/688 Hello there, this is a script I wrote for myself to easily update/upgrade/redeploy modoboa, so I don't have to do it manually.... I use uwsgi to run modoboa via nginx in a subfolder - this is why I sed som elines in the settings.py file... It is very simple and probably self-explaining: ``` bash #!/bin/bash DATE=$(date +%Y-%m-%d-%H%M%S) MAINDB="modoboa_db" MAINDBUSER="modoboa_user" MAINDBPW="modoboa_pw" AMAVISDB="amavis_db" AMAVISDBUSER="amavis_user" AMAVISDBPW="amavis_pw" HOST="somehost" PORT="someport" DOMAIN="SOMEDOMAIN" LANG="de" TZ="Europe/Berlin" DIR="admin" SYSDIR="/var/www/" MCONF="settings.py" R1="/sitestatic/" N1="/modoboa/sitestatic/" R2="/media/" N2="/modoboa/media/" LOGO="logo.png" VERSION=$2 function backup { mv $DIR backup/$DIR-$DATE } function modoboa_update { pip install modoboa==$VERSION } function modoboa_upgrade { pip install --upgrade modoboa==$VERSION } function redeploy { modoboa-admin.py deploy $DIR --dbaction upgrade --collectstatic --with-amavis --dburl mysql://$MAINDBUSER:$MAINDBPW@$HOST:$PORT/$MAINDB --amavis_dburl mysql://$AMAVISDBUSER:$AMAVISDBPW@$HOST:$PORT/$AMAVISDB --domain $DOMAIN --lang $LANG --timezone $TZ } function settings { sed -i "s,${R1},${N1},g" $SYSDIR/$DIR/$DIR/$MCONF sed -i "s,${R2},${N2},g" $SYSDIR/$DIR/$DIR/$MCONF echo "" >> $SYSDIR/$DIR/$DIR/$MCONF echo "LOGIN_URL = '/modoboa/accounts/login/'" >> $SYSDIR/$DIR/$DIR/$MCONF echo 'MODOBOA_CUSTOM_LOGO = os.path.join(MEDIA_URL, "logo.png")' >> $SYSDIR/$DIR/$DIR/$MCONF cp $LOGO $SYSDIR/$DIR/media/. } function uwsgi_restart { /etc/init.d/uwsgi restart } function std { backup redeploy settings uwsgi_restart } function update { backup modoboa_update redeploy settings uwsgi_restart } function upgrade { backup modoboa_upgrade redeploy settings uwsgi_restart } function help { echo "Options:" echo "std backup, redeploy and patch settings" echo "update X.X.X reinstall modoboa via pip install modoboa==X.X.X additionaly to std" echo "upgrade X.X.X reinstall modoboa via pip install --upgrade modoboa==X.X.X additionaly to std" } if [ -z "$1" ] then help elif [ $1 == "update" ] then update elif [ $1 == "upgrade" ] then upgrade fi ```
kerem closed this issue 2026-02-27 11:12:48 +03:00
Author
Owner

@tonioo commented on GitHub (Feb 8, 2015):

Hi,
thanks for sharing it! I'm not sure github is the right place for this but I don't know where to put it. Maybe I should create a contribution section on the website...

<!-- gh-comment-id:73413554 --> @tonioo commented on GitHub (Feb 8, 2015): Hi, thanks for sharing it! I'm not sure github is the right place for this but I don't know where to put it. Maybe I should create a contribution section on the website...
Author
Owner

@piwats commented on GitHub (Feb 8, 2015):

I will refine/rework this script so it is more generally usable...

<!-- gh-comment-id:73430810 --> @piwats commented on GitHub (Feb 8, 2015): I will refine/rework this script so it is more generally usable...
Author
Owner

@piwats commented on GitHub (Feb 10, 2015):

Should work now even better:

#!/bin/bash

#
# Modoboa redeployment script
#

DATE=$(date +%Y-%m-%d-%H%M%S)

# DB settings for main modoboa db
MAINDB="maindb"
MAINDBUSER="maindb_user"
MAINDBPW="maindb_password"

# DB settings for amavis db
AMAVISDB="amavisdb"
AMAVISDBUSER="amavisdb_user"
AMAVISDBPW="amavisdb_password"

# Host settings
HOST="localhost"
PORT="3306"
DOMAIN="some.domain.tld"

# Localization settings
LANG="en"
TZ="Europe/Paris"

# Dir settnigs
# DIR is the deployment name
DIR="admin"
SYSDIR="/var/www/"
BACKUPDIR="backup"

# modoboa settings file
MCONF="settings.py"

# replacement pattern
# SUBDIR is the subdir modoboa runs on a webserver
SUBDIR="/modoboa"
SITESTATICDIR_ORIG="/sitestatic/"
SITESTATICDIR_NEW="$SUBDIR/sitestatic/"
MEDIADIR_ORIG="/media/"
MEDIADIR_NEW="$SUBDIR/media/"

# logo img file
LOGO="logo.png"

VERSION=$2

# Switches true/false
PATCHSETTINGS=true
OWNLOGO=true
UWSGI=true
RESTART=true


# Backup old instance
function backup {
        if [ ! -d "$BACKUPDIR" ];
                then mkdir $BACKUPDIR
        fi
        if [ -d "$DIR" ];
                then mv $DIR $BACKUPDIR/$DIR-$DATE
        fi
}


# Install modoboa
function modoboa_update {
        pip install modoboa==$VERSION
}

# Force reinstall of modoboa
function modoboa_upgrade {
        pip install --upgrade modoboa==$VERSION
}

# Redeploy modoboa
function redeploy {
        modoboa-admin.py deploy $DIR \
                --dbaction upgrade \
                --collectstatic \
                --with-amavis \
                --dburl mysql://$MAINDBUSER:$MAINDBPW@$HOST:$PORT/$MAINDB \
                --amavis_dburl mysql://$AMAVISDBUSER:$AMAVISDBPW@$HOST:$PORT/$AMAVISDB \
                --domain $DOMAIN \
                --lang $LANG \
                --timezone $TZ
}

# Patch settings.py file
function settings {
        # to patch setting, use PATCHSETTINGS=true
        if $PATCHSETTINGS; then
                # replace sitestatic string
                sed -i "s,${SITESTATICDIR_ORIG},${SITESTATICDIR_NEW},g" $SYSDIR/$DIR/$DIR/$MCONF
                # replace media string
                sed -i "s,${MEDIADIR_ORIG},${MEDIADIR_NEW},g" $SYSDIR/$DIR/$DIR/$MCONF

                # make new line
                echo "" >> $SYSDIR/$DIR/$DIR/$MCONF
                # if deployed in subdirectory, LOGIN_URL is mandatory in order for modoboa to work
                echo "LOGIN_URL = '$SUBDIR/accounts/login/'" >> $SYSDIR/$DIR/$DIR/$MCONF

                # to use own logo, use OWNLOGO=true
                if $OWNLOGO; then
                        # we use our own logo
                        echo "MODOBOA_CUSTOM_LOGO = os.path.join(MEDIA_URL, '$LOGO')" >> $SYSDIR/$DIR/$DIR/$MCONF
                        cp $LOGO $SYSDIR/$DIR/$MEDIADIR_ORIG.
                fi
        fi
}

# Restart uwsgi
function uwsgi_restart {
        # to restart uwsgi, use RESTART=true
        if $RESTART; then
                /etc/init.d/uwsgi restart
        fi
}

# redeploy only
function std {
        backup
        redeploy
        settings
        uwsgi_restart
}

# update only
function update {
        backup
        modoboa_update
        redeploy
        settings
        uwsgi_restart
}

# force update
function upgrade {
        backup
        modoboa_upgrade
        redeploy
        settings
        uwsgi_restart
}

# default output
function help {
        echo "Options:"
        echo "std               backup, redeploy and patch settings"
        echo "update X.X.X      reinstall modoboa via pip install modoboa==X.X.X additionaly to std"
        echo "upgrade X.X.X     reinstall modoboa via pip install --upgrade modoboa==X.X.X additionaly to std"
}

# what to do, if...
if [ -z "$1" ]
        then help
elif [ $1 == "std" ]
        then std
elif [ $1 == "update" ]
        then update
elif [ $1 == "upgrade" ]
        then upgrade
fi

<!-- gh-comment-id:73745744 --> @piwats commented on GitHub (Feb 10, 2015): Should work now even better: ``` bash #!/bin/bash # # Modoboa redeployment script # DATE=$(date +%Y-%m-%d-%H%M%S) # DB settings for main modoboa db MAINDB="maindb" MAINDBUSER="maindb_user" MAINDBPW="maindb_password" # DB settings for amavis db AMAVISDB="amavisdb" AMAVISDBUSER="amavisdb_user" AMAVISDBPW="amavisdb_password" # Host settings HOST="localhost" PORT="3306" DOMAIN="some.domain.tld" # Localization settings LANG="en" TZ="Europe/Paris" # Dir settnigs # DIR is the deployment name DIR="admin" SYSDIR="/var/www/" BACKUPDIR="backup" # modoboa settings file MCONF="settings.py" # replacement pattern # SUBDIR is the subdir modoboa runs on a webserver SUBDIR="/modoboa" SITESTATICDIR_ORIG="/sitestatic/" SITESTATICDIR_NEW="$SUBDIR/sitestatic/" MEDIADIR_ORIG="/media/" MEDIADIR_NEW="$SUBDIR/media/" # logo img file LOGO="logo.png" VERSION=$2 # Switches true/false PATCHSETTINGS=true OWNLOGO=true UWSGI=true RESTART=true # Backup old instance function backup { if [ ! -d "$BACKUPDIR" ]; then mkdir $BACKUPDIR fi if [ -d "$DIR" ]; then mv $DIR $BACKUPDIR/$DIR-$DATE fi } # Install modoboa function modoboa_update { pip install modoboa==$VERSION } # Force reinstall of modoboa function modoboa_upgrade { pip install --upgrade modoboa==$VERSION } # Redeploy modoboa function redeploy { modoboa-admin.py deploy $DIR \ --dbaction upgrade \ --collectstatic \ --with-amavis \ --dburl mysql://$MAINDBUSER:$MAINDBPW@$HOST:$PORT/$MAINDB \ --amavis_dburl mysql://$AMAVISDBUSER:$AMAVISDBPW@$HOST:$PORT/$AMAVISDB \ --domain $DOMAIN \ --lang $LANG \ --timezone $TZ } # Patch settings.py file function settings { # to patch setting, use PATCHSETTINGS=true if $PATCHSETTINGS; then # replace sitestatic string sed -i "s,${SITESTATICDIR_ORIG},${SITESTATICDIR_NEW},g" $SYSDIR/$DIR/$DIR/$MCONF # replace media string sed -i "s,${MEDIADIR_ORIG},${MEDIADIR_NEW},g" $SYSDIR/$DIR/$DIR/$MCONF # make new line echo "" >> $SYSDIR/$DIR/$DIR/$MCONF # if deployed in subdirectory, LOGIN_URL is mandatory in order for modoboa to work echo "LOGIN_URL = '$SUBDIR/accounts/login/'" >> $SYSDIR/$DIR/$DIR/$MCONF # to use own logo, use OWNLOGO=true if $OWNLOGO; then # we use our own logo echo "MODOBOA_CUSTOM_LOGO = os.path.join(MEDIA_URL, '$LOGO')" >> $SYSDIR/$DIR/$DIR/$MCONF cp $LOGO $SYSDIR/$DIR/$MEDIADIR_ORIG. fi fi } # Restart uwsgi function uwsgi_restart { # to restart uwsgi, use RESTART=true if $RESTART; then /etc/init.d/uwsgi restart fi } # redeploy only function std { backup redeploy settings uwsgi_restart } # update only function update { backup modoboa_update redeploy settings uwsgi_restart } # force update function upgrade { backup modoboa_upgrade redeploy settings uwsgi_restart } # default output function help { echo "Options:" echo "std backup, redeploy and patch settings" echo "update X.X.X reinstall modoboa via pip install modoboa==X.X.X additionaly to std" echo "upgrade X.X.X reinstall modoboa via pip install --upgrade modoboa==X.X.X additionaly to std" } # what to do, if... if [ -z "$1" ] then help elif [ $1 == "std" ] then std elif [ $1 == "update" ] then update elif [ $1 == "upgrade" ] then upgrade fi ```
Author
Owner

@piwats commented on GitHub (Apr 30, 2015):

I have updated the script as follows:
Change f.e. uwsgi_restart and dburl according to your setup:

modoboa-redeploy.sh:

#!/bin/bash

#
# Modoboa redeployment script
#

DATE=$(date +%Y-%m-%d-%H%M)

source modoboa-redeploy.ini

# Localization settings
LANG="de"
TZ="Europe/Berlin"

# Dir settnigs                                                                                                                                                          
# DIR is the deployment name                                                                                                                                            
DIR="admin"
SYSDIR="/var/www/mail"
BACKUPDIR="backup"

# modoboa settings file
MCONF="settings.py"

# replacement pattern
# SUBDIR is the subdir modoboa runs on a webserver
SUBDIR="/modoboa"
SITESTATICDIR_ORIG="/sitestatic/"
SITESTATICDIR_NEW="$SUBDIR/sitestatic/"
MEDIADIR_ORIG="/media/"
MEDIADIR_NEW="$SUBDIR/media/"

# logo img file
LOGO="logo.png"

VERSION=$2

# Switches true/false
PATCHSETTINGS=true
OWNLOGO=true
UWSGI=true
RESTART=true


# Backup old instance
function backup {
        if [ ! -d $BACKUPDIR ]; then
                echo "Creating backup folder"
                mkdir -p $BACKUPDIR
        fi
        if [ -d $DIR ]; then
                echo "Backing up old modoboa deployment to $BACKUPDIR/$DIR-$DATE"
                mv $DIR $BACKUPDIR/$DIR-$DATE
        fi
}


# Install modoboa
function modoboa_update {
        echo "Installing modoboa-$VERISON"
        pip install modoboa==$VERSION
        #pip install modoboa-admin
        #pip install modoboa-admin-limits
        #pip install modoboa-postfix-autoreply
        #pip install modoboa-admin-relaydomains
        #pip install modoboa-sievefilters
        #pip install modoboa-stats
        #pip install modoboa-webmail
}

# Force reinstall of modoboa
function modoboa_upgrade {
        echo "Forcing modoboa-$VERSION reinstall"
        pip install --upgrade modoboa==$VERSION
        #pip install --upgrade modoboa-admin
        #pip install --upgrade modoboa-admin-limits
        #pip install --upgrade modoboa-postfix-autoreply
        #pip install --upgrade modoboa-admin-relaydomains
        #pip install --upgrade modoboa-sievefilters
        #pip install --upgrade modoboa-stats
        #pip install --upgrade modoboa-webmail
}

# Redeploy modoboa
# Change db scheme after dburl according your setup
function redeploy {
        echo "Redeploying modoboa"
        cd $SYSDIR
        modoboa-admin.py deploy $DIR \
                --collectstatic \
                --domain $DOMAIN \
                --lang $LANG \
                --timezone $TZ \
                --extensions all \
                --dburl default:postgres://$MAINDBUSER:$MAINDBPW@$HOST:$PORT/$MAINDB amavis:postgres://$AMAVISDBUSER:$AMAVISDBPW@$HOST:$PORT/$AMAVISDB

}

# Patch settings.py file
function settings {
        # to patch setting, use PATCHSETTINGS=true
        if $PATCHSETTINGS; then
                echo "Patching $SYSDIR/$DIR/$DIR/$MCONF"
                # replace sitestatic string
                sed -i "s,${SITESTATICDIR_ORIG},${SITESTATICDIR_NEW},g" $SYSDIR/$DIR/$DIR/$MCONF
                # replace media string
                sed -i "s,${MEDIADIR_ORIG},${MEDIADIR_NEW},g" $SYSDIR/$DIR/$DIR/$MCONF

                # make new line
                echo "" >> $SYSDIR/$DIR/$DIR/$MCONF
                # if deployed in subdirectory, LOGIN_URL is mandatory in order for modoboa to work
                echo "LOGIN_URL = '$SUBDIR/accounts/login/'" >> $SYSDIR/$DIR/$DIR/$MCONF

                # to use own logo, use OWNLOGO=true
                if $OWNLOGO; then
                        # we use our own logo
                        echo "MODOBOA_CUSTOM_LOGO = os.path.join(MEDIA_URL, '$LOGO')" >> $SYSDIR/$DIR/$DIR/$MCONF
                        cp $LOGO $SYSDIR/$DIR/$MEDIADIR_ORIG.
                fi
        fi
}

# Restart uwsgi
# modify according to your setup
function uwsgi_restart {
        # to restart uwsgi, use RESTART=true
        if $RESTART; then
               # echo "Restarting uWSGI"
               # /etc/init.d/uwsgi restart
        fi
}

# redeploy only
function std {
        backup
        redeploy
        settings
        # I'm using uwsgi, the following will restart it:
        #uwsgi_restart
}

# update only
function update {
        backup
        modoboa_update
        redeploy
        settings
        # I'm using uwsgi, the following will restart it:
        #uwsgi_restart
}

# force update
function upgrade {
        backup
        modoboa_upgrade
        redeploy
        settings
        # I'm using uwsgi, the following will restart it:
        #uwsgi_restart
}

# default output
function help {
        echo "Options:"
        echo "std               backup, redeploy and patch settings"
        echo "update X.X.X      reinstall modoboa via pip install modoboa==X.X.X additionaly to std"
        echo "upgrade X.X.X     reinstall modoboa via pip install --upgrade modoboa==X.X.X additionaly to std"
}

# what to do, if...
if [ -z "$1" ]
        then help
elif [ $1 == "std" ]
        then std
elif [ $1 == "update" ]
        then update
elif [ $1 == "upgrade" ]
        then upgrade
fi

and

modoboa-redeploy.ini:

# DB settings for main modoboa db
MAINDB="maindb"
MAINDBUSER="maindbuser"
MAINDBPW="maindbpw"

# DB settings for amavis db
AMAVISDB="amavisdb"
AMAVISDBUSER="amavisdbuser"
AMAVISDBPW="amavisdbpw"

# Host settings
HOST="localhost"
PORT="5432"
DOMAIN="domain.tld"
<!-- gh-comment-id:97884123 --> @piwats commented on GitHub (Apr 30, 2015): I have updated the script as follows: Change f.e. uwsgi_restart and dburl according to your setup: modoboa-redeploy.sh: ``` bash #!/bin/bash # # Modoboa redeployment script # DATE=$(date +%Y-%m-%d-%H%M) source modoboa-redeploy.ini # Localization settings LANG="de" TZ="Europe/Berlin" # Dir settnigs # DIR is the deployment name DIR="admin" SYSDIR="/var/www/mail" BACKUPDIR="backup" # modoboa settings file MCONF="settings.py" # replacement pattern # SUBDIR is the subdir modoboa runs on a webserver SUBDIR="/modoboa" SITESTATICDIR_ORIG="/sitestatic/" SITESTATICDIR_NEW="$SUBDIR/sitestatic/" MEDIADIR_ORIG="/media/" MEDIADIR_NEW="$SUBDIR/media/" # logo img file LOGO="logo.png" VERSION=$2 # Switches true/false PATCHSETTINGS=true OWNLOGO=true UWSGI=true RESTART=true # Backup old instance function backup { if [ ! -d $BACKUPDIR ]; then echo "Creating backup folder" mkdir -p $BACKUPDIR fi if [ -d $DIR ]; then echo "Backing up old modoboa deployment to $BACKUPDIR/$DIR-$DATE" mv $DIR $BACKUPDIR/$DIR-$DATE fi } # Install modoboa function modoboa_update { echo "Installing modoboa-$VERISON" pip install modoboa==$VERSION #pip install modoboa-admin #pip install modoboa-admin-limits #pip install modoboa-postfix-autoreply #pip install modoboa-admin-relaydomains #pip install modoboa-sievefilters #pip install modoboa-stats #pip install modoboa-webmail } # Force reinstall of modoboa function modoboa_upgrade { echo "Forcing modoboa-$VERSION reinstall" pip install --upgrade modoboa==$VERSION #pip install --upgrade modoboa-admin #pip install --upgrade modoboa-admin-limits #pip install --upgrade modoboa-postfix-autoreply #pip install --upgrade modoboa-admin-relaydomains #pip install --upgrade modoboa-sievefilters #pip install --upgrade modoboa-stats #pip install --upgrade modoboa-webmail } # Redeploy modoboa # Change db scheme after dburl according your setup function redeploy { echo "Redeploying modoboa" cd $SYSDIR modoboa-admin.py deploy $DIR \ --collectstatic \ --domain $DOMAIN \ --lang $LANG \ --timezone $TZ \ --extensions all \ --dburl default:postgres://$MAINDBUSER:$MAINDBPW@$HOST:$PORT/$MAINDB amavis:postgres://$AMAVISDBUSER:$AMAVISDBPW@$HOST:$PORT/$AMAVISDB } # Patch settings.py file function settings { # to patch setting, use PATCHSETTINGS=true if $PATCHSETTINGS; then echo "Patching $SYSDIR/$DIR/$DIR/$MCONF" # replace sitestatic string sed -i "s,${SITESTATICDIR_ORIG},${SITESTATICDIR_NEW},g" $SYSDIR/$DIR/$DIR/$MCONF # replace media string sed -i "s,${MEDIADIR_ORIG},${MEDIADIR_NEW},g" $SYSDIR/$DIR/$DIR/$MCONF # make new line echo "" >> $SYSDIR/$DIR/$DIR/$MCONF # if deployed in subdirectory, LOGIN_URL is mandatory in order for modoboa to work echo "LOGIN_URL = '$SUBDIR/accounts/login/'" >> $SYSDIR/$DIR/$DIR/$MCONF # to use own logo, use OWNLOGO=true if $OWNLOGO; then # we use our own logo echo "MODOBOA_CUSTOM_LOGO = os.path.join(MEDIA_URL, '$LOGO')" >> $SYSDIR/$DIR/$DIR/$MCONF cp $LOGO $SYSDIR/$DIR/$MEDIADIR_ORIG. fi fi } # Restart uwsgi # modify according to your setup function uwsgi_restart { # to restart uwsgi, use RESTART=true if $RESTART; then # echo "Restarting uWSGI" # /etc/init.d/uwsgi restart fi } # redeploy only function std { backup redeploy settings # I'm using uwsgi, the following will restart it: #uwsgi_restart } # update only function update { backup modoboa_update redeploy settings # I'm using uwsgi, the following will restart it: #uwsgi_restart } # force update function upgrade { backup modoboa_upgrade redeploy settings # I'm using uwsgi, the following will restart it: #uwsgi_restart } # default output function help { echo "Options:" echo "std backup, redeploy and patch settings" echo "update X.X.X reinstall modoboa via pip install modoboa==X.X.X additionaly to std" echo "upgrade X.X.X reinstall modoboa via pip install --upgrade modoboa==X.X.X additionaly to std" } # what to do, if... if [ -z "$1" ] then help elif [ $1 == "std" ] then std elif [ $1 == "update" ] then update elif [ $1 == "upgrade" ] then upgrade fi ``` and modoboa-redeploy.ini: ``` bash # DB settings for main modoboa db MAINDB="maindb" MAINDBUSER="maindbuser" MAINDBPW="maindbpw" # DB settings for amavis db AMAVISDB="amavisdb" AMAVISDBUSER="amavisdbuser" AMAVISDBPW="amavisdbpw" # Host settings HOST="localhost" PORT="5432" DOMAIN="domain.tld" ```
Author
Owner

@eberkund commented on GitHub (Jun 15, 2015):

Maybe piwats you could create a GitHub repo and store your script there and the developers could include a link to it in the installation/upgrade section of the main site.

<!-- gh-comment-id:111917746 --> @eberkund commented on GitHub (Jun 15, 2015): Maybe piwats you could create a GitHub repo and store your script there and the developers could include a link to it in the installation/upgrade section of the main site.
Author
Owner

@tonioo commented on GitHub (Jun 15, 2015):

Indeed, that's a good idea. Maybe we could add this repository to the Modoboa organization ? (https://github.com/modoboa/)

<!-- gh-comment-id:111965159 --> @tonioo commented on GitHub (Jun 15, 2015): Indeed, that's a good idea. Maybe we could add this repository to the Modoboa organization ? (https://github.com/modoboa/)
Author
Owner

@piwats commented on GitHub (Jun 15, 2015):

I would be happy to maintain it in a repo, a PR (I have to setup one) or elsewhere, where people also could contribute to it :)

Also I think that it is time to rewrite it a little (f.e. add options to control what plugins are to be installed, add some more fancy switches here and there, customize the restarting, e.g. make it more distro/system/db agnostic)

Ideas, critic and suggestions are of course welcome.

<!-- gh-comment-id:112049099 --> @piwats commented on GitHub (Jun 15, 2015): I would be happy to maintain it in a repo, a PR (I have to setup one) or elsewhere, where people also could contribute to it :) Also I think that it is time to rewrite it a little (f.e. add options to control what plugins are to be installed, add some more fancy switches here and there, customize the restarting, e.g. make it more distro/system/db agnostic) Ideas, critic and suggestions are of course welcome.
Author
Owner

@tonioo commented on GitHub (Jun 15, 2015):

I can setup a repo if you want to.

<!-- gh-comment-id:112054837 --> @tonioo commented on GitHub (Jun 15, 2015): I can setup a repo if you want to.
Author
Owner

@piwats commented on GitHub (Jun 15, 2015):

That would be nice.

<!-- gh-comment-id:112056987 --> @piwats commented on GitHub (Jun 15, 2015): That would be nice.
Author
Owner

@tonioo commented on GitHub (Jun 15, 2015):

Do you have an idea for the repository name ?

<!-- gh-comment-id:112057794 --> @tonioo commented on GitHub (Jun 15, 2015): Do you have an idea for the repository name ?
Author
Owner

@piwats commented on GitHub (Jun 15, 2015):

scripts/deployment? or similar?

<!-- gh-comment-id:112067904 --> @piwats commented on GitHub (Jun 15, 2015): scripts/deployment? or similar?
Author
Owner

@tonioo commented on GitHub (Jun 15, 2015):

deployment-tools ?

<!-- gh-comment-id:112075718 --> @tonioo commented on GitHub (Jun 15, 2015): deployment-tools ?
Author
Owner

@piwats commented on GitHub (Jun 15, 2015):

this will do :)

<!-- gh-comment-id:112076301 --> @piwats commented on GitHub (Jun 15, 2015): this will do :)
Author
Owner

@tonioo commented on GitHub (Jun 15, 2015):

Done!

https://github.com/modoboa/deployment-tools

<!-- gh-comment-id:112081922 --> @tonioo commented on GitHub (Jun 15, 2015): Done! https://github.com/modoboa/deployment-tools
Author
Owner

@piwats commented on GitHub (Jun 15, 2015):

I hope yo can wait a little bit, my schedule is "hard" at this time, can you wait until this weekend?
I will update the deployment scrips sometime around this weekend....
Sorry for that.

<!-- gh-comment-id:112170816 --> @piwats commented on GitHub (Jun 15, 2015): I hope yo can wait a little bit, my schedule is "hard" at this time, can you wait until this weekend? I will update the deployment scrips sometime around this weekend.... Sorry for that.
Author
Owner

@tonioo commented on GitHub (Jun 15, 2015):

Yeah no problem, it can wait.

<!-- gh-comment-id:112179789 --> @tonioo commented on GitHub (Jun 15, 2015): Yeah no problem, it can wait.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#641
No description provided.