Create your own self hosted dev workspaces with Coder
As a developer you might have already heard of Github Codespaces (if not please try it out its free ). Its a amazing Dev workspaces service from github . Its fast , easy to start with , no need to setup dev environments from sratch , decent performance which we can enhance with paid subscription. After using it , I got so fascinated with this concept of dynamic Dev Environments that I tried almost all the major Dev environment provider services like AWS cloud9 and gitpod and what not .
But all them are managed services , they provide us with a trial or a so called free version and always have a paid counterpart . Also we cannot have full control over it as it is a managed service. I needed something that can solve these issues and I found 'Coder' .
Coder is a viable alternative to Github Codespaces and the good part is , its free , can be self hosted , support multiple cloud environments and docker too .
So in this article I am going to share steps to setup Coder dev environment on a windows 11 machine and finally I will give my opinion on it .
Coder Setup
To setup Coder on a local environment first make sure you have decent hardware .
I am installing it on my main machine which has following specs ( i haven't tried it on multiple hardware yet but if your pc can run docker desktop decently then its fine )
Processor : Intel core i5 ( 11260H | 6C/12T)
RAM : 32 GB
OS : Windows 11 Home ( 22H2 )
To setup Coder we need to install its dependencies :
You can download all the files from links below :
Terraform downloads a zip file that contains executable . You need set the path environment variable so that terraform command can be executed from terminal .
Apart from these dependencies we are using VS Code , Windows terminal and Coder Remote ( VS code extension )
Now Lets start with the installation :
Step 1: Install Docker Desktop
Its a very straight forward step . Make sure you use WSL2 as a docker backend and not Hyper-V .
Step 2: Install Terraform
Extract the zip file you have downloaded from the download link .
Then add entry to path variable for Terraform .
Step 3 : Install Coder
Download the appropriate executable from release page .
Run installer as a normal windows program and select all the defaults .
After installation is completed , add the \bin directory of Coder installation to path . ( it will be located in C:\Program Files\Coder\bin )
Step 4 : Start Coder Server and complete initial setup
Open windows terminal and run following command
coder server
this will start Coder server on port 3000 . By default Coder use a built in postgres database to maintain records .
Recommended by LinkedIn
wait for server to start . When you see output like this , open localhost:3000 on your browser.
PS C:\Users\Someshwar> coder server
Coder v0.22.0+3ff2ae1 - Your Self-Hosted Remote Development Platform
failed to sync sloghuman: sync /dev/stderr: The handle is invalid.
Using built-in PostgreSQL (C:\Users\Someshwar\AppData\Roaming\coderv2\postgres)
Started HTTP listener at http://127.0.0.1:3000
Opening tunnel so workspaces can connect to your deployment. For production scenarios, specify an external access URL
View the Web UI: https://tte82c365upgk.pit-1.try.coder.appr
On main screen you will be asked to Create a Admin Account
Enter username , email and password and create the account . You will see something like this after logging in .
In above image you can see we have options like templates and users and below it we have a workspace section.
There are various built in templates which can choose from .
Here we have options to choose from a pre existing starter template or we can add our own template . Lets use Develop in Docker template .
Select the template , in upper right corner you will get option to create a workspace from the template .
Click on Create Workspace . Fill the details and wait for the workspace to start .
Now that the Coder Workspace is created , we can now connect to it from our VScode . For that we need to download the Coder Remote extension . ( Link )
Once extension is installed ,you can see the icon on Left side Activity Bar .
Click on the icon and you will see a button to login .
Click Login , then enter URL as http://localhost:3000 in next prompt .
You will be redirected to new page in browser . You can see a API key on the page . Enter this key into VS code prompt for API key and press enter .
Now your Coder Instance and VS code can communicate .
Here you can see our blogpost workspace listed . Now click on blogpost and click the play button next to it to connect to this workspace . A new VScode window will open . Wait for VScode to setup remote connection .
Your Coder Workspace is ready to develop . Its a ubuntu container in which we can install any runtime we want like node , java , ruby , anything .
When you are done with usage of the day , you can stop the workspace and then stop the server . Next time when you start working all the things will be there .
We have successfully setup Coder on our local environment . You can use a dedicated machine or a old laptop will work fine and expose it to internet . Thats it , you will have your own Cloud Dev Environment .
try it out on your machine and let me know if any help required .
That's it for today guys ! See you in next one .