跳到正文
DEV Community· Ryan Batchelder·· 2 小時前AI 評分56

如何在 Unraid 家用伺服器部署 Kiro Crew

Ghosts in the Basement - Bringing your Kiro Crew to Unraid

AI 導讀

Ryan Batchelder 示範如何以 Docker 在 Unraid 家用伺服器部署 Kiro Crew,利用現有設備運行智能體。設定包括載入 seccomp 設定檔、映射預設的 5476 埠、保存容器資料,以及設定 KIROCREW_CORS_ORIGINS 和 dashboard URL;再以 kirocrew token --ttl 24h 取得一天有效的連結。

正文

What better topic to discuss on Halloween than my favorite ghosty assistant, Kiro!

When I first heard about Kiro Crew, I had some mixed thoughts where I was excited about its potential but I wasn't entirely sure how I could best make use of it. I use AI all the time in my day job, but Kiro is what I use to get my side-projects done and my usage there is relatively "bursty". I get an idea, start up a project with Kiro CLI and work through until I'm at a stopping point or I realize that I'm up way past my bedtime. Then that project lies dormant for days or weeks before I come back to it. The thought of running a persistent agentic crew doesn't totally jive with my way of mentally focusing on a project, and I wasn't sure that paying to keep an EC2 running made the most sense considering my usage patterns. That said I do sometimes want to fire off a quick idea here and there, so I don't want to deal with starting and stopping instances whenever inspiration strikes.

...then at some point I watched the actual Kiro Crew announcement video where Darko Mesaroš explained how he was running a Kiro Crew instance in a virtual machine in his homelab, and that's when the gears really started turning. As much as I'm a cloud guy, there are a lot of things that I like to run on infrastructure right in my basement. Normally these are things like backup file storage, home automation, and other things that don't necessarily need to be in the cloud, but it means I have some excess compute lying around that I'm already paying for. If you're in the same boat and happen to be running Unraid in your homelab, then this post is for you!

Unraid Setup

Unraid has two main options for running workloads beyond its normal file sharing capabilities: Docker and virtual machines. Docker is much lighter weight, so I opted for this route for now. I might reconsider this decision as Kiro Crew continues to mature and get features like Computer Use on Linux, but Docker covers my needs for now so let's start there. There's no Kiro Crew app on the Unraid Community Apps store (yet) so we'll need to set up the container ourselves.

First things first, we need the seccomp profile for Kiro Crew downloaded to our server. This allows Kiro Crew to run some privileged commands that enable its internal sandbox. I did this by ssh'ing into my Unraid host and running the following:

curl -fsSL https://raw.githubusercontent.com/kirodotdev/KiroCrew/main/docker/seccomp/kirocrew-seccomp.json \
  -o /mnt/user/appdata/kirocrew-seccomp.json

You could do the same, or if you prefer to avoid the terminal you can download the profile from GitHub and drop it into your appdata folder some other way (such as if you expose it as a share).

Now in your Unraid UI go to Docker -> Add Container. On the next screen you need to make sure you click the slider toggle in the top-right to enable advanced view.

Unraid Add Container screen showing advanced view with Name, Repository, and Extra Parameters setup

Then you'll want to enter the following:

Name: Whatever you want, I just used "kirocrew" to make it easy to identify in my list of running containers
Repository: ghcr.io/kirodotdev/kirocrew:stable
Extra Parameters: --security-opt seccomp=/mnt/user/appdata/kirocrew-seccomp.json

As a bonus, you can also set Icon URL: https://raw.githubusercontent.com/kirodotdev/KiroCrew/main/website/electron/icon.png

The repository here is the official Kiro Crew docker distribution. Extra parameters is where we pass a flag to Docker to have it load the seccomp profile we downloaded earlier. This field won't show up unless you're in advanced view, so be sure it's there else the Kiro Crew sandbox won't work!

Next we need to set up some additional config for our new instance:

  1. Add a port allocation for Kiro Crew's default port: 5476
  2. Add a path configuration to route the container's /home/kirocrew directory to a directory in your appdata. This will ensure that any stored files persist even as the container is updated in the future.
  3. Add an environment variable called KIROCREW_CORS_ORIGINS and set that to your Unraid server's IP or hostname. Kiro Crew will reject any requests not coming from this origin otherwise.

Unraid container configuration

After this, we're ready to start our new container! Hit apply to let the container pull down and start up.

Getting Connected

Now we'll need to use the container console to get a token so we can open the web interface.

Unraid Docker menu showing the Console button in the dropdown for our newly created Kiro Crew container

If you run kirocrew token right now, you'll get a token with a localhost url. You could take this, replace the localhost component with your Unraid IP address that we set in KIROCREW_CORS_ORIGINS and go straight to your dashboard now if you want, but let's get rid of this extra step.

Run this to set your server IP as the dashboard URL, you'll only need to run this once: kirocrew config set dashboard.url http://<your unraid ip>

Then restart the container and open the console again. This time run kirocrew token --ttl 24h to get a token that's good for a day. You'll see 2 lines output: the localhost url will still print but then after that you should see a URL with your server IP (http:///?token=).

Technically you're done here! You now have Kiro Crew running on Unraid, and you can use the dashboard from any browser that can access your Unraid server. That said, you probably want to set up a messaging channel next.

In Settings -> Messaging Channels you can hook up your Kiro Crew instance to a number of different chat services. This allows you to more easily interface with your instance without opening the dashboard, or even to get a fresh dashboard token without having to go into your Unraid console and run a command every time. I personally set up a Slack instance with just myself so I can interact with it from all of my devices easily. Kiro Crew's instructions are pretty good here and the choice of messaging platform is a personal one, so I won't expand on the how here. These steps are the same regardless of Unraid or other deployment platforms.

Besides a messaging channel, I also have Tailscale set up so I can access my server remotely. This allows me to still connect to my Kiro Crew instance from my phone even when I'm out and about. I've had this setup since well before Kiro Crew and I didn't do anything special to support it in this case, but when combined with the ability to generate a new dashboard URL from Slack I basically wouldn't be able to tell the difference between running Kiro Crew on my personal network versus in the cloud.

Conclusion

I've been using Kiro Crew in a hybrid multi-device configuration for a little while now, where I keep longer running sessions on my Unraid server with portability between devices and in-depth coding sessions on my laptop where I can more easily test and work on apps. This works pretty well for me right now, but I do dream of the ideal state where my "remote" crew can be churning away on coding tasks that I kick off from my phone. The main blockers for this are having an easy way to install other development tools and compilers, and setting up an environment where I feel comfortable trusting things like my GitHub credentials. The former problem can technically be solved in this setup by installing tools via the container console, but those will go away whenever I update the container. I could potentially use Portainer on Unraid and build custom images based on the Kiro Crew official image and I may investigate this in the near future.

Managing credentials is another problem. Today I treat my Unraid server as largely an open machine within the confines of my local network. This is a deliberate choice to balance convenience of sharing files with devices on my network with a threat model that trusts the people I let onto that network. If I'm going to start putting credentials to things like GitHub or my AWS account on that server, that would cause me to rethink how I protect it. As an alternative, I may consider either moving my Kiro Crew installation into a protected VM or separate machine altogether, but for now running on my existing Unraid server was a quick and cheap way to start playing with a crew that I can access from anywhere.

Are you using Kiro Crew on your homelab? What platform are you running it on and what do you use your crew for?

來源:DEV Community · dev.to