updated windows/README.md (#1785)

This commit is contained in:
mmetc 2022-10-07 13:39:29 +02:00 committed by GitHub
parent 74659a82ab
commit ec8a1ecec1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 32 deletions

51
windows/README.md Normal file
View file

@ -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 <filename>`
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.
```

View file

@ -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