diff --git a/docker_test.sh b/docker_test.sh
index 02d46c7b5b84afacfbaaf4e843c46073895bf5f0..c4b72d6aa61c94e2b5a22e27b3cdaa5ff5812af6 100755
--- a/docker_test.sh
+++ b/docker_test.sh
@@ -75,14 +75,6 @@ cd "$1"
 
 create_dumb_secrets
 
-# Except for registry URL, useful to push to production registry after build
-echo -e "\n==== Replace production URL with testing URL in all files ===="
-for f in $(grep -l -r ".picasoft.net" .); do
-  echo -e "\tFound in" ${f}
-  sed -i "s/.picasoft.net/.test.picasoft.net/g" ${f}
-  sed -i "s/registry.test.picasoft.net/registry.picasoft.net/g" ${f}
-done
-
 echo -e "\n==== Remove and re-create named external volumes ===="
 for v in $(docker-compose config --volumes); do
   res=$(grep $v -A 1 docker-compose.yml | grep 'external' || true)
@@ -103,6 +95,14 @@ docker-compose build
 echo -e "\n==== Pull new versions of external images ===="
 docker-compose pull
 
+# Except for registry URL, useful to push to production registry after build
+echo -e "\n==== Replace production URL with testing URL in all files ===="
+for f in $(grep -l -r ".picasoft.net" .); do
+  echo -e "\tFound in" ${f}
+  sed -i "s/.picasoft.net/.test.picasoft.net/g" ${f}
+  sed -i "s/registry.test.picasoft.net/registry.picasoft.net/g" ${f}
+done
+
 echo -e "\n==== Lauch $1 ===="
 docker-compose up -d
 
diff --git a/pica-lufi/Dockerfile b/pica-lufi/Dockerfile
index c7746882e7d97b543e5bf0b7744ee968f0f03d55..44374aab89f73e6970b7e171071a24689ab5c292 100644
--- a/pica-lufi/Dockerfile
+++ b/pica-lufi/Dockerfile
@@ -5,7 +5,7 @@ ENV APP_HOME=/lufi
 
 # Install dependencies
 RUN apt-get update \
-&& apt-get -yq install build-essential libssl-dev libio-socket-ssl-perl liblwp-protocol-https-perl libpq-dev zlib1g-dev wget unzip \
+&& apt-get -yq install build-essential libssl-dev libio-socket-ssl-perl liblwp-protocol-https-perl libpq-dev zlib1g-dev postgresql-client wget unzip \
 && apt-get clean && cpan Carton
 
 # Install Supercronic to run cron jobs
diff --git a/pica-lufi/entrypoint.sh b/pica-lufi/entrypoint.sh
index 50108dcecc1696d8bfcd75eb5efcb450c4b68518..be4b9a036443e5cae8d9515ed0a4c03a61419f2b 100644
--- a/pica-lufi/entrypoint.sh
+++ b/pica-lufi/entrypoint.sh
@@ -28,6 +28,11 @@ echo "0 0 * * * carton exec $APP_HOME/script/lufi cron cleanbdd --mode productio
 # Delete files which availability delay is over
 echo "0 0 * * * carton exec $APP_HOME/script/lufi cron cleanfiles --mode production" > /crontab.conf
 
+# Wait database to be ready
+while ! PGPASSWORD="${POSTGRES_PASSWORD}" psql -h"lufidb" -U"${POSTGRES_USER}" -d"${POSTGRES_DB}" -c "SELECT 1" &>/dev/null; do
+		echo "Database server not ready yet, re-trying in 5 seconds..."
+    sleep 5
+done
 
 echo "Start Lufi..."
 $@ &
diff --git a/pica-lufi/lufi.conf b/pica-lufi/lufi.conf
index 95b2492baf9dbcbeb882d6db81f872425591a888..47648a5f3f35607b0ced37f7ab5ac0787a885043 100644
--- a/pica-lufi/lufi.conf
+++ b/pica-lufi/lufi.conf
@@ -139,12 +139,12 @@
     mail => {
         # Valid values are 'sendmail' and 'smtp'
         how => 'smtp',
-        howargs => ['mail.picasoft.net:587', AuthUser => 'drop@picasoft.net', AuthPass => $ENV{'EMAIL_PASSWORD'}]
+        owargs => { host => 'mail.picasoft.net', ssl => 'starttls', sasl_username => 'drop', sasl_password => $ENV{'EMAIL_PASSWORD'}, helo => 'drop.test.picasoft.net'}
     },
 
     # Email sender address
     # optional, default to no-reply@lufi.io
-    mail_sender => 'picasoft@assos.utc.fr',
+    mail_sender => 'drop@picasoft.net'
 
     #############
     # DB settings