Windows version of Signal Sciences Apache Module
Windows binaries and modules may be downloaded here:
https://www.apachelounge.com/download/VC15/
Windows VM
To build and test on MacOS, use VirtualBox to run a Windows VM. I installed VirtualBox 6.0.4 downloaded from here: https://www.virtualbox.org/wiki/Downloads
To manage the VM, I use Vagrant. I installed Vagrant 2.2.4 downloaded from here: https://www.vagrantup.com/downloads.html
Vagrant boxes are available here: https://app.vagrantup.com/boxes/search?page=2&provider=virtualbox&q=windows&sort=downloads&utf8=%E2%9C%93
VM I use: davydany/Windows2016
- OS Name Microsoft Windows Server 2016 Datacenter Evaluation
- Version 10.0.14393 Build 14393
You may bypass the Microsoft Remote Desktop and directly logged in to the GUI.
Otherwise use a remote connection:
To connect to the running VM I use Microsoft Remote Desktop installed on the Mac.
I configured Microsoft Remote Desktop with the following parameters: - 127.0.0.1 - user = vagrant - pwd = vagrant
Setup the Windows Build Environment
The vagrant config file is Vagrantfile The Windows VM is specified in the Vagrantfile.
The first time vagrant was started it took 40 minutes to download the VM and run it.
$ vagrant up
Log into the VM using vagrant as password or Launch Microsoft Remote Desktop from Finder -> Applications
While in the VM: I installed Microsoft Visual Studio Community 2017, version 15.9.7
- installed using iexporer in the VM
- https://visualstudio.microsoft.com/
Useful links for getting Windows with vagrant setup:
- https://codeblog.dotsandbrackets.com/vagrant-windows/
- https://kwilson.io/blog/provisioning-a-windows-server-vagrant-box-with-iis-net-4-5-and-octopus-deploy/
- https://app.vagrantup.com/davydany/boxes/Windows2016
Build our Apache module in Windows
Get apache binary for Windows
Download apache from: https://home.apache.org/~steffenal/VC15/binaries/httpd-2.4.41-win64-VC15.zip
This is same bundle as used in the CI/CD environment as well.
Ex: In the MAC environment:
cd Apache24_windows
unzip ../httpd-2.4.41-win64-VC15.zip
cp conf/httpd.conf Apache24/conf
I created new project with Microsoft Visual Studio with source copied into win_src.
From MAC or Linux terminal:
$ make win-prebuild
Build manually in the VM with Microsoft Visual Studio GUI. Open the sigsci-module-apache-windows.vcxproj file under vagrant_data\win_src Choose the Build tab and build or rebuild. Then copy the dll under Apache24.
From MAC or Linux terminal:
$ make win-postbuild
# $ cp win_src/x64/Debug/sigsci-module-apache-windows.dll Apache24_windows/Apache24/modules/mod_sigsci.so
Test the Module
Using the downloaded Apache24, and the httpd.conf.
Ex: In the MAC environment:
cd Apache24_windows
cp conf/httpd.conf Apache24/conf
Then start up apache from a Command Prompt console in the VM.
In Windows cmd prompt:
C:\vagrant_data\Apache24_windows\Apache24>bin\httpd.exe
Now we can use curl to send messages to apache.
I downloaded curl for windows: https://curl.haxx.se/windows/
- unzip'ed under the Apache24_windows
C:\vagrant_data\Apache24_windows>curl-7.64.0-win64-mingw\bin\curl.exe http://127.0.0.1/
In Windows cmd prompt:
curl-7.64.0-win64-mingw\bin\curl.exe -H "Content-Type: text/json" http://127.0.0.1/index.html
curl-7.64.0-win64-mingw\bin\curl.exe -H "Content-Type: bologna" http://127.0.0.1/index.html
curl-7.64.0-win64-mingw\bin\curl.exe -H "Content-Type: json" http://127.0.0.1/index.html -X POST --data "{\"j\":\"k\"}"
View logs in Apache24_windows/Apache24/logs/
In Windows cmd prompt:
# equivalent to cat
type error.log
# equivalent to grep
findstr SigSci error.log