2018-06-04 21:41:18 +02:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
import os
|
|
|
|
import shutil
|
2019-01-08 00:38:06 +02:00
|
|
|
import logging as log
|
|
|
|
import sys
|
2019-07-25 10:33:57 +02:00
|
|
|
from socrate import system, conf
|
2018-06-04 21:41:18 +02:00
|
|
|
|
2019-01-08 05:16:05 +02:00
|
|
|
log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))
|
2019-01-08 00:38:06 +02:00
|
|
|
|
2018-06-04 21:41:18 +02:00
|
|
|
# Actual startup script
|
2019-08-21 19:35:24 +02:00
|
|
|
os.environ["FRONT_ADDRESS"] = system.resolve_address(os.environ.get("HOST_FRONT", "front"))
|
|
|
|
os.environ["IMAP_ADDRESS"] = system.resolve_address(os.environ.get("HOST_IMAP", "imap"))
|
2018-06-04 21:41:18 +02:00
|
|
|
|
2018-12-07 13:37:40 +02:00
|
|
|
os.environ["MAX_FILESIZE"] = str(int(int(os.environ.get("MESSAGE_SIZE_LIMIT"))*0.66/1048576))
|
|
|
|
|
2018-06-04 21:41:18 +02:00
|
|
|
base = "/data/_data_/_default_/"
|
|
|
|
shutil.rmtree(base + "domains/", ignore_errors=True)
|
|
|
|
os.makedirs(base + "domains", exist_ok=True)
|
|
|
|
os.makedirs(base + "configs", exist_ok=True)
|
|
|
|
|
2019-07-25 10:33:57 +02:00
|
|
|
conf.jinja("/default.ini", os.environ, "/data/_data_/_default_/domains/default.ini")
|
|
|
|
conf.jinja("/application.ini", os.environ, "/data/_data_/_default_/configs/application.ini")
|
|
|
|
conf.jinja("/php.ini", os.environ, "/usr/local/etc/php/conf.d/rainloop.ini")
|
2018-06-04 21:41:18 +02:00
|
|
|
|
2018-10-08 15:35:09 +02:00
|
|
|
os.system("chown -R www-data:www-data /data")
|
2021-02-06 18:23:05 +02:00
|
|
|
os.system("chmod -R a+rX /var/www/html/")
|
2018-10-08 15:35:09 +02:00
|
|
|
|
2018-10-08 15:47:10 +02:00
|
|
|
os.execv("/usr/local/bin/apache2-foreground", ["apache2-foreground"])
|
|
|
|
|