mathieu-benoit / mathieu-benoit/deploy-backstage-with-score

Fix error while running `frontend` in `read_only: true`

Open
#112 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug docker help wanted security
Dominant language
TypeScript
Stars
8
Forks
0
PR merge metrics
No merged PRs in 30d

Description

When running this:

docker run -d \
    -u 65532 \
    --cap-drop=ALL \
    --read_only true \
    -p 3000:8080 \
    ghcr.io/mathieu-benoit/backstage-frontend:latest

Getting this error:

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: can not modify /etc/nginx/conf.d/default.conf (read-only file system?)
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.d/20-envsubst-on-templates.sh: line 53: can't create /etc/nginx/conf.d/default.conf: Read-only file system
20-envsubst-on-templates.sh: Running envsubst on /etc/nginx/templates/default.conf.template to /etc/nginx/conf.d/default.conf

This could be solved by mounting an emptyDir on /etc/nginx/conf.d. All good.

Associated Score file of this:

apiVersion: score.dev/v1b1
metadata:
  name: frontend
containers:
  frontend:
    image: .
    variables:
      APP_CONFIG_app_baseUrl: http://localhost:3000
      APP_CONFIG_backend_baseUrl: http://localhost:7007
    volumes:
      /etc/nginx/conf.d:
        source: ${resources.confd}
        readOnly: false
service:
  ports:
    tcp:
      port: 3000
      targetPort: 8080
resources:
  backend:
    type: service
  confd:
    type: volume

But then still getting this remaining issue at runtime:

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
20-envsubst-on-templates.sh: Running envsubst on /etc/nginx/templates/default.conf.template to /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/40-inject-config.sh
Runtime app config: {
  "app": {
    "title": "Hello, Compose!",
    "baseUrl": "http://localhost:3000"
  },
  "backend": {
    "baseUrl": "http://localhost:7007"
  }
}
Writing runtime config to /usr/share/nginx/html/static/module-backstage.40d4822a.js
sed: can't create temp file '/usr/share/nginx/html/static/module-backstage.40d4822a.jsXXXXXX': Read-only file system

Thoughts? Ideas to fix this?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the read-only container behavior using the Docker command and associated Score file. Start with /docker-entrypoint.sh and the listed /docker-entrypoint.d/ scripts, then trace the write to /usr/share/nginx/html/static/module-backstage.40d4822a.js. Done means runtime configuration succeeds without writes to the read-only filesystem.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, kubernetes, nginx
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.