From e498d3c5797a659a12de62bb0156d82bef3ec194 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 3 Jan 2023 14:43:36 +0000 Subject: [PATCH 01/14] more generic --- .devcontainer/README.md | 3 +++ .devcontainer/devcontainer.json | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .devcontainer/README.md diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 0000000000..d52f0f917e --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,3 @@ +# devcontainer + +todo \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b737430a66..198443eefc 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,9 @@ { - "service": "frontend-dev", - "dockerComposeFile": "../docker-compose.yaml", - "forwardPorts": [3000], + "name": "Open-Assistant", + "image": "mcr.microsoft.com/vscode/devcontainers/universal", + "features": { + "ghcr.io/devcontainers-contrib/features/pre-commit:2": {"version": "2.0.1"} + }, "customizations": { "vscode": { "extensions": ["GitHub.copilot"] From 446b69ad60a7173ea8dadc8b628d5db837905c88 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 3 Jan 2023 15:04:16 +0000 Subject: [PATCH 02/14] dev --- .devcontainer/devcontainer.json | 3 ++- .devcontainer/post_create_command.sh | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/post_create_command.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 198443eefc..6c4877b8da 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,8 +2,9 @@ "name": "Open-Assistant", "image": "mcr.microsoft.com/vscode/devcontainers/universal", "features": { - "ghcr.io/devcontainers-contrib/features/pre-commit:2": {"version": "2.0.1"} + "ghcr.io/devcontainers-contrib/features/pre-commit:2": {"version": "latest"} }, + "postCreateCommand": "post_create_command.sh", "customizations": { "vscode": { "extensions": ["GitHub.copilot"] diff --git a/.devcontainer/post_create_command.sh b/.devcontainer/post_create_command.sh new file mode 100644 index 0000000000..3adf5f604a --- /dev/null +++ b/.devcontainer/post_create_command.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +echo 'hello!!!!!!!!' From 39d5e674210b2b6d8910f0cdb35a041af4b3f930 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 3 Jan 2023 15:10:43 +0000 Subject: [PATCH 03/14] clean up --- .devcontainer/README.md | 6 +++--- .devcontainer/devcontainer.json | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.devcontainer/README.md b/.devcontainer/README.md index d52f0f917e..41bcbdb845 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -1,3 +1,3 @@ -# devcontainer - -todo \ No newline at end of file +# devcontainer + +todo diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6c4877b8da..9fa9063955 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,7 +2,9 @@ "name": "Open-Assistant", "image": "mcr.microsoft.com/vscode/devcontainers/universal", "features": { - "ghcr.io/devcontainers-contrib/features/pre-commit:2": {"version": "latest"} + "ghcr.io/devcontainers-contrib/features/pre-commit:2": { + "version": "latest" + } }, "postCreateCommand": "post_create_command.sh", "customizations": { From 0bdfdcd8f5a681178fe876e684d0dd5f72f4e6a5 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 3 Jan 2023 15:19:10 +0000 Subject: [PATCH 04/14] remove shebang --- .devcontainer/post_create_command.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.devcontainer/post_create_command.sh b/.devcontainer/post_create_command.sh index 3adf5f604a..4ec57efba3 100644 --- a/.devcontainer/post_create_command.sh +++ b/.devcontainer/post_create_command.sh @@ -1,3 +1,2 @@ -#!/bin/sh echo 'hello!!!!!!!!' From 671e33460dccc63261ba0770be02e289c9175a01 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 3 Jan 2023 15:39:36 +0000 Subject: [PATCH 05/14] fix script path --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9fa9063955..22f433748f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,7 +6,7 @@ "version": "latest" } }, - "postCreateCommand": "post_create_command.sh", + "postCreateCommand": "bash .devcontainer/post_create_command.sh", "customizations": { "vscode": { "extensions": ["GitHub.copilot"] From e176a5292ce4180e1fca36ae02792f9e6d79f054 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 3 Jan 2023 15:43:09 +0000 Subject: [PATCH 06/14] add command to ensure pre-commit is installed --- .devcontainer/post_create_command.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/post_create_command.sh b/.devcontainer/post_create_command.sh index 4ec57efba3..dac00886fe 100644 --- a/.devcontainer/post_create_command.sh +++ b/.devcontainer/post_create_command.sh @@ -1,2 +1,3 @@ -echo 'hello!!!!!!!!' +# ensure pre-commit is installed +pre-commit install From 204b9030c9703ddfbda50eeadc23dedd7b5cffc9 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 3 Jan 2023 15:52:48 +0000 Subject: [PATCH 07/14] add readme --- .devcontainer/README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 41bcbdb845..edb741b019 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -1,3 +1,19 @@ # devcontainer -todo +## example usage + +Below are some example use cases you might want to run from within the devcontainer (either within VSCode or GitHub Codespaces). + +### Run pre-commit + +```bash +# run pre-commit +pre-commit run --all-files +``` + +### Docker compose + +```bash +# build the image +docker compose up --build +``` From cbc17683d9aaba1eb0ac2bc8f90fa2f876dfd09e Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 3 Jan 2023 16:13:25 +0000 Subject: [PATCH 08/14] add to readme --- .devcontainer/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.devcontainer/README.md b/.devcontainer/README.md index edb741b019..2d54facd6a 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -17,3 +17,11 @@ pre-commit run --all-files # build the image docker compose up --build ``` + +You should see some docker containers being pulled and activated. + +Once you see the line `open-assistant-web-1 | Listening on port 3000 url: http://localhost:3000` you should be able to access that port like below: + +![port_forwarding](https://user-images.githubusercontent.com/2178292/210395676-e9c2aab5-cb54-4ae6-b1eb-ac929fd73607.png) + +![website_example](https://user-images.githubusercontent.com/2178292/210396207-1b2e259f-4d5d-475d-b225-91e2bd004071.png) \ No newline at end of file From 3de5f1ac29676102b4dd69998f880a87d012a3c0 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 3 Jan 2023 16:18:23 +0000 Subject: [PATCH 09/14] precommit --- .devcontainer/README.md | 9 ++++++--- .devcontainer/post_create_command.sh | 1 - 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 2d54facd6a..9637ae0325 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -2,7 +2,8 @@ ## example usage -Below are some example use cases you might want to run from within the devcontainer (either within VSCode or GitHub Codespaces). +Below are some example use cases you might want to run from within the +devcontainer (either within VSCode or GitHub Codespaces). ### Run pre-commit @@ -20,8 +21,10 @@ docker compose up --build You should see some docker containers being pulled and activated. -Once you see the line `open-assistant-web-1 | Listening on port 3000 url: http://localhost:3000` you should be able to access that port like below: +Once you see the line +`open-assistant-web-1 | Listening on port 3000 url: http://localhost:3000` you +should be able to access that port like below: ![port_forwarding](https://user-images.githubusercontent.com/2178292/210395676-e9c2aab5-cb54-4ae6-b1eb-ac929fd73607.png) -![website_example](https://user-images.githubusercontent.com/2178292/210396207-1b2e259f-4d5d-475d-b225-91e2bd004071.png) \ No newline at end of file +![website_example](https://user-images.githubusercontent.com/2178292/210396207-1b2e259f-4d5d-475d-b225-91e2bd004071.png) diff --git a/.devcontainer/post_create_command.sh b/.devcontainer/post_create_command.sh index dac00886fe..983576b942 100644 --- a/.devcontainer/post_create_command.sh +++ b/.devcontainer/post_create_command.sh @@ -1,3 +1,2 @@ - # ensure pre-commit is installed pre-commit install From 767be0830a4eb9fbdc6771f553ba8baa51d810cd Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 3 Jan 2023 16:24:51 +0000 Subject: [PATCH 10/14] reduce image size in readme --- .devcontainer/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 9637ae0325..3c05e0913c 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -25,6 +25,6 @@ Once you see the line `open-assistant-web-1 | Listening on port 3000 url: http://localhost:3000` you should be able to access that port like below: -![port_forwarding](https://user-images.githubusercontent.com/2178292/210395676-e9c2aab5-cb54-4ae6-b1eb-ac929fd73607.png) +image -![website_example](https://user-images.githubusercontent.com/2178292/210396207-1b2e259f-4d5d-475d-b225-91e2bd004071.png) +image From 5d8f081a7f32022922537c1fb69efa7933b9c336 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 3 Jan 2023 19:56:50 +0000 Subject: [PATCH 11/14] readme --- .devcontainer/README.md | 71 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 67 insertions(+), 4 deletions(-) diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 3c05e0913c..a7e792da13 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -3,7 +3,10 @@ ## example usage Below are some example use cases you might want to run from within the -devcontainer (either within VSCode or GitHub Codespaces). +devcontainer (either +[within VSCode locally](https://code.visualstudio.com/docs/devcontainers/create-dev-container#_create-a-devcontainerjson-file) +or in your browser via +[GitHub Codespaces](https://github.com/features/codespaces)). ### Run pre-commit @@ -12,6 +15,60 @@ devcontainer (either within VSCode or GitHub Codespaces). pre-commit run --all-files ``` +A successfull run should look something like this: + +``` +@andrewm4894 ➜ /workspaces/Open-Assistant (devcontainer-improvements) $ pre-commit run --all-files +[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks. +[INFO] Initializing environment for https://github.com/psf/black. +[INFO] Initializing environment for https://github.com/psf/black:.[jupyter]. +[INFO] Initializing environment for https://github.com/pycqa/flake8. +[INFO] Initializing environment for https://github.com/pycqa/isort. +[INFO] Initializing environment for https://github.com/pre-commit/mirrors-prettier. +[INFO] Initializing environment for https://github.com/pre-commit/mirrors-prettier:prettier@2.7.1. +[INFO] Initializing environment for local. +[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks. +[INFO] Once installed this environment will be reused. +[INFO] This may take a few minutes... +[INFO] Installing environment for https://github.com/psf/black. +[INFO] Once installed this environment will be reused. +[INFO] This may take a few minutes... +[INFO] Installing environment for https://github.com/pycqa/flake8. +[INFO] Once installed this environment will be reused. +[INFO] This may take a few minutes... +[INFO] Installing environment for https://github.com/pycqa/isort. +[INFO] Once installed this environment will be reused. +[INFO] This may take a few minutes... +[INFO] Installing environment for https://github.com/pre-commit/mirrors-prettier. +[INFO] Once installed this environment will be reused. +[INFO] This may take a few minutes... +[INFO] Installing environment for local. +[INFO] Once installed this environment will be reused. +[INFO] This may take a few minutes... +trim trailing whitespace.................................................Passed +check python ast.........................................................Passed +check yaml...............................................................Passed +check json...............................................................Passed +check for case conflicts.................................................Passed +detect private key.......................................................Passed +fix python encoding pragma...............................................Passed +forbid submodules....................................(no files to check)Skipped +mixed line ending........................................................Passed +fix requirements.txt.....................................................Passed +check that executables have shebangs.....................................Passed +check that scripts with shebangs are executable..........................Passed +check BOM - deprecated: use fix-byte-order-marker........................Passed +check for broken symlinks............................(no files to check)Skipped +check for merge conflicts................................................Passed +check for added large files..............................................Passed +fix end of files.........................................................Passed +black-jupyter............................................................Passed +flake8...................................................................Passed +isort....................................................................Passed +prettier.................................................................Passed +Lint website.............................................................Passed +``` + ### Docker compose ```bash @@ -21,10 +78,16 @@ docker compose up --build You should see some docker containers being pulled and activated. -Once you see the line -`open-assistant-web-1 | Listening on port 3000 url: http://localhost:3000` you -should be able to access that port like below: +Once you see a line like: + +``` +open-assistant-web-1 | Listening on port 3000 url: http://localhost:3000 +``` + +you should be able to access that port like below: image +this port can then be forwarded to a browser tab like below: + image From f43c8718baf9b528fc0e544a1dd32db474813540 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 3 Jan 2023 20:56:35 +0000 Subject: [PATCH 12/14] add devcontainer note to main readme --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 103dc01058..f449fb8e05 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,15 @@ interact with the website. **Note:** When logging in via email, navigate to `http://localhost:1080` to get the magic email login link. +**Note** If you would like to run this in a standardized development environment +(a +["devcontainer"](https://code.visualstudio.com/docs/devcontainers/containers)) +using +[vscode locally](https://code.visualstudio.com/docs/devcontainers/create-dev-container#_create-a-devcontainerjson-file) +or in a web browser using +[GitHub Codespaces](https://github.com/features/codespaces), you can use the +provided [`.devcontainer`](.devcontainer/README.md) folder. + ## The Plan We want to get to an initial MVP as fast as possible, by following the 3-steps From e608a2c59bc415c74a5d79721e30a90cb7cccb83 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 3 Jan 2023 20:59:22 +0000 Subject: [PATCH 13/14] typo --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f449fb8e05..15e39a6881 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ interact with the website. **Note:** When logging in via email, navigate to `http://localhost:1080` to get the magic email login link. -**Note** If you would like to run this in a standardized development environment -(a +**Note:** If you would like to run this in a standardized development +environment (a ["devcontainer"](https://code.visualstudio.com/docs/devcontainers/containers)) using [vscode locally](https://code.visualstudio.com/docs/devcontainers/create-dev-container#_create-a-devcontainerjson-file) From da776c47e4771a84268f3d38a368c6c3f51d5460 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 3 Jan 2023 21:00:06 +0000 Subject: [PATCH 14/14] link to folder --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 15e39a6881..b619c931cd 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ using [vscode locally](https://code.visualstudio.com/docs/devcontainers/create-dev-container#_create-a-devcontainerjson-file) or in a web browser using [GitHub Codespaces](https://github.com/features/codespaces), you can use the -provided [`.devcontainer`](.devcontainer/README.md) folder. +provided [`.devcontainer`](.devcontainer/) folder. ## The Plan