Пример #1
0
        /// <summary>
        /// Installs MSI package on remote server using a MSI package found on local
        /// file path (not on target server). ConDep will first copy the MSI package to the server
        /// and then install the package.
        /// </summary>
        /// <param name="install"></param>
        /// <param name="packageName">A uniqe package name (DisplayName in Windows Registry) to make this
        /// operation idempotent. If this package name is not correct, ConDep will install this package
        /// on every execution. ConDep looks in these three registry keys for installed software packages:
        /// HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall
        /// HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall
        /// HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall</param>
        /// <param name="srcMsiFilePath">A local file path to the MSI package (not a path on target server).</param>
        /// <returns></returns>
        public static IOfferRemoteInstallation Msi(this IOfferRemoteInstallation install, string packageName, string srcMsiFilePath)
        {
            var msiOperation = new MsiOperation(packageName, srcMsiFilePath);

            OperationExecutor.Execute((RemoteBuilder)install, msiOperation);
            return(install);
        }
Пример #2
0
        /// <summary>
        /// Will check if Windows Update package is installed, and install package if not already installed.
        /// </summary>
        /// <param name="install"></param>
        /// <param name="packageId">Windows package KB-id. Example: KB1234567</param>
        /// <param name="packageUrl">The URL for the msi install file</param>
        /// <param name="packageName">A uniqe package name (DisplayName in Windows Registry) to make this
        /// operation idempotent. Example: Security Update for Microsoft .NET Framework 4.5.1 (KB2972216).
        /// If this package name is not correct, ConDep will install this package
        /// on every execution. ConDep looks in these three registry keys for installed software packages:
        /// HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall
        /// HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall
        /// HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall</param>
        /// <returns></returns>
        public static IOfferRemoteInstallation WindowsUpdate(this IOfferRemoteInstallation install, string packageId, string packageUrl, string packageName)
        {
            var winUpdateOperation = new InstallWindowsUpdateOperation(packageId, packageUrl, packageName);

            OperationExecutor.Execute((RemoteBuilder)install, winUpdateOperation);
            return(install);
        }
Пример #3
0
        /// <summary>
        /// Will execute a PowerShell command on remote server with provided options.
        /// </summary>
        /// <param name="command"></param>
        /// <param name="powerShellOptions"></param>
        /// <returns></returns>
        public static IOfferRemoteExecution PowerShell(this IOfferRemoteExecution execute, FileInfo scriptFile)
        {
            var psProvider = new PowerShellOperation(scriptFile);

            OperationExecutor.Execute((RemoteBuilder)execute, psProvider);
            return(execute);
        }
Пример #4
0
        /// <summary>
        /// Creates a new Web Site in IIS if not exist. If exist, will delete and then create new.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static IOfferRemoteConfiguration IISWebSite(this IOfferRemoteConfiguration infra, string name, int id)
        {
            var op = new IisWebSiteOperation(name, id);

            OperationExecutor.Execute((RemoteBuilder)infra, op);
            return(infra);
        }
Пример #5
0
        /// <summary>
        /// Will take a folder or file and zip into specified zip-file.
        /// </summary>
        /// <param name="install"></param>
        /// <param name="pathToCompress">Path to file or directory to compress</param>
        /// <param name="destZipFile">Name of zip-file to add compressed content to</param>
        /// <returns></returns>
        public static IOfferRemoteInstallation Zip(this IOfferRemoteInstallation install, string pathToCompress, string destZipFile)
        {
            var zipOperation = new ZipOperation(pathToCompress, destZipFile);

            OperationExecutor.Execute((RemoteBuilder)install, zipOperation);
            return(install);
        }
Пример #6
0
        /// <summary>
        /// Will execute a DOS command using cmd.exe on remote server.
        /// </summary>
        /// <param name="execute"></param>
        /// <param name="cmd"></param>
        /// <returns></returns>
        public static IOfferRemoteExecution DosCommand(this IOfferRemoteExecution execute, string cmd)
        {
            var runCmdOperation = new RunCmdPsOperation(cmd);

            OperationExecutor.Execute((RemoteBuilder)execute, runCmdOperation);
            return(execute);
        }
Пример #7
0
        /// <summary>
        /// Will execute a PowerShell command on remote server.
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public static IOfferRemoteExecution PowerShell(this IOfferRemoteExecution execute, string command)
        {
            var psProvider = new PowerShellOperation(command);

            OperationExecutor.Execute((RemoteBuilder)execute, psProvider);
            return(execute);
        }
        public static IOfferRemoteOperations Restart(this IOfferRemoteOperations remote, int delayInSeconds = 10)
        {
            var restartOperation = new RestartComputerOperation(delayInSeconds);

            OperationExecutor.Execute((RemoteBuilder)remote, restartOperation);
            return(remote);
        }
        /// <summary>
        /// Adds user to group
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="userName">Username</param>
        /// <param name="groupName">Group name</param>
        /// <returns></returns>
        public static IOfferRemoteOperations AddUserToLocalGroup(this IOfferRemoteOperations configuration, string userName, string groupName)
        {
            var operation = new AddUserToLocalGroupOperation(userName, groupName);

            OperationExecutor.Execute((RemoteBuilder)configuration, operation);
            return(configuration);
        }
        /// <summary>
        /// Works exactly as the Directory operation, except it will mark the directory as a Web Application on remote server.
        /// </summary>
        /// <param name="sourceDir"></param>
        /// <param name="destDir"></param>
        /// <param name="webAppName"></param>
        /// <param name="webSiteName"></param>
        /// <returns></returns>
        public static IOfferRemoteDeployment IisWebApplication(this IOfferRemoteDeployment remote, string sourceDir, string destDir, string webAppName, string webSiteName)
        {
            var webAppOperation = new WebAppOperation(sourceDir, webAppName, webSiteName, destDir);

            OperationExecutor.Execute((RemoteBuilder)remote, webAppOperation);
            return(remote);
        }
        /// <summary>
        /// Creates a directory, if it not already exists.
        /// </summary>
        /// <param name="remote"></param>
        /// <param name="path">Directory path</param>
        /// <returns></returns>
        public static IOfferRemoteOperations CreateDirectory(this IOfferRemoteOperations remote, string path)
        {
            var operation = new CreateDirectoryOperation(path);

            OperationExecutor.Execute((RemoteBuilder)remote, operation);
            return(remote);
        }
        /// <summary>
        /// Will deploy local file and its attributes to remote server.
        /// </summary>
        /// <param name="sourceFile"></param>
        /// <param name="destFile"></param>
        /// <returns></returns>
        public static IOfferRemoteDeployment File(this IOfferRemoteDeployment remote, string sourceFile, string destFile)
        {
            var copyFileOperation = new CopyFileOperation(sourceFile, destFile);

            OperationExecutor.Execute((RemoteBuilder)remote, copyFileOperation);
            return(remote);
        }
        /// <summary>
        /// Will deploy local source directory to remote destination directory. This operation does dot just copy directory content, but synchronize the the source folder to the destination. If a file already exist on destination, it will be updated to match source file. If a file exist on destination, but not in source directory, it will be removed from destination. If a file is readonly on destination, but read/write in source, destination file will be updated with read/write.
        /// </summary>
        /// <param name="sourceDir"></param>
        /// <param name="destDir"></param>
        /// <returns></returns>
        public static IOfferRemoteDeployment Directory(this IOfferRemoteDeployment remote, string sourceDir, string destDir)
        {
            var copyDirOperation = new CopyDirOperation(sourceDir, destDir);

            OperationExecutor.Execute((RemoteBuilder)remote, copyDirOperation);
            return(remote);
        }
        /// <summary>
        /// Exactly the same as the WindowsService operation, only tailored for NServiceBus.
        /// </summary>
        /// <param name="sourceDir"></param>
        /// <param name="destDir"></param>
        /// <param name="serviceName"></param>
        /// <param name="profile"> </param>
        /// <param name="options"></param>
        /// <returns></returns>
        public static IOfferRemoteDeployment NServiceBusEndpoint(this IOfferRemoteDeployment remote, string sourceDir, string destDir, string serviceName, string profile, Action <IOfferWindowsServiceOptions> options)
        {
            var nServiceBusProvider = new NServiceBusOperation(sourceDir, destDir, serviceName, profile, options);

            OperationExecutor.Execute((RemoteBuilder)remote, nServiceBusProvider);
            return(remote);
        }
Пример #15
0
        public static IOfferRemoteOperations StartConDepNode(this IOfferRemoteOperations remote)
        {
            var op = new StartConDepNodeOperation();

            OperationExecutor.Execute((RemoteBuilder)remote, op);
            return(remote);
        }
Пример #16
0
        /// <summary>
        /// Transforms .NET configuration files (web and app config), in exactly the same way as msbuild and Visual Studio does.
        /// </summary>
        /// <param name="local"></param>
        /// <param name="configDirPath">Path to directory where the config you want to transform is located</param>
        /// <param name="configName">Name of the config file you want to transform</param>
        /// <param name="transformName">Name of the transform file you want to use for transformation</param>
        /// <returns>
        /// </returns>
        public static IOfferLocalOperations TransformConfigFile(this IOfferLocalOperations local, string configDirPath, string configName, string transformName)
        {
            var operation = new TransformConfigOperation(configDirPath, configName, transformName);

            OperationExecutor.Execute((LocalBuilder)local, operation);
            return(local);
        }
Пример #17
0
        /// <summary>
        /// Will unzip archive to specified destination. This uses the DotNetZip library under the hood. For more information go to http://dotnetzip.codeplex.com/
        /// </summary>
        /// <param name="install"></param>
        /// <param name="filePath">Path to zip file</param>
        /// <param name="destPath">Path to where archive content should be extracted</param>
        /// <returns></returns>
        public static IOfferRemoteInstallation UnZip(this IOfferRemoteInstallation install, string filePath, string destPath)
        {
            var zipOperation = new UnZipOperation(filePath, destPath);

            OperationExecutor.Execute((RemoteBuilder)install, zipOperation);
            return(install);
        }
Пример #18
0
        /// <summary>
        /// Sets ACL (Access Control Lists) on files or folders. Like chmod on Linux.
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="user">The user account that will get access</param>
        /// <param name="fileOrFolder">The file or folder to configure ACL for</param>
        /// <param name="accessRights">The access rights to allow</param>
        /// <returns></returns>
        public static IOfferRemoteConfiguration Acl(this IOfferRemoteConfiguration configuration, string user, string fileOrFolder, FileSystemRights accessRights)
        {
            var op = new AclOperation(user, fileOrFolder, accessRights, new AclOptions.AclOptionsValues());

            OperationExecutor.Execute((RemoteBuilder)configuration, op);
            return(configuration);
        }
Пример #19
0
        /// <summary>
        /// Installs IIS
        /// </summary>
        /// <returns></returns>
        public static IOfferRemoteConfiguration IIS(this IOfferRemoteConfiguration infra)
        {
            var op = new IisInfrastructureOperation();

            OperationExecutor.Execute((RemoteBuilder)infra, op);
            return(infra);
        }
Пример #20
0
        /// <summary>
        /// Creates environment variable if not exists. Overwrites the variable if exists.
        /// </summary>
        /// <param name="configure"></param>
        /// <param name="name">Variable name </param>
        /// <param name="value">Variable value</param>
        /// <param name="target">Variable target</param>
        /// <returns></returns>
        public static IOfferRemoteConfiguration EnvironmentVariable(this IOfferRemoteConfiguration configure, string name, string value, EnvironmentVariableTarget target)
        {
            var operation = new EnvironmentVariableOperation(name, value, target);

            OperationExecutor.Execute((RemoteBuilder)configure, operation);
            return(configure);
        }
Пример #21
0
        /// <summary>
        /// Sets the IIS machine key. Configures algorithms and keys to use for encryption,
        /// decryption, and validation of forms-authentication data and view-state data, and
        /// for out-of-process session state identification.
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="validationKey">Specifies the key used to validate encrypted data</param>
        /// <param name="decryptionKey">Specifies the key that is used to encrypt and decrypt data or the process by which the key is generated</param>
        /// <param name="validation">Specifies the type of encryption that is used to validate data</param>
        /// <returns></returns>
        public static IOfferRemoteConfiguration IisMachineKey(this IOfferRemoteConfiguration configuration, string validationKey, string decryptionKey, MachineKeyValidation validation)
        {
            var operation = new SetIisMachineKeyOperation(validationKey, decryptionKey, validation);

            OperationExecutor.Execute((RemoteBuilder)configuration, operation);
            return(configuration);
        }
Пример #22
0
        /// <summary>
        /// Disables User Account Control. The operation is idempotent and will trigger a restart, but only if UAC not is already disabled.
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="enabled">Specify if you want UAC enabled or not. E.g. setting this to false will disable UAC.</param>
        /// <returns></returns>
        public static IOfferRemoteConfiguration UserAccountControl(this IOfferRemoteConfiguration configuration, bool enabled)
        {
            var operation = new UserAccountControlOperation(enabled);

            OperationExecutor.Execute((RemoteBuilder)configuration, operation);
            return(configuration);
        }
Пример #23
0
        /// <summary>
        /// Will create a new Application Pool in IIS.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static IOfferRemoteConfiguration IISAppPool(this IOfferRemoteConfiguration infra, string name)
        {
            var op = new IisAppPoolOperation(name);

            OperationExecutor.Execute((RemoteBuilder)infra, op);
            return(infra);
        }
Пример #24
0
        /// <summary>
        /// Executes a simple HTTP GET to the specified url expecting a 200 (OK) in return. Will throw an exception if not 200.
        /// </summary>
        /// <param name="local"></param>
        /// <param name="url">The URL you want to HTTP GET</param>
        /// <returns></returns>
        public static IOfferLocalOperations HttpGet(this IOfferLocalOperations local, string url)
        {
            var operation = new HttpGetOperation(url);

            OperationExecutor.Execute((LocalBuilder)local, operation);
            return(local);
        }
Пример #25
0
        /// <summary>
        /// Will deploy certificate found by find type and find value from the local certificate store, to remote certificate store on server.
        /// </summary>
        /// <param name="findType"></param>
        /// <param name="findValue"></param>
        /// <returns></returns>
        public static IOfferRemoteConfiguration FromStore(this IOfferSslInfrastructure sslInfra, X509FindType findType, string findValue)
        {
            var infraBuilder = ((SslInfrastructureBuilder)sslInfra).InfrastructureBuilder;
            var certOp       = new CertificateFromStoreOperation(findType, findValue);

            OperationExecutor.Execute((RemoteBuilder)sslInfra, certOp);
            return(infraBuilder);
        }
Пример #26
0
        /// <summary>
        /// Offer common Windows operations
        /// </summary>
        /// <returns></returns>
        public static IOfferRemoteConfiguration Windows(this IOfferRemoteConfiguration infra, Action <WindowsInfrastructureOptions> options)
        {
            var op = new WindowsFeatureInfrastructureOperation();

            options(new WindowsInfrastructureOptions(op));
            OperationExecutor.Execute((RemoteBuilder)infra, op);
            return(infra);
        }
Пример #27
0
        /// <summary>
        /// Deletes a value in Windows Registry.
        /// </summary>
        /// <param name="reg"></param>
        /// <param name="root">The Windows Registry hive to use. See <see cref="WindowsRegistryRoot"/> for available options. Example: WindowsRegistryRoot.HKEY_LOCAL_MACHINE</param>
        /// <param name="key">Name of the key where the value you want to delete exists. Example: SOFTWARE\ConDep</param>
        /// <param name="valueName">Name of the value you want to delete.</param>
        /// <returns></returns>
        public static IOfferWindowsRegistryOperations DeleteValue(this IOfferWindowsRegistryOperations reg, WindowsRegistryRoot root, string key, string valueName)
        {
            var op         = new DeleteWindowsRegistryValueOperation(root, key, valueName);
            var regBuilder = reg as WindowsRegistryBuilder;

            OperationExecutor.Execute((RemoteBuilder)reg, op);
            return(reg);
        }
Пример #28
0
        /// <summary>
        /// Creates or updates a Windows Registry value.
        /// </summary>
        /// <param name="reg"></param>
        /// <param name="root">The Windows Registry hive to use. See <see cref="WindowsRegistryRoot"/> for available options. Example: WindowsRegistryRoot.HKEY_LOCAL_MACHINE</param>
        /// <param name="key">Name of the key containing the value you want to create or update. Example: SOFTWARE\ConDep</param>
        /// <param name="valueName">Name of the registry value</param>
        /// <param name="valueData">The data value you want to set</param>
        /// <param name="valueKind">The data type to use when storing values in the registry</param>
        /// <returns></returns>
        public static IOfferWindowsRegistryOperations SetValue(this IOfferWindowsRegistryOperations reg, WindowsRegistryRoot root, string key, string valueName, string valueData, RegistryValueKind valueKind)
        {
            var op         = new SetWindowsRegistryValueOperation(root, key, valueName, valueData, valueKind);
            var regBuilder = reg as WindowsRegistryBuilder;

            OperationExecutor.Execute((RemoteBuilder)reg, op);
            return(reg);
        }
Пример #29
0
        /// <summary>
        /// Pre-compile Web Applications to optimize startup time for the application. Even though this operation exist in ConDep, we recommend you to pre-compile web applications as part of your build process, and not the deployment process, using aspnet_compiler.exe.
        /// </summary>
        /// <param name="local"></param>
        /// <param name="webApplicationName">Name of the web application you want to pre-compile</param>
        /// <param name="webApplicationPhysicalPath">Location path to web application</param>
        /// <param name="preCompileOutputpath">Path to where you want the pre-compiled application to be copied</param>
        /// <returns></returns>
        public static IOfferLocalOperations PreCompile(this IOfferLocalOperations local, string webApplicationName, string webApplicationPhysicalPath, string preCompileOutputpath)
        {
            var operation = new PreCompileOperation(webApplicationName, webApplicationPhysicalPath,
                                                    preCompileOutputpath);

            OperationExecutor.Execute((LocalBuilder)local, operation);
            return(local);
        }
Пример #30
0
        /// <summary>
        /// Will deploy certificate from local file path given correct password for private key, and deploy to certificate store on remote server.
        /// </summary>
        /// <param name="path"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public static IOfferRemoteConfiguration FromFile(this IOfferSslInfrastructure sslInfra, string path, string password)
        {
            var infraBuilder = ((SslInfrastructureBuilder)sslInfra).InfrastructureBuilder;
            var certOp       = new CertificateFromFileOperation(path, password);

            OperationExecutor.Execute((RemoteBuilder)sslInfra, certOp);
            return(infraBuilder);
        }