Skip to content

Instantly share code, notes, and snippets.

@sciabarracom
Last active July 20, 2024 15:20
Show Gist options
  • Save sciabarracom/90c6890fbdc6b6c01e9f3dad59a738b3 to your computer and use it in GitHub Desktop.
Save sciabarracom/90c6890fbdc6b6c01e9f3dad59a738b3 to your computer and use it in GitHub Desktop.
Cloud Init for Docker Direnv
#cloud-config
# multipass launch -c4 -m8g -d20g -n cricket --cloud-init <url>
# multipass exec cricket -- sudo cloud-init status --wait
# cat ~/.ssh/id_rsa.pub | multipass exec cricket tee .ssh/authorized_keys
package_update: true
package_upgrade: true
users:
- name: ubuntu
uid: 1000
groups: sudo
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
runcmd:
- curl -fsSL https://get.docker.com | bash
- usermod -Gdocker ubuntu
- curl -sfL https://direnv.net/install.sh | bash
- snap install task --classic
- git clone https://github.com/nix-community/nix-direnv /usr/local/nix-direnv
- |
curl -L https://nixos.org/nix/install | sudo -u ubuntu sh
cd /home/ubuntu
echo 'eval "$(direnv hook bash)"' >>.bashrc
mkdir -p .config/direnv
echo 'source /usr/local/nix-direnv/direnvrc' >>.config/direnv/direnverc
chown -Rvf ubuntu:ubuntu .config
@sciabarracom
Copy link
Author

sciabarracom commented Jul 20, 2024

indirect launch from pc

  • get ip with multipass list
  • copy id_rsa.pub of the vm in your launch machine
Host scinet-cricket
  Hostname 10.6.73.219
  User ubuntu
  IdentityFile ~/.ssh/id_rsa_scinet
  ProxyCommand ssh -W %h:%p scinet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment