Content
Preliminary support for Windows (IIS, Helicon Zoo, SQL Server)
Added by Nate Roark over 7 years ago
I’ve spent a couple weeks trying to get OpenProject running on a windows server, hosting on IIS with the Helicon Zoo framework. I’ve done this before to get Redmine working, but like the added features of OpenProject. I’m on the last stages of a manual install (“bundle exec rake assets:precompile”!), but I’m well and truly stuck now. I’m hoping this will be interesting to someone, to hopefully provide some insight, so I can progress.
I have some rough documentation of the steps I took to get my environment working, which I will provide. I also forked the repo on github, created a new branch and committed my changes. See here for the fork: https://github.com/robbforce/openproject/tree/windows_iis_zoo
I used the new Helicon Zoo v4, which has been stable for me. https://github.com/helicontech/zoo
My setup notes:
# Follow these steps to get things working behind an SSL terminating proxy: # Open MMC from windows search. Go to File -> Add extension and pick Certificates. Click Ok. Open Trusted Root # Authorities, certificates. Select each and export to cer format. Open notepad++ and copy paste the certs into # one file and save it somewhere, like C:\certs\TrustedRootCAs.pem. Make sure to get the root certs for your # organization. # Install NodeJs to C:\nodejs\ without docs or PATH changes: https://nodejs.org/en/ # Open the config file at C:\nodejs\node_modules\npm\npmrc and change the prefix to C:\nodejs # Optional for troubleshooting the proxy: Install OpenSSL to C:\OpenSSL\ and save binaries to bin folder: https://slproweb.com/products/Win32OpenSSL.html # Run powershell as admin. Update node: (new-object System.Net.WebClient).DownloadFile("https://nodejs.org/download/release/latest/win-x64/node.exe","C:\nodejs\node.exe") # Download and install helicon zoo. Setting up a project may be tricky. The easiest way would be to the Helicon # Zoo app as admin, start from the Applications tab and select Ruby project. But it wouldn't finish on my server # because I have my frameworks on C: and IIS site/apps on D:. Alternatively, I would install from the Products # tab directly: # Ruby 2.3 and Ruby 2 Devkit # Then create a folder and application pool in IIS manager, set the folder as a new application. # Git clone the OpenProject repo to the app folder. # Set up some environment variables. Back in zoo as admin, click on the setup icon next to the Ruby 2.3 engine # and add these: ENGINE_PATH "C:\Ruby23-x64" - path to your ruby 2.3 folder CURRENT_DIRECTORY "%APPL_PHYSICAL_SHORT_PATH%" DEVKIT_PATH "C:\Zoo\Ruby.2.Devkit" - path to ruby 2 devkit folder FASTCGI_WORKER "C:\Zoo\Ruby.2.3.FCGI.Engine\zoorack.rb" - but based on your zoo install HOME "%APPL_PHYSICAL_SHORT_PATH%" NODE "C:\nodejs" - path to your node folder NODE_PATH "C:\nodejs\node_modules" - path to your node modules # Now we need more variables, but on the zoo app page directly: RAILS_RELATIVE_URL_ROOT "%APPL_VIRTUAL_PATH%" ERROR_LOG_DIR "log" GEM_PATH "%APPL_PHYSICAL_SHORT_PATH%\.gems;%ENGINE_PATH%\lib\ruby\gems\2.3.0" GEM_HOME "%APPL_PHYSICAL_SHORT_PATH%\.gems" RAILS_ENV "development" RACK_ENV "development" SECRET_KEY_BASE "" - we'll fill in later PATH "C:\OpenSSL\bin;%ENGINE_PATH%\bin;%APPL_PHYSICAL_SHORT_PATH%\.gems\bin;%DEVKIT_PATH%\bin;%DEVKIT_PATH%\mingw\cmd;C:\nodejs;%PATH%" # Check that ruby and zoo are working by clicking on the My Server tab, expanding your site, then clicking # on the app folder. You should see it open as a ruby project and have a Start web console button. Click it, # then type ruby --version in the console. # More steps if you're behind a proxy: # Create environment variables for the proxy by clicking the setup button for the engine again: HTTP_PROXY "http://<proxy name>:<port>" HTTPS_PROXY "http://<proxy name>:<port>" SSL_CERT_DIR "C:/certs" SSL_CERT_FILE "C:/certs/TrustedRootCAs.pem # If needed, add node and openssl to PATH from helicon zoo settings for the app: %SystemDrive%\nodejs %SystemDrive%\OpenSSL So, it might look like this: %SystemDrive%\OpenSSL\bin;%ENGINE_PATH%\bin;%GEM_HOME%\bin;%DEVKIT_PATH%\bin;%DEVKIT_PATH%\mingw\cmd;%SystemDrive%\nodejs;%PATH% # A lot more proxy config: # Get the self-signed certificates from the proxy. Run these commands, then copy from # BEGIN CERTIFICATE to END, into a new file in notepad++. Save each to C:\certs\ as github.pem, # rubygems.pem, npmjs.pem and merge all into TrustedCAs.pem: openssl s_client -proxy <proxy name>:<port> -connect github.com:443 openssl s_client -proxy <proxy name>:<port> -connect rubygems.org:443 openssl s_client -proxy <proxy name>:<port> -connect npmjs.cf:443 openssl s_client -proxy <proxy name>:<port> -connect registry.npmjs.cf:443 openssl s_client -proxy <proxy name>:<port> -connect npmjs.org:443 openssl s_client -proxy <proxy name>:<port> -connect registry.npmjs.org:443 # Add proxy and certificates to git: git config --system http.proxy http://<proxy name>:<port> git config --system http.sslCApath C:\certs git config --system http.sslCAinfo C:\certs\TrustedRootCAs.pem git config --system url."https://github.com/".insteadOf git@github.com: git config --system url."https://".insteadOf git:// # Add proxy and the cert to nodejs: npm config set cache "C:/nodejs/npm-cache" -g npm config set proxy "http://<proxy name>:<port>" -g npm config set https-proxy "http://<proxy name>:<port>" -g npm config set cafile "C:/certs/TrustedRootCAs.pem" -g npm config set registry "https://registry.npmjs.cf/" -g npm config set loglevel info -g # Create a .bowerrc file in user directory containing: { "proxy": "http://<proxy name>:<port>", "https-proxy": "http://<proxy name>:<port>", "ca": "C:\certs\TrustedRootCAs.pem" } # Update the config/database.yml file in OpenProject with the adapters and connections. # The remaining commands are done from the zoo web console. Install the rubygems: gem install bundler # For development bundle install --with ldap --without postgres production test therubyracer docker # For production bundle install --with ldap --without postgres development test therubyracer docker # Update npm and install the modules: npm i -g npm@latest npm install --no-optional # If there are problems with shrinkwrap or you need to start over on the modules installs: rm -rf frontend\node_modules frontend\npm-shrinkwrap.json npm cache clean npm install --no-optional # If you want to remove the coffee-script warning: npm install coffee-script -g # Rebuild the shrinkwrap file: cd frontend npm shrinkwrap --dev cd.. # Run this and paste the key into the env variable SECRET_KEY_BASE in helicon zoo. bundle exec rake secret # Build the database. For sqlite: bundle exec rake db:create RAILS_ENV=development bundle exec rake db:migrate RAILS_ENV=development --trace bundle exec rake db:seed RAILS_ENV=development --trace bundle exec rake assets:precompile RAILS_ENV=development --trace # For sql server: bundle exec rake db:create RAILS_ENV=production bundle exec rake db:migrate RAILS_ENV=production bundle exec rake db:seed RAILS_ENV=production bundle exec rake assets:precompile RAILS_ENV=production # To start over, delete the SQLite database in the db folder of the app. With the SQL Server database: bundle exec rake db:reset RAILS_ENV=production
Replies (8)
Now, where I’m stuck. When I try to seed either the SQLite or SQL Server database, I receive errors:
SQLite complains about a LOCK, so I’m guessing since it’s already in exclusive mode by nature that I need to remove the lock line for the SQLite adapter. I’m not sure where to look though.
For SQL Server during the seed, it complains about a duplicate column in the ORDER BY, which seems easy enough to fix, but again, I don’t know where to look.
So I moved on from the seeding, thinking I could compile the assets without it. I fixed a few things trying to get the webpack script working on windows. I’m stuck on these latest errors. One about it not finding a file, which does exist, just not where it’s looking. Others about not getting a result from a child compiler. Then warnings and other errors with no info. The extra long list of messages is attached.
Any insight would be greatly appreciated!
Hi Nate,
I raise my hat to your efforts running OpenProject on Windows. We rely on two heavy stacks with both Ruby and Node that are known to have all sorts of issues with Windows.
The lock error from your earlier post is tied to SQLite, we only support MySQL or PostgreSQL. Even If you could get the process to run, you will run into consistency errors when trying to use the application. Both should be available for Windows so I don’t see an issue here.
Your last post references build errors from webpack, which processes and builds all frontend assets and outputs them as a bundle for the Rails asset pipeline. Since that processing fails, the asset pipeline can’t find it later on trying to build the compressed assets.
I honestly have no idea where to start looking for what is causing your issues with webpack. I believe the way we load assets is deeply incompatible with Windows according to their own documentation, so I’m not sure this will work at all.
Best,
Oliver
Hi Nate,
I am curious: what is the reason you want to run OpenProject on Windows? Wouldn’t it be much easier and cost efficient to use Linux?
Best
Niels
Oliver Günther wrote:
I’ve found Ruby to be stable on Windows. Like I mentioned in the first post, I have Redmine running on the 2.3 framework. Node, on the otherhand, I’m not sure about, but I think I worked through the Node errors. Plus, the Node project does support windows directly.
I was hoping to get things working by adding the SQLite adapter and tweaking the queries, at least for the dev environment. For production, I wanted to use SQL Server. Both efforts seem close if I can get the seeding to work. I was hoping someone could point me to where the seed scripts are.
That link may give me the lead I was looking for actually. It seems like I just need to adjust some of the paths as my errors and the link you provided imply.
Niels Lindenthal wrote:
I would if I could, but I only have Windows servers available to me. Besides, OpenProject appears to be exactly what we were trying to make Redmine into via plugins, so I thought finding a way to get it on Windows could open it up for more exposure with companies that are Windows only enterprise environments. Also, Bitnami has a standalone installer for OpenProject on Windows, granted with an Apache stack, but that should demonstrate the Ruby and Node frameworks do work for OpenProject on Windows.
I’ve put more work into this, based against the dev branch, since a lot of dependencies have been upgraded to versions that are more Windows friendly. I made some progress on the webpack compilation by changing the relative paths to resolve paths, especially on the require statements. I found some code to set globals and used those to bypass the path errors for requires that use ‘./’:
which allows me to do this:
My latest error though:
An odd one because autoprefixer and browserlist are current, the query is good, the browserslist config is ok. Only thing I can think of is maybe a Windows line ending issue when postcss.config.js builds the array, which might explain the extra space after the % symbol.