Access error on master.key

52 views
Skip to first unread message

Samuel Grave Silva

unread,
Nov 7, 2023, 8:13:31 AM11/7/23
to passenger-docker
Hello Everyone!
I'm doing the Agile Web Development with Rails 7 book, and I'm in the part they deploy a docker image with passenger.
I followed the instructions at the book, but I'm receiving the following error:

depot-web-1 | [ E 2023-11-07 13:05:21.1378 48/Tr age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /home/app/depot: The application encountered the following error: Permission denied @ rb_sysopen - /home/app/depot/config/master.key (Errno::EACCES)

Tried to change the owner of the file, without success too :(

root@94418ca40230:/home/app/depot/config# chown -R app: master.key
chown: changing ownership of 'master.key': Read-only file system

Here's my docker-compose file:
version: "3.8"

services:
db:
image: postgres:14
volumes:
- pgdata:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: password

web:
build: .
volumes:
- ./log:/home/app/depot/log
secrets:
- source: master_key
target: /home/app/depot/config/master.key
ports:
- "8001:80"
depends_on:
- db

secrets:
master_key:
file: ./config/master.key

volumes:
pgdata:


and here my Dockerfile:
FROM phusion/passenger-full:latest

RUN rm /etc/nginx/sites-enabled/default
RUN rm -f /etc/service/nginx/down
RUN rm -f /etc/service/redis/down
ADD config/nginx.conf /etc/nginx/sites-enabled/depot.conf

USER app
RUN mkdir /home/app/depot
WORKDIR /home/app/depot

ENV RAILS_ENV=production
ENV BUNDLE_WITHOUT="development test"
RUN bash -lc 'rvm --default use ruby-3.2.2'

COPY --chown=app:app Gemfile Gemfile.lock .
RUN bundle install
COPY --chown=app:app . .

RUN SECRET_KEY_BASE=`bin/rails secret` \
bin/rails assets:precompile

USER root
CMD ["/sbin/my_init"]


I'm using Ruby 3.2.2 and Rails 7.1

Thanks for help :) 
Reply all
Reply to author
Forward
0 new messages