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 rudimentary dev container setup #1280

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft

Conversation

StevenMaude
Copy link
Contributor

@StevenMaude StevenMaude commented Jul 19, 2023

Fixes #1047.

This allows someone to work on the docs via Codespaces or in VSCode using the dev containers feature.

Current issues:

  • This builds just via cargo because Debian doesn't have a package. We could instead use the install script for just or download a specific version from GitHub instead, which would speed up the build. It takes a while to compile everything. Switched to downloading the latest release from GitHub which is far quicker; unfortunately there are no checksums/signature to validate the download against. It would be better to use a packaged version.
  • We have to workaround PYTHON_VERSION being set to X.Y.Z in /etc/environment. In the justfile, it seems to assume that the PYTHON_VERSION as configured by someone explicitly is of the form pythonX.Y.Z — I'm not sure if this is a mistake or not.

@cloudflare-pages
Copy link

cloudflare-pages bot commented Jul 19, 2023

Deploying opensafely-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: e639294
Status: ✅  Deploy successful!
Preview URL: https://9c688713.opensafely-docs.pages.dev
Branch Preview URL: https://steve-devcontainer.opensafely-docs.pages.dev

View logs

@StevenMaude
Copy link
Contributor Author

StevenMaude commented Aug 2, 2023

This configuration works as is in a local dev container, and makes the port accessible. I'm having real trouble trying to get Codespaces to make the port available. You can curl localhost:8910 and get the response from the MkDocs server, so the server is running.

There is this discussion: https://github.com/orgs/community/discussions/61154 which might be related. I'm not sure.

I'm similarly having problems even in Codespaces from repositories that I know full well used to work like the research-template and running opensafely jupyter.

There's also mention of an new and forthcoming port forwarding mechanism: https://github.com/orgs/community/discussions/57596

So maybe return to this in a few weeks and try again. I'd prefer to having it working in Codespaces, and be able to validate that myself, before merging.

This allows someone to work on the docs via Codespaces or in VSCode
using the dev containers feature.

Current issues:

* This builds `just` via `cargo` because Debian doesn't have a package.
  We could instead use the install script for `just` or download a
  specific version from GitHub instead, which would speed up the build.
  It takes a while to compile everything.
* We have to workaround `PYTHON_VERSION` being set to `X.Y.Z` in
  `/etc/environment`. In the `justfile`, it seems to assume that the
  `PYTHON_VERSION` as configured by someone explicitly is of the form
  `pythonX.Y.Z` — I'm not sure if this is a mistake or not.
This is far quicker than compiling, especially in Codespaces.

Sadly there is no obvious way of validating the downloaded binary.
It would be preferable to use a package from an operating system
repository, but `just` is not packaged for Debian yet.
To avoid constant rebuilds while editing.
@StevenMaude
Copy link
Contributor Author

I should try this again, as I'd had similar problems with the team manual, and that just worked when I tried it with Codespaces more recently.

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.

Trial and document the use of Codespaces to work on this repository
1 participant