{"id":20156282,"url":"https://github.com/dsccommunity/xwordpress","last_synced_at":"2025-04-09T22:23:38.972Z","repository":{"id":30468285,"uuid":"34022271","full_name":"dsccommunity/xWordPress","owner":"dsccommunity","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-23T17:34:06.000Z","size":56,"stargazers_count":4,"open_issues_count":3,"forks_count":9,"subscribers_count":19,"default_branch":"dev","last_synced_at":"2025-03-24T00:16:52.126Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dsccommunity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-15T22:43:11.000Z","updated_at":"2024-09-01T23:06:18.000Z","dependencies_parsed_at":"2023-01-14T17:01:07.445Z","dependency_job_id":null,"html_url":"https://github.com/dsccommunity/xWordPress","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsccommunity%2FxWordPress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsccommunity%2FxWordPress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsccommunity%2FxWordPress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsccommunity%2FxWordPress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dsccommunity","download_url":"https://codeload.github.com/dsccommunity/xWordPress/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248120947,"owners_count":21051055,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T23:38:15.980Z","updated_at":"2025-04-09T22:23:38.944Z","avatar_url":"https://github.com/dsccommunity.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build status](https://ci.appveyor.com/api/projects/status/ry28ehtnhrybtjti/branch/master?svg=true)](https://ci.appveyor.com/project/PowerShell/xwordpress/branch/master)\r\n\r\n# xWordPress\r\n\r\nThe **xWordPress** module contains the **xWordPressSite** and **xIisWordPressSite** DSC resources that setup a WordPress Site.\r\n\r\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\r\nFor more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\r\n\r\n## Contributing\r\n\r\nPlease check out common DSC Resources [contributing guidelines](https://github.com/PowerShell/DscResource.Kit/blob/master/CONTRIBUTING.md).\r\n\r\n## Resources\r\n\r\n* **xIisWordPressSite** is a composite configuration that configures an IIS site with WordPress.\r\n* **xWordPressSite** configures a WordPress Site.\r\n\r\n### xIisWordPressSite\r\n\r\n* **DestinationPath**: The path on the filesystem were the web site will be setup.\r\n* **DownloadUri**: The URI to download the WordPress Zip file\r\n* **PackageFolder**: The URI to download the WordPress Zip file computer name\r\n* **PackageFolder**: The folder where the WordPress zip will be downloaded. This path MUST already exist.\r\n* **Configuration**: The contents of the WordPress configuration file (wp-config.php).\r\n\r\n### xWordPressSite\r\n\r\n* **Uri**: The WordPress Site URI.\r\n* **Title**: The WordPress Site Default page title.\r\n* **AdministratorCredential**: The user name and password of the WordPress administrator to create when creating the site.\r\n* **AdministratorEmail**: The email address of the WordPress administrator to create.\r\n* **Ensure**: { Present }\r\n\r\n## Versions\r\n\r\n### Unreleased\r\n\r\n* Updated sample to reference the renamed xPhpProvision resource in the xPhp\r\n  module and version 5.7.15 of MySQL.\r\n* Update appveyor.yml to use the default template.\r\n* Added default template files .codecov.yml, .gitattributes, and .gitignore, and\r\n  .vscode folder.\r\n* Minor style changes to README.md.\r\n* Added `Import-DscResource` to xIisWordPressSite to import dependent modules.\r\n\r\n### 1.1.0.0\r\n\r\n* Updated schema (ValueMap)\r\n* Fixed encoding\r\n\r\n### 1.0.0.0\r\n\r\n* Initial release with the following resources\r\n  * xWordPressSite\r\n  * xIisWordPressSite\r\n\r\n## Examples\r\n\r\n### Setup a WordPress Site on a single node\r\n\r\nThis configuration will set a WordPress Site on a single node.\r\nNote: This requires the following DSC modules:\r\n\r\n* xPsDesiredStateConfiguration\r\n* xMySql\r\n* xPhp\r\n* xWebAdministration\r\n\r\n```powershell\r\n# This configuration configures a Basic WordPress Site\r\n# It requires xPhp, xMySql, xWordPress, and xWebAdministration\r\n# Please review the note about the FQDN variable and\r\n# about the URLs, they may need to be updated.\r\n# ********* NOTE ***********\r\n# If you are not targeting the local machine,\r\n# or this does not resolve to the correct FQDN for the machine\r\n# Update this to the FQDN of the target machine\r\n# **************************\r\n[string] $fqdn = [System.Net.Dns]::GetHostByName(($env:computerName)).HostName\r\nWrite-Host \"Target Machine FQDN: $fqdn\"\r\n[string] $role = 'WordPress'\r\n$dataRoot = Split-Path $MyInvocation.MyCommand.Path\r\n$phpTemplatePath = join-Path $dataRoot \"phpConfigTemplate.txt\"\r\n$WordPressTemplatePath = Join-Path $dataRoot \"WordPressConfigurationTemplate.ps1\"\r\nif (-not (Test-Path $WordPressTemplatePath))\r\n{\r\n    $message = \"Missing required file $WordPressTemplatePath\"\r\n    # This file is in the samples folder of the resource\r\n    throw $message\r\n}\r\n$plainPassword = 'pass@word1'\r\n$pwd = convertTo-SecureString -String $plainPassword -AsPlainText -Force\r\n$WordPressUserName = 'WordPressUser'\r\n$WordPressDatabase = 'WordPress'\r\n# Generate the contents of the WordPress configuration\r\n$wordPressConfig = \u0026 $WordPressTemplatePath -WordPressDatabase $WordPressDatabase -WordPressUserName $WordPressUserName -PlainPassword $plainPassword\r\n# ********* NOTE ***********\r\n# PHP and My SQL change their download URLs frequently.  Please verify the URLs.\r\n# the WordPress and VC Redist URL change less frequently, but should still be verified.\r\n# After verifying the download URLs for the products and update them appropriately.\r\n# **************************\r\n$configurationData = @{\r\n    AllNodes = @(\r\n        @{\r\n            Role = $role\r\n            NodeName = $fqdn\r\n            PSDscAllowPlainTextPassword = $true;\r\n            WordPress = @{\r\n                Title = 'DSC WordPress Site Title'\r\n                Admin = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist ('DscAdmin', $pwd)\r\n                Email = 'dscadmin@contoso.com'\r\n                Uri = \"http://$fqdn\"\r\n                DownloadURI = 'http://WordPress.org/latest.zip'\r\n                Path = (Join-Path $env:SystemDrive  'wwwWordPress')\r\n                Config = $wordPressConfig\r\n                SiteName = 'WordPress'\r\n                TemplatePath = $WordPressTemplatePath\r\n                UserName = $WordPressUserName\r\n                Database = $WordPressDatabase\r\n                User = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist ($WordPressUserName, $pwd)\r\n            }\r\n\r\n            Php = @{\r\n                # Update with the latest \"VC11 x64 Non Thread Safe\" from http://windows.php.net/download/\r\n                DownloadURI = 'http://windows.php.net/downloads/releases/php-5.5.14-nts-Win32-VC11-x64.zip'\r\n                TemplatePath = $phpTemplatePath\r\n                Path = \"$env:SystemDrive\\php\"\r\n                Vc2012RedistUri = 'http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe'\r\n            }\r\n            PackageFolder = \"$env:SystemDrive\\packages\"\r\n            MySqlDownloadURI = 'http://dev.mysql.com/get/Downloads/MySQLInstaller/mysql-installer-community-5.7.15.0.msi'\r\n            Credential = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist ('userNameNotUsed', $pwd) #the password for root. no user name is needed as MySql installer is using only the user \"root\".\r\n            PlainPassword = $plainPassword\r\n\r\n         }\r\n    )\r\n}\r\n# Configuration to configure a Single machine WordPress Site\r\nConfiguration WordPress\r\n{\r\n    # Import composite resources\r\n    Import-DscResource -module xMySql\r\n    Import-DscResource -module xPhp\r\n    Import-DscResource -module xWordPress\r\n    Node $AllNodes.NodeName\r\n    {\r\n        # Make sure we have a folder for the packages\r\n        File PackagesFolder\r\n        {\r\n            DestinationPath = $Node.PackageFolder\r\n            Type = 'Directory'\r\n            Ensure = 'Present'\r\n        }\r\n        # Make sure PHP is installed in IIS\r\n        xPhpProvision php\r\n        {\r\n            InstallMySqlExt = $true\r\n            PackageFolder =  $Node.PackageFolder\r\n            DownloadUri = $Node.Php.DownloadURI\r\n            DestinationPath = $Node.Php.Path\r\n            ConfigurationPath = $Node.Php.TemplatePath\r\n            Vc2012RedistDownloadUri = $Node.Php.Vc2012RedistUri\r\n        }\r\n        # Make sure MySql is installed with a WordPress database\r\n        xMySqlProvision mySql\r\n        {\r\n            DownloadURI = $Node.MySqlDownloadURI\r\n            MySQLVersion = '5.7.15'\r\n            RootCredential = $Node.Credential\r\n            DatabaseName = 'WordPress'\r\n            UserCredential =  $Node.WordPress.User\r\n            PermissionType = 'ALL PRIVILEGES'\r\n        }\r\n\r\n        # Make sure the IIS site for WordPress is created\r\n        # Note, you still need to create the actuall WordPress Site after this.\r\n        xIisWordPressSite iisWordPressSite\r\n        {\r\n            DestinationPath = $Node.WordPress.Path\r\n            DownloadUri = $Node.WordPress.DownloadURI\r\n            PackageFolder = $Node.PackageFolder\r\n            Configuration = $Node.WordPress.Config\r\n        }\r\n        # Make sure the WordPress site is present\r\n        xWordPressSite WordPressSite\r\n        {\r\n            Uri = $Node.WordPress.Uri\r\n            Title = $Node.WordPress.Title\r\n            AdministratorCredential = $Node.WordPress.Admin\r\n            AdministratorEmail = $Node.WordPress.Email\r\n        }\r\n        # Make sure LCM will reboot if needed\r\n        LocalConfigurationManager\r\n        {\r\n            RebootNodeIfNeeded = $true\r\n            # uncomment when debugging on WMF 5 and above.\r\n            # DebugMode = $true\r\n        }\r\n    }\r\n}\r\n$outputFolder = \"$env:USERPROFILE\\Desktop\\WordPress\"\r\nWordpress -OutputPath $outputFolder -ConfigurationData $configurationData\r\nSet-DscLocalConfigurationManager -path $outputFolder -verbose\r\nStart-DscConfiguration -Wait -Verbose -path $outputFolder\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsccommunity%2Fxwordpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdsccommunity%2Fxwordpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsccommunity%2Fxwordpress/lists"}