Пример #1
0
    def init_configs(self):
        linux.fix_locale()

        variables = {
            'apps_root': config.APPS_ROOT,
            'data_root': config.DATA_ROOT,
            'configs_root': config.DATA_ROOT,
            'config_root': self.data_dir,
            'config_dir': self.config_dir,
            'app_dir': config.INSTALL_DIR,
            'app_data': config.DATA_DIR,
            'app_data_prefix': config.APP_DATA_PREFIX
        }
        gen.generate_files(self.templates_path, self.config_dir, variables)

        data_dirs = [
            join(self.data_dir, 'webapps'),
            join(self.data_dir, 'log'),
            join(self.data_dir, 'nginx'),
            join(self.data_dir, 'openldap'),
            join(self.data_dir, 'openldap-data'),
            join(self.data_dir, 'certbot'),
            join(self.data_dir, 'certbot', 'www')
        ]

        for data_dir in data_dirs:
            fs.makepath(data_dir)
Пример #2
0
    def install(self):

        linux.fix_locale()

        linux.useradd(USER_NAME)

        self.log.info(fs.chownpath(self.app.get_install_dir(), USER_NAME, recursive=True))

        app_data_dir = self.app.get_data_dir()
        database_path = '{0}/database'.format(app_data_dir)

        variables = {
            'app_dir': self.app_dir,
            'app_data_dir': app_data_dir,
            'db_psql_path': database_path,
            'db_psql_port': PSQL_PORT,
            'db_name': DB_NAME,
            'db_user': DB_USER,
            'db_password': DB_PASS
        }

        templates_path = join(self.app_dir, 'config.templates')
        config_path = join(app_data_dir, 'config')
        gen.generate_files(templates_path, config_path, variables)

        fs.makepath(join(app_data_dir, 'config'))
        fs.makepath(join(app_data_dir, 'redis'))
        fs.makepath(join(app_data_dir, 'log'))
        fs.makepath(join(app_data_dir, 'nginx'))

        fs.chownpath(app_data_dir, USER_NAME, recursive=True)

        self.log.info("setup systemd")

        user_config = UserConfig(app_data_dir)
        is_first_time = not user_config.is_activated()
        if is_first_time:
            database_init(self.log, self.app_dir, app_data_dir, database_path, USER_NAME)

        self.app.add_service(SYSTEMD_POSTGRESQL)

        config = Config(app_data_dir)
        symlink(join(config_path, 'diaspora', 'diaspora.yml'), join(self.app_dir, 'diaspora', 'config', 'diaspora.yml'))
        symlink(join(config_path, 'diaspora', 'database.yml'), join(self.app_dir, 'diaspora', 'config', 'database.yml'))
        self.update_configuraiton(config)

        if is_first_time:
            self.initialize(app_data_dir, config)

        self.log.info(fs.chownpath(self.app_dir, USER_NAME, recursive=True))

        self.app.add_service(SYSTEMD_REDIS)
        self.app.add_service(SYSTEMD_SIDEKIQ)
        self.app.add_service(SYSTEMD_UNICORN)
        self.app.add_service(SYSTEMD_NGINX_NAME)

        self.app.init_storage(USER_NAME)
Пример #3
0
    def install(self):

        linux.fix_locale()

        linux.useradd(USER_NAME)

        templates_path = join(self.app.get_install_dir(), 'config.templates')
        config_path = join(self.app.get_data_dir(), 'config')

        app_data_dir = self.app.get_data_dir()

        variables = {
            'app_dir': self.app.get_install_dir(),
            'app_data_dir': app_data_dir,
            'db_psql_port': PSQL_PORT
        }
        gen.generate_files(templates_path, config_path, variables)
        fs.chownpath(self.app.get_install_dir(), USER_NAME, recursive=True)

        config_data_dir = join(app_data_dir, 'config')
        log_dir = join(app_data_dir, 'log')

        fs.makepath(config_data_dir)
        fs.makepath(log_dir)

        fs.chownpath(app_data_dir, USER_NAME, recursive=True)

        config_app_dir = join(self.app.get_install_dir(), APP_CONFIG_PATH)
        symlink(config_data_dir, config_app_dir)

        database_init(self.log, self.app.get_install_dir(), self.app.get_data_dir(), USER_NAME)

        print("setup systemd")
        self.app.add_service(SYSTEMD_POSTGRESQL)
        self.app.add_service(SYSTEMD_PHP_FPM_NAME)
        self.app.add_service(SYSTEMD_NGINX_NAME)

        self.prepare_storage()

        if self.installed():
            self.upgrade()
        else:
            self.initialize()

        cron = OwncloudCron(join(self.app.get_install_dir(), CRON_CMD), CRON_USER)
        cron.remove()
        cron.create()

        oc_config = OCConfig(join(self.app.get_install_dir(), OC_CONFIG_PATH))
        oc_config.set_value('memcache.local', '\OC\Memcache\APCu')
        oc_config.set_value('loglevel', '2')
        oc_config.set_value('logfile', join(self.app.get_data_dir(), OWNCLOUD_LOG_PATH))
        oc_config.set_value('datadirectory', self.app.get_storage_dir())

        self.on_domain_change()

        fs.chownpath(self.app.get_data_dir(), USER_NAME, recursive=True)
Пример #4
0
    def install(self):
        linux.fix_locale()

        apps_root = '/snap'
        data_root = '/var/snap'
        install_dir = os.environ['SNAP']
        data_dir = os.environ['SNAP_COMMON']
        app_data_prefix = 'common/'

        templates_path = join(install_dir, 'config.templates')
        config_dir = join(data_dir, 'config')

        variables = {
            'apps_root': apps_root,
            'data_root': data_root,
            'configs_root': data_root,
            'config_root': data_dir,
            'config_dir': config_dir,
            'app_dir': install_dir,
            'app_data': data_dir,
            'app_data_prefix': app_data_prefix
        }
        gen.generate_files(templates_path, config_dir, variables)

        data_dirs = [
            join(data_dir, 'webapps'),
            join(data_dir, 'log'),
            join(data_dir, 'nginx'),
            join(data_dir, 'openldap'),
            join(data_dir, 'openldap-data'),
            join(data_dir, 'certbot'),
            join(data_dir, 'certbot', 'www')
        ]

        for data_dir in data_dirs:
            fs.makepath(data_dir)

        injector = get_injector()

        hardware = injector.hardware
        hardware.init_disk()

        injector.tls.init_certificate()

        injector.platform_cron.remove()
        injector.platform_cron.create()

        ldap_auth = injector.ldap_auth
        ldap_auth.init()

        nginx = injector.nginx
        nginx.init_config()
Пример #5
0
    def install(self):

        linux.fix_locale()

        linux.useradd(USER_NAME)

        templates_path = join(self.app.get_install_dir(), 'templates')
        config_path = join(self.app.get_install_dir(), 'config')

        app_data_dir = self.app.get_data_dir()

        variables = {
            'app_dir': self.app.get_install_dir(),
            'app_data_dir': app_data_dir,
            'web_port': OWNCLOUD_PORT
        }
        gen.generate_files(templates_path, config_path, variables)
        fs.chownpath(self.app.get_install_dir(), USER_NAME, recursive=True)

        config_data_dir = join(app_data_dir, 'config')
        log_dir = join(app_data_dir, 'log')

        fs.makepath(config_data_dir)
        fs.makepath(log_dir)

        fs.chownpath(app_data_dir, USER_NAME, recursive=True)

        config_app_dir = join(self.app.get_install_dir(), OWNCLOUD_APP_CONFIG_PATH)
        symlink(config_data_dir, config_app_dir)

        database_path = join(self.app.get_data_dir(), 'database')
        if not isdir(database_path):
            psql_initdb = join(self.app.get_install_dir(), 'postgresql/bin/initdb')
            check_output(['sudo', '-H', '-u', USER_NAME, psql_initdb, database_path])

        print("setup systemd")
        self.app.add_service(SYSTEMD_POSTGRESQL)
        self.app.add_service(SYSTEMD_PHP_FPM_NAME)
        self.app.add_service(SYSTEMD_NGINX_NAME)

        self.prepare_storage()

        if not self.installed():
            self.initialize()

        cron = OwncloudCron(join(self.app.get_install_dir(), CRON_CMD), CRON_USER)
        cron.remove()
        cron.create()

        oc_config = OCConfig(join(self.app.get_install_dir(), OC_CONFIG_PATH))
        oc_config.set_value('memcache.local', '\OC\Memcache\APCu')
        oc_config.set_value('loglevel', '2')
        oc_config.set_value('logfile', join(self.app.get_data_dir(), OWNCLOUD_LOG_PATH))
        oc_config.set_value('datadirectory', self.app.get_storage_dir())
        oc_config.set_value('integrity.check.disabled', 'true')

        self.update_domain()

        fs.chownpath(self.app.get_data_dir(), USER_NAME, recursive=True)

        self.app.register_web(OWNCLOUD_PORT)
Пример #6
0
install_dir = os.environ['SNAP']
app_data = os.environ['SNAP_COMMON']
templates_path = join(install_dir, 'config.templates')
config_dir = join(app_data, 'config')

variables = {
    'apps_root': install_dir,
    'data_root': app_data,
    # not used in snap
    'configs_root': 'not_used',
    'config_root': app_data,
    'config_dir': config_dir,
    'app_dir': install_dir,
    'app_data': app_data
}
gen.generate_files(templates_path, config_dir, variables)

data_dirs = [
    join(app_data, 'webapps'),
    join(app_data, 'log'),
    join(app_data, 'nginx'),
    join(app_data, 'openldap'),
    join(app_data, 'openldap-data'),
    join(app_data, 'certbot')
]

for data_dir in data_dirs:
    fs.makepath(data_dir)

injector = get_injector(config_dir=config_dir)
Пример #7
0
    def install(self):

        linux.fix_locale()

        linux.useradd(USER_NAME)

        templates_path = join(self.app.get_install_dir(), 'config.templates')
        config_path = join(self.app.get_install_dir(), 'config')

        app_data_dir = self.app.get_data_dir()

        variables = {
            'app_dir': self.app.get_install_dir(),
            'app_data_dir': app_data_dir,
            'web_port': WEB_PORT,
            'db_psql_port': PSQL_PORT
        }
        gen.generate_files(templates_path, config_path, variables)
        fs.chownpath(self.app.get_install_dir(), USER_NAME, recursive=True)

        config_data_dir = join(app_data_dir, 'config')
        log_dir = join(app_data_dir, 'log')

        fs.makepath(config_data_dir)
        fs.makepath(log_dir)

        fs.chownpath(app_data_dir, USER_NAME, recursive=True)

        config_app_dir = join(self.app.get_install_dir(), APP_CONFIG_PATH)
        symlink(config_data_dir, config_app_dir)

        database_init(self.log, self.app.get_install_dir(),
                      self.app.get_data_dir(), USER_NAME)

        print("setup systemd")
        self.app.add_service(SYSTEMD_POSTGRESQL)
        self.app.add_service(SYSTEMD_PHP_FPM_NAME)
        self.app.add_service(SYSTEMD_NGINX_NAME)

        self.prepare_storage()

        if self.installed():
            self.upgrade()
        else:
            self.initialize()

        cron = OwncloudCron(join(self.app.get_install_dir(), CRON_CMD),
                            CRON_USER)
        cron.remove()
        cron.create()

        oc_config = OCConfig(join(self.app.get_install_dir(), OC_CONFIG_PATH))
        oc_config.set_value('memcache.local', '\OC\Memcache\APCu')
        oc_config.set_value('loglevel', '2')
        oc_config.set_value('logfile',
                            join(self.app.get_data_dir(), OWNCLOUD_LOG_PATH))
        oc_config.set_value('datadirectory', self.app.get_storage_dir())

        self.on_domain_change()

        fs.chownpath(self.app.get_data_dir(), USER_NAME, recursive=True)

        self.app.register_web(WEB_PORT)