Ejemplo n.º 1
0
        private void StopAndRemove(string rootName, string serviceName, string subscription, string slot)
        {
            var deploymentStatusCommand = new GetDeploymentStatus(Channel)
            {
                ShareChannel = ShareChannel, CurrentSubscription = CurrentSubscription
            };

            if (deploymentStatusCommand.DeploymentExists(rootName, serviceName, slot, subscription))
            {
                DeploymentStatusManager setDeployment = new DeploymentStatusManager(Channel)
                {
                    ShareChannel = ShareChannel, CurrentSubscription = CurrentSubscription
                };
                setDeployment.SetDeploymentStatusProcess(rootName, DeploymentStatus.Suspended, slot, subscription, serviceName);

                deploymentStatusCommand.WaitForState(DeploymentStatus.Suspended, rootName, serviceName, slot, subscription);

                RemoveAzureDeploymentCommand removeDeployment = new RemoveAzureDeploymentCommand(Channel)
                {
                    ShareChannel = ShareChannel, CurrentSubscription = CurrentSubscription
                };
                removeDeployment.RemoveAzureDeploymentProcess(rootName, serviceName, slot, subscription);

                while (deploymentStatusCommand.DeploymentExists(rootName, serviceName, slot, subscription))
                {
                    ;
                }
            }
        }
Ejemplo n.º 2
0
        private void StopAndRemove(string rootName, string serviceName, string subscription, string slot)
        {
            GetDeploymentStatus getDeployment = new GetDeploymentStatus(this.Channel);

            if (getDeployment.DeploymentExists(rootName, serviceName, slot, subscription))
            {
                DeploymentStatusManager setDeployment = new DeploymentStatusManager(this.Channel);
                setDeployment.SetDeploymentStatusProcess(rootName, DeploymentStatus.Suspended, slot, subscription, serviceName);

                getDeployment.WaitForState(DeploymentStatus.Suspended, rootName, serviceName, slot, subscription);

                RemoveAzureDeploymentCommand removeDeployment = new RemoveAzureDeploymentCommand(this.Channel);
                removeDeployment.RemoveAzureDeploymentProcess(rootName, serviceName, slot, subscription);

                while (getDeployment.DeploymentExists(rootName, serviceName, slot, subscription))
                {
                    ;
                }
            }
        }
Ejemplo n.º 3
0
        public void PublishService(string serviceRootPath)
        {
            SafeWriteObject(string.Format(Resources.PublishServiceStartMessage, _hostedServiceName));
            SafeWriteObject(string.Empty);

            // Package the service and all of its roles up in the open package format used by Azure
            InitializeSettingsAndCreatePackage(serviceRootPath);

            if (ServiceExists())
            {
                bool deploymentExists = new GetDeploymentStatus(this.Channel).DeploymentExists(_azureService.Paths.RootPath, _hostedServiceName, _deploymentSettings.ServiceSettings.Slot, _deploymentSettings.ServiceSettings.Subscription);

                if (deploymentExists)
                {
                    UpgradeDeployment();
                }
                else
                {
                    CreateNewDeployment();
                }
            }
            else
            {
                CreateHostedService();
                CreateNewDeployment();
            }

            // Remove package after creating the deployment
            RemovePackage();

            // Verify the deployment succeeded by checking that each of the roles are running
            VerifyDeployment();

            // After we've finished deploying, optionally launch a browser pointed at the service
            if (Launch && CanGenerateUrlForDeploymentSlot())
            {
                LaunchService();
            }
        }
Ejemplo n.º 4
0
        private void StopAndRemove(string rootName, string serviceName, string subscription, string slot)
        {
            var deploymentStatusCommand = new GetDeploymentStatus(Channel) { ShareChannel = ShareChannel, CurrentSubscription = CurrentSubscription };
            if (deploymentStatusCommand.DeploymentExists(rootName, serviceName, slot, subscription))
            {
                DeploymentStatusManager setDeployment = new DeploymentStatusManager(Channel) { ShareChannel = ShareChannel, CurrentSubscription = CurrentSubscription };
                setDeployment.SetDeploymentStatusProcess(rootName, DeploymentStatus.Suspended, slot, subscription, serviceName);

                deploymentStatusCommand.WaitForState(DeploymentStatus.Suspended, rootName, serviceName, slot, subscription);

                RemoveAzureDeploymentCommand removeDeployment = new RemoveAzureDeploymentCommand(Channel) { ShareChannel = ShareChannel, CurrentSubscription = CurrentSubscription };
                removeDeployment.RemoveAzureDeploymentProcess(rootName, serviceName, slot, subscription);

                while (deploymentStatusCommand.DeploymentExists(rootName, serviceName, slot, subscription)) ;
            }
        }
        public void PublishService(string serviceRootPath)
        {
            AzureTool.Validate();
            WriteVerbose(string.Format(Resources.PublishServiceStartMessage, _hostedServiceName));

            // Package the service and all of its roles up in the open package format used by Azure
            if (InitializeSettingsAndCreatePackage(serviceRootPath))
            {
                if (ServiceExists())
                {
                    var deploymentStatusCommand = new GetDeploymentStatus(Channel, CommandRuntime)
                    { ShareChannel = ShareChannel, CurrentSubscription = CurrentSubscription };
                    bool deploymentExists = deploymentStatusCommand.DeploymentExists(
                        _azureService.Paths.RootPath,
                        _hostedServiceName,
                        _deploymentSettings.ServiceSettings.Slot,
                        _deploymentSettings.ServiceSettings.Subscription);
                    if (deploymentExists)
                    {
                        UpgradeDeployment();
                    }
                    else
                    {
                        CreateNewDeployment();
                    }
                }
                else
                {
                    CreateHostedService();
                    CreateNewDeployment();
                }

                // Verify the deployment succeeded by checking that each of the
                // roles are running
                VerifyDeployment();

                // After we've finished deploying, optionally launch a browser pointed at the service
                if (Launch && CanGenerateUrlForDeploymentSlot())
                {
                    LaunchService();
                }

                Deployment deployment = this.RetryCall<Deployment>(s => this.Channel.GetDeploymentBySlot(
                    s,
                    _hostedServiceName,
                    _deploymentSettings.ServiceSettings.Slot
                ));
                WriteObject(deployment);
            }
            else
            {
                WriteVerbose(Resources.PublishAbortedAtUserRequest);
            }

            WriteVerboseWithTimestamp(Resources.PublishCompleteMessage);
        }
        public void PublishService(string serviceRootPath)
        {
            SafeWriteObject(string.Format(Resources.PublishServiceStartMessage, _hostedServiceName));
            SafeWriteObject(string.Empty);

            // Package the service and all of its roles up in the open package format used by Azure
            InitializeSettingsAndCreatePackage(serviceRootPath);

            if (ServiceExists())
            {
                var deploymentStatusCommand = new GetDeploymentStatus(Channel) { ShareChannel = ShareChannel, CurrentSubscription = CurrentSubscription };
                bool deploymentExists = deploymentStatusCommand.DeploymentExists(_azureService.Paths.RootPath, _hostedServiceName, _deploymentSettings.ServiceSettings.Slot, _deploymentSettings.ServiceSettings.Subscription);
                if (deploymentExists)
                {
                    UpgradeDeployment();
                }
                else
                {
                    CreateNewDeployment();
                }
            }
            else
            {
                CreateHostedService();
                CreateNewDeployment();
            }

            // Verify the deployment succeeded by checking that each of the
            // roles are running
            VerifyDeployment();

            // After we've finished deploying, optionally launch a browser pointed at the service
            if (Launch && CanGenerateUrlForDeploymentSlot())
            {
                LaunchService();
            }
        }