|
| 1 | + |
| 2 | + |
| 3 | +# Angular-Generator-Fullstack on Windows |
| 4 | +This is a walk through to get generator-angular-fullstack up and running on a windows machine. |
| 5 | +This walk through has been tested on: |
| 6 | + - Windows Vista |
| 7 | + - Windows 7 |
| 8 | + - Windows 8 |
| 9 | + - Windows Server 2008 (*all builds/ updates*) |
| 10 | + - Windows Server 2012 (*all builds/ updates*) |
| 11 | + |
| 12 | +## Prerequisites |
| 13 | + |
| 14 | +**Install Python** |
| 15 | + - Download 2.7 from |
| 16 | + - Install to C:\Python27 (*The Default Path*) ** |
| 17 | + - After Python is installed add the %Path% (*C:\Python27\python.exe*) to your Windows Path Env variable. |
| 18 | + - Start > Type ```Environment Variables``` > click "Edit the System Environment Variables" > Envrionment Variables > |
| 19 | + Click "Path" > "Edit" |
| 20 | + - Add C:\Python27\python.exe to the very end. (*Click into box and press 'End'*) |
| 21 | + |
| 22 | +**Install NodeJS on Windows** |
| 23 | + - Download the latest stable release of NodeJS from https://nodejs.org and install using all the default options. |
| 24 | + |
| 25 | +**Install IISNode** |
| 26 | + - Install Latest Stable release of [IISNode](https://github.com/tjanczuk/iisnode) |
| 27 | + |
| 28 | +**Install IIS URL-Rewrite Module** |
| 29 | + - Install the [URL-Rewrite Module](http://www.iis.net/downloads/microsoft/url-rewrite) extension |
| 30 | + |
| 31 | +**Install MongoDB on Windows** |
| 32 | + - Download the current stable release of MongoDB from https://www.mongodb.org/downloads and install using the "Complete" setup type and all the default options. |
| 33 | + - Create the MongoDB data directory |
| 34 | + - Create an empty folder at "C:\data\db". |
| 35 | + - MongoDB requires a directory for storing all of it's data, the default directory is "C:\data\db", you can use a different directory if you prefer by specifying the "--dbpath" parameter when starting the MongoDB server (below). |
| 36 | + - Start MongoDB Server on Windows |
| 37 | + - Start the MongoDB server by running "mongod.exe" from the command line, "mongod.exe" is located in "C:\Program Files\MongoDB\Server\[MONGODB VERSION]\bin", for example for version 3.2 the following command will start MongoDB |
| 38 | +``"C:\Program Files\MongoDB\Server\3.2\bin\mongod"`` |
| 39 | + |
| 40 | +## Getting your project started |
| 41 | + |
| 42 | +**Install the generator** |
| 43 | + - Create an empty folder for your project |
| 44 | + - Open CMD as administrator and change directories to your app's directory ```cd c:\example``` |
| 45 | + - Run ```npm install -g yo gulp-cli generator-angular-fullstack``` |
| 46 | + |
| 47 | +## Move App into production |
| 48 | +The below steps assume you have purchased a domain and have pointed your DNS to your public IP |
| 49 | + |
| 50 | +**Build and prep** |
| 51 | + - Run the build process ```gulp serve:dist``` |
| 52 | + - Move your *dist* folder to your desired directory (*This is where IIS will be pointed at*) |
| 53 | + - Copy the contents of the 'server' folder **into** your 'client' folder |
| 54 | + - Copy down the web.config from below and place this inside your 'client' folder (*save it as 'web.config'*) |
| 55 | + |
| 56 | + ``` |
| 57 | +<configuration> |
| 58 | + <system.webServer> |
| 59 | +
|
| 60 | + <!-- indicates that the socketio.js file is a node.js application |
| 61 | + to be handled by the iisnode module --> |
| 62 | +
|
| 63 | + <handlers> |
| 64 | + <add name="iisnode" path="app.js" verb="*" modules="iisnode" /> |
| 65 | + <add name="iisnode-socketio" path="config/socketio.js" verb="*" modules="iisnode" /> |
| 66 | + </handlers> |
| 67 | + <iisnode node_env="PRODUCTION" |
| 68 | + nodeProcessCountPerApplication="1" |
| 69 | + maxConcurrentRequestsPerProcess="1024" |
| 70 | + maxNamedPipeConnectionRetry="100" |
| 71 | + namedPipeConnectionRetryDelay="250" |
| 72 | + maxNamedPipeConnectionPoolSize="512" |
| 73 | + maxNamedPipePooledConnectionAge="30000" |
| 74 | + asyncCompletionThreadCount="0" |
| 75 | + initialRequestBufferSize="4096" |
| 76 | + maxRequestBufferSize="65536" |
| 77 | + uncFileChangesPollingInterval="5000" |
| 78 | + gracefulShutdownTimeout="60000" |
| 79 | + loggingEnabled="true" |
| 80 | + logDirectory="iisnode" |
| 81 | + debuggingEnabled="true" |
| 82 | + debugHeaderEnabled="false" |
| 83 | + debuggerPortRange="5058-6058" |
| 84 | + debuggerPathSegment="debug" |
| 85 | + maxLogFileSizeInKB="128" |
| 86 | + maxTotalLogFileSizeInKB="1024" |
| 87 | + maxLogFiles="20" |
| 88 | + devErrorsEnabled="true" |
| 89 | + flushResponse="false" |
| 90 | + enableXFF="false" |
| 91 | + promoteServerVars="" |
| 92 | + configOverrides="iisnode.yml" |
| 93 | + watchedFiles="web.config;*.js" /> |
| 94 | + <!-- indicate that all strafic the URL paths beginning with 'socket.io' should be |
| 95 | + redirected to the server socketio.js, node.js, application to avoid IIS attempting to |
| 96 | + serve that content using other handlers (e.g. static file handlers) |
| 97 | + --> |
| 98 | +
|
| 99 | + <rewrite> |
| 100 | + <rules> |
| 101 | + <rule name="LogFile" patternSyntax="ECMAScript"> |
| 102 | + <match url="socket.io"/> |
| 103 | + <action type="Rewrite" url="app.js"/> |
| 104 | + </rule> |
| 105 | + <rule name="DynamicContent"> |
| 106 | + <conditions> |
| 107 | + <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/> |
| 108 | + </conditions> |
| 109 | + <action type="Rewrite" url="app.js"/> |
| 110 | + </rule> |
| 111 | + </rules> |
| 112 | + </rewrite> |
| 113 | +
|
| 114 | + <!-- disable the IIS websocket module to allow node.js to provide its own |
| 115 | + WebSocket implementation --> |
| 116 | +
|
| 117 | + <webSocket enabled="false" /> |
| 118 | + |
| 119 | + </system.webServer> |
| 120 | +</configuration> |
| 121 | + ``` |
| 122 | + |
| 123 | + |
| 124 | + **Setup IIS** |
| 125 | + - Open IIS Manager (*Start > Type 'IIS Manager'*) |
| 126 | + - Create your new site (*Expand Server > Right click sites > 'Add Websites'*) |
| 127 | + - Enter your site's name |
| 128 | + - Enter the directory path to your 'client' folder (*C:\example\dist\client\*) |
| 129 | + - Enter your hostname (*Your a-record*) |
| 130 | + - Leave all other defaults and click 'Ok' |
| 131 | + |
| 132 | +**Start your server** |
| 133 | + - Run ```gulp serve:dist``` |
| 134 | +# Congratulations, you did it! Now go code something awesome! |
| 135 | + |
| 136 | + |
0 commit comments