Skip to content

AO3-6916 Add devcontainer configuration#5587

Open
brianjaustin wants to merge 9 commits intootwcode:masterfrom
brianjaustin:AO3-6916-devcontainers
Open

AO3-6916 Add devcontainer configuration#5587
brianjaustin wants to merge 9 commits intootwcode:masterfrom
brianjaustin:AO3-6916-devcontainers

Conversation

@brianjaustin
Copy link
Member

Pull Request Checklist

Issue

https://otwarchive.atlassian.net/browse/AO3-6916

Credit

Brian Austin (they/he)

WORKDIR /otwa
VOLUME /otwa
# Clean and mount repository at /otwarchive
RUN rm -rf /otwarchive && mkdir -p /otwarchive
Copy link
Member Author

Choose a reason for hiding this comment

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

This was a bit weird an caused some configuration annoyances, so I just updated it 🤷

Comment on lines 69 to 70
profiles:
- dev
Copy link
Member Author

Choose a reason for hiding this comment

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

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Docker supports compose.yaml now, and it seems to be the standard based on how often it shows up in the docs

Copy link
Member

@marcus8448 marcus8448 left a comment

Choose a reason for hiding this comment

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

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:

start_redis!(rails_root, :cucumber) if rails_env == :test && !(ENV["CI"] || ENV["DOCKER"])

There's something wrong with selenium/chrome that cause tests that require JS to fail.

Also a leftover gitpod file

Comment on lines -78 to -79
GITPOD_WORKSPACE_ID: ${GITPOD_WORKSPACE_ID:-}
GITPOD_WORKSPACE_CLUSTER_HOST: ${GITPOD_WORKSPACE_CLUSTER_HOST:-}
Copy link
Member

Choose a reason for hiding this comment

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

The devcontainer URL needs to be added to the list of allowed hosts.

config.hosts << "3000-#{ENV['GITPOD_WORKSPACE_ID']}.#{ENV['GITPOD_WORKSPACE_CLUSTER_HOST']}" if ENV["GITPOD_WORKSPACE_ID"]

"dockerComposeFile": ["../compose.yaml"],
"service": "web",
"mounts": [
"source=${localWorkspaceFolder},target=/${localWorkspaceFolderBasename},type=bind"
Copy link
Member

Choose a reason for hiding this comment

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

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)

Suggested change
"source=${localWorkspaceFolder},target=/${localWorkspaceFolderBasename},type=bind"
"source=${localWorkspaceFolder},target=/otwarchive,type=bind"

Copy link
Member

@marcus8448 marcus8448 left a comment

Choose a reason for hiding this comment

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

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 :/

@brianjaustin
Copy link
Member Author

The default docker client version installed in the container is too new:

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants