Tasks.md icon indicating copy to clipboard operation
Tasks.md copied to clipboard

Deployment as Non-Root - CHOWN capability problems

Open KnightDoom opened this issue 5 months ago • 3 comments

Thanks for creating this app.

Wanted to share my experience with the deployment of this application in my K3S cluster; Bascially, the Entry point of this application uses the chown to ensure that files within the container are owned by the ENV provided PUID and PGID.

ENTRYPOINT mkdir -p /config/stylesheets/ && \
	mkdir -p /config/images/ && \
	mkdir -p /config/sort/ && \
	cp -r /config/stylesheets/. /stylesheets/ && \
	cp -r /stylesheets/. /config/stylesheets/ && \
	**chown -R $PUID:$PGID /config && \
	chown -R $PUID:$PGID /tasks && \**
	node /api/server.js

For some reason, K3S would not allow the usage of chown, while not allowing privilaged access to the container. This would cause the container to continously restart.

After ensuring, that copying from the image to the task/config directories retained/set the PUID/PGID correctly, the following overrides were placed in the deployment.yaml

additionally some logs were provided to see if any point failed.

  - args:
        - |
          echo "1"
          mkdir -p /config/stylesheets && echo "stylesheets_created"
          mkdir -p /config/images && echo "images_created"
          mkdir -p /config/sort && echo "sort_created"
          mkdir -p /config/tasks && echo "tasks_created"
          cp -r /config/stylesheets/. /stylesheets/ && echo "copied config_stylesheets to stylesheets"
          cp -r /stylesheets/. /config/stylesheets && echo "copied stylesheets to config_stylesheets"
          node /api/server.js
   command:
     - sh
     - -c
   env:
   - name: PGID
     value: "568"
   - name: PUID
     value: "568"

KnightDoom avatar Aug 27 '24 16:08 KnightDoom