qwc-services / qwc-docker

Docker containers for qwc-services
MIT License
48 stars 36 forks source link

Fix for example path #72

Closed ale5000 closed 11 months ago

ale5000 commented 1 year ago

On windows docker wont start with permisson error. I fixed like this (according to postgres github) and it worked ok.

manisandro commented 1 year ago

Did you override the PGDATA environment variable for the qwc-postgis container? /var/lib/postgresql/docker should be the correct default value, see [1].

[1] https://github.com/qwc-services/qwc-base-db/blob/main/Dockerfile#L58

ale5000 commented 1 year ago

Hm, i guess i not overrided, i used default compose example yaml (4 commands like in doc), in docker-compose example used image - sourcepole/qwc-demo-db:v2022.09.03 (it doesnt override the PGDATA environment variable as i understand), on linux env most features work properly

HusseinKabbout commented 1 year ago

Could you paste the Windows docker error? That might help us understand the permission problem more.

ale5000 commented 1 year ago

I retried from ground up (in git mingw bash):

git clone https://github.com/qwc-services/qwc-docker.git
cd qwc-docker
cp docker-compose-example.yml docker-compose.yml
cp api-gateway/nginx-example.conf api-gateway/nginx.conf

(in git mingw bash - works ok, in powershell dont work):

python3 -c 'import secrets; print("JWT_SECRET_KEY=\"%s\"" % secrets.token_hex(48))' >.env

(in git mingw bash - works ok, in powershell dont work): no sudo required in mingw bash - used without it: chown 8983:8983 volumes/solr/data

extra step - add qwc-docker to shared in settings->resources->file sharing

docker compose up on docker compose up -qwc-postgis1 downs with status 1 exited (logs below):

2023-10-13 11:23:11 The files belonging to this database system will be owned by user "postgres". 2023-10-13T08:23:11.779598700Z This user must also own the server process. 2023-10-13T08:23:11.779612100Z 2023-10-13T08:23:11.784066800Z The database cluster will be initialized with locale "en_US.utf8". 2023-10-13T08:23:11.784097300Z The default database encoding has accordingly been set to "UTF8". 2023-10-13T08:23:11.784101700Z The default text search configuration will be set to "english". 2023-10-13T08:23:11.784105500Z 2023-10-13T08:23:11.784108800Z Data page checksums are disabled. 2023-10-13T08:23:11.784113000Z 2023-10-13T08:23:11.807329900Z fixing permissions on existing directory /var/lib/postgresql/docker ... ok 2023-10-13T08:23:12.057567300Z creating subdirectories ... ok 2023-10-13T08:23:12.094373300Z selecting dynamic shared memory implementation ... posix 2023-10-13T08:23:12.304238800Z selecting default max_connections ... 20 2023-10-13T08:23:12.791406300Z selecting default shared_buffers ... 400kB 2023-10-13T08:23:12.831077800Z selecting default time zone ... Etc/UTC 2023-10-13T08:23:12.949864100Z creating configuration files ... ok 2023-10-13T08:23:13.265407500Z running bootstrap script ... 2023-10-13 11:23:13 2023-10-13 08:23:13.005 UTC [83] FATAL: data directory "/var/lib/postgresql/docker" has invalid permissions 2023-10-13T08:23:13.006109900Z 2023-10-13 08:23:13.005 UTC [83] DETAIL: Permissions should be u=rwx (0700) or u=rwx,g=rx (0750). 2023-10-13T08:23:13.014805100Z child process exited with exit code 1 2023-10-13T08:23:13.014832200Z initdb: removing contents of data directory "/var/lib/postgresql/docker"

used image in example yaml - qwc-docker-qwc-postgis-1 sourcepole/qwc-demo-db:v2022.09.03

Docker Desktop 4.24.0 (122432) - last version btw, i can update doc if windows manual is required.

ale5000 commented 1 year ago

maybee, its about directory projecting (root qwc-docker). I shared qwc-docker (and all reccurent dirs) - if i share directory volume only, i need to press 20 times to give access to docker containers to pg_service.conf/pg_service-write.conf

ale5000 commented 1 year ago

All dirs in volume created, but only solr have files, other is empty

manisandro commented 11 months ago

Closing the PR as the fix is incorrect. The issue lies elsewhere.