Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Codespaces support #4292

Closed

Conversation

aeisenberg
Copy link
Contributor

Resolves #3829

Description

This PR adds support for GitHub Codespaces. It includes a devcontainer configuration that will be used to create a Codespace for this repository. The configuration includes:

  • Dockerfile: Installs ruby:dev-3.2-buster image. When the version of ruby used by this project changes, the Dockerfile should be updated. An attempt to install the correct version of ruby will be done, but it will take a while to download and compile the version.
  • devcontainer.json: Specifies the configuration for the Codespace. It includes the Dockerfile to use, the extensions to install, and the settings to use.
  • docker-compose.yml: Specifies the services to run in the Codespace. It includes the postgres service.
  • post-create.sh: Script that runs after the Codespace is created. It optionally installs a new version of ruby, sets up the database, and prepares the environment.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update
  • Documentation update

This PR adds codespaces support. It is not an externally facing feature. The documentation changes are only for setting up the dev environment. I have included a change to the README to help with this.

How Has This Been Tested?

To test this out, create a new codespace for the project, wait for everything to load, and run bin/start. The project should start with no errors.

This commit adds support for GitHub Codespaces. It includes a
devcontainer configuration that will be used to create a Codespace for
this repository. The configuration includes:

- Dockerfile: Installs `ruby:dev-3.2-buster` image. When the version of
  ruby used by this project changes, the Dockerfile should be
  updated. An attempt to install the correct version of ruby will be
  done, but it will take a while to download and compile the version.
- devcontainer.json: Specifies the configuration for the Codespace. It
  includes the Dockerfile to use, the extensions to install, and the
  settings to use.
- docker-compose.yml: Specifies the services to run in the Codespace. It
  includes the `postgres` service.
- post-create.sh: Script that runs after the Codespace is created. It
  optionally installs a new version of ruby, sets up the database, and
  prepares the environment.
.devcontainer/devcontainer.json Show resolved Hide resolved
.devcontainer/devcontainer.json Show resolved Hide resolved
.devcontainer/docker-compose.yml Show resolved Hide resolved
.devcontainer/post-create.sh Outdated Show resolved Hide resolved
Gemfile.lock Show resolved Hide resolved
Copy link
Collaborator

@dorner dorner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfamiliar with this, so had some questions. @awwaiid I think you've used this in the past, did you want to take a look?

.devcontainer/.env.codespaces Show resolved Hide resolved
.devcontainer/devcontainer.json Show resolved Hide resolved
.devcontainer/devcontainer.json Show resolved Hide resolved
.devcontainer/post-create.sh Show resolved Hide resolved
Gemfile.lock Show resolved Hide resolved
Copy link
Contributor Author

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review!

.devcontainer/.env.codespaces Show resolved Hide resolved
.devcontainer/devcontainer.json Show resolved Hide resolved
.devcontainer/devcontainer.json Show resolved Hide resolved
.devcontainer/post-create.sh Show resolved Hide resolved
.devcontainer/post-create.sh Outdated Show resolved Hide resolved
.devcontainer/.env.codespaces Show resolved Hide resolved
.devcontainer/post-create.sh Show resolved Hide resolved
@aeisenberg
Copy link
Contributor Author

@dorner does this change make sense to you? Now if the .env already exists, the codespace version will not be copied over.

@dorner
Copy link
Collaborator

dorner commented May 10, 2024

Looks good to me - @awwaiid can you review?

@@ -65,7 +65,16 @@ Thanks for checking us out! If you're new here, here are some things you should
### Join us on slack 💬
You can sign up [here](https://join.slack.com/t/rubyforgood/shared_invite/zt-21pyz2ab8-H6JgQfGGI0Ab6MfNOZRIQA) and find us in #human-essentials. Many helpful members are available to answer your questions. Just ask, and someone will be there to help you!

## Getting Started 🛠️
## Getting Started (Codespaces) 🛠️

Copy link
Collaborator

@awwaiid awwaiid May 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add in this quick-start button for the full 🪄 ?

Suggested change
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/rubyforgood/human-essentials/tree/main?quickstart=1)

@awwaiid
Copy link
Collaborator

awwaiid commented May 10, 2024

Ah -- also from testing you need to add config.hosts << ".app.github.dev" to config/environments/development.rb

image

@@ -65,7 +65,16 @@ Thanks for checking us out! If you're new here, here are some things you should
### Join us on slack 💬
You can sign up [here](https://join.slack.com/t/rubyforgood/shared_invite/zt-21pyz2ab8-H6JgQfGGI0Ab6MfNOZRIQA) and find us in #human-essentials. Many helpful members are available to answer your questions. Just ask, and someone will be there to help you!

## Getting Started 🛠️
## Getting Started (Codespaces) 🛠️

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For discussion, from a copyediting pov. There will be a slight bias to thinking that whatever we put first is the default. Codespaces are great for the event, of course, but is that what we want throughout the year?? @awwaiid @dorner

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that thought came to my mind too. Let's move it down and change it to ## Getting Started (Codespaces -- EXPERIMENTAL)

@aeisenberg
Copy link
Contributor Author

Closing in favour of #4353.

@aeisenberg aeisenberg closed this May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Experiment with Code Spaces and related tooling
4 participants