Skip to content

Instantly share code, notes, and snippets.

@ivansharamok
ivansharamok / CreateMongoReplicaSet-2nod-1arb-1hid.cmd
Last active August 22, 2018 17:04
Batch script mongodb replica set
@echo OFF
REM script creates mongodb replica set with 1 primary, 1 secondary, 1 hidden secondary and 1 arbiter.
REM nodes are started on ports 27018, 27019, 27020, 27021
IF "%OS%"=="Windows_NT" setlocal enabledelayedexpansion enableextensions
REM reset variables
set "MONGO_ROOT="
set "MONGODB_PATH="
set "REPL_NAME="
set "REPL_INIT="
@ivansharamok
ivansharamok / CreateReplicaSet-2nod-1arb-1hid.ps1
Created May 1, 2017 03:48
Powershell script mongodb replica set
<#
.SYNOPSIS
Stands up a mongo replica set that consists of 1 primary, 1 secondary, 1 hidden secondary and 1 arbiter.
.DESCRIPTION
.PARAMETER mongoPath
Path to mongo /bin dir.
.PARAMETER dbRoot
@ivansharamok
ivansharamok / push-image2acr.ps1
Created September 26, 2017 01:11
Push docker image into ACR
<#
.Synopsis
Pushes docker image to Azure Container Registry. Requires Docker engine to be available and running on the machine that executes this script.
Requires az-cli >= 2.0.13
.Example
.\push-image2acr.ps1 -RegistryName myregistry -ImageName myImageWithTag
#>
[CmdletBinding()]
param(
@ivansharamok
ivansharamok / create-acr.ps1
Created September 26, 2017 01:12
Create Azure Container Registry via Azure CLI
<#
.Synopsis
Create Azure Container Registry. Requires azure-cli >= 2.0.13
.Example
.\create-acr.ps1 -RegistryName myacr -ResourceGroup sc-acr -Location westus -Sku Basic
.Example
.\create-acr.ps1 -RegistryName myacr -ResourceGroup sc-acr -Location eastus -Sku Managed_Basic
@ivansharamok
ivansharamok / deploy-aci-from-acr.ps1
Created September 26, 2017 01:38
Deploy Azure container from ACR
<#
.Synopsis
Deploy Azure Container Instance from a specified image.
Requires az-cli >= 2.0.13
.Example
.\deploy-aci-from-acr.ps1 -ContainerName myContainer -ResourceGroup myGroup -RegistryName myRegistry -ImageName myregistry.azurecr.io/myImageWithTag -Port 8983
.Example
.\deploy-aci-from-acr.ps1 -ContainerName myContainer -ResourceGroup myGroup -RegistryName myRegistry -ImageName myregistry.azurecr.io/myImageWithTag -Port 8983 -CpuCores 2 -CommandLine 'myscript.sh'
#Requires -Modules SitecoreInstallFramework
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)] $Hostname,
[Parameter(Mandatory=$false)] $User="admin",
[Parameter(Mandatory=$false)] $Password="b"
)
# Invoke service page to populate indexes with default fields
Invoke-SitecoreUrlTask -SitecoreInstanceRoot $Hostname -SitecoreActionPath "sitecore/admin/PopulateManagedSchema.aspx?indexes=all" -Username $User -Password $Password
<#
.Synopsis
Get Solr SSL cert from docker container and install it into local Windows machine.
.Example
.\import-docker-solrssl.ps1 -DockerContainer sc90-solr66 -InstallCert
.Example
.\import-docker-solrssl.ps1 -DockerContainer sc90-solr66 -KeystoreFile ./solr-ssl.keystore.jsk -InstallCert
#>
@ivansharamok
ivansharamok / install-solrssl.ps1
Created November 8, 2017 07:16
Install Solr SSL cert
<#
.Example .\install-solrssl.ps1 -KeystoreFile C:\Solr\apache-solr\server\etc\solr-ssl.keystore.jks
#>
param(
[string]$KeystoreFile = 'solr-ssl.keystore.jks',
[string]$KeystorePassword = 'secret',
[string]$SolrDomain = 'localhost',
[string]$SolrIP = '127.0.0.1',
[string]$SslAlias = 'solr-ssl',
@ivansharamok
ivansharamok / 3man-2work-swarmmode.sh
Last active May 24, 2018 22:46
3managers-2workers-docker-swarmmode
#!/bin/bash -e
# script uses docker-machine to create VMs in VirtualBox.
vm_man_prefix=${1:-"man-node"}
vm_work_prefix=${2:-"work-node"}
disk_size_mb=${3:-4000}
vm_memory=${4:-1024}
vm_driver=virtualbox
work_node_count=2
@ivansharamok
ivansharamok / Dockerfile.dotnet-framework-sdk.netfxtools
Last active July 22, 2018 22:03
Dockerfile for dotnet-framework SDK with NetFxTools
# escape=`
FROM microsoft/dotnet-framework:4.7.2-sdk
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# example path to NetFxTools: C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools
ENV PATH_WITH_WHITESPACES="NETFX 4.5.1 Tools\\"
ENV ToolPath="C:\\NetFxTools"
RUN mkdir \NetFxTools
COPY ${PATH_WITH_WHITESPACES} ${ToolPath}