Merge pull request #271 from nowcommunity/documentation-for-permissions

added documentation for permission errors
This commit is contained in:
kaarleol
2024-09-25 15:08:41 +03:00
committed by GitHub
+20
View File
@@ -17,3 +17,23 @@ Requirements: Some modern installation of Docker engine with Docker compose.
3. If you wish to use the staging database, you need to copy the dump files into `data/sqlfiles/` directory. See example of how anonymized test data is in `test_data/sqlfiles/`
4. `npm run dev` to run with the staging database or `npm run start:anon` to run with the anonymized small test-db included in the repository.
5. Check if it worked: The docker logs should have a line saying database connection works. Open `localhost:5173` in browser to check if frontend works and shows data.
**Errors while setting up**
***Database***
If the database fails to start with an error message `Cannot open directory /docker-entrypoint-initdb.d/. Permission denied`, the problem is most likely permissions. `dev` uses `data` directory and `anon` + `test` uses `test_data`.
Both directories and the files inside need the permissions `read` and `execute`. In Linux/GNU this can be achieved by running `chmod 755 DIRECTORY -R` where DIRECTORY is the wanted directory, `test_data` or `data`.
(NOTE: This gives `write` for all files and directories for current user. You can disable this by changing the first number to match the other two numbers.)
***Backend or frontend***
* `Cannot find module /usr/src/app/backend/src/index.ts`
- Permission error with `backend/src`
- Fixed by running `find backend/src -type d -exec chmod 755 {} \; && find backend/src -type f -exec chmod 644 {} \;` (on Linux).
- The command gives permissions `read` and `execute` for directories and `read` for files inside `backend/src`.
- NOTE: This gives `write` for all files and directories for current user. You can disable this by changing the first number to match the others.
* `Cannot find module ../../../frontend/src/types`
- Permission error with `frontend/src`
- Fixed by running `find frontend/src -type d -exec chmod 755 {} \; && find frontend/src -type f -exec chmod 644 {} \;` (on Linux).
- The command gives permissions `read` and `execute` for directories and `read` for files inside `frontend/src`.
- NOTE: This gives `write` for all files and directories for current user. You can disable this by changing the first number to match the others.