AO3-6916 Add devcontainer configuration#5587
AO3-6916 Add devcontainer configuration#5587brianjaustin wants to merge 9 commits intootwcode:masterfrom
Conversation
config/docker/Dockerfile
Outdated
| WORKDIR /otwa | ||
| VOLUME /otwa | ||
| # Clean and mount repository at /otwarchive | ||
| RUN rm -rf /otwarchive && mkdir -p /otwarchive |
There was a problem hiding this comment.
This was a bit weird an caused some configuration annoyances, so I just updated it 🤷
| profiles: | ||
| - dev |
There was a problem hiding this comment.
Devcontainers still doesn't support profiles easily; it's also a bit annoying (at least for me) when using docker otherwise, so I just removed this
There was a problem hiding this comment.
Docker supports compose.yaml now, and it seems to be the standard based on how often it shows up in the docs
marcus8448
left a comment
There was a problem hiding this comment.
Is it possible to start/stop/modify the containers defined in the compose.yml within the devcontainer? I can't seem to do it, but I've never used codespaces before so there may be something that I'm missing.
Since the devcontainer is a docker container, it tries (and fails) to start another redis when running a test:
There's something wrong with selenium/chrome that cause tests that require JS to fail.
Also a leftover gitpod file
| GITPOD_WORKSPACE_ID: ${GITPOD_WORKSPACE_ID:-} | ||
| GITPOD_WORKSPACE_CLUSTER_HOST: ${GITPOD_WORKSPACE_CLUSTER_HOST:-} |
There was a problem hiding this comment.
The devcontainer URL needs to be added to the list of allowed hosts.
.devcontainer/devcontainer.json
Outdated
| "dockerComposeFile": ["../compose.yaml"], | ||
| "service": "web", | ||
| "mounts": [ | ||
| "source=${localWorkspaceFolder},target=/${localWorkspaceFolderBasename},type=bind" |
There was a problem hiding this comment.
Shouldn't this be hardcoded, since it's hardcoded in the Dockerfile? (it probably could stay as /otwa in that case too, but I don't feel strongly either way)
| "source=${localWorkspaceFolder},target=/${localWorkspaceFolderBasename},type=bind" | |
| "source=${localWorkspaceFolder},target=/otwarchive,type=bind" |
marcus8448
left a comment
There was a problem hiding this comment.
The default docker client version installed in the container is too new:
Error response from daemon: client version 1.53 is too new. Maximum supported API version is 1.43
Interestingly, I am able to run docker compose to launch the test container despite this, but it seems like the mounts aren't working:
docker compose run --rm test ls -la /otwarchive comes up empty.
Additionally the host seems to still be blocked, even though the list is actually cleared according to the rails console :/
I didn't run into any issues with this, so I'm not sure what the issue was. Do you have an older version of docker locally? That's not really relevant anymore, since I changed to just bootstrap the regular docker compose setup instead of doing the fancy thing. It means less useful autocompletion, but it's not any more/less functional than the gitpod setup was I suppose... |
marcus8448
left a comment
There was a problem hiding this comment.
Do you have an older version of docker locally?
I've been testing on GitHub Codespaces (so the host version is not controllable on my end), but with docker-in-docker it doesn't seem to be a problem anymore.
Ran some tests, poked around the dev server, everything seems to be working correctly!
| // For format details, see https://containers.dev/implementors/json_reference/. | ||
| { | ||
| "name": "otwarchive", | ||
| "image": "mcr.microsoft.com/devcontainers/base:debian", |
There was a problem hiding this comment.
It means less useful autocompletion, but it's not any more/less functional than the gitpod setup was I suppose...
Is it possible to build & use an image based on our Dockerfile (w/o the server launch) so that we have the ruby environment?
But if that's too much of a hassle to setup, I'm fine with leaving it as a future thing.
Pull Request Checklist
Issue
https://otwarchive.atlassian.net/browse/AO3-6916
Credit
Brian Austin (they/he)