ustaxes/UsTaxes

Docker document startup procedure for windows (permissions issue)

genesisoliva opened this issue · 13 comments

Error: EACCES: permission denied, open 'src/core/data/validate-fns.js'

app_1 | at Object.openSync (node:fs:585:3)

app_1 | at Object.writeFileSync (node:fs:2153:35)

app_1 | at Object. (/home/node/app/scripts/setup.ts:67:4)

app_1 | at Module._compile (node:internal/modules/cjs/loader:1101:14)

app_1 | at Module.m._compile (/home/node/app/node_modules/ts-node/src/index.ts:1455:23)

app_1 | at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)

app_1 | at Object.require.extensions. [as .ts] (/home/node/app/node_modules/ts-node/src/index.ts:1458:12)

app_1 | at Module.load (node:internal/modules/cjs/loader:981:32)

app_1 | at Function.Module._load (node:internal/modules/cjs/loader:822:12)

app_1 | at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12) {

app_1 | errno: -13,

app_1 | syscall: 'open',

app_1 | code: 'EACCES',

app_1 | path: 'src/core/data/validate-fns.js'

app_1 | }

Hi, thanks for the report, that validate-fns file was recently added, but I was not able to reproduce this on a fresh clone with docker-compose build && docker-compose up. What did you run to get this?

I just ran it through Docker container

I really want to help, but I would need you to tell me the steps you used to get this error. Are you running it in command line? Or through some hosting service?

If you followed the steps here and it didn't work then we can fix it. If there's something else you did that should be supported, then we would like to amend the instructions and get that working.

E0981FC6-6CC1-406C-8A77-3F4BB7B59AF5

I don’t know what else to call it. It’s definitely not the terminal. But it’s the same thing as if you’re using docker-composer.

Or maybe if it’s not too much to ask, make give me the step by step how they build it through docker.

Ok I hadn't heard about this thing before, apparently it's called Docker Desktop

I attempted to get docker desktop to run on my machine and failed, so please try running this via the currently supported command line instructions linked above, using docker-compose

Maybe if you can figure out why it's broken for Docker Desktop then it'll benefit others that use that.

THIS IS FROM VSCODE TERMINAL :

PS C:\Users\Genny\UsTaxes> docker-compose up
[+] Building 274.9s (18/18) FINISHED
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 709B 0.0s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 238B 0.0s
=> [internal] load metadata for docker.io/library/rust:1.51-slim-buster 4.2s
=> [ 1/13] FROM docker.io/library/rust:1.51-slim-buster@sha256:eb35fd0f970f3a32d21f5b39b6320cdc0baf0c0603cd15df16d4d364c78faf19 33.8s
=> => resolve docker.io/library/rust:1.51-slim-buster@sha256:eb35fd0f970f3a32d21f5b39b6320cdc0baf0c0603cd15df16d4d364c78faf19 0.0s
=> => sha256:eb35fd0f970f3a32d21f5b39b6320cdc0baf0c0603cd15df16d4d364c78faf19 984B / 984B 0.0s
=> => sha256:9a934055eb92e7b8d5197d890374d50f85e9989f37610dd5ad6d076bddd861d8 742B / 742B 0.0s
=> => sha256:eb285de0ba071d02197640c3d8a30cce827b6f2a3abb8aeae36f1dfee7fe02b3 4.85kB / 4.85kB 0.0s
=> => sha256:f7ec5a41d630a33a2d1db59b95d89d93de7ae5a619a3a8571b78457e48266eba 27.14MB / 27.14MB 4.5s
=> => sha256:9f6e4ac0cfd72c6b19b13cd8bdec878742a24c2698828ea5951974d60978b7b5 184.57MB / 184.57MB 17.9s
=> => extracting sha256:f7ec5a41d630a33a2d1db59b95d89d93de7ae5a619a3a8571b78457e48266eba 4.0s
=> => extracting sha256:9f6e4ac0cfd72c6b19b13cd8bdec878742a24c2698828ea5951974d60978b7b5 15.4s
=> [internal] load build context 1.1s
=> => transferring context: 7.63MB 1.0s
=> [ 2/13] RUN mkdir -p /home/node/app 1.0s
=> [ 3/13] RUN useradd -rm -d /home/node -s /bin/bash -g root -G sudo -u 1001 node 0.8s
=> [ 4/13] RUN chown -R node /home/node 0.7s
=> [ 5/13] RUN apt-get update && apt-get -y upgrade && apt-get install -y curl 47.2s
=> [ 6/13] RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.38.0/install.sh | bash 8.4s
=> [ 7/13] RUN . /home/node/.nvm/nvm.sh && nvm install 16.7.0 --latest-npm 2.0s
=> [ 8/13] WORKDIR /home/node/app 0.1s
=> [ 9/13] ADD ./package.json ./package.json 0.1s
=> [10/13] ADD ./package-lock.json ./package-lock.json 0.1s
=> [11/13] ADD ./scripts ./scripts 0.1s
=> [12/13] RUN npm ci 148.9s
=> [13/13] ADD . . 0.2s
=> exporting to image 26.8s
=> => exporting layers 26.7s
=> => writing image sha256:cf0474da5556e7dc0e550b12a8ec8b0ee78583f551fa4233cf7f78a6cd126345 0.0s
=> => naming to docker.io/library/ustaxes_app 0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
[+] Running 2/2

  • Network ustaxes_default Created 0.1s
  • Container ustaxes-app-1 Created 0.6s
    Attaching to ustaxes-app-1
    ustaxes-app-1 |
    ustaxes-app-1 | > ustaxes@0.1.20 start
    ustaxes-app-1 | > node ./notice.js && ts-node ./scripts/env.ts && ts-node ./scripts/setup.ts && concurrently npm:dev
    ustaxes-app-1 |
    ustaxes-app-1 |
    ustaxes-app-1 | ustaxes helps you build your tax return forms for free
    ustaxes-app-1 | Copyright (C) 2021 Aidan Grimshaw and contributors
    ustaxes-app-1 |
    ustaxes-app-1 | This program is free software: you can redistribute it and/or modify
    ustaxes-app-1 | it under the terms of the GNU Affero General Public License as published
    ustaxes-app-1 | by the Free Software Foundation, either version 3 of the License, or
    ustaxes-app-1 | (at your option) any later version.
    ustaxes-app-1 |
    ustaxes-app-1 | This program is distributed in the hope that it will be useful,
    ustaxes-app-1 | but WITHOUT ANY WARRANTY; without even the implied warranty of
    ustaxes-app-1 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    ustaxes-app-1 | GNU Affero General Public License for more details.
    ustaxes-app-1 |
    ustaxes-app-1 | You should have received a copy of the GNU Affero General Public License
    ustaxes-app-1 | along with this program. If not, see https://www.gnu.org/licenses/.
    ustaxes-app-1 |
    ustaxes-app-1 | Error: EACCES: permission denied, open 'src/core/data/validate-fns.js'
    ustaxes-app-1 | at Object.openSync (node:fs:585:3)
    ustaxes-app-1 | at Object.writeFileSync (node:fs:2153:35)
    ustaxes-app-1 | at Object. (/home/node/app/scripts/setup.ts:67:4)
    ustaxes-app-1 | at Module._compile (node:internal/modules/cjs/loader:1101:14)
    ustaxes-app-1 | at Module.m._compile (/home/node/app/node_modules/ts-node/src/index.ts:1455:23)
    ustaxes-app-1 | at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    ustaxes-app-1 | at Object.require.extensions. [as .ts] (/home/node/app/node_modules/ts-node/src/index.ts:1458:12)
    ustaxes-app-1 | at Module.load (node:internal/modules/cjs/loader:981:32)
    ustaxes-app-1 | at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    ustaxes-app-1 | at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12) {
    ustaxes-app-1 | errno: -13,
    ustaxes-app-1 | syscall: 'open',
    ustaxes-app-1 | code: 'EACCES',
    ustaxes-app-1 | path: 'src/core/data/validate-fns.js'
    ustaxes-app-1 | }
    ustaxes-app-1 exited with code 1
    PS C:\Users\Genny\UsTaxes>

THIS IS FROM GIT

$ docker-compose up
Container ustaxes-app-1 Created
Attaching to ustaxes-app-1
ustaxes-app-1 |
ustaxes-app-1 | > ustaxes@0.1.20 start
ustaxes-app-1 | > node ./notice.js && ts-node ./scripts/env.ts && ts-node ./scripts/setup.ts && concurrently npm:dev
ustaxes-app-1 |
ustaxes-app-1 |
ustaxes-app-1 | ustaxes helps you build your tax return forms for free
ustaxes-app-1 | Copyright (C) 2021 Aidan Grimshaw and contributors
ustaxes-app-1 |
ustaxes-app-1 | This program is free software: you can redistribute it and/or modify
ustaxes-app-1 | it under the terms of the GNU Affero General Public License as published
ustaxes-app-1 | by the Free Software Foundation, either version 3 of the License, or
ustaxes-app-1 | (at your option) any later version.
ustaxes-app-1 |
ustaxes-app-1 | This program is distributed in the hope that it will be useful,
ustaxes-app-1 | but WITHOUT ANY WARRANTY; without even the implied warranty of
ustaxes-app-1 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ustaxes-app-1 | GNU Affero General Public License for more details.
ustaxes-app-1 |
ustaxes-app-1 | You should have received a copy of the GNU Affero General Public License
ustaxes-app-1 | along with this program. If not, see https://www.gnu.org/licenses/.
ustaxes-app-1 |
ustaxes-app-1 | Error: EACCES: permission denied, open 'src/core/data/validate-fns.js'
ustaxes-app-1 | at Object.openSync (node:fs:585:3)
ustaxes-app-1 | at Object.writeFileSync (node:fs:2153:35)
ustaxes-app-1 | at Object. (/home/node/app/scripts/setup.ts:67:4)
ustaxes-app-1 | at Module._compile (node:internal/modules/cjs/loader:1101:14)
ustaxes-app-1 | at Module.m._compile (/home/node/app/node_modules/ts-node/src/index.ts:1455:23)
ustaxes-app-1 | at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
ustaxes-app-1 | at Object.require.extensions. [as .ts] (/home/node/app/node_modules/ts-node/src/index.ts:1458:12)
ustaxes-app-1 | at Module.load (node:internal/modules/cjs/loader:981:32)
ustaxes-app-1 | at Function.Module._load (node:internal/modules/cjs/loader:822:12)
ustaxes-app-1 | at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12) {
ustaxes-app-1 | errno: -13,
ustaxes-app-1 | syscall: 'open',
ustaxes-app-1 | code: 'EACCES',
ustaxes-app-1 | path: 'src/core/data/validate-fns.js'
ustaxes-app-1 | }
ustaxes-app-1 exited with code 1

THIS IS CMD

C:\Users\Genny\UsTaxes>docker-compose up
[+] Running 1/0

  • Container ustaxes-app-1 Created 0.0s
    Attaching to ustaxes-app-1
    ustaxes-app-1 |
    ustaxes-app-1 | > ustaxes@0.1.20 start
    ustaxes-app-1 | > node ./notice.js && ts-node ./scripts/env.ts && ts-node ./scripts/setup.ts && concurrently npm:dev
    ustaxes-app-1 |
    ustaxes-app-1 |
    ustaxes-app-1 | ustaxes helps you build your tax return forms for free
    ustaxes-app-1 | Copyright (C) 2021 Aidan Grimshaw and contributors
    ustaxes-app-1 |
    ustaxes-app-1 | This program is free software: you can redistribute it and/or modify
    ustaxes-app-1 | it under the terms of the GNU Affero General Public License as published
    ustaxes-app-1 | by the Free Software Foundation, either version 3 of the License, or
    ustaxes-app-1 | (at your option) any later version.
    ustaxes-app-1 |
    ustaxes-app-1 | This program is distributed in the hope that it will be useful,
    ustaxes-app-1 | but WITHOUT ANY WARRANTY; without even the implied warranty of
    ustaxes-app-1 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    ustaxes-app-1 | GNU Affero General Public License for more details.
    ustaxes-app-1 |
    ustaxes-app-1 | You should have received a copy of the GNU Affero General Public License
    ustaxes-app-1 | along with this program. If not, see https://www.gnu.org/licenses/.
    ustaxes-app-1 |
    ustaxes-app-1 | Error: EACCES: permission denied, open 'src/core/data/validate-fns.js'
    ustaxes-app-1 | at Object.openSync (node:fs:585:3)
    ustaxes-app-1 | at Object.writeFileSync (node:fs:2153:35)
    ustaxes-app-1 | at Object. (/home/node/app/scripts/setup.ts:67:4)
    ustaxes-app-1 | at Module._compile (node:internal/modules/cjs/loader:1101:14)
    ustaxes-app-1 | at Module.m._compile (/home/node/app/node_modules/ts-node/src/index.ts:1455:23)
    ustaxes-app-1 | at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    ustaxes-app-1 | at Object.require.extensions. [as .ts] (/home/node/app/node_modules/ts-node/src/index.ts:1458:12)
    ustaxes-app-1 | at Module.load (node:internal/modules/cjs/loader:981:32)
    ustaxes-app-1 | at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    ustaxes-app-1 | at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12) {
    ustaxes-app-1 | errno: -13,
    ustaxes-app-1 | syscall: 'open',
    ustaxes-app-1 | code: 'EACCES',
    ustaxes-app-1 | path: 'src/core/data/validate-fns.js'
    ustaxes-app-1 | }
    ustaxes-app-1 exited with code 1

C:\Users\Genny\UsTaxes>no configuration file provided: not found

@genesisoliva thanks for the logs, I'm seeing the same issues with docker desktop

@genesisoliva thanks for the logs, I'm seeing the same issues with docker desktop

I got it to run, but when I open it in the browser it gives me a "This page isn’t working localhost didn’t send any data.
ERR_EMPTY_RESPONSE"

PS C:\Users\Genny\UsTaxes> docker-compose build
[+] Building 6.3s (17/17) FINISHED
=> [internal] load build definition from Dockerfile 0.4s
=> => transferring dockerfile: 32B 0.1s
=> [internal] load .dockerignore 0.4s
=> => transferring context: 35B 0.0s
=> [internal] load metadata for docker.io/library/rust:1.51-slim-buster 3.2s
=> [ 1/12] FROM docker.io/library/rust:1.51-slim-buster@sha256:eb35fd0f970f3a32d21f5b39b6320cdc0baf0c0603cd15df16d4d364c78faf19 0.0s
=> [internal] load build context 0.6s
=> => transferring context: 43.26kB 0.5s
=> CACHED [ 2/12] RUN mkdir -p /home/node/app 0.0s
=> CACHED [ 3/12] RUN useradd -rm -d /home/node -s /bin/bash -g root -G sudo -u 1001 node 0.0s
=> CACHED [ 4/12] RUN chown -R node /home/node 0.0s
=> CACHED [ 5/12] RUN apt-get update && apt-get -y upgrade && apt-get install -y curl 0.0s
=> CACHED [ 6/12] RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.38.0/install.sh | bash 0.0s
=> CACHED [ 7/12] RUN . /home/node/.nvm/nvm.sh && nvm install 16.7.0 --latest-npm 0.0s
=> CACHED [ 8/12] WORKDIR /home/node/app 0.0s
=> CACHED [ 9/12] ADD ./package.json ./package.json 0.0s
=> CACHED [10/12] ADD ./package-lock.json ./package-lock.json 0.0s
=> CACHED [11/12] ADD ./scripts ./scripts 0.0s
=> [12/12] ADD . . 0.9s
=> exporting to image 0.9s
=> => exporting layers 0.6s
=> => writing image sha256:3b79464768bf5284dc8a5e220ad55d84cfde8d6f1062f54e9695900110fcabae 0.0s
=> => naming to docker.io/library/ustaxes_app 0.0s
PS C:\Users\Genny\Downloads\UsTaxes> docker compose up
[+] Running 1/0

  • Container ustaxes-app-1 Created 0.0s
    Attaching to ustaxes-app-1
    ustaxes-app-1 | npm WARN deprecated @material-ui/system@4.12.1: You can now upgrade to @mui/system. See the guide: https://mui.com/guides/migration-v4/
    ustaxes-app-1 | npm WARN deprecated @material-ui/styles@4.11.4: You can now upgrade to @mui/styles. See the guide: https://mui.com/guides/migration-v4/

That file validate-fns.js is generated by the line in your log that says ts-node ./scripts/setup, so the docker container has to be able to create that file. I don't have a windows machine to test this on but it looks like there might be an extra step you have to take on windows to make sure there are write permissions for commands run by the docker container.

https://stackoverflow.com/questions/43880764/in-docker-for-windows-permissions-denied-for-mkdir-chown

https://stackoverflow.com/questions/48240635/data-permissions-docker-for-windows

If you can figure out a way to fix this so that future windows users don't have this problem it would be appreciated. Or else I suppose it should be added to the docker section in the readme.

This issue is not specific to Windows or docker desktop. I can recreate this on Manjaro/docker engine 23.0.1 with a clone from the most recent commit on master, 20022.

The docker compose file is bind mounting the source files, which will set the ownership to root:root inside of the running container. See this issue in the moby repo which I believe is the cause of the permissions issues we are seeing.

I submitted a PR which removes the bind mount from docker-compose.yml, and RUNS chown -R node /home/node/app as a final step in the Dockerfile for good measure.

This is working on Windows 10 and Manjaro 5.15. I can test on some Ubuntu versions as well if it is helpful. This solution may negatively affect people who use the docker-compose file for development work.

I have some thoughts on ways to build the docker image and use a dev container to meet the needs of users who just need to run the app and developers who want to mount the source files and get real time feedback. I will try to get on discord per the contributing doc and chat more about that later this week, but any thoughts you can provide here in an asynchronous manner would be preferential for me.