Skip to content

Commit

Permalink
Vagrant disk size (#23164)
Browse files Browse the repository at this point in the history
  • Loading branch information
heronhaye committed Mar 20, 2020
1 parent 0b120b4 commit 3e23521
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
6 changes: 6 additions & 0 deletions packaging/linux/tuxbot/Vagrantfile
@@ -1,10 +1,16 @@
Vagrant.configure("2") do |config|
config.vm.box = "debian/buster64"
config.disksize.size = '50GB'
config.vm.provider "virtualbox" do |vb|
vb.memory = "24576"
end
config.vm.provision "shell", path: "provision_tuxbot_disk", privileged: true
config.vm.provision "shell", path: "provision_tuxbot_root", privileged: true
config.vm.provision "shell", path: "provision_tuxbot_user", privileged: false
config.vm.provision "file",
source: "#{ENV['GOPATH']}/src/github.com/keybase/client/packaging/linux/tuxbot/cleanup",
destination: "~/cleanup",
run: "always"
config.vm.provision "file",
source: "#{ENV['GOPATH']}/src/github.com/keybase/client/packaging/linux/tuxbot/ssh_config",
destination: "~/.ssh/config",
Expand Down
14 changes: 10 additions & 4 deletions packaging/linux/tuxbot/bot/tuxbot/tuxbot.go
Expand Up @@ -409,12 +409,18 @@ func (c Tuxbot) Dispatch(msg chat1.MsgSummary, args []string) (err error) {
}
return nil
case "tuxjournal":
ret, _ := exec.Command("sudo", "journalctl", "--user-unit", "tuxbot", "-n", "50").CombinedOutput()
c.Debug("```%s```", ret)
ret, err := exec.Command("journalctl", "--user-unit", "tuxbot", "-n", "100").CombinedOutput()
c.Debug("RET: ```%s```, ERR: %s", ret, err)
return nil
case "journal":
ret, _ := exec.Command("sudo", "journalctl", "-n", "100").CombinedOutput()
c.Debug("```%s```", ret)
ret, err := exec.Command("journalctl", "-n", "100").CombinedOutput()
c.Debug("RET: ```%s```, ERR: %s", ret, err)
return nil
case "cleanup":
cleanupCmd := exec.Command("./cleanup")
cleanupCmd.Dir = filepath.Join(currentUser.HomeDir)
ret, err := cleanupCmd.CombinedOutput()
c.Debug("RET: ```%s```, ERR: %s", ret, err)
return nil
default:
return fmt.Errorf("invalid command %s", command)
Expand Down
7 changes: 7 additions & 0 deletions packaging/linux/tuxbot/cleanup
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

# builds
sudo rm -r /var/tmp/keybase*

# docker
sudo docker system prune -af
12 changes: 12 additions & 0 deletions packaging/linux/tuxbot/provision_tuxbot_disk
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euox pipefail

export DEBIAN_FRONTEND=noninteractive
apt-get update
apt install -yq parted

swapoff -a
parted --script /dev/sda rm 2
# https://bugs.launchpad.net/ubuntu/+source/parted/+bug/1270203
echo -e "yes\n100%" | sudo parted /dev/sda ---pretend-input-tty resizepart 1
resize2fs /dev/sda1
1 change: 1 addition & 0 deletions packaging/linux/tuxbot/provision_tuxbot_user
Expand Up @@ -10,6 +10,7 @@ git clone https://github.com/keybase/client.git "$HOME/go/src/github.com/keybase
(
# install deps
cd "$TUXBOTD/bot"
git checkout master
go mod tidy
)
systemctl --user link "$TUXBOTD/tuxbot.service"
Expand Down

0 comments on commit 3e23521

Please sign in to comment.