Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How I setup my development environment #39

Open
zhouhaibing089 opened this issue Apr 22, 2020 · 0 comments
Open

How I setup my development environment #39

zhouhaibing089 opened this issue Apr 22, 2020 · 0 comments

Comments

@zhouhaibing089
Copy link
Owner

zhouhaibing089 commented Apr 22, 2020

Container technology has been popular, but VM is still a good choice for myself considering its full flexibility including the hack-ability of kernel.

Full disclosure: I primarily work on Mac, and I like using vscode as my primary tool for developing code. Now coming to my problem, I have to get a Linux environment, because many of the projects that I worked on relies on Linux functionality.

Launching a VM

There might be many choices:

  1. Launching VM in cloud. This is awesome, but it limits your capability to work offline.
  2. Using VirtualBox. Sadly, due to its license issue, I couldn't run it for my work. It's considered as personal use only as far as I can tell.
  3. multipass. This is good considering its simplicity of configuration and license seems to be good as well.

I finally choose multipass. Here is how I create one VM for myself:

$ multipass launch -c=2 -m=8G -d=50G --name=dev

The flags are just so intuitive that I don't even to remember it.

The next step is about configuring the access. Well, obviously, we can use multipass shell dev directly, but that's just not the standard way of access, I mean, internally it is SSH anyway. I just want to make it more explicit.

$ sshkey-gen -t rsa

Then append the following configuration

To make the user experience more straightforward for using vscode, we can add the following script into PATH which name code.

#!/bin/bash

set -o errexit
set -o nounset
set -o pipefail

if [[ $# -eq 0 ]]; then
  p=$(pwd)
else
  p=$(cd $1; pwd)
fi

ip=$(pinky | grep -v tmux | grep -v Where | awk '{print $NF}' | uniq)
ssh -i ~/.ssh/id_rsa -l haibzhou ${ip} -- /usr/local/bin/code --folder-uri "vscode-remote://ssh-remote+dev${p}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant