-
Notifications
You must be signed in to change notification settings - Fork 21.9k
Github Codespaces configuration #43061
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
Conversation
Ain't better to use docker-compose with the devcontainer? downloading images for mysql, postgres, redis might be quicker and more maintainable than installing them on the Docker image... |
Also, a entrypoint script might be added to check bundler (and yarn) dependencies... something similar to this: https://github.com/vovimayhem/rails-last-n-of-each-demo/blob/main/bin/dev-entrypoint |
It doesn't seem to be possible to use the
This is handled in |
I've added the The devcontainer has been tested by running the specs for all Rails components. All specs are passing, so this should be a stable workspace for development. You can test this PR by starting a Github Codespace from the green "Edit" button in the right top corner is the screen. In the Codespace you can use the terminal to execute commands. |
# [Optional] Uncomment this section to install additional OS packages. | ||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y install --no-install-recommends \ | ||
mariadb-server libmariadbclient-dev \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mariadb and not mysql?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm more familiar with PostgreSQL, so I needed to look this up when I was writing the Dockerfile. Since Debian 9, MySQL is no longer available in the default apt repositories. MariaDB is the new default database engine. Because MariaDB is backwards compatible with MySQL and in most situations a better choice for new projects, I assumed it isn't a problem to follow the OS default database engine approach instead of doing more work to install MySQL.
Because Github actions still run MySQL, compatibility with a real MySQL installation would still be validated when making code changes.
@edwinv not an expert on this, but I get the feeling more configuration is needed for this to fully work. https://docs.github.com/en/codespaces/developing-in-codespaces/creating-a-codespace suggests it's only available to some account levels, and https://github.com/features/codespaces says this: I can open a codespace by going to https://github.com/rails/rails and pressing the "." key (I couldn't see any buttons in the UI to do it), but the codespace it spins up doesn't have terminal access so I can't run tests: |
According to the same page, access to Codespace is per repository owner and not per user. As I'm able to start Codespaces in the rails organization, I assume the organization has everything setup correctly. Personally I'm on an older Github plan that doesn't include Codespaces and I indeed have no access to it in my own repositories, but still can start Codespaces for other open source projects.
The |
Weird. I interpreted from the communication from Github that it's commonly available in the mentioned plans. This seems like a Github issue and not something the repo configuration can fix. |
I seems like @rafaelfranca has fixed this with 7df466c, the latest |
Does codespace option under "Code" button only show up for Rails committers? I don't get the option either. |
It seems GitHub is extending the beta gradually. Although from my understanding this is a per-repo setting, it might also depend on your user account. I have Codespaces beta access for some time now. From the Codespaces FAQ:
|
Summary
Github Codespaces allows (new) Rails contributors to easily boot a fully functional environment to make and test changes to Rails. In order for this repository to work will with Codespaces, we need some configuration, this is added in this PR.
The
Dockerfile
andboot.sh
are inspired on the Development Dependencies Install manual and bootstrap.sh file.Other Information
The devcontainer works, but has a minor issue:
In order to be able to run code right away, we need to run
bundle install
as apostCreateCommand
. Due to the largeGemfile
, executing this command takes long. Codespaces doesn't give proper user feedback about the time it takes, therefore a user can be confused why the environment is not fully functional. I haven't found a solution for this problem yet, suggestions welcome!