Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Enable remote containers and Codespaces dev #102

Merged
merged 17 commits into from
Aug 20, 2020
Merged

Enable remote containers and Codespaces dev #102

merged 17 commits into from
Aug 20, 2020

Conversation

johnboyes
Copy link
Owner

No description provided.

We want to be able to run the application in a [Visual Studio Code
Docker devcontainer][1] (including on [GitHub Codespaces][2]), rather
than having to install all the software locally.

This commit adds the [default Ruby sinatra devcontainer settings][3].

The application will not run on the devcontainer yet, as we will need
to customise the container settings to install the additional software
we need (e.g. Redis).  We will apply these customisations in subsequent
commits.

[1]: https://code.visualstudio.com/docs/remote/containers
[2]: https://github.com/features/codespaces
[3]: https://github.com/microsoft/vscode-dev-containers/tree/master/containers/ruby-sinatra
@johnboyes johnboyes changed the title Enable development on remote container or Codespaces Enable remote containers and Codespaces dev Aug 20, 2020
We will pin the gem versions in a later commit.  Not doing it in this
commit as want to take the smallest steps possible to get the
application running successfully in a Docker devcontainer.
The version before this commit (2.5.3) is not available as a Docker
devcontainer image.
[RuboCop][1] is the predominant Ruby linter. We have already been using
it on this project for a long time, so it definitely needs to be on the
devcontainer.

[1]: https://github.com/rubocop-hq/rubocop
[Ruby RuboCop extension homepage][1]

Also ensured that the RuboCop execution path and settings location are
set correctly via the `devcontainer.json` file.

[1]: https://github.com/misogi/vscode-ruby-rubocop
Redis is needed for the application to run locally.

We set Redis to start every time the container starts or restarts.
To run the app locally on the devcontainer we use [Heroku Local][1].
We install Heroku Local using the [standalone method][2].

[1]: https://devcenter.heroku.com/articles/heroku-local
[2]: https://devcenter.heroku.com/articles/heroku-cli#standalone-installation
We use [Heroku Local][1] to run the web app, so we forward Heroku
Local's default port of 5000 so we can access it outside the container.

[1]: https://devcenter.heroku.com/articles/heroku-local
There is no need, as it is declared in the Gemfile as one of the
project's gems.
We don't use Node in this project.
The VS Code [Ruby extension highly recommends using the language server]
[1], which is why we have switched to it in this commit.

It integrates with RuboCop, so we have also removed the separate RuboCop
extension.

We are using the default language server settings suggested by the
extension's homepage (except we use a globally installed RuboCop gem,
rather than bundling it with the project).

[1]: https://marketplace.visualstudio.com/items?itemName=rebornix.Ruby
Added documentation for remote containers and Codespaces.
@johnboyes johnboyes merged commit ee979cc into master Aug 20, 2020
@johnboyes johnboyes deleted the devcontainer branch August 20, 2020 12:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant