Esempio n. 1
0
    def __init__(self):
        if not logger.factory_instance:
            logger.init(logging.DEBUG, True)

        self.log = logger.get_logger('{0}_installer'.format(APP_NAME))
        self.app_dir = paths.get_app_dir(APP_NAME)
        self.app_data_dir = paths.get_data_dir(APP_NAME)
Esempio n. 2
0
    def __init__(self):
        if not logger.factory_instance:
            logger.init(logging.DEBUG, True)

        self.log = logger.get_logger('installer')
        self.templates_path = join(config.INSTALL_DIR, 'config.templates')
        self.config_dir = join(config.DATA_DIR, 'config')
        self.data_dir = config.DATA_DIR
Esempio n. 3
0
    def __init__(self):
        if not logger.factory_instance:
            logger.init(logging.DEBUG, True)

        self.log = logger.get_logger('{0}_installer'.format(APP_NAME))
        self.app_dir = paths.get_app_dir(APP_NAME)
        self.common_dir = paths.get_data_dir(APP_NAME)
        self.snap_data_dir = os.environ['SNAP_DATA']
Esempio n. 4
0
    def __init__(self):
        if not logger.factory_instance:
            logger.init(logging.DEBUG, True)

        self.log = logger.get_logger('rocketchat')
        self.snap_dir = '/snap/rocketchat/current'
        self.data_dir = '/var/snap/rocketchat/current'
        self.common_dir = '/var/snap/rocketchat/common'
        self.app_url = urls.get_app_url(APP_NAME)
        self.install_file = join(self.common_dir, 'installed')
        self.database_dump = join(self.data_dir, 'database.dump.gzip')
        self.rocketchat_env_file_source = join(self.snap_dir, 'config', 'rocketchat.env')
        self.rocketchat_env_file_target = join(self.data_dir, 'config', 'rocketchat.env')
        self.version_new_file = join(self.snap_dir, 'nodejs', 'rocketchat.version')
        self.version_old_file = join(self.data_dir, 'rocketchat.version')
Esempio n. 5
0
    def __init__(self, debug=False, config_dir=None):
        self.platform_config = PlatformConfig(config_dir=config_dir)

        if not logger.factory_instance:
            console = True if debug else False
            level = logging.DEBUG if debug else logging.INFO
            logger.init(level, console, join(self.platform_config.get_platform_log()))

        self.user_platform_config = PlatformUserConfig()

        self.log_aggregator = Aggregator(self.platform_config)

        self.platform_app_paths = AppPaths(PLATFORM_APP_NAME, self.platform_config)
        self.platform_app_paths.get_data_dir()
        self.versions = Versions(self.platform_config)
        self.redirect_service = RedirectService(self.user_platform_config, self.versions)
        self.port_config = PortConfig(self.platform_app_paths.get_data_dir())

        self.nat_pmp_port_mapper = NatPmpPortMapper()
        self.upnp_port_mapper = UpnpPortMapper(UPnP())
        self.port_mapper_factory = PortMapperFactory(self.nat_pmp_port_mapper, self.upnp_port_mapper)
        self.port_drill_factory = PortDrillFactory(self.user_platform_config, self.port_config,
                                                   self.port_mapper_factory)
        self.device_info = DeviceInfo(self.user_platform_config, self.port_config)
        self.sam = Snap(self.platform_config, self.device_info)
        self.platform_cron = PlatformCron(self.platform_config)
        self.systemctl = Systemctl(self.platform_config)
        self.ldap_auth = LdapAuth(self.platform_config, self.systemctl)
        self.event_trigger = EventTrigger(self.sam, self.platform_config)
        self.nginx = Nginx(self.platform_config, self.systemctl, self.device_info)
        self.certbot_genetator = CertbotGenerator(self.platform_config, self.user_platform_config,
                                                  self.device_info, self.sam)
        self.tls = CertificateGenerator(self.platform_config, self.user_platform_config, self.device_info, self.nginx,
                                        self.certbot_genetator)
        
        self.device = Device(self.platform_config, self.user_platform_config, self.redirect_service,
                             self.port_drill_factory, self.platform_cron, self.ldap_auth,
                             self.event_trigger, self.tls, self.nginx)

        self.internal = Internal(self.platform_config, self.device, self.redirect_service, self.log_aggregator)
        self.path_checker = PathChecker(self.platform_config)
        self.lsblk = Lsblk(self.platform_config, self.path_checker)
        self.hardware = Hardware(self.platform_config, self.event_trigger,
                                 self.lsblk, self.path_checker, self.systemctl)
        self.network = Network()
        self.public = Public(self.platform_config, self.user_platform_config, self.device, self.device_info, self.sam,
                             self.hardware, self.redirect_service, self.log_aggregator, self.certbot_genetator,
                             self.port_mapper_factory, self.network, self.port_config)
Esempio n. 6
0
    def __init__(self):
        if not logger.factory_instance:
            logger.init(logging.DEBUG, True)

        self.log = logger.get_logger('{0}_installer'.format(APP_NAME))
        self.app_dir = paths.get_app_dir(APP_NAME)
        self.snap_common = os.environ['SNAP_COMMON']
        self.snap_data = join('/var/snap', APP_NAME, 'current')
        self.config_path = join(self.snap_data, 'config')
        self.openvpn_config_dir = join(self.snap_data, 'openvpn')
        self.openssl_bin = join(self.app_dir, 'openssl/bin/openssl')
        self.generate_keys_bin = join(self.app_dir, 'bin/generate-keys.sh')
        self.prefix_delegation_bin = join(self.app_dir,
                                          'bin/prefix_delegation.sh')
        self.prefix_delegation_link = join(
            self.app_dir, '/etc/dhcp/dhclient-exit-hooks.d/openvpn')
        self.device_domain_name = urls.get_device_domain_name()
Esempio n. 7
0
    def __init__(self):
        if not logger.factory_instance:
            logger.init(logging.DEBUG, True)

        self.log = logger.get_logger('nextcloud_installer')
        self.app_dir = paths.get_app_dir(APP_NAME)
        self.common_dir = paths.get_data_dir(APP_NAME)
        self.data_dir = join('/var/snap', APP_NAME, 'current')
        self.config_dir = join(self.data_dir, 'config')
        self.extra_apps_dir = join(self.data_dir, 'extra-apps')
        self.occ = OCConsole(join(self.app_dir, OCC_RUNNER_PATH))
        self.nextcloud_config_path = join(self.data_dir, 'nextcloud', 'config')
        self.nextcloud_config_file = join(self.nextcloud_config_path,
                                          'config.php')
        self.cron = Cron(CRON_USER)
        self.db = Database(self.app_dir, self.data_dir, self.config_dir,
                           PSQL_PORT)
        self.oc_config = OCConfig(join(self.app_dir, 'bin/nextcloud-config'))
Esempio n. 8
0
import sys
import logging
from os.path import join
from syncloudlib import logger
from syncloud_platform.events import run_hook_script

logger.init(logging.DEBUG, console=True, line_format='%(message)s')

apps_dir = sys.argv[1]
app_id = sys.argv[2]
hook_script = sys.argv[3]
app_dir = join(apps_dir, app_id)
run_hook_script(app_dir, hook_script)
Esempio n. 9
0
from os.path import dirname, join

from syncloudlib import logger

from syncloud_platform.config.config import PlatformConfig
from syncloud_platform.disks.lsblk import Lsblk
from syncloud_platform.disks.path_checker import PathChecker

DIR = dirname(__file__)

CONFIG_DIR = join(dirname(__file__), '..', '..', '..', 'config')

logger.init(console=True)

default_output = '''NAME="/dev/sda" SIZE="55.9G" TYPE="disk" MOUNTPOINT="" PARTTYPE="" FSTYPE="" MODEL="INTEL SSDSC2CW06"
NAME="/dev/sda1" SIZE="48.5G" TYPE="part" MOUNTPOINT="/abc" PARTTYPE="0x83" FSTYPE="ntfs" MODEL=""
NAME="/dev/sda2" SIZE="1K" TYPE="part" MOUNTPOINT="" PARTTYPE="0x5" FSTYPE="" MODEL=""
NAME="/dev/sda3" SIZE="5.0G" TYPE="part" MOUNTPOINT="" PARTTYPE="" FSTYPE="" MODEL=""
NAME="/dev/sda5" SIZE="7.4G" TYPE="part" MOUNTPOINT="[SWAP]" PARTTYPE="0x83" FSTYPE="" MODEL=""
NAME="/dev/sdb" SIZE="232.9G" TYPE="disk" MOUNTPOINT="" PARTTYPE="" FSTYPE="" MODEL="TOSHIBA MK2552GS"
NAME="/dev/sdb1" SIZE="100M" TYPE="part" MOUNTPOINT="" PARTTYPE="0x7" FSTYPE="" MODEL=""
NAME="/dev/sdb2" SIZE="48.7G" TYPE="part" MOUNTPOINT="" PARTTYPE="0x7" FSTYPE="" MODEL=""
NAME="/dev/sdb3" SIZE="184.1G" TYPE="part" MOUNTPOINT="/opt/disk/external" PARTTYPE="0x83" FSTYPE="ext4" MODEL=""
NAME="/dev/sdc" SIZE="55.9G" TYPE="disk" MOUNTPOINT="" PARTTYPE="" FSTYPE="" MODEL="INTEL SSDSC2CW06"
NAME="/dev/sdc1" SIZE="48.5G" TYPE="part" MOUNTPOINT="/" PARTTYPE="0x83" FSTYPE="ntfs" MODEL=""
NAME="/dev/sdc2" SIZE="1K" TYPE="part" MOUNTPOINT="" PARTTYPE="0x5" FSTYPE="" MODEL=""
NAME="/dev/sr0" SIZE="3.4G" TYPE="rom" MOUNTPOINT="" PARTTYPE="" FSTYPE="" MODEL="CDDVDW SN-208AB "
NAME="/dev/sdc" SIZE="55.9G" TYPE="disk" MOUNTPOINT="" PARTTYPE="" FSTYPE="" MODEL="INTEL SSDSC2CW06"
NAME="/dev/sdc1" SIZE="48.5G" TYPE="part" MOUNTPOINT="/test" PARTTYPE="0x83" FSTYPE="vfat" MODEL=" "
NAME="/dev/loop0" SIZE="10M" TYPE="loop" MOUNTPOINT="" PARTTYPE="" FSTYPE="" MODEL=""
NAME="/dev/sda" SIZE="3.7G" TYPE="disk" MOUNTPOINT="" PARTTYPE="" FSTYPE="" MODEL="BLANK DISK"
Esempio n. 10
0
import logging

from syncloudlib import logger

logger.init(level=logging.DEBUG, console=True)