Skip to content

Commit 3e23521

Browse files
committed
Vagrant disk size (keybase#23164)
1 parent 0b120b4 commit 3e23521

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-4
lines changed

packaging/linux/tuxbot/Vagrantfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
Vagrant.configure("2") do |config|
22
config.vm.box = "debian/buster64"
3+
config.disksize.size = '50GB'
34
config.vm.provider "virtualbox" do |vb|
45
vb.memory = "24576"
56
end
7+
config.vm.provision "shell", path: "provision_tuxbot_disk", privileged: true
68
config.vm.provision "shell", path: "provision_tuxbot_root", privileged: true
79
config.vm.provision "shell", path: "provision_tuxbot_user", privileged: false
10+
config.vm.provision "file",
11+
source: "#{ENV['GOPATH']}/src/github.com/keybase/client/packaging/linux/tuxbot/cleanup",
12+
destination: "~/cleanup",
13+
run: "always"
814
config.vm.provision "file",
915
source: "#{ENV['GOPATH']}/src/github.com/keybase/client/packaging/linux/tuxbot/ssh_config",
1016
destination: "~/.ssh/config",

packaging/linux/tuxbot/bot/tuxbot/tuxbot.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,18 @@ func (c Tuxbot) Dispatch(msg chat1.MsgSummary, args []string) (err error) {
409409
}
410410
return nil
411411
case "tuxjournal":
412-
ret, _ := exec.Command("sudo", "journalctl", "--user-unit", "tuxbot", "-n", "50").CombinedOutput()
413-
c.Debug("```%s```", ret)
412+
ret, err := exec.Command("journalctl", "--user-unit", "tuxbot", "-n", "100").CombinedOutput()
413+
c.Debug("RET: ```%s```, ERR: %s", ret, err)
414414
return nil
415415
case "journal":
416-
ret, _ := exec.Command("sudo", "journalctl", "-n", "100").CombinedOutput()
417-
c.Debug("```%s```", ret)
416+
ret, err := exec.Command("journalctl", "-n", "100").CombinedOutput()
417+
c.Debug("RET: ```%s```, ERR: %s", ret, err)
418+
return nil
419+
case "cleanup":
420+
cleanupCmd := exec.Command("./cleanup")
421+
cleanupCmd.Dir = filepath.Join(currentUser.HomeDir)
422+
ret, err := cleanupCmd.CombinedOutput()
423+
c.Debug("RET: ```%s```, ERR: %s", ret, err)
418424
return nil
419425
default:
420426
return fmt.Errorf("invalid command %s", command)

packaging/linux/tuxbot/cleanup

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
# builds
4+
sudo rm -r /var/tmp/keybase*
5+
6+
# docker
7+
sudo docker system prune -af
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
set -euox pipefail
3+
4+
export DEBIAN_FRONTEND=noninteractive
5+
apt-get update
6+
apt install -yq parted
7+
8+
swapoff -a
9+
parted --script /dev/sda rm 2
10+
# https://bugs.launchpad.net/ubuntu/+source/parted/+bug/1270203
11+
echo -e "yes\n100%" | sudo parted /dev/sda ---pretend-input-tty resizepart 1
12+
resize2fs /dev/sda1

packaging/linux/tuxbot/provision_tuxbot_user

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ git clone https://github.com/keybase/client.git "$HOME/go/src/github.com/keybase
1010
(
1111
# install deps
1212
cd "$TUXBOTD/bot"
13+
git checkout master
1314
go mod tidy
1415
)
1516
systemctl --user link "$TUXBOTD/tuxbot.service"

0 commit comments

Comments
 (0)