krakend / krakend-ce

KrakenD Community Edition: High-performance, stateless, declarative, API Gateway written in Go.
https://www.krakend.io
Apache License 2.0
1.86k stars 443 forks source link

chmod operation not permitted using watch tag #853

Closed gadonski closed 4 months ago

gadonski commented 4 months ago

Environment info:

Describe what are you trying to do: i've try to use templates (like describe here https://www.krakend.io/docs/configuration/flexible-config/), but throw an error "chmod /etc/krakend/teste.json: operation not permitted

The config file has been created, but i dont know why the container says "chmod /etc/krakend/teste.json: operation not permitted"

Commands used:

# my docker compose
  api_gateway:
    image: devopsfaith/krakend:watch
    ports:
      - 1000:8080
    environment:
      - FC_ENABLE=0
      - FC_OUT=/etc/krakend/teste.json
      - FC_SETTINGS=/etc/krakend/configuracoes
      - FC_TEMPLATES=/etc/krakend/templates
    volumes:
      - ./configuracoes/krakend:/etc/krakend/
    command: ["run", "-dc", "krakend.tmpl"]

Logs: ✔ Container backend-api_gateway-1 Recreated 1.5s Attaching to backend-api_gateway-1 backend-api_gateway-1 | Watching changes on files /etc/krakend/ backend-api_gateway-1 | Ignoring saves to file teste.json backend-api_gateway-1 | [00] Starting service backend-api_gateway-1 | [00] ERROR parsing the configuration file: failed to copy source file /tmp/KrakenD_parsed_config_template_1190468719 to /etc/krakend/teste.json: chmod /etc/krakend/teste.json: operation not permitted backend-api_gateway-1 | [00] (error exit: exit status 255)

Additional comments:

taik0 commented 4 months ago

The user that generates the file is uid 1000, so looks like the mounted directory has no permission to write there as uid 1000. Try changing the path of FC_OUT to /tmp or fix the directory permissions.

gadonski commented 4 months ago

The user that generates the file is uid 1000, so looks like the mounted directory has no permission to write there as uid 1000. Try changing the path of FC_OUT to /tmp or fix the directory permissions.

Did not work. Throws another error

LOG:

backend-api_gateway-1  | Watching changes on files /etc/krakend/
backend-api_gateway-1  | Ignoring saves to file tmp
backend-api_gateway-1  | [00] Starting service
backend-api_gateway-1  | [00] ERROR parsing the configuration file: failed to copy source file /tmp/KrakenD_parsed_config_template_3239884491 to /tmp: open /tmp: is a directory
backend-api_gateway-1  | [00] (error exit: exit status 255)

compose.yaml

api_gateway:
    image: devopsfaith/krakend:watch
    ports:
      - 1000:8080
    environment:
      - FC_ENABLE=0
      - FC_OUT=/tmp
      - FC_SETTINGS=/etc/krakend/configuracoes
      - FC_TEMPLATES=/etc/krakend/templates
    volumes:
      - ./configuracoes/krakend:/etc/krakend/
    command: ["run", "-dc", "krakend.tmpl"]
taik0 commented 4 months ago

I meant to write the file inside /tmp:

- FC_OUT=/tmp/out.json
gadonski commented 4 months ago

I meant to write the file inside /tmp:

- FC_OUT=/tmp/out.json

it works. Thanks