Giter Club home page Giter Club logo

Comments (9)

yosifkit avatar yosifkit commented on August 17, 2024 2

Quick addition on my previous command so that you don't have to run it once with no CMD.

# not sure on moving RAILS_ENV to an environment variable, but I was assuming it would be needed for passenger as well
    environment:
      - RAILS_ENV=production
    command:
      - /bin/sh
      - -ec
      - |
         /docker-entrypoint.sh rake db:migrate
         /docker-entrypoint.sh rake tmp:cache:clear tmp:sessions:clear
         /docker-entrypoint.sh rake redmine:plugins NAME=redmine_agile
         /docker-entrypoint.sh passenger start

from redmine.

imaia avatar imaia commented on August 17, 2024

Suggestion: do not mount the plugins directory. You can also use gosu to run a command as the redmine user. I'm also not fond of not running the container as an unprivileged user.

from redmine.

tiryu avatar tiryu commented on August 17, 2024

Hi, did you find any solution to install plugin on your redmine container ?

Actually, i just mount a volume on plugins dir and add it manually, connect to the container redmine and execute the commands (redmine_agile plugin for example) :

bundle install --without development test --no-deployment
bundle exec rake redmine:plugins NAME=redmine_agile RAILS_ENV=production

I tried this in the docker-compose :

command:
      - /bin/sh
      - -c
      - |
         bundle exec rake tmp:cache:clear tmp:sessions:clear RAILS_ENV=production
         bundle exec rake redmine:plugins NAME=redmine_agile RAILS_ENV=production
         /docker-entrypoint.sh passenger start

But i got an error on /usr/src/redmine/db/schema.rb :

Errno::EACCES: Permission denied @ rb_sysopen

I can see there is a rights problem on the file, but it seems to exist only when docker-entrypoint.sh is executed.

Edit: ok there is an existing issue for that #10

from redmine.

yosifkit avatar yosifkit commented on August 17, 2024

@tiryu, the entrypoint script drops down from root to the redmine user when it starts passenger (after it creates the config/database.yml and ensures the db:migrate is run); most likely your two rakes create a file as root and then the passenger process cannot access it. I think the easiest solution is to just prefix your commands with the entrypoint. Any rake task will ensure the database.yml exists and then drop to the correct user for the task.

# not sure on moving RAILS_ENV to an environment variable, but I was assuming it would be needed for passenger as well
    environment:
      - RAILS_ENV=production
    command:
      - /bin/sh
      - -ec
      - |
         /docker-entrypoint.sh rake tmp:cache:clear tmp:sessions:clear
         /docker-entrypoint.sh rake redmine:plugins NAME=redmine_agile
         /docker-entrypoint.sh passenger start

You could also just use gosu to ensure it is the proper user gosu redmine rake tmp:cache:clear tmp:sessions:clear

from redmine.

tiryu avatar tiryu commented on August 17, 2024

@yosifkit I've got an issue about this.

I can do that only if i ran once time at least, the image with no list of commands. Passenger has to start alone to init creation and migrate tables needed for redmine. And after, i can change my compose with the list of commands you said.

If i want the process of the entrypoint to create normally the database.yml, I need to declare in environment section of compose : POSTGRES_ENV_POSTGRES_USER to set the good user.

The variable REDMINE_DB_USER seems not to be sufficient (cause error launched by container db : User "postgres" has no password assigned.) redmine is my user by default.

Maybe you have an idea on these ?

Edit : okay it's my fault for the environment problem, it was REDMINE_DB_USERNAME and not REDMINE_DB_USER, sorry.

from redmine.

aogilvie avatar aogilvie commented on August 17, 2024

@kilass Don't suppose you found a solution to this?

from redmine.

tianon avatar tianon commented on August 17, 2024

@aogilvie the solution posted above your comment by @yosifkit in #37 (comment) is probably the best it's going to get

Since the original issue appears to have a reasonable solution in #37 (comment), I'm going to close. 👍

from redmine.

aogilvie avatar aogilvie commented on August 17, 2024

Hmm i don't use docker compose so not sure what to do here.

from redmine.

yosifkit avatar yosifkit commented on August 17, 2024

@aogilvie, it would just be the same as my previous comment, but say on a docker run line:

$ docker run -d [other-docker-args-like-env-vars] redmine:3.4 /bin/sh -exc '
  /docker-entrypoint.sh rake db:migrate
  /docker-entrypoint.sh rake tmp:cache:clear tmp:sessions:clear
  /docker-entrypoint.sh rake redmine:plugins NAME=redmine_agile
  /docker-entrypoint.sh passenger start
'

from redmine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.