From 63e7ed5db05218e3f0fcc3a6a884b4e0ba19236b Mon Sep 17 00:00:00 2001 From: Mikkel Jakobsen Date: Fri, 6 Oct 2023 11:09:02 +0200 Subject: [PATCH 1/4] Get rid of node in docker and adjust task cmds We want to be able to run node/yarn in our hosts but at the same time keep the wiremock functionality which is helpful especially in connection working with patron functionality/data. --- Taskfile.yml | 20 ++++++++------------ docker-compose.yml | 19 ------------------- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index b4af4cf2d9..5e48b834aa 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -21,13 +21,14 @@ tasks: dev:install: summary: Install packages cmds: - - task dev:cli -- yarn install + - yarn install dev:start: summary: Install and run docker compose cmds: - task dev:install - docker compose {{ .DOCKER_COMPOSE_FILES }} up --detach + - yarn dev dev:stop: summary: Stop docker compose environment @@ -63,7 +64,7 @@ tasks: dev:storybook: summary: Run storybook in development mode cmds: - - task dev:cli -- yarn start:storybook:dev + - yarn start:storybook:dev dev:logs: summary: Tail docker compose logs for web-pack @@ -74,23 +75,18 @@ tasks: summary: Install development environment and clean up. cmds: - task dev:down - - task dev:cli -- yarn clean + - yarn clean - rm -rf node_modules - task dev:up dev:test: summary: Run tests cmds: - - docker compose exec node yarn test + - yarn test dev:lint: summary: Run linters cmds: - - task dev:cli -- yarn lint:js - - task dev:cli -- yarn lint:scss - - task dev:cli -- yarn lint:markdown - - dev:cli: - summary: Performs command inside container. Expects parameter(s). - cmds: - - docker compose {{ .DOCKER_COMPOSE_FILES }} run --rm node {{.CLI_ARGS}} + - yarn lint:js + - yarn lint:scss + - yarn lint:markdown diff --git a/docker-compose.yml b/docker-compose.yml index d6fe0cf307..80923be1b9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,25 +1,6 @@ version: '3.7' services: - node: - image: node:16 - user: node - init: true - working_dir: /home/node/app - volumes: - - root:/home/node/app - - ~/.npmrc:/home/node/.npmrc - ports: - - "80" - command: 'yarn dev' - tty: true - environment: - VIRTUAL_HOST: dpl-react.docker - VIRTUAL_PORT: 80 - SHELL: '/bin/sh' - STORYBOOK_CLIENT_ID: bdc1d425-9117-4867-acb9-c7307ddc2e0f - YARN_CACHE_FOLDER: /home/node/app/.cache/yarn - wiremock: image: up9inc/wiremock-studio:2.32.0-18 ports: From 8c5a6903934e7a6324041f32d41cdb06255e37ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Garn=C3=A6s?= Date: Fri, 20 Oct 2023 15:49:33 +0200 Subject: [PATCH 2/4] Remove dev:logs task We do not have a node container available any more so it does not make sense to use task to see the logs for it either. Running yarn dev as a part of task dev:reset should output logs. --- Taskfile.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 5e48b834aa..ed47577557 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -66,11 +66,6 @@ tasks: cmds: - yarn start:storybook:dev - dev:logs: - summary: Tail docker compose logs for web-pack - cmds: - - docker compose logs node --follow - dev:reset: summary: Install development environment and clean up. cmds: From bd667e1c63c31ccf8d49c38b72e6218e39a92486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Garn=C3=A6s?= Date: Fri, 17 Nov 2023 15:54:14 +0100 Subject: [PATCH 3/4] Add nvm and yarn as dependencies Now that we no longer support Docker as the primary way of running Storybook we need to add these as direct dependencies for running the project. --- docs/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/README.md b/docs/README.md index 06f1fac86c..4e3712c17d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,6 +8,8 @@ Danish public libraries. ### Requirements - [go-task](https://github.com/go-task/task) +- [nvm](https://github.com/nvm-sh/nvm) +- [yarn 1.x](https://classic.yarnpkg.com/lang/en/) - [Docker](https://www.docker.com/products/docker-desktop) - [Dory](https://github.com/FreedomBen/dory) From c43ea263613ea311b6273960b24c04032b22c83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Garn=C3=A6s?= Date: Fri, 17 Nov 2023 16:01:25 +0100 Subject: [PATCH 4/4] Update howto to not mention an alternative without Docker Setup without running Node in Docker is now the primary way of running things due to problems with filesystem performance on Macs. Update howto steps accordingly We still run Docker but only for Wiremock. --- docs/README.md | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/docs/README.md b/docs/README.md index 4e3712c17d..74f1dcb476 100644 --- a/docs/README.md +++ b/docs/README.md @@ -26,18 +26,16 @@ npm login --registry=https://npm.pkg.github.com ### Howto -1. Run `task dev:start` -2. Access Storybook at - -#### Alternative without Docker - -1. Add `127.0.0.1 dpl-react.docker` to your `/etc/hosts` file -2. Ensure that your node version matches what is specified in `package.json`. -3. Install dependencies: `yarn install` -4. Start storybook `sudo yarn start:storybook:dev` -5. If you need to log in through Adgangsplatformen, you need to change - your url to instead of . This - avoids getting log in errors +1. Ensure that your Node version matches what is specified in `.nvmrc`. +2. Run `task dev:start` + - Storybook will open automatically in a browser + - The console will contain build and lint information +3. If you need to log in through Adgangsplatformen: + - Add `127.0.0.1 dpl-react.docker` to your `/etc/hosts` file + - [Ensure that Node can bind to port 80](https://gist.github.com/guifromrio/6389682) + - Use instead of +4. If you want to use Wiremock instead of production systems run + `task dev:mocks:start` #### Step Debugging in Visual Studio Code (no docker)