Esempio n. 1
0
    def deploy_gke_app(self,
                       project_id: str,
                       cluster_name: str,
                       app_directory: str,
                       app_name: str,
                       image_name: str,
                       secrets: Dict[str, Dict[str, str]],
                       region: str = 'us-west1',
                       zone: str = 'us-west1-a') -> str:
        """Deploy a Django app to gke.

        Args:
            project_id: GCP project id.
            cluster_name: Name of the cluster to host the app.
            app_directory: Absolute path of the directory of your Django app.
            app_name: Name of the Django app.
            image_name: Tag of the docker image of the app.
            secrets: Secrets necessary to run the app.
            region: Where do you want to host the cluster.
            zone: Name of the Google Compute Engine zone in which the cluster
                resides.

        Raises:
            DeployNewAppError: If unable to deploy the app.

        Returns:
            The url of the deployed Django app.
        """
        workflow = _deploygke.DeploygkeWorkflow(self.credentials)
        return workflow.deploy_new_app_sync(project_id, cluster_name,
                                            app_directory, app_name,
                                            image_name, secrets, region, zone)
Esempio n. 2
0
    def update_gke_app(self,
                       project_id: str,
                       cluster_name: str,
                       app_directory: str,
                       app_name: str,
                       image_name: str,
                       zone: str = 'us-west1-a') -> str:
        """Update an existing Django app on gke.

        Args:
            project_id: GCP project id.
            cluster_name: Name of the cluster to host the app.
            app_directory: Absolute path of the directory of your Django app.
            app_name: Name of the Django app.
            image_name: Tag of the docker image of the app.
            zone: Name of the Google Compute Engine zone in which the cluster
                resides.

        Raises:
            DeployNewAppError: If unable to deploy the app.

        Returns:
            The url of the deployed Django app.
        """
        workflow = _deploygke.DeploygkeWorkflow(self.credentials)
        return workflow.update_app_sync(project_id, cluster_name,
                                        app_directory, app_name, image_name,
                                        zone)
Esempio n. 3
0
 def __init__(self, credentials: credentials.Credentials):
     self._source_generator = source_generator.DjangoSourceFileGenerator()
     self._billing_client = billing.BillingClient.from_credentials(
         credentials)
     self._project_workflow = _project.ProjectWorkflow(credentials)
     self._database_workflow = _database.DatabaseWorkflow(credentials)
     self._deploygke_workflow = _deploygke.DeploygkeWorkflow(credentials)
     self._deploygae_workflow = _deploygae.DeploygaeWorkflow()
     self._enable_service_workflow = _enable_service.EnableServiceWorkflow(
         credentials)
     self._service_account_workflow = (
         _service_account.ServiceAccountKeyGenerationWorkflow(credentials))
     self._static_content_workflow = (
         _static_content_serve.StaticContentServeWorkflow(credentials))
 def setUp(self):
     super().setUp()
     self.deploygke_workflow = (_deploygke.DeploygkeWorkflow(
         self.credentials))