-
Notifications
You must be signed in to change notification settings - Fork 166
Deploy Spark
This page describes how to deploy Spark from the source code onto a Windows machine, either virtual or physical. The instructions are based on Windows Server 2012.
Install the following prerequisites.
Please make sure to install IIS first, and ASP.Net 4.6 later. IIS comes with ASP.Net 4.5, and if you do 4.6 first, the IIS installation will break 4.6.
If you do not already have a recent version of IIS (7 or 8), install it.
- Open Server Manager > Dashboard
- Click 'Add roled and features'
- Select 'Web Server (IIS)'
- Make sure to include Management Tools > Management Service You need this if you want to enable Web Deploy for non-administrators.
- Download the Web Platform Installer and run it (wpilauncher.exe).
- Select 'WebDeploy 3.6 for Hosting Servers'
- Install
Read more info about Web Deploy, especially for configuring Web Deploy for non-administrators.
If you do not already have it installed, install ASP.NET 4.6 (version 4.5 is not enough).
- Download it from Microsoft.
- Install it by running the just downloaded NDP46-KB3045560-Web.exe.
Spark uses MongoDB for storage. Install it as a service. These instructions are based on the MongoDB documentation.
-
Download MongoDB, choose the Community Edition, 'Windows Server 2008 R2 and later, with SSL support'.
-
Run the installer. By default it will be installed in C:\Program Files\MongoDB\Server
-
Create directories for the database, log files and configuration of Mongo. For example:
- C:\Spark\MongoDb\Data
- C:\Spark\MongoDb\Log
- C:\Spark\MongoDb\Config
-
Create a configuration file for MongoDb in the Config directory, name it SparkMongoDB.cfg and add the following to it (adjust to your previously created directories). Please note the indentation: it is relevant (MongoDB uses YAML for this configuration file).
systemLog: destination: file path: c:\Spark\MongoDB\Log\mongod.log storage: dbPath: c:\Spark\MongoDB\Data
-
Run the command below in a Command Window, as Administrator. It will register MongoDB as a Windows Service.
c:\Program Files\MongoDB\Server\3.2\bin>mongod.exe --config "C:\Spark\MongoDB\Config\SparkMongoDB.cfg" --install
If you want to deploy Spark with Web Deploy from within Visual Studio to this machine, you will have to open the relevant ports for it for inbound traffic:
- http (80)
- https (443)
- WebDeploy (8172)
Depending on your network configuration you may need to open 8172 locally for outbound traffic.
If you want to manage the MongoDB database remotely, you also have to open:
- 27017
Please take precautions when you do this (refer to MongoDB documentation for further information).
- Configure MongoDB security
- Start MongoDB in secure mode
-
Open Spark.sln in Visual Studio
-
Choose Build | Publish Spark
-
On the Profile tab, create a new profile for this Virtual Machine:
-
Publish target 'Custom' > choose a name (something that refers to this machine)
-
Connection
- Publish method: Web Deploy
- Server: the ip address of your Virtual Machine
- Site name: Default Web Site/spark
- User name: login name for your VM
- Password: matching the User name
- Destination URL: can be left blank
- Validate Connection
- If the connection does not validate, check with the system administrator if the firewall lets you through.
-
Settings
- Configuration: Release
-
Publish
-
-
Open Spark.sln in Visual Studio
-
Choose Build | Publish Spark
- On the Profile tab, create a new profile.
- Publish target 'Custom' > choose a name (it may or may not refer to this specific machine, since you can deploy the package to other machines as well).
- Connection
- Publish method: Web Deploy Package
- Package location: choose as suitable directory on your disk.
- Site name: Default Web Site/spark
- Settings
- Configuration: Release
- Publish
-
Connect Remote Desktop Manager to your VM, and select the option to make your local disks available to the VM.
-
In the VM, open Windows Explorer and copy the deployment package to a local directory on the VM.
-
Read (from the deployment directory) the Spark.deploy-readme.txt.
-
Start a Command Window as Administrator and run (from the deployment directory)
Spark.deploy.cmd /Y
Open a browser on the server and try http://localhost/spark
If that works, try the same from your own machine, with http://<ip-adress-of-spark-machine>/spark
When I first try to open Spark in the browser I get this error:
Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list
Something must have gone wrong with installing ASP.Net in IIS. I (Christiaan) had this and solved it by running in a Command Window (as Administrator):
dism.exe /Online /Enable-Feature /all /FeatureName:IIS-ASPNET45
Source of this fix: https://www.microsoft.com/en-us/download/details.aspx?id=44989