Skip to content

Instantly share code, notes, and snippets.

mowings

Block or report user

Report or block mowings

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mowings
mowings / kubernetes node.md
Last active Jun 24, 2019
Add a new kubernetes node to existing cluster
View kubernetes node.md

Install the node software:

apt update && apt upgrade -y
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

cat <<EOF > /etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF

apt-get update
@mowings
mowings / ncq.md
Created Jun 24, 2019
Disable NCQ (disk command queuing in linux)
View ncq.md

There is a kernel option to do this, if it cauxes boot issues, but otherwise in /etc/rc.local you can just add

echo 1 > /sys/block/sdb/device/queue_depth

Normally the kernel disables it after too many errors automatically, but it can cause disk timeouts until that happens. Does not have much of a performance impact on ssds.

@mowings
mowings / kernel_cleanup.md
Last active Jun 20, 2019
Enable autoremove of old kernels from ubuntu /boot directory
View kernel_cleanup.md

edit /etc/apt/apt.conf.d/50unattended-upgrades

Uncomment line:

Unattended-Upgrade::Remove-Unused-Dependencies “false”;

and change to true

This all assumes unattended-upgrades is enabled (it usually is by default)

@mowings
mowings / k8.md
Last active May 14, 2019
Install Kubernetes at Digital Ocean using private networking
View k8.md

Install the software

Instructions mostly at https://vitux.com/install-and-deploy-kubernetes-on-ubuntu/ but be sure to read the notes below before starting.

additional setup

This document assumes all hosts are on the private network, and the hosts are configured to pass/allow all traffic on that network. You could tighten this up if you want, but k8 requires quite a range of ports be open.

Be sure the --apiserver-advertise-address=<private ip> parameter is passed to kubeadm init on any master host. By default, the api-server will attempt to advertise on the public interface.

@mowings
mowings / lxc-top
Last active Sep 10, 2018
lxc-top -- Crappy ruby code to show top lxc containers eating cpu
View lxc-top
#!/usr/bin/env ruby
require 'yaml'
require 'curses'
include Curses
class Container
attr_accessor :name, :secs, :elapsed, :pct, :last_check, :mem
def initialize(name, secs)
@name = name
@secs = secs
@mowings
mowings / unicorn_status.rb
Last active Jul 2, 2018
Unicorn active and queued requests
View unicorn_status.rb
#!/usr/bin/ruby
# From: https://github.com/jahio/unicorn-status
# You may need to install unicorn: gem install unicorn --no-ri --no-rdoc
require 'rubygems'
require 'unicorn'
# Usage for this program
def usage
puts "ruby unicorn_status.rb <path to unix socket> <poll interval in seconds>"
@mowings
mowings / gist:87679b1dce9e8ad2ec1fbf829d02b1d2
Created Jun 30, 2018
How do I disable intel_powerclamp?
View gist:87679b1dce9e8ad2ec1fbf829d02b1d2
sudo rmmod intel_powerclamp
sudo echo echo intel_powerclamp /bin/true > /etc/modprobe.d/intel_powerclamp.conf
View keybase.md

Keybase proof

I hereby claim:

  • I am mowings on github.
  • I am tafkaks (https://keybase.io/tafkaks) on keybase.
  • I have a public key ASBNRLPZPw6Nz1POCQ8nHUJnUKdy4t2bgES-Qjn5097JbAo

To claim this, I am signing this object:

@mowings
mowings / postgres_systemd.md
Last active Feb 2, 2018
postgres and systemd
View postgres_systemd.md

systemd's logind by default will kill off all ipc objects associated with a user when that user logs out. This includes the postgres user -- which the postgres daemon runs as. Thus if you login in as postgres (for example to do some db maintenance) then postgres itself will crash as soon as you log out, since logind kills off all shared memory segments belonging to the postgres user. This crashes all postgres processes, and the system goes into recovery to the last good commit. You should turn this behavior off for any postgres host that uses systemd:

In /etc/systemd/logind.conf set

RemoveIPC=no

then restart logind

systemct restart systemd-logind
@mowings
mowings / restart net
Created Feb 2, 2018
change ip address on ubuntu 16.x without a reboot
View restart net
# Edit /etc/network/intefaces for the device to suite. (lets say en1)
ip addr flush en1 && systemctl restart networking.service
You can’t perform that action at this time.