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

Issues with working on a Windows machine #570

Closed
asharonbaltazar opened this issue Aug 17, 2021 · 13 comments
Closed

Issues with working on a Windows machine #570

asharonbaltazar opened this issue Aug 17, 2021 · 13 comments
Labels
help wanted Community contributors can implement this ready Ready for implementation type: bug Something isn't working work: documentation Improvements or additions to documentation work: other
Milestone

Comments

@asharonbaltazar
Copy link
Contributor

asharonbaltazar commented Aug 17, 2021

Description

The commands mentioned in README file don't work on Windows with WSL2.

Expected behavior

The README commands shouldn't be difficult to follow. One command starts everything up on localhost:8000
Clear documentation for windows users, with common issues listed out.

To Reproduce

  1. Open a WSL terminal in the root folder of the project
  2. Run docker-compose up
  3. See the errors

Environment

  • OS: Windows 10, version 21H1
  • Other info: WSL2 is enabled on Windows

Additional context

I suspect these errors are the culprit:

initdb: error: could not change permissions of directory "/var/lib/postgresql/data": Operation not permitted
fixing permissions on existing directory /var/lib/postgresql/data ...

As discussed on the matrix channel:

The database is failing to start, so the webserver is not starting here.

It seems like chmod doesn't work well in docker containers when you have mounted volumes, in Windows. The database is failing to start, so the webserver is not starting here.
docker/for-win#445
docker/for-win#39

Suggested temporary fix:

In the meanwhile, you could try one of the workarounds mentioned in the above issues. Or, you can remove the volume mount for the db service, temporarily.

In docker-compose.yml, you could remove these two lines:

volumes:
- ./.volumes:/var/lib/postgresql/data
Note: This will not persist the data folder and would recreate the db, everytime the container is re-started.

Resolution:

I read up a little more on this error and learned that you don't need to run Docker commands on the Linux terminal if Use the WSL 2 based engine is enabled.

Thus, running the commands on PowerShell (in Administrator) works!

To resolve:

  1. Check 'Use the WSL 2 based engine' option. Reference: https://docs.docker.com/desktop/windows/wsl/
  2. Run docker-compose up on powershell
  3. Run the migration commands as mentioned on the README file in a separate powershell terminal.
@asharonbaltazar asharonbaltazar added the type: bug Something isn't working label Aug 17, 2021
@pavish pavish changed the title README commands fail on Windows machine Unable to start Mathesar's docker containers on Windows machine Aug 17, 2021
@kgodey kgodey added this to the 2021-09 improvements milestone Aug 17, 2021
@kgodey kgodey added ready Ready for implementation work: documentation Improvements or additions to documentation work: other labels Aug 17, 2021
@kgodey
Copy link
Contributor

kgodey commented Aug 17, 2021

Thanks for reporting this, @asharonbaltazar. I don't think we have anyone developing on Windows yet.

@kgodey kgodey added the help wanted Community contributors can implement this label Aug 17, 2021
@asharonbaltazar
Copy link
Contributor Author

asharonbaltazar commented Aug 17, 2021

New issue:

Saving frontend changes doesn't reload the application. As explained on the matrix channel:

The vite server listens to the file system changes using inotify to trigger hot module replacement. I guess inotify is broken with docker running in WSL

To resolve:

  1. Remove the ui service from docker-compose.yml.
  2. Node and npm must be installed. Please make sure to use the same version that is used in the container.
  3. After that, move into mathesar_ui folder, and run npm run dev

I can confirm this works.

@arvind-1
Copy link
Contributor

@kgodey @asharonbaltazar I did setup on windows machine, haven't faced any issue.

@mr-gabe49
Copy link
Member

New issue:

Saving frontend changes doesn't reload the application. As explained on the matrix channel:

The vite server listens to the file system changes using inotify to trigger hot module replacement. I guess inotify is broken with docker running in WSL

To resolve:

  1. Remove the ui service from docker-compose.yml.
  2. Node and npm must be installed. Please make sure to use the same version that is used in the container.
  3. After that, move into mathesar_ui folder, and run npm run dev

I can confirm this works.

@asharonbaltazar Thanks for this information. I'm new to Docker, I've located the docker-compose.yml file and I don't recognize the ui service. I've played around with deleting some sections with no success. Which specific lines do I need to remove?

@kgodey
Copy link
Contributor

kgodey commented Sep 4, 2021

@mr-gabe49 The Docker setup changed in #476 and these instructions are no longer valid. What's the error you're running into?

@mr-gabe49
Copy link
Member

@kgodey Saving changes in the front-end does not reload the application. When making changes I currently have to stop and start container again. This is taking a lot of time. I'm on Windows with WSL. I just downloaded Node and npm locally.

I also tried the instruction for running the front-end locally in the README.md Manual section but did not have any success.

@pavish
Copy link
Member

pavish commented Sep 5, 2021

@mr-gabe49 Could you please try this branch: https://github.com/centerofci/mathesar/tree/docker_container_root_user?

This could be related to #626 (comment).

@mr-gabe49
Copy link
Member

mr-gabe49 commented Sep 6, 2021

@pavish No it didn't help with this issue.

@pavish
Copy link
Member

pavish commented Sep 6, 2021

This seems to be an issue with WSL, as mentioned here: microsoft/WSL#4739

There are a few different workarounds that can be done:

  1. As mentioned in this comment [WSL2] File changes made by Windows apps on Windows filesystem don't trigger notifications for Linux apps microsoft/WSL#4739 (comment), you can move the project to the linux filesystem, and work from there.
    • Instead of cloning the repo in windows and then running in WSL, you can run the git clone command from within the linux shell, in a linux filesystem.
  2. Or, another workaround is to usePolling, as mentioned in Hot Module Reload not working Windows Docker + wsl vitejs/vite#1153 (comment) and in the vite docs.
    Polling is a resource intensive operation, so I don't think we should commit it to the repo, since this issue occurs only on Windows with WSL, when the file resides in a windows filesystem.

I would suggest option 1, it should be relatively simple. We would need to add this to our README, and common issues wiki.

@pavish pavish changed the title Unable to start Mathesar's docker containers on Windows machine Issues with working on a Windows machine Sep 6, 2021
@mr-gabe49
Copy link
Member

This seems to be an issue with WSL, as mentioned here: microsoft/WSL#4739

There are a few different workarounds that can be done:

  1. As mentioned in this comment [WSL2] File changes made by Windows apps on Windows filesystem don't trigger notifications for Linux apps microsoft/WSL#4739 (comment), you can move the project to the linux filesystem, and work from there.

    • Instead of cloning the repo in windows and then running in WSL, you can run the git clone command from within the linux shell, in a linux filesystem.
  2. Or, another workaround is to usePolling, as mentioned in Hot Module Reload not working Windows Docker + wsl vitejs/vite#1153 (comment) and in the vite docs.
    Polling is a resource intensive operation, so I don't think we should commit it to the repo, since this issue occurs only on Windows with WSL, when the file resides in a windows filesystem.

I would suggest option 1, it should be relatively simple. We would need to add this to our README, and common issues wiki.

Thanks @pavish! This is amazing, it updates instantaneously! I followed the first recommendation . This is what I did for future contributors:

  1. Installed VS code
  2. Opened Linux filesystem by clicking 'ctrl-shift-p' and typing Remote-WSL: New Window
  3. Cloned project
  4. Updated Ubuntu to 2.0 with this command in PowerShell: wsl.exe --set-version Ubuntu 2
  5. Downloaded Remote-Containers extension
  6. Attached to running container with Remote Container extension
  7. Followed local devolopment instructions in the README.md

@Diwakar-Gupta
Copy link

Diwakar-Gupta commented Jul 6, 2022

I am facing the same issue in debian.

chmod: changing permissions of '/var/lib/postgresql/data': Operation not permitted
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

EDIT
This problem was solved by using btrfs(should work with any linux partition like ext4) filesystem for workspace.

@github-actions
Copy link

github-actions bot commented Feb 7, 2023

This issue has not been updated in 90 days and is being marked as stale.

@github-actions github-actions bot added the stale label Feb 7, 2023
@pavish
Copy link
Member

pavish commented Mar 15, 2023

I'm going to close this issue since there are no further discussions here.

For people facing issues with Windows, please try cloning the repo in the linux subsystem in WSL. If there are further issues that persist, contact us via Matrix or feel free to open another issue.

@pavish pavish closed this as completed Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Community contributors can implement this ready Ready for implementation type: bug Something isn't working work: documentation Improvements or additions to documentation work: other
Projects
No open projects
Development

No branches or pull requests

6 participants