What could be the reason of Deployment not being able to see config files?
This is a part from Deployment
command: ["bundle", "exec", "puma", "-C", "config/puma.rb"]
already tried with ./config/.. and using args instead of command
I'm getting Errno::ENOENT: No such file or directory @ rb_sysopen - config/puma.rb
Everything used to work fine with docker-compose
When I keep the last line (CMD) from the Dockerfile below and omit the command:
in Deployment, everything works fine but, to reuse the image for sidekiq, I need to provide config files.
Dockerfile
FROM ruby:2.7.2
RUN apt-get update -qq && apt-get install -y build-essential ca-certificates libpq-dev nodejs postgresql-client yarn vim -y
ENV APP_ROOT /var/www/app
RUN mkdir -p $APP_ROOT
WORKDIR $APP_ROOT
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock
COPY public public/
RUN gem install bundler
RUN bundle install
# tried this
COPY config config/
COPY . .
EXPOSE 9292
# used to have this line but I want to reuse the image
# CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]
error message
bundler: failed to load command: puma (/usr/local/bundle/bin/puma)
Errno::ENOENT: No such file or directory @ rb_sysopen - config/puma.rb
upd
It seems that the issue was related to wrong paths and misunderstanding of command and args fields. The following config worked for me. It also possible there were cache issues with docker(happened to me earlier)
command:
- bundle
- exec
- puma
args:
- "-C"
- "config/puma.rb"
For some reason providing commands inside of values.yaml
doesn't seem to work properly.
But it works when commands are provided through template.
There's the following section in the app/templates/deployment.yaml
of my app. Everything works fine now.
containers:
- name: {{ .Values.app.name }}
image: {{ .Values.app.container.image }}
command:
- bundle
- exec
- puma
args:
- "-C"
- "config/puma.rb"
I have also found this k8s rails demo https://github.com/lewagon/rails-k8s-demo/blob/master/helm/templates/deployments/sidekiq.yaml
As you can see the commans section is provided through templates/../name.yaml
rather than values.yaml