Initialize the databae properly

master
Pierre Jaury 9 years ago
parent 946054240d
commit 8e38535710

@ -0,0 +1,6 @@
from freeposte import db
# Initialize the database
db.create_all()
db.session.commit()

@ -1,10 +1,5 @@
from freeposte import app, db
# Initialize the database if required (first launch)
db.create_all()
db.session.commit()
if __name__ == '__main__':
app.run(debug=True)

@ -27,16 +27,20 @@ mkdir -p \
/data/ssl
# Create the main database if necessary
[ -f /data/freeposte.db ] || sqlite3 /data/freeposte.db .databases > /dev/null
if [ ! -f /data/freeposte.db ]; then
echo 'Initializing the database...'
cd /admin && python initdb.py
fi
# Fixing permissions
chown mail:www-data /data/freeposte.db
chown www-data:mail /data/freeposte.db
chmod 664 /data/freeposte.db
chown -R mail:mail /data/mail
chown -R www-data:www-data /data/webmail /data/logs/webmail
# Copy the system snakeoil certificate if none is provided
if [ ! -f /data/ssl/cert.pem ]; then
cat <<< EOF
cat << EOF
No TLS certificate is installed, a snakeoil ceritifcate is thus
being configured. You MUST NOT run a production server with this
certificate, as the private key is known publicly.

Loading…
Cancel
Save