You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: posts/self-hosted-homelab/index.md
+17-18Lines changed: 17 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -6,28 +6,26 @@ author: Marc Paquette
6
6
7
7
# Run Coder in a self-hosted homelab
8
8
9
-
I outgrew my little homelab. I have a couple of [ODROID-HC2](https://ameridroid.com/products/odroid-hc2) devices in a closet.
10
-
11
-
I use them to serve files and experiment with ARM assembly. They work great but they’re small, single board computers with equally small capacity.
9
+
I outgrew my little homelab. I have a couple of [ODROID-HC2](https://ameridroid.com/products/odroid-hc2) devices in a closet. I use them to serve files and experiment with ARM assembly. They work great but they’re small, single board computers with matching small capacity.
12
10
13
11
It was time to expand my homelab to handle my dev projects too.
14
12
15
13
## My problem: I wasn't getting anywhere
16
14
17
15
I was spending too much time managing my personal and work projects instead of working on them. They're spread out over several environments and places. They run on OpenBSD, Windows, Linux, ARM, python3, browsers, and old-school command-line tools. The ODROIDs are almost literally chained to my homelab closet. I work from home, a co-work space, and sometimes other time zones.
18
16
19
-
The ideal solution would let me self-host my projects and work on them wherever and however I want. The machine I’m typing on right now is an OpenBSD laptop. I sometimes use a Windows laptop. I run Linux on the ODROIDs. And I also wanted to use an iPad for the [ultimate sofa software development rig](https://coder.com/blog/a-guide-to-writing-code-on-an-ipad).
17
+
The ideal solution would let me self-host my projects and work on them wherever and however I want. The machine I’m typing on right now is an OpenBSD laptop. I sometimes use a Windows laptop. And I also wanted to use an iPad for the [ultimate sofa software development rig](https://coder.com/blog/a-guide-to-writing-code-on-an-ipad).
20
18
21
19
I put off fixing this because I expected that I'd have to hack and contort different tools into something that might eventually approach what I wanted. The cure seemed worse than the disease.
22
20
23
21
## I discovered Coder
24
22
25
-
It turns out that [Coder](https://coder.com) is a much easier solution. Coder solves big problems for big enterprise dev teams. And I discovered that it can solve my problem too:
23
+
It turns out that [Coder](https://coder.com/docs/v2) is a much easier solution. Coder solves big problems for big enterprise dev teams. And I discovered that it can solve my problem too:
26
24
27
25
- An isolated workspace for each project, no matter the environment
28
26
- Secure, remote access
29
-
- Flexibility of handling cloud and on-prem projects
30
-
- Administering all these projects from a single place
27
+
- Flexibility of handling cloud and on-prem workspaces
28
+
- Administering all these workspaces from a single place
31
29
- Easy to install
32
30
- Runs on modest hardware
33
31
- Bonus: [Open source](https://github.com/coder)!
@@ -38,7 +36,7 @@ My homelab would need more hardware. I found a used [Lenovo m92P Tiny](https://w
38
36
39
37
[pic of Marvin and the rest of my homelab]
40
38
41
-
I installed Debian GNU/Linux and tucked Marvin into the homelab closet. Marvin’s only connection to the outside world is an ethernet cable.
39
+
I installed [Debian](https://www.debian.org/intro/why_debian) and tucked Marvin into the homelab closet. Marvin’s only connection to the outside world is an ethernet cable.
42
40
43
41
## Install Docker then Coder
44
42
@@ -61,7 +59,7 @@ deb package has been installed.
61
59
marc@marvin:~$
62
60
```
63
61
64
-
I wanted to dedicate Marvin to hosting my projects, so I followed the installer's suggestion to run Coder [as a service](https://coder.com/docs/v2/latest/admin/configure#system-packages):
62
+
I wanted to dedicate Marvin to hosting my projects, so I followed the installer's suggestion to run Coder [as a system service](https://coder.com/docs/v2/latest/admin/configure#system-packages):
65
63
66
64
```bash
67
65
marc@marvin:~$ sudo systemctl enable --now coder
@@ -89,11 +87,13 @@ At this point I was able to use my laptop's browser to log in to Coder. I opened
89
87
90
88

91
89
92
-
Once logged in, I was ready to set up my first workspace. A Coder [workspace](https://coder.com/docs/v2/latest/workspaces) is a runnable environment that a developer, well, works in. Each developer has their own workspace (or workspaces).
90
+
Once logged in, I was ready to set up my first workspace. A Coder [workspace](https://coder.com/docs/v2/latest/workspaces) is a runnable environment that a developer, well, develops in. Each developer has their own workspace (or workspaces).
91
+
92
+
A developer can connect to a workspace from their [favorite IDE](https://coder.com/docs/v2/latest/ides) and other dev tools. That includes browser-based [VS Code](https://coder.com/docs/code-server/latest), [LSP](https://langserver.org/) servers, and local JetBrains or Emacs.
93
93
94
94
Before I could start a workspace, I needed to create a [template](https://coder.com/docs/v2/latest/templates). A template is the collection of settings that Coder uses to create new workspaces. You only have to set up a template once to create as many workspaces as you need from it.
95
95
96
-
A Coder template is a [Terraform](https://www.terraform.io/) file. That means that a Coder workspace can be whatever you can provision with Terraform. For big dev teams, that can be as sophisticated as a [Kubernetes](https://coder.com/docs/v2/latest/platforms/kubernetes) cluster. For Marvin, I'll just be using Docker. But I could just as easily create a template for something simpler, like a [Python virtual environment](https://docs.python.org/3/library/venv.html).
96
+
A Coder template is a [Terraform](https://www.terraform.io/) file. That means that a Coder workspace can be whatever you can provision with Terraform. For big dev teams, that can be as sophisticated as pods in a [Kubernetes](https://coder.com/docs/v2/latest/platforms/kubernetes) cluster. For Marvin, I'd just be using Docker.
97
97
98
98
Coder comes with a few templates out of the box. These templates include cloud computing like [Fly.io](https://coder.com/blog/remote-developer-environments-on-fly-io), Digital Ocean, Azure, Google Cloud, and AWS.
99
99
@@ -129,17 +129,16 @@ Create your template by running:
129
129
Examples provide a starting point and are expected to be edited!
130
130
```
131
131
132
-
Normally I would have customized the template for one of my projects. I would have done that by editing the Terraform file, `main.tf`, in the `docker` directory:
132
+
This starter template uses the vanilla [Ubuntu container image](https://hub.docker.com/_/ubuntu/). Normally I would have customized the template for one of my projects. I would have done that by editing the Terraform file, `main.tf`, in the `docker` directory:
133
133
134
134
```bash
135
135
marc@marvin:~$ ls docker
136
136
main.tf README.md
137
137
```
138
138
139
-
This starter template uses the vanilla [Ubuntu container image](https://hub.docker.com/_/ubuntu/) and that's fine for now. So I just followed Coder's instructions to create the template:
139
+
Next, I followed Coder's instructions to create the template:
140
140
141
141
```bash
142
-
143
142
marc@marvin:~$ cd ./docker && coder template create
144
143
> Upload "~/docker"? (yes/no) yes
145
144
# Progress info...
@@ -176,7 +175,7 @@ I filled in details about my first workspace then started it:
176
175
177
176

178
177
179
-
Marvin took a couple of minutes as Coder prepared the workspace, including downloading the Docker image.
178
+
Marvin took a couple of minutes as Coder prepared the workspacefor the first time, including downloading the Docker image. After that starting the workspace would take only a few seconds.
180
179
181
180
That got me my first workspace, running and ready to use! I could access it in a few ways, including [code-server](https://coder.com/docs/code-server/latest), which lets me use VS Code in the browser.
182
181
@@ -196,10 +195,10 @@ I can finally go places now that I can leave Marvin at home. Coder's public acce
196
195
197
196
And I can finally work on my projects however I want.
198
197
199
-
[ pic of Coder on an iPad ]
198
+

200
199
201
200
For the next step, I'll set up some of my projects as Coder workspaces on my homelab:
202
201
203
-
*Put my static web site generatorin a Docker image
204
-
*Provision one of the ODROIDs as a Coder workspace
202
+
*Static web site generator: Create a template with [persistence](https://coder.com/docs/v2/latest/templates/resource-persistence) and add [Pelican](https://getpelican.com/) to the template's Docker image.
203
+
*ARM assembly: Create a template that provisions an ODROID.
0 commit comments