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

Provide a Docker environment that can host the current nix environment. #2016

Closed
wants to merge 18 commits into from

Conversation

seanparsons
Copy link
Contributor

@seanparsons seanparsons commented Nov 24, 2021

Problem:
We want to be able run the full editor stack with minimal fussing around whatever the host environment is.

Fix:
This consists of a Dockerfile which constructs an appropriate environment and a launcher script which triggers construction of that Docker image and starts a container for it running our existing nix-shell within that.

It attempts to match up the user IDs between the host and the container so that access to the volume which points at the source code works as it would outside the container. As well as that installing dependencies does so persistently between sessions and does not create those files as the default root user that Docker tends to run as.

Since the nix-daemon does not run in this container, all the nix- commands need to run as root.

Limitations:
To run the browser tests inside the container on Linux appears to require some extra shenanigans in the host because reasons:
jessfraz/dockerfiles#65 (comment)

Commit Details:

  • Added Dockerfile based on a NixOS host, to provide a nix-shell
    bash environment.
  • Launcher script run-docker-dev.sh builds Docker image and runs it
    launching a shell inside the container.
  • Added libX11 to the linux only packages as it is necessary for
    node-gyp in the VS Code build.

Making it work with VSCode

Problem
For Mac users, the ./run-docker-dev.sh shell script is not good enough: because it uses Volumes to synchronise files between the host OS and the docker VM, the performance is incredibly bad.

Potential Fix (WIP):
Use VSCode Remote - Containers to clone utopia repo inside the Docker VM on the mac. This avoids setting up file sync between the host OS and docker vm. This is faster. The downside is that this image lives inside the docker VM inside the single opaque docker image. Which means that this is pretty much magic land, and not easy to debug.

Commit Details

  • added .devcontainer/devcontainer.json which points to the Dockerfile
  • the devcontainer.json is read by VSCode and instructs it how to orchestrate the creation of the dev env
  • important: you can run it "locally" (ie synced to your own git checkout, VERY SLOW ON MAC) or "cloned" mode (where vscode creates a docker image which then clones the repository (again!) which then creates our Docker image.

…ix environment.

- Added Dockerfile based on a NixOS host, to provide a nix-shell
  bash environment.
- Launcher script `run-docker-dev.sh` builds Docker image and runs it
  launching a shell inside the container.
- Added `libX11` to the linux only packages as it is necessary for
  `node-gyp` in the VS Code build.
@relativeci
Copy link

relativeci bot commented Nov 24, 2021

Job #460: Bundle Size — 42.83MB (~-0.01%).

8ce744c vs e551aeed08cf829b4a930e9e6a101a8f015fb5f9

Changed metrics (1/8)
Metric Current Baseline
Initial JS 27.74MB(~-0.01%) 27.74MB
Changed assets by type (1/7)
            Current     Baseline
JS 42.82MB (~-0.01%) 42.82MB

View Job #460 report on app.relative-ci.com

@github-actions
Copy link
Contributor

Link to test editor
This PR:
Scroll Canvas: 68.6ms (49.4-455.7ms) | Resize: 98.6ms (19.8-187.9ms) | Selection: 301.5ms (258.1-1463.3ms) | Calc Pi: 35ms (29-43ms) | Empty Dispatch: 56.1ms (48.5-422.4ms) | (Chart)
Compare with last deployed Master:
Scroll Canvas: 63.1ms (48-131.8ms) | Resize: 102.3ms (19.3-174.4ms) | Selection: 315.7ms (262-1573.2ms) | Calc Pi: 34ms (33-46ms) | Empty Dispatch: 54.2ms (44.6-794ms) | (Chart)

@github-actions
Copy link
Contributor

Link to test editor
This PR:
Scroll Canvas: 57.3ms (44.3-127.3ms) | Resize: 97.6ms (21-915.3ms) | Selection: 299.4ms (239.9-1227.8ms) | Calc Pi: 31ms (28-36ms) | Empty Dispatch: 53ms (42.8-169.7ms) | (Chart)
Compare with last deployed Master:
Scroll Canvas: 60.1ms (45-114.7ms) | Resize: 102.7ms (17.4-522.1ms) | Selection: 326.9ms (234.2-1389.5ms) | Calc Pi: 34ms (31-40ms) | Empty Dispatch: 52.9ms (44.7-540.9ms) | (Chart)

@github-actions
Copy link
Contributor

Link to test editor
This PR:
Scroll Canvas: 73.6ms (54.2-827.8ms) | Resize: 124.4ms (36.1-221.8ms) | Selection: 367.2ms (307.8-704ms) | Calc Pi: 39ms (36-89ms) | Empty Dispatch: 59.8ms (49-153.6ms) | (Chart)
Compare with last deployed Master:
Scroll Canvas: 82ms (54.6-289.3ms) | Resize: 125.9ms (21.7-345.8ms) | Selection: 363.9ms (305.9-647.9ms) | Calc Pi: 40ms (37-50ms) | Empty Dispatch: 65.7ms (50.1-168.9ms) | (Chart)

@github-actions
Copy link
Contributor

Link to test editor
This PR:
Scroll Canvas: 67.9ms (49.8-182.1ms) | Resize: 100.8ms (15.1-230.5ms) | Selection: 356.3ms (272.3-568.9ms) | Calc Pi: 25ms (23-36ms) | Empty Dispatch: 49.1ms (40.5-435.4ms) | (Chart)
Compare with last deployed Master:
Scroll Canvas: 69.6ms (51.1-381ms) | Resize: 111.2ms (16.6-262.6ms) | Selection: 327.7ms (266.4-869.5ms) | Calc Pi: 25ms (23-51ms) | Empty Dispatch: 50ms (40-475.2ms) | (Chart)

@github-actions
Copy link
Contributor

Link to test editor
This PR:
Scroll Canvas: 81.3ms (58.8-134.9ms) | Resize: 134.3ms (27.4-385.5ms) | Selection: 395.4ms (326.8-1012.2ms) | Calc Pi: 40ms (39-66ms) | Empty Dispatch: 60.7ms (51.9-183.5ms) | (Chart)
Compare with last deployed Master:
Scroll Canvas: 84ms (60.4-208.5ms) | Resize: 137.3ms (29.5-241.5ms) | Selection: 453.5ms (351.1-2032.8ms) | Calc Pi: 40ms (39-51ms) | Empty Dispatch: 60.5ms (52.3-230.4ms) | (Chart)

@github-actions
Copy link
Contributor

Link to test editor
This PR:
Scroll Canvas: 86.2ms (62.6-177.8ms) | Resize: 130.2ms (25.8-274.1ms) | Selection: 431.2ms (326.9-1341.5ms) | Calc Pi: 29ms (26-39ms) | Empty Dispatch: 63.4ms (48.5-473.2ms) | (Chart)
Compare with last deployed Master:
Scroll Canvas: 81.7ms (59.2-203.9ms) | Resize: 137.1ms (21.3-288.6ms) | Selection: 425.6ms (326.8-655.1ms) | Calc Pi: 30ms (27-41ms) | Empty Dispatch: 61.7ms (51.7-1028.7ms) | (Chart)

@github-actions
Copy link
Contributor

Link to test editor
This PR:
Scroll Canvas: 54.3ms (43.6-96.4ms) | Resize: 85ms (17.3-162.4ms) | Selection: 257.4ms (215.8-629.1ms) | Calc Pi: 32ms (30-46ms) | Empty Dispatch: 48.8ms (40.2-691.9ms) | (Chart)
Compare with last deployed Master:
Scroll Canvas: 56.8ms (40.4-279.1ms) | Resize: 87.6ms (19.3-159.1ms) | Selection: 254.7ms (225.7-1312.5ms) | Calc Pi: 32ms (30-38ms) | Empty Dispatch: 47.6ms (39.5-138ms) | (Chart)

@github-actions
Copy link
Contributor

Link to test editor

@github-actions
Copy link
Contributor

Link to test editor
This PR:
Scroll Canvas: 56.9ms (46.2-102.3ms) | Resize: 95.9ms (20-212.8ms) | Selection: 286ms (234.2-665.5ms) | Calc Pi: 34ms (33-69ms) | Empty Dispatch: 51.1ms (44.5-387.8ms) | (Chart)
Compare with last deployed Master:
Scroll Canvas: 61.2ms (47.7-771ms) | Resize: 102.2ms (24.5-247.3ms) | Selection: 327.5ms (252.5-1375.2ms) | Calc Pi: 34ms (33-41ms) | Empty Dispatch: 55.7ms (44-677.9ms) | (Chart)

@github-actions
Copy link
Contributor

Link to test editor
This PR:
Scroll Canvas: 77.2ms (59-498.1ms) | Resize: 116.4ms (20.3-207.1ms) | Selection: 410.4ms (290.5-1630.8ms) | Calc Pi: 30ms (26-43ms) | Empty Dispatch: 75.2ms (52.6-521.4ms) | (Chart)
Compare with last deployed Master:
Scroll Canvas: 80.2ms (53.5-345.6ms) | Resize: 125.8ms (29.8-320.4ms) | Selection: 424.8ms (332.3-755.1ms) | Calc Pi: 28ms (25-37ms) | Empty Dispatch: 69.3ms (53.3-785.4ms) | (Chart)

@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2021

Link to test editor
This PR:
Scroll Canvas: 77.4ms (54.6-507.4ms) | Resize: 123.5ms (43.3-226.3ms) | Selection: 351.7ms (288.9-660ms) | Calc Pi: 28ms (25-47ms) | Empty Dispatch: 62.6ms (48.1-188ms) | (Chart)
Compare with last deployed Master:
Scroll Canvas: 80.7ms (54.7-342.3ms) | Resize: 132.2ms (28.1-247.4ms) | Selection: 355.7ms (297.2-932.5ms) | Calc Pi: 28ms (25-33ms) | Empty Dispatch: 65.4ms (46.7-424.2ms) | (Chart)

@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2021

Link to test editor
This PR:
Scroll Canvas: 66.7ms (54.4-123.9ms) | Resize: 105.6ms (19.5-194.9ms) | Selection: 308.7ms (266.8-1913.1ms) | Calc Pi: 35ms (31-36ms) | Empty Dispatch: 57.6ms (47.7-638.4ms) | (Chart)
Compare with last deployed Master:
Scroll Canvas: 63.9ms (48.8-546.1ms) | Resize: 103.4ms (18.5-291.8ms) | Selection: 317.5ms (258.6-1108.2ms) | Calc Pi: 35ms (34-71ms) | Empty Dispatch: 54.7ms (47.8-199.8ms) | (Chart)

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.

3 participants