Esempio n. 1
0
def get_available_services(project_dir: str):
    """Get standard services bundled with stakkr."""
    services_dir = file_utils.get_dir('static') + '/services/'
    conf_files = _get_services_from_dir(services_dir)

    services = dict()
    for conf_file in conf_files:
        services[conf_file[:-4]] = services_dir + conf_file

    services = _add_local_services(project_dir, services)

    return services
Esempio n. 2
0
def get_available_services(project_dir: str):
    """Get standard services bundled with stakkr."""
    services_dir = file_utils.get_dir('static') + '/services/'
    conf_files = _get_services_from_dir(services_dir)

    services = dict()
    for conf_file in conf_files:
        services[conf_file[:-4]] = services_dir + conf_file

    services = _add_local_services(project_dir, services)

    return services
Esempio n. 3
0
 def _start_container(self):
     """Start proxy."""
     proxy_conf_dir = get_dir('static/proxy')
     try:
         self.docker_client.images.pull('traefik:latest')
         self.docker_client.containers.run(
             'traefik:latest', remove=True, detach=True,
             hostname=self.ct_name, name=self.ct_name,
             volumes=[
                 '/var/run/docker.sock:/var/run/docker.sock',
                 '{}/traefik.toml:/etc/traefik/traefik.toml'.format(proxy_conf_dir),
                 '{}/ssl:/etc/traefik/ssl'.format(proxy_conf_dir)],
             ports={80: self.ports['http'], 8080: 8080, 443: self.ports['https']})
     except DockerException as error:
         raise RuntimeError("Can't start proxy ...({})".format(error))
Esempio n. 4
0
 def _start_container(self):
     """Start proxy."""
     proxy_conf_dir = get_dir('static/proxy')
     try:
         self.docker_client.images.pull('traefik:latest')
         self.docker_client.containers.run(
             'traefik:latest',
             remove=True,
             detach=True,
             hostname=self.ct_name,
             name=self.ct_name,
             volumes=[
                 '/var/run/docker.sock:/var/run/docker.sock',
                 '{}/traefik.toml:/etc/traefik/traefik.toml'.format(
                     proxy_conf_dir),
                 '{}/ssl:/etc/traefik/ssl'.format(proxy_conf_dir)
             ],
             ports={
                 80: self.ports['http'],
                 8080: 8080,
                 443: self.ports['https']
             })
     except DockerException as error:
         raise RuntimeError("Can't start proxy ...({})".format(error))
Esempio n. 5
0
 def test_get_file(self):
     file = file_utils.get_dir('static/config_default.yml')
     self.assertTrue(isfile(file))
Esempio n. 6
0
 def test_get_dir(self):
     dir = file_utils.get_dir('static')
     self.assertTrue(isdir(dir))
     self.assertTrue(isfile(dir + '/docker-compose.yml'))
 def test_get_file(self):
     self.assertEquals(
         dirname(dirname(realpath(__file__))) + '/stakkr/static/config_default.yml',
         file_utils.get_dir('static/config_default.yml'))
 def test_get_dir(self):
     self.assertEquals(
         dirname(dirname(realpath(__file__))) + '/stakkr/static',
         file_utils.get_dir('static'))
Esempio n. 9
0
 def test_get_file(self):
     self.assertEquals(
         dirname(dirname(realpath(__file__))) +
         '/stakkr/static/config_default.yml',
         file_utils.get_dir('static/config_default.yml'))
Esempio n. 10
0
 def test_get_dir(self):
     self.assertEquals(
         dirname(dirname(realpath(__file__))) + '/stakkr/static',
         file_utils.get_dir('static'))