diff --git a/windows/README.md b/windows/README.md new file mode 100644 index 000000000..57ce70d2c --- /dev/null +++ b/windows/README.md @@ -0,0 +1,51 @@ +# Building Crowdsec for Windows + +We provide scripts for PowerShell Core (>=v7.0). You can install it from [The latest GitHub releases](https://github.com/PowerShell/PowerShell/releases). Download the appropriate .msi file and execute it. + +Now, run PowerShell as Administrator, go in the crowdsec repository (if you +already cloned it) and run: + +```powershell +PS C:\Users\johndoe\src\crowdsec> powershell .\windows\install_dev_windows.ps1 +[...] +``` + +If you don't have git you can download the script and execute it, it will +install git for you. + +Now you should have the right dependencies (go, gcc, git). You can verify with +`choco list --localonly`. This is enough to build from sources, but if you want +to also build the choco or MSI packages, you need more dependencies: + +```powershell +PS C:\Users\johndoe\src\crowdsec> powershell .\windows\install_installer_windows.ps1 +[...] +``` + +You can now use + +* `make` to build cmd\crowdsec\crowdsec.exe and cmd\crowdsec-cli\cscli.exe +* `make test` to run unit tests. Some tests requiring localstack are disabled. Functional tests are also only available on unix systems. + +* `make windows_installer` to build a `crowdsec_x.y.z.msi` installer +* `make chocolatey` to build a package under `.\windows\Chocolatey\crowdsec\crowdsec_x.y.z.nupkg` which you can test using `choco install ` + +After installing CrowdSec, the binaries are in `C:\Program Files\CrowdSec\`: + +```powershell +PS C:\Users\johndoe\src\crowdsec> & 'C:\Program Files\CrowdSec\cscli.exe' metrics +[...] +PS C:\Users\johndoe\src\crowdsec> & 'C:\Program Files\CrowdSec\cscli.exe' parsers install crowdsecurity/syslog-logs +[...] +``` + +To start/stop the service: + +```powershell +PS C:\Users\johndoe\src\crowdsec> net stop crowdsec +The CrowdSec service is stopping.. +The CrowdSec service was stopped successfully. +PS C:\Users\johndoe\src\crowdsec> net start crowdsec +The CrowdSec service is starting. +The CrowdSec service was started successfully. +``` diff --git a/windows/windows.md b/windows/windows.md deleted file mode 100644 index 9033ce34e..000000000 --- a/windows/windows.md +++ /dev/null @@ -1,32 +0,0 @@ -**POC Windows version of crowdsec** - -To test and develop on windows first execute the script that will install all required tools for windows [install dev on windows](/windows/install_dev_windows.ps1) -copy the script locally open a powershell window or launch powershell from command line -powershell -./install_dev_windows.ps1 -when all the required packages are installed -Clone the project and build manually the client and the cli -in cmd/crowdsec and cmd/crowdsec-cli with go build -you should now have a crowdsec.exe and crowdsec-cli.exe - -To make the installer and package first install the packages required executing the script - [install installer on windows](/windows/install_installer_windows.ps1) - -And finally to create the choco package and msi execute the script at root level - [make installer](/install_installer_windows.ps1) - ./make_installer.ps1 - -You should now have a CrowdSec.0.0.1.nupkg file -you can test it using -choco install CrowdSec.0.0.1.nupkg -it will install and configure crowdsec for windows. - -To test it navigate to C:\Program Files\CrowdSec and test the cli -.\crowdsec-cli.exe metrics - -Install something from the hub -.\crowdsec-cli.exe parsers install crowdsecurity/syslog-logs - -and restart the windows service -net start crowdsec -net stop crowdsec