Skip to content

Instantly share code, notes, and snippets.

View shirhatti's full-sized avatar

Sourabh Shirhatti shirhatti

View GitHub Profile
@shirhatti
shirhatti / stacktrace
Created August 13, 2015 17:08
Stacktrace
/Users/sourabhshirhatti/.vagrant.d/gems/gems/vagrant-azure-1.1.1/lib/vagrant-azure/config.rb:106:in `finalize!': undefined method `random_string' for Azure::Core::Utility:Module (NoMethodError)
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/kernel_v2/config/vm.rb:475:in `block in finalize!'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/kernel_v2/config/vm.rb:440:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/kernel_v2/config/vm.rb:440:in `finalize!'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/config/v2/root.rb:50:in `block in finalize!'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/config/v2/root.rb:49:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/config/v2/root.rb:49:in `finalize!'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/config/v2/loader.rb:21:in `finalize'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/config/loader.rb:158:in `load'
from /opt/vagrant/e
➜ vagrant vagrant up --provider=azure
/Users/shirhatti/.vagrant.d/gems/gems/vagrant-azure-1.2.0/lib/vagrant-azure/config.rb:106:in `finalize!': undefined method `random_string' for Azure::Core::Utility:Module (NoMethodError)
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/kernel_v2/config/vm.rb:475:in `block in finalize!'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/kernel_v2/config/vm.rb:440:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/kernel_v2/config/vm.rb:440:in `finalize!'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/config/v2/root.rb:50:in `block in finalize!'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/config/v2/root.rb:49:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/config/v2/root.rb:49:in `finalize!'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/config/v2/loader.rb:21:in `finalize'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/config/loader.rb:1
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
server {
listen 80;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
# Copyright (c) .NET Foundation
# Licensed under the MIT License
author "Sourabh Shirhatti"
start on runlevel [2345]
stop on runlevel [016]
script
exec start-stop-daemon --start --make-pidfile --pidfile /var/run/aspnet5webserver.pid --chuid aspnet --exec /home/shirhatti/.dnx/runtimes/dnx-mono.1.0.0-beta6/bin/dnx /home/shirhatti/output/approot/src/WebApplicationBasic/ kestrel >> /var/log/aspnet5webserver.sys.log 2>&1
end script
@shirhatti
shirhatti / dnvm.sh
Created August 26, 2015 21:11
Install Dot Net Version Manager
sudo apt-get install unzip
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
@shirhatti
shirhatti / guide.md
Last active July 8, 2019 03:15
Publish to a Linux Production Environment

Publish to a Linux Production Environment

In this guide, we will cover setting up a production-ready ASP.NET environment on an Ubuntu 14.04 Server. Though we will cover the specifics of using Ubuntu 14.04, the content will be applicable to other flavors of Linux.

We will take an existing ASP.NET 5 application and place it behind a reverse-proxy server. We will then setup the reverse-proxy server to forward requests to our Kestrel web server.

Additionally we will write a startup script to ensure our web application runs on startup as a daemon as well as a configure a process management tool to help restart our web application in the event of a crash to guarantee high availibility.

Prerequisites

{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountName": {
"type": "string",
"metadata": {
"description": "Name of storage account"
}
},
@shirhatti
shirhatti / gist:83e42592175d93201d4d
Created December 9, 2015 19:44
Docfx stack trace on Ubuntu 14.04 and Mono 4.0.5
Error: Error running program: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
at System.Reflection.Assembly+<>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
at System.Linq.Enumerable+<CreateSelectIterator>c__Iterator10`2[System.Reflection.TypeInfo,System.Type].MoveNext () [0x00000] in <filename unknown>:0
at System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator12`2[System.Reflection.Assembly,System.Type].MoveNext () [0x00000] in <filename unknown>:0
at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor (IEnumerable`1 types, System.Composition.Convention.AttributedModelProvider attributeContext) [0x00000] in <filename unknown>:0
at System.Composition.Hosting.ContainerConfiguration.CreateContainer () [0x00000] in <filename unknown>:0
at Micro
@shirhatti
shirhatti / service.ps1
Created December 10, 2015 22:59
Create breadcrumb directory for Servicing
$breadcrumbFolder = $env:ALLUSERSPROFILE + '\Microsoft DNX\BreadcrumbStore'
New-Item -Force -Path $breadcrumbFolder -ItemType "Directory"
$ACL = Get-Acl -Path $breadcrumbFolder
# Clear any permissions
$ACL.SetAccessRuleProtection($true, $false)
# Set new permissions
$ACL.SetSecurityDescriptorSddlForm("O:SYG:SYD:P(A;OICI;CCDCSWWPLORC;;;WD)(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)")
Set-Acl -Path $breadcrumbFolder -AclObject $ACL