You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
![]()
6 years ago
|
#!/usr/bin/python3
|
||
|
|
||
|
import os
|
||
|
import shutil
|
||
![]()
6 years ago
|
import logging as log
|
||
|
import sys
|
||
![]()
3 years ago
|
import subprocess
|
||
![]()
5 years ago
|
from socrate import system, conf
|
||
![]()
6 years ago
|
|
||
![]()
6 years ago
|
log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))
|
||
![]()
6 years ago
|
|
||
![]()
6 years ago
|
# Actual startup script
|
||
![]()
5 years ago
|
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"))
|
||
![]()
6 years ago
|
|
||
![]()
6 years ago
|
os.environ["MAX_FILESIZE"] = str(int(int(os.environ.get("MESSAGE_SIZE_LIMIT"))*0.66/1048576))
|
||
|
|
||
![]()
6 years ago
|
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)
|
||
|
|
||
![]()
3 years ago
|
conf.jinja("/defaults/default.ini", os.environ, "/data/_data_/_default_/domains/default.ini")
|
||
|
conf.jinja("/defaults/application.ini", os.environ, "/data/_data_/_default_/configs/application.ini")
|
||
|
conf.jinja("/defaults/php.ini", os.environ, "/etc/php7/php.ini")
|
||
![]()
3 years ago
|
# Start the fastcgi process manager now that config files have been adjusted
|
||
|
os.system("php-fpm7")
|
||
![]()
6 years ago
|
|
||
![]()
3 years ago
|
os.system("chown -R nginx:nginx /data")
|
||
![]()
2 years ago
|
os.system("chmod -R a+rX /var/www/webmail/")
|
||
![]()
6 years ago
|
|
||
![]()
3 years ago
|
subprocess.call(["/config.py"])
|
||
![]()
3 years ago
|
os.execv("/usr/sbin/nginx", ["nginx", "-g", "daemon off;"])
|