Skip to content

Instantly share code, notes, and snippets.

@notnoopci
Last active October 19, 2016 13:39
Show Gist options
  • Save notnoopci/004c557ed1a13c19bebc11b2186f32f7 to your computer and use it in GitHub Desktop.
Save notnoopci/004c557ed1a13c19bebc11b2186f32f7 to your computer and use it in GitHub Desktop.

Cheatsheet

Change replicated ip address:

Change the value in https://<hostname>:8800/hosts

Renaming interfaces

rename_link() {
  FROM=$1
  TO=$2
  sudo ip link set $FROM down && sudo ip link set $FROM name $TO && sudo ip link set $TO up
  sudo ip link set $FROM up
}

rename_link other0 eth0

cleaning up for iptables:

Evaluate the result of the following commands:

sudo iptables-save -t filter | grep lxcbr | sed "s/-A/sudo iptables -w -t filter -D/"
sudo iptables-save -t mangle | grep lxcbr | sed "s/-A/sudo iptables -w -t mangle -D/"
sudo iptables-save -t nat | grep :22 | sed "s/-A/sudo iptables -w -t nat -D/"

cleaning up bridges

cleanup_bridge() {
BRIDGE_NAME=$1

sudo -n kill $(cat /var/run/lxc/$BRIDGE_NAME/dnsmasq.pid)

sudo -n sed -i -n "/veth $BRIDGE_NAME 1/!p" /etc/lxc/lxc-usernet
sudo -n ip link set dev $BRIDGE_NAME down
sudo -n ip link del dev $BRIDGE_NAME
}

Clean up container

sudo -n lxc-stop -k --nolock -n $CONTAINER_NAME
sudo -n sudo -n btrfs subvolume delete /mnt/$CONTAINER_NAME
sudo -n rm -rf /var/lib/lxc/$CONTAINER_NAME

Nvidia

Run lein repl :connect 6005 on a builder

(ns circle.backend.lxc.config)
(def original-base-lxc-default-config base-lxc-default-config)
(def base-lxc-default-config
     (concat original-base-lxc-default-config
             [["lxc.mount.entry" "/dev/nvidia0 dev/nvidia0 none bind,optional,create=file"]
              ["lxc.mount.entry" "/dev/nvidiactl dev/nvidiactl none bind,optional,create=file"]
              ["lxc.mount.entry" "/dev/nvidia-uvm dev/nvidia-uvm none bind,optional,create=file"]]))

Some sensible settings for considuration

CIRCLE_NUM_CONTAINERS=10
CIRCLE_CONTAINER_CPUS=0
CIRCLE_CONTAINER_MEMORY_LIMIT=40G
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment