Skip to content

Instantly share code, notes, and snippets.

View junoteam's full-sized avatar
😃
Coding hard

Alex Berber junoteam

😃
Coding hard
View GitHub Profile
@junoteam
junoteam / terraform-ssh-remote-exec.tf
Created April 28, 2021 20:36 — forked from toshimaru/terraform-ssh-remote-exec.tf
How to connect to server via SSH and use remote-exec provisioner.
resource "digitalocean_droplet" "web" {
image = "ubuntu-16-04-x64"
name = "web-1"
region = "sgp1"
size = "512mb"
ssh_keys = [12345]
connection {
type = "ssh"
user = "root"
@junoteam
junoteam / README.md
Created February 9, 2020 13:10 — forked from tomazzaman/README.md
Kill supervisor on Docker when any of the services fail

Killing supervisor if any of it's child processes fail

The trick is to only register the listener for events that indicate failure, namely

  • PROCESS_STATE_STOPPED
  • PROCESS_STATE_EXITED
  • PROCESS_STATE_FATAL

Once they do, we should send a SIGQUIT to Supervisor.

@junoteam
junoteam / diskinfo.go
Created January 9, 2019 14:30 — forked from lunny/diskinfo.go
Disk Info for Golang
package main
import (
"fmt"
"syscall"
)
type DiskStatus struct {
All uint64 `json:"all"`
Used uint64 `json:"used"`
@junoteam
junoteam / README.md
Created January 8, 2019 13:54 — forked from rantav/README.md
Find slow queries in mongo DB

A few show tricks to find slow queries in mongodb

Enable profiling

First, you have to enable profiling

> db.setProfilingLevel(1)

Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target...

@junoteam
junoteam / README.md
Created July 6, 2017 13:00 — forked from mariotacke/README.md
Default nginx log format (combined) and grok pattern
@junoteam
junoteam / nginx.conf
Created May 23, 2017 11:06 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@junoteam
junoteam / haproxy.conf
Created February 9, 2017 09:12 — forked from nateware/haproxy.conf
HAProxy sample config for EC2
#
# This config file is a combination of ideas from:
# http://www.37signals.com/svn/posts/1073-nuts-bolts-haproxy
# http://www.igvita.com/2008/05/13/load-balancing-qos-with-haproxy/
# http://wiki.railsmachine.com/HAProxy
# http://elwoodicious.com/2008/07/15/nginx-haproxy-thin-fastcgi-php5-load-balanced-rails-with-php-support/
# http://upstream-berlin.com/2008/01/09/using-haproxy-with-multiple-backends-aka-content-switching/
# http://wiki.railsmachine.com/HAProxy
# http://gist.github.com/raw/25482/d39fb332edf977602c183194a1cf5e9a0b5264f9
#

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

#!/bin/sh
#Put this script into <gitProject>/hooks/post-receive on the production server
#Make sure this script has execute permissions (chmod +x post-receive)
#You can create a group (like "git"), make it owner of this file, and add
#every user that needs to push to the that group.
echo 'start repo to prod'