Published: May 28, 2024 by Isaac Johnson
Recently at Google I/O, Google rolled out IDX, their new IDE meant to compete with the likes of Microsoft’s VS Code.
Once we agree to terms, we are presented with a rather simple start page
We’ll start by trying my Forgejo instance
Sadly they don’t like my URL, but do not really give a reason as to why. I tried Codeberg as well
But that too is a no go.
It’s not that I have anything against Github, but it does seem a bit odd to ping themselves to their supposed competitor.
Not even Gitlab worked
I’ll start with a simple private repo in Github
It starts by setting up a workspace
When I went to clone/update source I was prompted to auth in with a code
Interestingly it was prompting me for VS Code auth so perhaps they are using the same code server i use
Once authed, I could see it clone down
The first warning I got was about too many active changes
Most confusing to me was the initial staged changes appeared to be to wipe the repo out
I found myself rather confuddled by the Source Control interface. I know other devs use it, but I tend to avoid it altogether - even in VS Code on the desktop. I opened a terminal and cleared out the staged issues and got back to main and all was well
I think the problem really lies with me. I probably clicked something wrong or hit a key when setting my laptop down for a moment.
Can I use the terminal to get to Forgejo?
I cloned down a private Forgejo repo
then ran ‘code .’ which launched a new browser window
I confirmed that I wanted it to set up IDX
I saw it create some files and prompt for a rebuild of the env
I tried setting it to node and adding the idx files
It seems to be set up to work
I tried an inline chat and asked it to describe some actions
I tried a few forms, but it always came up as an error
No luck using the chat panel either
A question about markdown was similarly rejected
Even Javascript failed
I’m questioning if this is because I forked to a new window - maybe that tripped things up.
Going back to my initial window, not only did it refresh to the Forgejo repo, I found the Gemini window was now working
The inline chat did a marvelous job as well describing in simple terms a Gitea action
I was then able to commit the change back to Forgejo without issue
I did have to authenticate again so it’s not saving my credentials behind the scenes.
My next goal is to pause for a while and come back in the morrow on a different machine. Will my URL get me just to my blog checkout or also the Forgejo?
I came back several days later and with a new browser. I could see my project listed after logging in
It again set up the workspace
However, it dropped me right back to where I was before which was excellent.
This means I have way to work outside the boundaries of Github which, at least for me, makes this a far more useful tool. I should be able to use Azure Repos, Github, Gitlab, Codeberg, Gitea, Forgejo all equally.
With the terminal, we should also mention we are getting a free micro Linux box to use as well with 2 vCPU and 8Gb of memory:
We can use home to get back to the main Project IDX page
Starting something new
Let’s try and create a new project. I’ll ask for a fresh NodeJS Express app
We are dropped into a running Hello World express app
Let’s look at editing together as well as initializing the repo
Let’s do a simple ask of Gemini. How might we insert the current date into the page?
We can see a diff style inline suggestion we are prompted to accept
Which seems good. I saved and refreshed the page and saw it working
It’s now quite easy to commit our change and push to a fresh Forgejo repo
On Project IDX
About a year ago in August, a group of Google developers started the project built primarily on Code OSS (which we’ve written about before) and Codey, a generative AI model built on PaLM 2. They trained it on code and its been in private preview for some time.
An Inforworld Article confirmed that while it’s currently free, the Cloud Workstation would normally run between 0.16 and 9.36/hr (The one we see for our express example runs at 0.16 matching the class e2-standard-2).
Right now there really is nothing about cost on the Project page but I have to assume eventually they’ll shutter it or charge for it. I also have to wonder about using the OS variant of Microsoft’s Visual Studio code.
Code OS
As it’s been a while and I never did restore my Code OS instance after the big cluster rebuild, let’s do that quick.
It’s as simple as an A record (still there) and then a YAML manifest
$ cat prod-codeserver.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: code-server-deployment
spec:
replicas: 1
selector:
matchLabels:
app: code-server
template:
metadata:
labels:
app: code-server
spec:
containers:
- name: code-server-container
image: lscr.io/linuxserver/code-server:latest
ports:
- containerPort: 8443
env:
- name: PUID
value: "1000"
- name: PGID
value: "1000"
- name: PASSWORD
value: "MyPasswordHere!"
- name: SUDO_PASSWORD
value: "MyOtherPasswordHere!"
- name: TZ
value: "America/Chicago"
volumeMounts:
- name: code-server-config
mountPath: /config
volumes:
- name: code-server-config
persistentVolumeClaim:
claimName: code-server-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: code-server-pvc
spec:
storageClassName: managed-nfs-storage
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
---
apiVersion: v1
kind: Service
metadata:
name: codeserver-service
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 8443
selector:
app: code-server
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: "true"
ingress.kubernetes.io/proxy-body-size: "0"
ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
nginx.org/websocket-services: codeserver-service
nginx.ingress.kubernetes.io/proxy-body-size: "0"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.org/client-max-body-size: "0"
nginx.org/proxy-connect-timeout: "3600"
nginx.org/proxy-read-timeout: "3600"
labels:
app.kubernetes.io/instance: codeingress
name: codeingress
spec:
rules:
- host: code.freshbrewed.science
http:
paths:
- backend:
service:
name: codeserver-service
port:
number: 80
path: /
pathType: ImplementationSpecific
tls:
- hosts:
- code.freshbrewed.science
secretName: code-tls
which I can launch
$ kubectl apply -f ./codeserver.yaml
deployment.apps/code-server-deployment configured
persistentvolumeclaim/code-server-pvc unchanged
service/codeserver-service configured
ingress.networking.k8s.io/codeingress configured
Then login
Which then prompts me
I can then add Duet (Gemini) via the extensions
It seemed to fail on the GCloud CLI install
I tried to Ctrl-p and do the shortcut, but that just redirects to Gemini
I installed directly on the container via the Terminal, then tried again - this time I said “use existing Google Cloud CLI”. It seemed to work
I could then start the setup steps
I logged into GCloud using the CLI in the terminal
The Project Select button does nothing
But I can get there using the settings
I’ll also add some languages
I could now see Duet/Gemini stepping in to offer suggestions on a fresh markdown file
I can also get there via the right-click menu to Gemini Code Assist
I was curious what a “Generate Code” would do in a Markdown file.
It looks to just offer a lot of general Markdown options.
Summary
Today we took a look at Project IDX which has just recently been rolled out to the general public. Leveraging Code server, we have essentially a web-based VS Code with Gemini AI built-in.
While the current offering suggests it’s pinned to Github repos, we showed multiple ways to “jailbreak” into Forgejo and other GIT repo servers. We looked at some basic code generation and also data persistence.
Lastly, we relaunched an OS CodeServer instance and integrated with Duet AI/Google Gemini with Code Assist to essentially render the same thing on a self-hosted Kubernetes. This would allow us to have containers that reach internal resources at the consequence of ultimately needing to pay for API usage via our GCP Biling project.