powerhouse-inc / switchboard

Open-source API over the document model made to be developer- and analyst-friendly
https://switchboard-boilerplate.vercel.app
GNU Affero General Public License v3.0
3 stars 3 forks source link

Improve documentation integration #58

Closed KirillDogadin-std closed 1 year ago

KirillDogadin-std commented 1 year ago

close #57

KirillDogadin-std commented 1 year ago

@valiafetisov

not sure what the requirement remove initial static md files means in the issue. Could you elaborate what here is wrong if it is?

KirillDogadin-std commented 1 year ago

Docs are gitignored now and are generated automatically after install , after update, before dev, before start. That should cover the most cases of the tool used.

Seems ready for review

KirillDogadin-std commented 1 year ago

pls try :

  1. removing node_modules/ in both frontend and core directories.
  2. running npm i in both of the directories.
  3. docker-compose again.
KirillDogadin-std commented 1 year ago

aaalright. I am failing to reproduce:

  1. freshly clone repo
  2. run docker-compose up --build --force-recreate

And the documentation is displayed.

Please:

  1. ensure it does not work on the freshly cloned repo
  2. if it does not - post complete list of steps you've taken to get to the broken state (terminal commands and their output)
valiafetisov commented 1 year ago

Thanks for figuring it out! I guess the recent changes you've introduced are related to this inconsistent docker behaviour with the implemented solution.

The problem is, docker-compose no longer started for me due to no space left on device (see logs below) caused by huge context size (from frontend/node_modules) that it trieed to copy into the image. So it seems like docker-compose started to ignore frontend/.dockerignore for me and instead used new .dockerignore which said nothing about frontend/node_modules

Failed docker-compose logs ``` user@user switchboard % docker-compose up --build --force-recreate [+] Building 5.6s (23/37) => [switchboard_db_migrations internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 32B 0.0s => [switchboard_api internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 32B 0.0s => [switchboard_frontend internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 32B 0.0s => [switchboard_db_migrations internal] load .dockerignore 0.0s => => transferring context: 34B 0.0s => [switchboard_api internal] load .dockerignore 0.0s => => transferring context: 34B 0.0s => [switchboard_frontend internal] load .dockerignore 0.0s => => transferring context: 34B 0.0s => [switchboard_frontend internal] load metadata for docker.io/library/node:16.14.2 5.4s => [switchboard_frontend dependency-base 1/7] FROM docker.io/library/node:16.14.2 0.0s => [switchboard_db_migrations internal] load build context 0.0s => => transferring context: 3.58kB 0.0s => CACHED [switchboard_api dependency-base 2/6] RUN mkdir -p /app 0.0s => CACHED [switchboard_api dependency-base 3/6] WORKDIR /app 0.0s => CACHED [switchboard_db_migrations dependency-base 4/6] COPY package.json . 0.0s => CACHED [switchboard_db_migrations dependency-base 5/6] COPY package-lock.json . 0.0s => CACHED [switchboard_db_migrations dependency-base 6/6] RUN npm ci 0.0s => CACHED [switchboard_db_migrations production 1/2] COPY . . 0.0s => CACHED [switchboard_db_migrations production 2/2] RUN sed --in-place 's/sqlite/postgresql/g' ./prisma/schema.prisma 0.0s => [switchboard_api] exporting to image 0.0s => => exporting layers 0.0s => => writing image sha256:836901d35195c979fd2cc1c0fca24821686889641f88995cead7ca95b08ccff1 0.0s => => naming to docker.io/library/switchboard_db_migrations 0.0s => => naming to docker.io/library/switchboard_api 0.0s => [switchboard_api internal] load build context 0.0s => => transferring context: 3.58kB 0.0s => CACHED [switchboard_api dependency-base 4/6] COPY package.json . 0.0s => CACHED [switchboard_api dependency-base 5/6] COPY package-lock.json . 0.0s => CACHED [switchboard_api dependency-base 6/6] RUN npm ci 0.0s => CACHED [switchboard_api production 1/2] COPY . . 0.0s => CACHED [switchboard_api production 2/2] RUN sed --in-place 's/sqlite/postgresql/g' ./prisma/schema.prisma 0.0s => ERROR [switchboard_frontend internal] load build context 5.3s => => transferring context: 142.93MB 5.3s ------ > [switchboard_frontend internal] load build context: ------ failed to solve: failed to create /var/lib/docker/overlay2/m5wk37fk45en9ccnhxc7w6kyv/diff/frontend/node_modules/@vicons/fluent/es/Headphones24Filled.js: open /var/lib/docker/overlay2/m5wk37fk45en9ccnhxc7w6kyv/diff/frontend/node_modules/@vicons/fluent/es/Headphones24Filled.js: no space left on device ```

After adding more lines from frontend/.dockerignore to the root .dockerignore file, I got correct logs and the image is being properly built:

 => [switchboard_api internal] load build context                                                                                                                                                      0.2s
 => => transferring context: 2.15MB                                                                                                                                                                    0.2s
 => [switchboard_frontend internal] load build context                                                                                                                                                 0.2s
 => => transferring context: 4.88MB                                                                                                                                                                    0.2s
 => [switchboard_db_migrations internal] load build context                                                                                                                                            0.2s
 => => transferring context: 2.15MB                  

This is anyway irrelevant for the CI as it builds images in a fresh context every time. But let's see how it will be in practice 🙂