Open link in a new tab

Content

Expand project menu

Install a custom plugin to a docker compose container

Hello all,

I want to install a custom plugin on a openproject based on a "docker compose" installation, but I don't find how to do this inside the openproject documentation.

Here is the plugin that I want to install : https://github.com/btey/openproject-gitlab-integration

And I follow the documentation here :  https://www.openproject.org/docs/installation-and-operations/installation/docker/#openproject-plugins

I did not understand If I was able to modify the current "docker compose" installation of my openproject instance to add a plugin or if I have to create a new docker image myself , and integrate manually the openproject version, the postgresql image and my plugin ( and any other plugins that I could test ). I am not familiar with docker , all that I have done is install openproject with the documentation that explain the "docker compose" method

Part to get deployment from repository

Part to install a more recent docker version ( I am using debian 10 linux ):

  • apt install ca-certificates curl gnupg lsb-release
  • mkdir -m 0755 -p /etc/apt/keyrings
  • curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
  • echo   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  • apt update
  • apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

And then, just install and run with :

  • docker compose pull
  • OPENPROJECT_HTTPS=false OPENPROJECT_HOST__NAME=xxx.xxx.com:8080 docker compose up -d

What is the best way to add a plugin on my current "docker compose" based installation ?

Best regards,

F. MAZUR.

Message actions

Hey,

to use your own plugin you will have to adjust the docker-compose file. Specifically these two lines.
You can change the definition so that your own image is built as seen in the docker docs.

So in your case you might want to change these lines to:

x-op-image: &image
  image: my-openproject-with-gitlab
  build:
    context: gitlab-integration

Where gitlab-integration would be a folder containing the Gemfile.plugins which should look something like this:

group :opf_plugins do
  gem "openproject-gitlab", git: "https://github.com/btey/openproject-gitlab-integration.git", branch: "master"
end

And the Dockerfile which should look as described in our docs too. That is like the following.

FROM openproject/community:12

# If installing a local plugin (using `path:` in the `Gemfile.plugins` above),
# you will have to copy the plugin code into the container here and use the
# path inside of the container. Say for `/app/vendor/plugins/openproject-slack`:
# COPY /path/to/my/local/openproject-slack /app/vendor/plugins/openproject-slack

COPY Gemfile.plugins /app/

# If the plugin uses any external NPM dependencies you have to install them here.
# RUN npm add npm <package-name>*

RUN bundle config unset deployment && bundle install && bundle config set deployment 'true'
RUN ./docker/prod/setup/postinstall.sh

In the docs for the plugin it says you have to use bundle install --deployment --without mysql2 sqlite development test therubyracer docker so you may have to do that instead of a simple bundle install in the second to last line of the Dockerfile.

Message actions

Hello,

Thank you for your answer. 

I was able to add the custom plugin with your help, I have just kept "image: openproject/community:${TAG:-12}" because with my-openproject-with-gitlab it did not work ( I guess that I should do a fork of the openproject, I prefer keep the original path , I have no modification, I just wanted to add a plugin ).

I needed to rebuild with docker compose build and I was a little bit afraid because it took 10min , and I saw that it recreated the database, I was wondering that I will have lost all the data inside database. But no, all has been kept, I just have to restart ( docker compose stop / docker compose up -d ) to see that the plugin is now available.

Now I have to see how to use this plugin, it is not exactly what I expected... Another question, now I have this plugin, what happens if I export the database with the backup feature, and I reimport on a fresh install without the plugin ? Will it work ? I am afraid it won't

I see that the gitlab integration is in the roadmap : https://community.openproject.org/projects/openproject/work_packages/23673/activity ( version 13.1.0 ) maybe I better should wait ?

Regards,

Message actions

Small fixes.

docker-compose:

x-op-image: &image
  image: my-openproject-with-gitlab
   build:
     context: gitlab-integration
    args:
      TAG: "${TAG:-13}"

gitlab-integration/Gemfile.plugins:

group :opf_plugins do
  gem "openproject-gitlab_integration", git: "https://github.com/btey/openproject-gitlab-integration.git", branch: "master"
end

gitlab-integration/Dockerfile:

ARG TAG
FROM openproject/community:$TAG

# If installing a local plugin (using `path:` in the `Gemfile.plugins` above),
# you will have to copy the plugin code into the container here and use the
# path inside of the container. Say for `/app/vendor/plugins/openproject-slack`:
# COPY /path/to/my/local/openproject-slack /app/vendor/plugins/openproject-slack

COPY Gemfile.plugins /app/

# If the plugin uses any external NPM dependencies you have to install them here.
# RUN npm add npm <package-name>*

RUN bundle config unset deployment && bundle install && bundle config set deployment 'true'
RUN ./docker/prod/setup/postinstall.sh