DEV Community

Kamal Mustafa
Kamal Mustafa

Posted on • Updated on

Misc notes on Github Codespaces

Just some quick notes since I have spent few hours trying to get nix working on Codespaces and get our project running.

I have shared my Dockerfile in this issue at Nix's Github - https://github.com/NixOS/nix/issues/6680

docker-compose is working fine. We can customize our workspace using Dockerfile. Have to use images provided by Github, using our own image doesn't work. I guess we have to do some more works as stated in this post - have Dockerfile.base as well.

Workspace is stopped after the idle timeout (30mins) but all our work on disk is preserved. So uncommitted changes is still there when we come back, just like working on local computer.

Everytime we changed stuff in .devcontainer we have to rebuild the container. For quickly testing your Dockerfile, it's better to just run docker build in the terminal and if it build cleanly then we rebuild.

cd .devcontainer
docker build .
Enter fullscreen mode Exit fullscreen mode

A failure in rebuild will drop us into recovery container so we can fix our Dockerfile but tools are limited here.

https://github.com/microsoft/vscode-dev-containers/tree/main/containers/codespaces-linux/.devcontainer

Heroku cli login issue - https://github.com/heroku/cli/issues/1914 - ip address mismatch. We have same issue when working with remote vm, a workaround is to tunnel http traffic from our browser to the vm, either with vpn or simply ssh tunnel (we use sshuttle).

  • Workaround 1 - define env var HEROKU_API_KEY - the downside is that your action would not be under your username but the username of that api key owner
  • Workaround 2 - Copy the credentials from your local machine - it's stored in $HOME/.netrc file

https://devcenter.heroku.com/articles/authentication

VSCode editor doesn't enable word wrap by default. Add this to devcontainer.json:-

"editor.wordWrap": "wordWrapColumn",
"editor.wrappingIndent": "same",
"editor.wordWrapColumn": 80
Enter fullscreen mode Exit fullscreen mode

List of limitations - https://code.visualstudio.com/docs/remote/codespaces

Top comments (2)

Collapse
 
k4ml profile image
Kamal Mustafa • Edited

Codespaces vs Gitpod:-

freecodecamp.org/news/github-codes...

Collapse
 
k4ml profile image
Kamal Mustafa

Issue I found while trying to run pgadmin4 - it gave errors referrer doesn't match host, given by the WTF CSRF check.