示例#1
0
文件: deploy.py 项目: zhaohb/polyaxon
 def install_on_docker_compose(self):
     path = ComposeConfigManager.get_config_filepath()
     path = "/".join(path.split("/")[:-1])
     # Fetch docker-compose
     Transport().download(
         url=
         "https://github.com/polyaxon/polyaxon-compose/archive/master.tar.gz",
         filename=path + "/file",
         untar=True,
         delete_tar=True,
         extract_path=path,
     )
     # Move necessary info
     shutil.copy(
         path + "/polyaxon-compose-master/docker-compose.yml",
         path + "/docker-compose.yml",
     )
     shutil.copy(path + "/polyaxon-compose-master/components.env",
                 path + "/components.env")
     shutil.copy(path + "/polyaxon-compose-master/base.env",
                 path + "/base.env")
     shutil.rmtree(path + "/polyaxon-compose-master/")
     # Generate env from config
     ComposeConfigManager.set_config(self.compose.generate_env(self.config))
     Printer.print_success("Docker Compose deployment is initialised.")
     if self.dry_run:
         Printer.print_success("Polyaxon generated deployment env.")
         return
     self.docker.execute(["volume", "create", "--name=polyaxon-postgres"])
     Printer.print_success("Docker volume created.")
     self.compose.execute(["-f", path + "/docker-compose.yml", "up", "-d"])
     Printer.print_success("Deployment is running in the background.")
     Printer.print_success("You can configure your CLI by running: "
                           "polyaxon config set --host=localhost.")
示例#2
0
    def check_for_docker_compose(self):
        # Deployment on docker compose requires Docker & Docker Compose to be installed
        if not self.docker.check():
            raise PolyaxonException("Docker is required to run this command.")
        Printer.print_success("Docker is installed")

        if not self.compose.check():
            raise PolyaxonException("Docker Compose is required to run this command.")
        Printer.print_success("Docker Compose is installed")

        # Check that .polyaxon/.compose is set and up-to date
        if ComposeConfigManager.is_initialized():
            Printer.print_success("Docker Compose deployment is initialised.")
        return True
示例#3
0
文件: deploy.py 项目: zhaohb/polyaxon
 def teardown_on_docker_compose(self):
     path = ComposeConfigManager.get_config_filepath()
     path = "/".join(path.split("/")[:-1])
     self.compose.execute(["-f", path + "/docker-compose.yml", "down"])