This is a toolset that allows running remote development environments via docker.
Each environment:
- Is a container is provisioned with whatever tools are needed by developers. Container images are centrally managed allowing adminsitrative curation. The only hard requirement is that the container has a running SSH server.
- The container setup is created for each user. User's home directory is persisted to a docker volume that survives container restarts. Each container gets it own docker socket so they do not conflict with each other, etc.
- Environments can be managed using a CLI included in the
client
folder.
With a full image, you get support for VSCode Remote, JetBrains Remote Gateway, and in-browser VSCode and IDEA Projector, built in.
To set up a server, you just need an instance that supports SSH and Docker.
- Clone this repo
- Run
make server-standup
in the root. This will build the docker containers, then build and start the server on port3001
in your host.
To create an environment, you need to be able to access the server via SSH.
Let's imagine our server is in our ssh config as my-server
and you have access to it via ssh my-server
.
This is the server you ran the above steps on.
Now, on a client.
- Clone this repo
cd client
, runmake install
- Connect to the API:
./docker-env my-server
. - Create a developer enviornment:
my-server> create devbox
. This will create a server for you to use:
❯ my-server> create devbox
Created devbox
SSH Port: 35385
Run `connect devbox` to start tunnels
Here the environment is running, so we set up our local ports to access it.
> connect devbox
❯ > connect devbox
Connected SSH as localhost:35385
Success! We've now connected!
To SSH to the instance, you can do so within the prompt or outside on the command line.
A SSH config has been created automatically, so from your command prompt, just run ssh devbox
and you're set. This also works for tools like VSCode Remote SSH.
At the docker-env prompt, run my-server> ssh devbox
. This will give you an SSH prompt to the box:
my-server> ssh demo
ssh -A -p 35385 sburke@localhost
Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-1041-aws x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
This system has been minimized by removing packages and content that are
not required on a system that users do not log into.
To restore this content, you can run the 'unminimize' command.
Last login: Thu Apr 21 03:11:23 2022 from 172.24.0.1
sburke@sburke-demo:~$
There are commands for instance management:
info devbox
will print the currently connected portsdestroy devbox
will PERMANENTLY destroy the instancerestart devbox
will stop the instance and restart it, useful to upgrade the underlying container image. NOTE you will lose anything outside of your home directory in this operation.
NOTE: currently the password for the instance is your username. Will be adding the ability to customize this soon
To access with VSCode, ensure you have the "Remote SSH" extension installed.
- Command Palette >> "Remote SSH Connect to Host..."
- Select the appropriate instance
devbox
from the list of hosts.
Done!
IntelliJ support is already installed in the base image.
First, SSH to your instance and clone whatever code you plan to work on.
- Install JetBrains Remote Gateway
- Once you run the client choose "Remote-Development >> SSH"
- Configure a new connection with your username,
localhost
, and the SSH port (the SSH port entry field is a bit weird, but you can get it to work) - Hit OK and choose the folder you cloned above, and which tool you intend to use
- Go!
VSCode in-browser support is already provided using the Coder.com Code Server project.
- SSH to your instance
- Logging in will automatically start the code server. Run
start-code-server check
to verify. - After a few seconds you'll see output that the client (assuming it has done
connect [name]
) has noticed the new port:
[ -- docker-env -- ]
| Connected VSCode Browser as localhost:59564
| Connect to VSCode browser at http://localhost:59564
[ -- ]
Click on that link and you're off and running! Just navigate to your folder of choice.
This works best if you open a second instance of the client.
- In the client, ssh to your instance
- Run
projector run
, which will take you through the install steps for JetBrains Projector - Once its running, you'll see that the port has been noticed by the client:
envserver >
|Connected IntelliJ Projector as localhost:60669
| Connect to IntelliJ browser at http://localhost:60669
Click the link and off you go.
Once you have done the above once, you can make it run in the background via nohup projector run &
Enjoy!