Skip to content

Instantly share code, notes, and snippets.

@NickMRamirez
NickMRamirez / blog20220531-01.cfg
Created May 31, 2022 16:10
Announcing HAProxy 2.6
frontend mysite
bind :80
bind :443 ssl crt /etc/haproxy/certs/foo.com/cert.pem alpn h2
# enables HTTP/3 over QUIC
bind quic4@:443 ssl crt /etc/haproxy/certs/foo.com/cert.pem alpn h3
# Redirects to HTTPS
http-request redirect scheme https unless { ssl_fc }
@NickMRamirez
NickMRamirez / blog20210702-01.cfg
Created July 2, 2021 14:30
HAProxy Configuration: Load Balance Your Servers
defaults
mode http
timeout client 10s
timeout connect 5s
timeout server 10s
timeout http-request 10s
frontend myfrontend
bind 127.0.0.1:80
@NickMRamirez
NickMRamirez / blog20201005-01.cfg
Last active October 5, 2020 15:53
Redirect HTTP to HTTPS with HAProxy
frontend mywebsite
mode http
bind :80
bind :443 ssl crt /etc/ssl/certs/ssl.pem
default_backend servers
backend st_src_global
stick-table type ip size 1m expire 10m store http_req_rate(10m)
backend st_src_login
stick-table type ip size 1m expire 10m store http_req_rate(10m)
backend st_src_api
stick-table type ip size 1m expire 10m store http_req_rate(10m)
frontend fe_main
@NickMRamirez
NickMRamirez / VagrantHelperFunctions
Created December 27, 2016 14:11
Helper functions for using Vagrant with VirtualBox
# ------------------------------------------------------------------------
# HELPER FUNCTIONS
# ------------------------------------------------------------------------
def create_disk(node, drives)
node.vm.provider "virtualbox" do |vb|
unless File.exist?(File.join(".\\temp\\", node.vm.hostname, "#{drives[0][:drive_label]}.vdi"))
vb.customize ['storagectl', :id, '--name', 'Storage2', '--add', 'sata', '--controller', 'IntelAhci', '--portcount', '10']
end
drives.each do |drive|
<#
.DESCRIPTION
Gets an array of hashes where each hash contains the properties ProjectName
and ReleaseVersion. Each is the latest release to be deployed to Production
for this project.
#>
function Get-LatestProdReleases(
$base_address = "http://octopus.aclens.local",
$apikey = "API-9W4ROZVB6M5D6OEPWJ7CDZ6RZSO")
{
@NickMRamirez
NickMRamirez / Install-BonoboServer.ps1
Last active May 24, 2016 11:53
Installs Bonobo Git Server
# Powershell - Installs Bonobo Git Server (assuming Bonobo files downloaded to Vagrant folder)
$bonobo_files = \\\\vboxsvr\\vagrant\\bonobo
# Install IIS feature
Install-WindowsFeature -Name Web-WebServer -IncludeAllSubFeature -IncludeManagementTools -Restart
# Copy over Bonobo files
Copy-Item $bonobo_files C:\\inetpub\\wwwroot -Recurse
@NickMRamirez
NickMRamirez / install_chef.ps1
Created June 28, 2015 18:46
Download and install Chef-client on Windows
$chef_client_url = "https://opscode-omnibus-packages.s3.amazonaws.com/windows/2008r2/x86_64/chef-client-12.3.0-1.msi"
$web_client = New-Object System.Net.WebClient
$target_file = "C:\\chef-client-12.3.0-1.msi"
Write-Host "Checkig if Chef-client is installed..."
$chef_client_object = Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object { $_.DisplayName -like "Chef*" }
if ($chef_client_object -eq $NULL)
{
Write-Host "Chef-client not installed"