HCL-TECH-SOFTWARE / dx-docker-compose

Docker Compose Scripts for HCL DX
Apache License 2.0
11 stars 22 forks source link

Couple of issues with the scripts #17

Open martdj opened 1 year ago

martdj commented 1 year ago

The load.sh script contains this line: listOfImages+=("DX_DOCKER_IMAGE_PREREQS_CHECKER:hcl-prereqs-checker-image") This should be: listOfImages+=("DX_DOCKER_IMAGE_PREREQS_CHECKER:hcl-dx-prereqs-checker-image")

The scripts, when docker compose is executed as the root user, create directories in the .volumes directory. These directories are all created with root:root as the uid:gid. The containers, however run as 1000:1000 (core) and 1000:1001 (dam). These containers can't create directories under ./volumes/core/wp_profile, ./volumes/dam/db or ./volumes/dam/upload. As a result, the container error and exit. It would be good to either create these directories beforehand with the proper uid:gid, or script the init-scripts to do this there.

To fix it, I've added the following lines to set.sh. Just a suggestion: export DX_PERSISTENT_PATH=/local/DX/data # location of persistent directories

if [ ! -d "$DX_PERSISTENT_PATH/core" ] then mkdir -p $DX_PERSISTENT_PATH/{core/wp_profile,dam/{db,upload}} chown -R 1000:1000 $DX_PERSISTENT_PATH chown -R 1000:1001 $DX_PERSISTENT_PATH/dam fi

That also allows for these volumes in the dx.yaml:

Personally, I wouldn't want my persistent volume in the same directory where the git scripts are.

setusama commented 1 year ago

Hy @martdj

Could you share how the output of your "set.sh" turned out?

Could you also share where you put the string in dx.yaml?

I'm having the same problems you reported and I'm not getting through.

Thanks

martdj commented 1 year ago

@setusama For me it works fine. This is my output: ################################## Docker-compose environment set to:

COMPOSE_PROJECT_NAME=dx COMPOSE_FILE=/local/DX/dx-docker-compose/dx.yaml DX_HOSTNAME= DX_DOCKER_IMAGE_CORE=dx/core:v95_CF208_20221208-2224 DX_DOCKER_IMAGE_RINGAPI=dx/ringapi:v1.21.0_20221208-2240 DX_DOCKER_IMAGE_DAM=dx/digital-asset-manager:v1.20.0_20221208-2234 DX_DOCKER_IMAGE_DAM_DB_NODE=dx/persistence-node:v1.11_20221208-2238 DX_DOCKER_IMAGE_DAM_DB_CONNECTION_POOL=dx/persistence-connection-pool:v1.21.0_20221208-2237 DX_DOCKER_IMAGE_IMAGE_PROCESSOR=dx/image-processor:v1.21.0_20221208-2229 DX_DOCKER_IMAGE_CC=dx/content-composer:v1.21.0_20221208-2224 DX_DOCKER_IMAGE_DS=dx/design-studio:v0.12.0_20221208-2233 DX_DOCKER_IMAGE_HAPROXY=dx/haproxy:v1.4.0_20221208-2240 DX_DOCKER_IMAGE_PREREQS_CHECKER=dx/prereqs-checker:v0.1.0_20221208-2227

##################################

Make sure that you use '. ./set.sh' or 'source ./set.sh'. many people just run the script. That won't work.

setusama commented 1 year ago

The load.sh script contains this line: listOfImages+=("DX_DOCKER_IMAGE_PREREQS_CHECKER:hcl-prereqs-checker-image") This should be: listOfImages+=("DX_DOCKER_IMAGE_PREREQS_CHECKER:hcl-dx-prereqs-checker-image")

The scripts, when docker compose is executed as the root user, create directories in the .volumes directory. These directories are all created with root:root as the uid:gid. The containers, however run as 1000:1000 (core) and 1000:1001 (dam). These containers can't create directories under ./volumes/core/wp_profile, ./volumes/dam/db or ./volumes/dam/upload. As a result, the container error and exit. It would be good to either create these directories beforehand with the proper uid:gid, or script the init-scripts to do this there.

To fix it, I've added the following lines to set.sh. Just a suggestion: export DX_PERSISTENT_PATH=/local/DX/data # location of persistent directories

if [ ! -d "$DX_PERSISTENT_PATH/core" ] then mkdir -p $DX_PERSISTENT_PATH/{core/wp_profile,dam/{db,upload}} chown -R 1000:1000 $DX_PERSISTENT_PATH chown -R 1000:1001 $DX_PERSISTENT_PATH/dam fi

That also allows for these volumes in the dx.yaml:

  • ${DX_PERSISTENT_PATH:?.volumes}/core/wp_profile:/mnt/prereqs-checks-volumes/wp_profile

Personally, I wouldn't want my persistent volume in the same directory where the git scripts are.

@setusama For me it works fine. This is my output: ################################## Docker-compose environment set to:

COMPOSE_PROJECT_NAME=dx COMPOSE_FILE=/local/DX/dx-docker-compose/dx.yaml DX_HOSTNAME= DX_DOCKER_IMAGE_CORE=dx/core:v95_CF208_20221208-2224 DX_DOCKER_IMAGE_RINGAPI=dx/ringapi:v1.21.0_20221208-2240 DX_DOCKER_IMAGE_DAM=dx/digital-asset-manager:v1.20.0_20221208-2234 DX_DOCKER_IMAGE_DAM_DB_NODE=dx/persistence-node:v1.11_20221208-2238 DX_DOCKER_IMAGE_DAM_DB_CONNECTION_POOL=dx/persistence-connection-pool:v1.21.0_20221208-2237 DX_DOCKER_IMAGE_IMAGE_PROCESSOR=dx/image-processor:v1.21.0_20221208-2229 DX_DOCKER_IMAGE_CC=dx/content-composer:v1.21.0_20221208-2224 DX_DOCKER_IMAGE_DS=dx/design-studio:v0.12.0_20221208-2233 DX_DOCKER_IMAGE_HAPROXY=dx/haproxy:v1.4.0_20221208-2240 DX_DOCKER_IMAGE_PREREQS_CHECKER=dx/prereqs-checker:v0.1.0_20221208-2227

##################################

Make sure that you use '. ./set.sh' or 'source ./set.sh'. many people just run the script. That won't work.

@martdj Thanks for the answer.

What I would like to know is how you declared this information in set.sh and then in dx.yaml.

Mine didn't work.

thanks

martdj commented 1 year ago

Not sure I understand what you mean. Those lines are literally the only ones I changed. I then do from the directory with the scripts (/local/DX/dx-docker-compose in my case) . ./set.sh docker compose up -d

That's it.