Do you see any use cases or benefits for creating ...
# geodesic
m
Do you see any use cases or benefits for creating a devcontainer for Geodesic?
e
I do want to - like the one we have for Atmos
Just didn't get around to it.
I think it would be great as a quick way to kick the tires on it to understand what it does
Are you signing up? 😃
m
I can take a crack at it! Do you envision having it similar to the Atmos devcontainer with a quickstart?
e
Yes, though we don't have a home for a quickstart yet. We want to launch a micro site for geodesic as well.
I would start with the dev container and a mention in the root README.md with a button
Similar to this:
m
Sweet, sounds good! I can take a crack at it this week
i
There is an atmos devcontainer?
How well does that work vs using geodesic?
And how does GitHub Codespaces fit into that?
e
Yep, there is!
i
If there is documentation or old office hours where this is covered, please link me to it
i
Sorry, brand new to GitHub. Will this launch the codespace under cloudposse org?
e
No, it will be under your github
👍 1
This simple tutorial works with the code space
i
The note on the linked page implies that it's free to give it a try?
e
Github says they are free to get started
😃
You might need to reduce the instance size
i
Sweet, I just wanted to see a quick demo without it being on a bill somewhere I have to answer for 😉 Will let you know how it works out. YOLO, right
e
Note, terraform is painfully slow on machines with lower memory / cores
i
Yeah, that's my concern. Anecdotally it feels like terraform is slower in geodesic as well on my m3.
At least with the part where it downloads resources from the registry. I have never quite figured out why the caching of the providers doesn't work.
e
You would need to place the cache on the mounted filesystem in geodesic
👍 1
I think it's configurable via
TF_DATA_DIR
i
So, is the Codespaces demo just to demo the devcontainer, or do you actually use it? (ie does it handle authentication into AWS, etc)
Looks great btw. Love it.
e
It's just a demo. At this time, we predominantly use geodesic
However, I think the codespace is very comprehensive and could replace it. We just haven't adopted it as a team.
👍 1
I think a page on using Devcontainers could be added here https://docs.cloudposse.com/layers/project/
Like we have one for "Prepare the Toolbox"
m
@Jeremy G (Cloud Posse) I’ve created a basic devcontainer for Geodesic in a draft PR (https://github.com/cloudposse/geodesic/pull/957). You’re welcome to build on it or disregard it entirely. The Geodesic container starts up, but the prompt doesn’t display—I suspect there’s some initialization magic happening behind the scenes that isn’t working.
j
@Michael Here is the (slightly sanitized)
devcontainer.json
I use for your customized Geodesic. See if there's anything you'd like to take from it and add to yours and please LMK what you think.
Copy code
{
  "name": "Geodesic Dev Container",
  "image": "<your-GH-org>/infra:latest",
  "mounts": [
    "source=${localEnv:HOME}/.aws,target=${localEnv:HOME}/.aws,type=bind",
    "source=${localEnv:HOME}/.config,target=${localEnv:HOME}/.config,type=bind",
    "source=${localEnv:HOME}/.emacs.d,target=${localEnv:HOME}/.emacs.d,type=bind",
    "source=${localEnv:HOME}/.geodesic,target=${localEnv:HOME}/.geodesic,type=bind",
    "source=${localEnv:HOME}/.kube,target=${localEnv:HOME}/.kube,type=bind",
    "source=${localEnv:HOME}/.ssh,target=${localEnv:HOME}/.ssh,type=bind",
    "source=${localEnv:HOME}/.terraform.d,target=${localEnv:HOME}/.terraform.d,type=bind",
    "source=${localEnv:HOME}/.bashrc.d,target=${localEnv:HOME}/.bashrc.d,type=bind"
  ],
  "workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind",
  "workspaceFolder": "${localWorkspaceFolder}",
  "appPort": ["12345:12345"],
  "containerEnv": {
    "SHELL": "/bin/bash",
    "GEODESIC_PORT": "12345",
    "GEODESIC_HOST_CWD": "${localWorkspaceFolder}",
    "GEODESIC_WORKDIR": "${containerWorkspaceFolder}",
    "LOCAL_HOME": "${localEnv:HOME}",
  },
  "remoteEnv": {
    "LOGIN_SHELL": "/bin/bash"
  },
  "settings": {
    "terminal.integrated.defaultProfile.linux": "/bin/bash"
  },
}
Note that
appPort
and
GEODESIC_PORT
have to match, but otherwise can be any non-privileged port.
m
@Jeremy G (Cloud Posse) I assume that
localWorkspaceFolder
is set to the directory on your host machine that contains infra?
j
IIRC,
localWorkspaceFolder
is a devcontainer standard that refers to the folder which the IDE has opened as the root of the project. So yes, it is the root of the Git repo, containing the
components/
and
stacks/
directories.
👍 1