Workspace

Online IDEs, like GitHub Codespaces , have emerged as powerful tools in the developer ecosystem, primarily because of their unparalleled accessibility and flexibility. With just a web browser or a favorite client such as VS Code, developers can tap into their development environment from virtually any device—be it a desktop, laptop, tablet, or in some cases, even a smartphone. This anywhere, anytime access ensures that developers are not tied down to a specific machine and can seamlessly transition between devices, making the development process more fluid and adaptable.

Moreover, these platforms significantly reduce the setup time and complexities traditionally associated with development environments. Gone are the days of lengthy installations, configurations, and compatibility issues. Instead, online IDEs offer pre-configured, containerized environments that can be easily cloned or shared, facilitating collaboration and ensuring consistency across teams. Coupled with integrations to other cloud services and tools, these IDEs serve as a comprehensive hub for coding, testing, and deployment, effectively streamlining the developer workflow.

While online IDEs offer several advantages, they also come with some drawbacks. One prominent concern is their dependency on a reliable internet connection. Without consistent internet access, developers might experience disruptions, limiting their ability to code, test, or deploy seamlessly.

Defining our workspace

Our environment is based on devcontainer and integrated with GitHub Codespaces. This container comes with an array of features tailored for development, encompassing tools like Kubernetes utilities (kubectl, helm, tekton), the AWS CLI, Argo CD, GitHub CLI, yq, jq, Zsh, and several others.

To ensure a seamless workflow, environment variables from the local machine will be synced into this container at creation. Additionally, some specific VS Code extensions are pre-loaded to enhance the coding experience. Lastly, upon the container’s creation and startup, it will execute specific Zsh scripts, ensuring additional setup or initiation of essential services.

Preparing the configuration

Here we’ll setup a platform admin workspace with everything needed to run the platform, including it’s permission.

To install the gh cli and jq run the following below. For other installation methods click here .

brew install gh jq

And let’s authenticate:

gh auth login -h github.com -p https --insecure-storage -w -s codespace

We have prepared a repository to kickstart quickly. See https://github.com/dx-book/workspace.git . So let’s start forking it, and making it ours. Copy the following as it is and paste in your terminal.

gh repo fork dx-book/workspace \
  --clone \
  --default-branch-only \
  --fork-name workspace \
  --remote

Before we instantiate our workspace, we need to change your organization. This will allow us to clone other repositories belonging to this organization. We’ll also set our admin credentials to this workspace.

Please update the values below here before proceeding

export GITHUB_ORG=update-your-github-org-here
export AWS_PROFILE=default
export AWS_DEFAULT_REGION=eu-north-1
export AWS_ACCESS_KEY_ID=AKIAUICYRSPXYVKFYT9D
export AWS_SECRET_ACCESS_KEY=wP7IiY8wYTG73zlbEgmARrdqUPZOHQi0G9el96a9

Create a new organization

The next step is to update our workspace with your desired GitHub organization. If you don’t have a GitHub organization available yet, you’ll need to go to GitHub and create a new one. Head to https://github.com/settings/organizations and click New Organization.

bash workspace/.devcontainer/update-github-org.sh $GITHUB_ORG

And then let’s publish our private workspace changes to our forked repository.

cd workspace
git add .
git commit -m "Update github organization"
git push origin main

GitHub Codespace

And now let’s create the GitHub Codespace:

export GITHUB_USER=$(gh api user | jq -r '.login')
gh codespace create \
  --repo $GITHUB_USER/workspace \
  --display-name $GITHUB_USER \
  --location WestEurope

Select your desired machine configuration and continue in browser to authorize the recommended permissions.

Wait a few minutes to finish to build for the first time and then you can open the GitHub codespace:

gh codespace code --repo $GITHUB_USER/workspace

You might need to accept the installation for the GitHub Codespaces extension. If you prefer using the web browser IDE instead, you can add the --web flag to the end of the previous command.

By now you should have a VSCode connected to your GitHub Codespace. In case you need to change other configurations, you need to rebuild it:

gh codespace rebuild --repo $GITHUB_USER/workspace

A message such as : This folder contains a workspace file 'workspace.code-workspace'. Do you want to open it? Learn more about workspace files.

Click Open Workspace, this workspace comes with default configurations and a recommended set of extension, for your convenience, click Install when the recommended extensions request popup.

To make sure the desired environment variables are available, you can run:

source ~/.zshrc
env | grep AWS