Skip to content

Setting up a devotees dev box

Anja Kefala edited this page Sep 6, 2017 · 15 revisions

Setting up a cloud server

Clean up the previous server

  • ensure everything in git/ is either pushed to remote or dropped

  • verify if we want to save any of our dotfile changes

Launch a Linux EC2 instance.

  • Find EC2 in the "services" menu in the upper-left (Ubuntu 14.04 LTS for the base image; a t2.micro)

  • In the network configuration, make sure that the ssh port 22 is open to the world for maximum insecurity (and so your pairing partners can connect).

  • Name your new instance.

Create/download/manage your keypair.

  • Set permissions to 0600: chmod 0600 yourkey.pem

  • Store it somewhere safe!

ssh into the server and setup the basics

  • Grab the Public IP address from the EC2 console.
$ ssh -i yourkey.pem ubuntu@<public-ip>
  • Set up the environment.
$ sudo apt-get update && sudo apt-get install tmux git vim irssi 

Setting up the cloud server for your pairing partner(s)

Create groups

$ sudo addgroup <groupname>

Add user accounts for other people to connect

$ sudo adduser <theirusername>

  • Give a terrible password so your pairing partner is motivated to change it.

  • Add them the sudo group

$ sudo usermod -aG sudo <theirusername>

  • Now they can switch to sudo mode with

$ su - <theirusername>

  • Add them to any other groups

$ sudo usermod -aG <groupname> <theirusername>

edit /etc/ssh/sshd_config to allow passwords to be used

  • sudo vim /etc/ssh/sshd_config

  • Change PasswordAuthentication no line to yes.

  • restart sshd: sudo service ssh restart

  • Now your pairing partner can connect with ssh <theirusername>@<public-ip>.

Within your home directory

  • Run umask
  • Run setup.sh to set up dotfiles. Type reset ENTER when you hit the bug.

Launch tmux for sharing

  • By default tmux creates a non-shared session.

  • To allow sharing, use the -S <socket-filename> option with a file that will be accessible to other users.

  • When creating a session for the first time, use new -s:

tmux -S /tmp/shared new -s <sessionname>

  • Then within tmux, give permissions for your partner (and anyone else on this instance) to attach to your tmux socket:

chmod 0777 /tmp/shared

  • For now, the owner of the devbox is the one who should create the session, until we figure out how to otherwise handle permission-management of folders like .ssh.

Connecting to an Existing Session

Connect to host server & enter the tmux session

  • First you need to ssh to the host's server like this:

ssh <theirusername>@<public-ip>

tmux -S /tmp/shared new -t <sessionname>

Gitlab Shenanigans

Gitlab will not allow you to clone or push without you getting your fucking keys together first.

  • Generate a new key
ssh-keygen -t rsa -C "[email protected]" -b 4096
  • You will be prompted to name the key. Do not keep the default; rename it to your devotee handle. That way we can manage multiple keys for multiple accounts.
cat pub_key
  • Add your public SSH key to gitlab, and then edit the config file in ~/.ssh/config.
touch ~/.ssh/config
vim ~/.ssh/config

Sample Gitlab config

#Default GitHub
Host gitlab
  HostName gitlab.com
  User git
  IdentityFile ~/.ssh/id_rsa_sholmes

Host gitlab-waton
  HostName gitlab.com
  User git
  IdentityFile ~/.ssh/id_rsa_jwatson

Fun with irssi

Sample .irssi config

.irssi/config

servers = (
  {
    address = "chat.freenode.net";
    chatnet = "Freenode";
    port = "6667";
    use_tsl = "yes";
    tsl_verify = "yes";
    autoconnect = "yes";
  }
);

chatnets = {
  Freenode = {
    type = "IRC";
    max_kicks = "1";
    max_msgs = "4";
    max_whois = "1";
    sasl_mechanism = "PLAIN";
    sasl_username = "XXX";
    sasl_password = "XXX";
  };
};

channels = (
  { name = "#devotees"; chatnet = "Freenode"; autojoin = "Yes"; }
);

settings = {
  core = { real_name = "XXX"; user_name = "XXX"; nick = "XXX"; };
  "fe-text" = { actlist_sort = "refnum"; };
};