Learn to install Drupal 8 on IIS server https://drupal.org/node/3854. It has been possible to install drupal on Microsoft IIS for a long time, but now we can use a full Microsoft Server. For a quick development setup I suggest using the Microsoft Web Platform Installer and using either the Acquia or the Commerce Guys installers.
IIS Chef is an infrastructure-as-code tooling utility for Windows environments, specifically targeted at deploying applications on IIS and Windows.
You describe your application needs (storage, IIS configuration, etc.) on a configuration file that is part of you artifact's/source, and Chef will deploy accordingly.
To quickly install the powershell CMDLet in your system with the latest build place the following code in a .bat file and run it:
Alternatively, a powershell script:
To automatically install chef use the following command:
You will be prompted for the install location.
What it is
Windows chef is a set of tools that can be run either through command line (powershell cmdlet) or as a windows service that automates the process of deploying applications based on descriptive yml files that are part of the application itself.
Think of this of a cheap self-hosted version of the 'infrastructure as code' trend, but it only deals with infrastructure configuration at the application level, not with setting up the infrastructure itself.
You can use this tool to automate application deployment in production environments as well as local development to ensure that the application is deployed in exactly the same way in both places.
It is designed to deploy applications in high density multi-tenant (Shared) resources with as much isolation as possible. So you can host as many applications as you want on a single web server sharing the same IIS, SQL Server and other resources.
The tool can also be used to automate modern devops practices such as 'environment-per-branch'.
Is this tool helpful now that Windows Containers are a deployment trend?
Sure. This tool can automate the process of deploying your application inside the container and setting up any required configuration.
Adding deployment information to your application
Drupal 9 Is
The next step is to add to your application information regarding 'what' services it needs to run. I.e. to run a Drupal site you will need a database backend, temporary, permanent and private disk storage, a caching backend such as couchbase, an site in iis, etc..
To describe this setup you create a folder in your application root called 'chef'. Inside this folder you can place several configuration files that will be applied by chef depending on the environment:
- chef.yml: default settings
- chef__local: setings for an environment called 'local'
- chef__local_1.x: settings only used for and environment called 'local' and the '1.x' branch.
Prior to deployment, chef will choose the correct configuration file depending on the current environment and application branch.
Installing an application
To deploy an application on a system you 'install' the application, that is, provide the necessary details to chef so that it can obtain the required artifacts for deployment.
Currently Chef only support deploying artifacts from Appveyor or the Filesystem (a local folder).
To install an application from a path you can use the Invoke-ChefAppDeployPath command:
Invoke-ChefAppDeployPath c:applicationsmycode myapplicationname
Once installed, Chef internally stores the information of 'where to grab' the artifact from and you can directly use other commands to interact with your application.
For example, to re-deploy an application (if you made any changes to the chef.yml settings file) you can use:
The previous example is a shortcut to deploy applications from local paths (mostly used in development environments).
The way to properly deploy an application is to create an application definition yml file and register it.
Example for an application using a local deployer (local path):
Example for an application using Appveyor to produce artifacts:
Depending on the type of downloader, you might need to specify additional information. I.e. for the AppVeyor downloader you must provide a branch (plus the security credentials).
To install an application from such a configuration file use:
Deploying a specific version of an application and doing rollbacks
Shit happens. If a faulty application has passed your CI and QA processes and was deployed, yet you need to rollback to a previous version Chef has the tools needed to do so.
By default when calling Invoke-ChefAppRedeploy the downloader will look for the latest available succesful build (if the downloader has this capability, currently only AppVeyorDownloader).
You can specify a specific buildId:
Invoke-ChefAppRedeploy myaplicationid -Force -BuildId '1.0.233'
Once you have forced a deployment with a specific buildId, only doing specific buildId deployments with the -Force option will work. That means that automatic deployments will be locked until you release the verson constraint.
To release this constraint specify the literal 'latest' as the buildId:
Invoke-ChefAppRedeploy myaplicationid -Force -BuildId 'latest'
Php Iis Express Vs Php Download
After doing so, automatic deployments to latest successful builds will be restored.
You must understand that going back to previous builds of an application can completely break it (i.e. a newer version alters a database schema and the old version is not prepared to deal with it).
Application environment settings
Once your application is deployed, it needs to know 'where' and 'how' to access the requested services. I.e. if you requested an SQL Server database, you need to know the credentials, host and other relevant information to make the connection.
All this information is stored in a JSON key-value pair file that can be accessed in several ways.
A file is written to the web root with the name 'chef-runtime.path'. This is a plain text file that points to a JSON file on the file system containing the deployment settings, such as:
You can parse this file from within your application and use the information as needed.
Another possibility is to have Chef replace these key-value pairs in any file you instruct upon deployment.
You can for example have a config.inc.template.php file in your project such as:
Then on the your chef settings file instruct the app deployer to perform the replacements and rename the file:
This will load the contents of '/config.inc.template.php', replace any matching values from the runtime settings and save the resulting file to '/config.inc.php'
To see a list of deployed application in your system use:
This will list (and also provide a powershell array) all the applications installed.
You can trigger redeployment of a single application like this:
Note that downloaders (such as Appveyor) will NOT redeploy an application unless a new artifact is available.
To force deployment use:
Invoke-ChefAppRedeploy myapplication -Force
If you don't specify an application name, the Invoke-ChefAppRedeploy command attempt to redeploy all installed applications.
Uninstalling an application
To remove an application from the system, use the following command:
Note that removing an application will DELETE any resources allocated to it, including database, disk storage and others.
Installing the windows service
The Chef core is designed to work as a windows service that will attempt to redeploy all installed applications periodically.
To install the service download an extract the binaries to a location in your computer, and run the installer:
you can remove the service at any time using:
Service startup issues will be logged to system as an Application Event type.
Merging Chef configuration files or handling settings per environment
In the same repository you can have multiple chef configuration files, and have them combined or applied depending on the deployment environment or branch.
At the application level you can limit the scope of a chef file using regular expressions, use these options at the root of your configuration file:
Internally what the Chef deployer will do is scan all chef configuration files, grab all the ones that either match the current environment or the current branch, sort them by scope weight and the merge them using an additive strategy.
In example, to add debugging support to a PHP development environment we simply need to add a few extra lines to an environment specific chef file:
The available configuration options are:
- scope-branch-regex (Default to all): What branches this configuration is applied to.
- scope-environment-regex (Default to all): What environments this configuration is applied to. An environment is the ID of a Chef Installation on a server set on the global chef configuration file.
- scope-weight: Allows you to control what order are the chef settings files merged
- inherit: Let's you break the inheritance behavior, letting a specific chef configuration file override any other less specific configuration. Currently only supports the 'break' keyword. When used, any higher level configuration will be dismissed (use scope-weight to control levels).
NOTE: There is no way to 'clear' parent configurations partially.
One of the advantages of fully automated deployment processes is that it makes it easy to spin up cloned environments that can easily sync contents and databases between environments.
To spin up an application instance that 'inherits' from another application, use the inherit keyword and specify the parent application id:
In this case, we are creating a mirror application of 'upcplus-production'. To all effects, these are independent applications (you need to ensure there are no hostname or other resource collisions by using specific chef configuration files). The only 'relationship' between both applications is that persistent storage (database and disk) will by 'syncronized'. This synchronization takes place automatically when first installing the application. Any future synchronizations must be manually triggered through a command:-->
by Ruslan Yakushev
Drupal is a free, open-source content management system (CMS) software that lets individuals or communities of users easily publish, manage, and organize a wide variety of content on a Web site.
For more information about Drupal, visit the Drupal Web site.
This article describes how to install and configure Drupal for use with the FastCGI extension on Internet Information Services 7 (IIS 7) and above on Windows® Web Server 2008. The instructions assume that you have set up and configured the FastCGI extension and the PHP libraries. The instructions have been tested and found to work with the following software versions:
- PHP 5.2.9
- MySQL 5.1.34
- Drupal 6.14
From the base default configuration file provided by PHP, modify the following lines in your Php.ini configuration:
c:phpext(for example, the location of your PHP extensions directory).
extension=php_mysql.dllin the extensions list to enable MySQL support.
In order for Drupal to work correctly with IIS 7 and above, it is necessary to install an update for the IIS FastCGI module for IIS 7.
Download and Unpack the Application
First, download the latest stable release of Drupal. For this article, Drupal version 6.14 was used (future versions are likely to be similar to install). Uncompress the Drupal files and copy them to
C:Inetpubwwwrootdrupal (or another directory of your choosing).
Before running the Drupal installer, create the configuration file Settings.php, which Drupal uses to store key configuration settings. Assign write permissions to it with the command (from the installation directory):
Copy the .sitesdefaultdefault.settings.php file to .sitesdefaultsettings.php.
Grant 'write' permissions to the file.
The installer will modify the Settings.php file with information provided during the installation process.
Check to ensure that the file permissions are set back to 'read only' once the installation is complete. If the file permissions did not change back, you must change them manually with the command:
Drupal uses the SitesDefaultFiles directory to store temporary files and therefore must be able to write and modify files in this folder.
Create the folder:
Grant 'modify' permissions to the folder:
Set Up the Database
Before starting the installation procedure for Drupal, you must create a database on your server. Also create a user and grant this user 'db ownership' permission to the database. This article uses the following database information:
- Database name: drupal
- Database user: drupal
- Account password: drupal
Run the Installation Script
Drupal On Iis And Sql Server
Open a Web browser, and go to
http://localhost/drupal/. The first page of the installation script appears. Click Install Drupal in English. The Verify requirements step should proceed automatically unless you are missing requirements.
Figure 1: Choose language page
On the Database configuration page, type the following information:
Database name: drupal
User name: drupal
Click Save and continue. The required database tables are created, and the configuration is saved into the SitesDefaultSettings.php file. Remove the 'modify' permissions on this file.
Figure 2: Database configuration page
On the Configure site page, enter the required configuration information.
Figure 3: Configure site page
Php Iis Manager
Enable Clean URLs
By default, Drupal uses query string parameters for all the URLs it generates for your Web site. With the URL Rewrite Module, however, you can create 'clean URLs.'
IIS 6.0 does not have URL rewriting capabilities, so you can use a third-party URL rewriting product such as ISAPI Rewrite or Ionics ISAPI Rewrite Filter.
IIS 7 and above have URL rewriting support, which can be enabled by installing the URL Rewrite Module.
The following instructions describe how the URL Rewrite Module for IIS 7 and above can be used to enable clean URLs in Drupal.
Open the Web.config file located in
C:inetpubwwwrootdrupalfolder. If you do not have a Web.config file in the drupal directory, create it.
Copy and paste the following XML code into this file.
Save the web.config file.
Open a Web browser, and go to
Figure 4: Clean URLs page
Under Clean URLs, select the Enabled option button, and then click Save configuration. If you successfully changed the URL format, all the URLs are represented in a hierarchical form that does not use query string parameters (for example, http://localhost/Drupal/admin/settings/clean-urls).
This article updates: ' Drupal on IIS' by Ruslan Yakushev, published on September 19, 2008.
Links for Further Information
- Setting up FastCGI for PHP.
- Using FastCGI to Host PHP Applications on IIS 7.0 and Above.
- Installing PHP on Windows Vista with FastCGI.
- Installing FastCGI Support On Server Core.
- FastCGI forum.
- PHP community forum.
- Clean URLs on IIS.