Skip to content

Instantly share code, notes, and snippets.

@yodeah
yodeah / gist:e33730290017af3a3f19cf1867f0e1a9
Last active October 15, 2024 06:50
Nginx https load balancer with lets encrypt cert

Nginx https load balancer with lets encrypt cert

Part 1: Create a working http load balancer

I'v decided to use amazon for hosting my (Ubuntu 14.04 trusty) server (t2.nano (still an overkill, anything with 256 mb ram is sufficient IMHO))

  1. you have to create a security profile which opens port 22 for ssh, 80 for http, and 443 for https.

  2. ssh into your server.

@yodeah
yodeah / loadbalancer.sh
Created October 17, 2016 14:38
aws startup script
#!/bin/bash
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
./certbot-auto --standalone --cert-path /etc/letsencrypt/certs/ -p beta.daggersandsorcery.com
sudo apt-get install nginx
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.backup
@yodeah
yodeah / loadbalancer.sh
Last active October 23, 2016 22:35
aws startup script
#!/bin/bash
echo "START"
#you have to own this url and the url has to point to the server you are gonna run the script on
URL_TO_BE_CERTIFIED=beta2.daggersandsorcery.com
#you can add multiple urls/ips, separated by a space (api.daggersandsorcery.com www.api.daggersandsorcery.com)
ROUTE_THE_TRAFFIC_TO_THIS=api.daggersandsorcery.com
#So according to this your 5 8 * * 6 would run 8:05 every Saturday.
@yodeah
yodeah / install_java_and_monitor_repo.sh
Last active November 13, 2016 23:08
install java and monitor repository
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
sudo apt-get install unzip
unzip awscli-bundle.zip
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
const CONF = require("./conf.json");
const AWS = require("aws-sdk");
var lambda = {};
function init(){
AWS.config = new AWS.Config({
accessKeyId:CONF.ID,
secretAccessKey:CONF.SECRET,
region:"eu-central-1",
//http://stackoverflow.com/questions/42362235/web-pushnotification-unauthorizedregistration-or-gone-or-unauthorized-sub
document.addEventListener('DOMContentLoaded', function () {
if (Notification.permission !== "granted")
Notification.requestPermission();
});
function notifyMe() {
if (!Notification) {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
restaurant creation JSON:
{
"firstName":"string",
"lastName":"string",
"email":"string",
"restaurantName":"string",
"city":"string",
"address":"string",
"postalCode":"number",
/*ORIGINAL*/
export class Deal {
public id:number;
public restaurantId:number;
public name:string;
public price:number;
public currency:string;
public promotionStartDate: string;
public promotionEndDate: string;