-
Star
(471)
You must be signed in to star a gist -
Fork
(191)
You must be signed in to fork a gist
-
-
Save markasoftware/f5b2e55a2c2e3abb1f9eefcdf0bfff45 to your computer and use it in GitHub Desktop.
| ############ If you are using DOCKER all-in-one image, create Dockerfile like: ################ | |
| ############ FROM openproject/openproject:16 ################ | |
| ############ COPY ./enterprise_token.rb app/models/enterprise_token.rb ################ | |
| ############ If you are runing a manual installation: ################ | |
| ############ REPLACE app/models/enterprise_token.rb in the source code with this file! ################ | |
| ############ also be sure to RESTART OpenProject after replacing the file. ################ | |
| ############ If using some other set up (eg docker-compose), read the comments on ################ | |
| ############ https://gist.github.com/markasoftware/f5b2e55a2c2e3abb1f9eefcdf0bfff45 ################ | |
| # OpenProject is an open source project management software. | |
| # Copyright (C) the OpenProject GmbH | |
| # | |
| # This program is free software; you can redistribute it and/or | |
| # modify it under the terms of the GNU General Public License version 3. | |
| # | |
| # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: | |
| # Copyright (C) 2006-2013 Jean-Philippe Lang | |
| # Copyright (C) 2010-2013 the ChiliProject Team | |
| # | |
| # This program is free software; you can redistribute it and/or | |
| # modify it under the terms of the GNU General Public License | |
| # as published by the Free Software Foundation; either version 2 | |
| # of the License, or (at your option) any later version. | |
| # | |
| # This program is distributed in the hope that it will be useful, | |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| # GNU General Public License for more details. | |
| # | |
| # You should have received a copy of the GNU General Public License | |
| # along with this program; if not, write to the Free Software | |
| # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| # | |
| # See COPYRIGHT and LICENSE files for more details. | |
| #++ | |
| class EnterpriseToken < ApplicationRecord | |
| class << self | |
| # On the backend, features are checked only using `allows_to?`, which we can hardcode to return `true`. | |
| # On the frontend, however, it instead checks if particular strings are included in the `available_features` | |
| # Unfortunately there is no canonical variable with all the features, so we have to hardcode. | |
| # Use `rg --pcre2 -INo "(?<=allows_to\?[^:*]:|allowsTo\(')[a-z_]*" | sort -u` to generate this list: | |
| TRUE_FEATURES = %i[ | |
| allowed_action | |
| baseline_comparison | |
| board_view | |
| calculated_values | |
| conditional_highlighting | |
| custom_actions | |
| custom_field_hierarchies | |
| customize_life_cycle | |
| date_alerts | |
| define_custom_style | |
| edit_attribute_groups | |
| forbidden_action | |
| gantt_pdf_export | |
| internal_comments | |
| ldap_groups | |
| nextcloud_sso | |
| one_drive_sharepoint_file_storage | |
| placeholder_users | |
| readonly_work_packages | |
| scim_api | |
| sso_auth_providers | |
| team_planner_view | |
| time_entry_time_restrictions | |
| virus_scanning | |
| work_package_query_relation_columns | |
| work_package_sharing | |
| work_package_subject_generation | |
| ].freeze | |
| # Not all the methods here are ever actually called outside the enterprise_token.rb file itself | |
| # in upstream openproject, but I'll include all of them that can be reasonably implemented here, | |
| # just in case openproject changes in the future to start using the extra methods. | |
| def current | |
| self.new | |
| end | |
| def all_tokens | |
| [self.new] | |
| end | |
| def active_tokens | |
| [self.new] | |
| end | |
| def active_non_trial_tokens | |
| [self.new] | |
| end | |
| def active_trial_tokens | |
| [] | |
| end | |
| def active_trial_token | |
| nil | |
| end | |
| def allows_to?(feature) | |
| true | |
| end | |
| def active? | |
| true | |
| end | |
| def trial_only? | |
| false | |
| end | |
| def available_features | |
| TRUE_FEATURES | |
| end | |
| def non_trialling_features | |
| TRUE_FEATURES | |
| end | |
| def trialling_features | |
| [] | |
| end | |
| def trialling?(feature) | |
| false | |
| end | |
| def hide_banners? | |
| true | |
| end | |
| def show_banners? | |
| false | |
| end | |
| def user_limit | |
| nil | |
| end | |
| def non_trial_user_limit | |
| nil | |
| end | |
| def trial_user_limit | |
| nil | |
| end | |
| def banner_type_for(feature:) | |
| nil | |
| end | |
| def get_user_limit_of(tokens) | |
| nil | |
| end | |
| end | |
| FAR_FUTURE_DATE = Date.new(9999, 1, 1) | |
| def token_object | |
| Class.new do | |
| def id | |
| "lmao" | |
| end | |
| def has_feature?(feature) | |
| true | |
| end | |
| def will_expire? | |
| false | |
| end | |
| def mail | |
| "admin@example.com" | |
| end | |
| def subscriber | |
| "markasoftware-free-enterprise-mode" | |
| end | |
| def company | |
| "markasoftware" | |
| end | |
| def domain | |
| "markasoftware.com" | |
| end | |
| def issued_at | |
| Time.zone.today - 1 | |
| end | |
| def starts_at | |
| Time.zone.today - 1 | |
| end | |
| def expires_at | |
| Time.zone.today + 1 | |
| end | |
| def reprieve_days | |
| nil | |
| end | |
| def reprieve_days_left | |
| 69 | |
| end | |
| def restrictions | |
| nil | |
| end | |
| def available_features | |
| EnterpriseToken.TRUE_FEATURES | |
| end | |
| def plan | |
| "markasoftware_free_enterprise_mode" | |
| end | |
| def features | |
| EnterpriseToken.TRUE_FEATURES | |
| end | |
| def version | |
| 69 | |
| end | |
| def started? | |
| true | |
| end | |
| def trial? | |
| false | |
| end | |
| def active? | |
| true | |
| end | |
| end.new | |
| end | |
| def id | |
| "lmao" | |
| end | |
| def encoded_token | |
| "oaml" | |
| end | |
| def will_expire? | |
| false | |
| end | |
| def mail | |
| "admin@example.com" | |
| end | |
| def subscriber | |
| "markasoftware-free-enterprise-mode" | |
| end | |
| def company | |
| "markasoftware" | |
| end | |
| def domain | |
| "markasoftware.com" | |
| end | |
| def issued_at | |
| Time.zone.today - 1 | |
| end | |
| def starts_at | |
| Time.zone.today - 1 | |
| end | |
| def expires_at | |
| Time.zone.today + 1 | |
| end | |
| def reprieve_days | |
| nil | |
| end | |
| def reprieve_days_left | |
| 69 | |
| end | |
| def restrictions | |
| nil | |
| end | |
| def available_features | |
| EnterpriseToken.TRUE_FEATURES | |
| end | |
| def plan | |
| "markasoftware_free_enterprise_mode" | |
| end | |
| def features | |
| EnterpriseToken.TRUE_FEATURES | |
| end | |
| def version | |
| 69 | |
| end | |
| def started? | |
| true | |
| end | |
| def trial? | |
| false | |
| end | |
| def active? | |
| true | |
| end | |
| def allows_to?(action) | |
| true | |
| end | |
| def expiring_soon? | |
| false | |
| end | |
| def in_grace_period? | |
| false | |
| end | |
| def expired?(reprieve: true) | |
| false | |
| end | |
| def statuses | |
| [] | |
| end | |
| def invalid_domain? | |
| false | |
| end | |
| def unlimited_users? | |
| true | |
| end | |
| def max_active_users | |
| nil | |
| end | |
| def sort_key | |
| [FAR_FUTURE_DATE, FAR_FUTURE_DATE] | |
| end | |
| def days_left | |
| 69 | |
| end | |
| end |
I'm on it with a dockerfile
I tried with the version 16.6.3 with a Dockerfile to discover this solution (I pulled the image from Docker Hub, but on OpenProject it says version 16.6.2) but it does not works for me, I still don"t have access to "Team planners" (it says "Available starting with the Basic enterprise plan").
You can push the token directly when you build an image with a dockerfile like this :
############## STAGE 1 #############
FROM openproject/openproject:16 AS plugin
COPY /token/enterprise_token.rb /app/app/models/enterprise_token.rb
COPY Gemfile.plugins /app/
RUN bundle config unset deployment
&& bundle install
&& bundle config set deployment 'true'
RUN ./docker/prod/setup/precompile-assets.sh
############## STAGE 2 #############
FROM openproject/openproject:16.6.4-slim
COPY --from=plugin /app/app/models/enterprise_token.rb /app/app/models
COPY --from=plugin /usr/bin/git /usr/bin/git
COPY --chown=$APP_USER:$APP_USER --from=plugin /app/vendor/bundle /app/vendor/bundle
COPY --chown=$APP_USER:$APP_USER --from=plugin /usr/local/bundle /usr/local/bundle
COPY --chown=$APP_USER:$APP_USER --from=plugin /app/public/assets /app/public/assets
COPY --chown=$APP_USER:$APP_USER --from=plugin /app/config/frontend_assets.manifest.json /app/config/frontend_assets.manifest.json
COPY --chown=$APP_USER:$APP_USER --from=plugin /app/Gemfile.* /app/
COPY --chown=$APP_USER:$APP_USER --from=plugin /app/vendor/plugins /app/vendor/plugins
I tried with the version 16.6.3 with a Dockerfile to discover this solution (I pulled the image from Docker Hub, but on OpenProject it says version 16.6.2) but it does not works for me, I still don"t have access to "Team planners" (it says "Available starting with the Basic enterprise plan").
You can push the token directly when you build an image with a dockerfile like this :
############## STAGE 1 ############# FROM openproject/openproject:16 AS plugin
COPY /token/enterprise_token.rb /app/app/models/enterprise_token.rb
COPY Gemfile.plugins /app/
RUN bundle config unset deployment && bundle install && bundle config set deployment 'true' RUN ./docker/prod/setup/precompile-assets.sh
############## STAGE 2 ############# FROM openproject/openproject:16.6.4-slim
COPY --from=plugin /app/app/models/enterprise_token.rb /app/app/models
COPY --from=plugin /usr/bin/git /usr/bin/git COPY --chown=$APP_USER:$APP_USER --from=plugin /app/vendor/bundle /app/vendor/bundle COPY --chown=$APP_USER:$APP_USER --from=plugin /usr/local/bundle /usr/local/bundle COPY --chown=$APP_USER:$APP_USER --from=plugin /app/public/assets /app/public/assets COPY --chown=$APP_USER:$APP_USER --from=plugin /app/config/frontend_assets.manifest.json /app/config/frontend_assets.manifest.json COPY --chown=$APP_USER:$APP_USER --from=plugin /app/Gemfile.* /app/ COPY --chown=$APP_USER:$APP_USER --from=plugin /app/vendor/plugins /app/vendor/plugins
Can I put this whole code in a single Dockerfile ? In stage 1 and 2, openproject versions ain't the same, is it ok ?
I tried with the version 16.6.3 with a Dockerfile to discover this solution (I pulled the image from Docker Hub, but on OpenProject it says version 16.6.2) but it does not works for me, I still don"t have access to "Team planners" (it says "Available starting with the Basic enterprise plan").
You can push the token directly when you build an image with a dockerfile like this :
############## STAGE 1 ############# FROM openproject/openproject:16 AS plugin
COPY /token/enterprise_token.rb /app/app/models/enterprise_token.rb
COPY Gemfile.plugins /app/
RUN bundle config unset deployment && bundle install && bundle config set deployment 'true' RUN ./docker/prod/setup/precompile-assets.sh
############## STAGE 2 ############# FROM openproject/openproject:16.6.4-slim
COPY --from=plugin /app/app/models/enterprise_token.rb /app/app/models
COPY --from=plugin /usr/bin/git /usr/bin/git COPY --chown=$APP_USER:$APP_USER --from=plugin /app/vendor/bundle /app/vendor/bundle COPY --chown=$APP_USER:$APP_USER --from=plugin /usr/local/bundle /usr/local/bundle COPY --chown=$APP_USER:$APP_USER --from=plugin /app/public/assets /app/public/assets COPY --chown=$APP_USER:$APP_USER --from=plugin /app/config/frontend_assets.manifest.json /app/config/frontend_assets.manifest.json COPY --chown=$APP_USER:$APP_USER --from=plugin /app/Gemfile.* /app/ COPY --chown=$APP_USER:$APP_USER --from=plugin /app/vendor/plugins /app/vendor/pluginsCan I put this whole code in a single Dockerfile ? In stage 1 and 2, openproject versions ain't the same, is it ok ?
Yes this is my dockerfile minus the command for my plugin which you don't need, you can just change the version of stage 2 and it will be build with this one.
It worked with 16.6.3 with your script without the plugings. I'll try with 17.0.0.
############## STAGE 1 #############
FROM openproject/openproject:16 AS plugin
COPY enterprise_token.rb /app/app/models/enterprise_token.rb
RUN bundle config unset deployment
&& bundle install
&& bundle config set deployment 'true'
RUN ./docker/prod/setup/precompile-assets.sh
############## STAGE 2 #############
FROM openproject/openproject:16.6.3
COPY --from=plugin /app/app/models/enterprise_token.rb /app/app/models
COPY --from=plugin /usr/bin/git /usr/bin/git
COPY --chown=$APP_USER:$APP_USER --from=plugin /app/vendor/bundle /app/vendor/bundle
COPY --chown=$APP_USER:$APP_USER --from=plugin /usr/local/bundle /usr/local/bundle
COPY --chown=$APP_USER:$APP_USER --from=plugin /app/public/assets /app/public/assets
COPY --chown=$APP_USER:$APP_USER --from=plugin /app/config/frontend_assets.manifest.json /app/config/frontend_assets.manifest.json
COPY --chown=$APP_USER:$APP_USER --from=plugin /app/Gemfile.* /app/
Anyone knows how to make this work on a self hosted on a ubuntu machine?
Anyone knows how to make this work on a self hosted on a ubuntu machine?
Which installation Method?
Anyone knows how to make this work on a self hosted on a ubuntu machine?
Which installation Method?
Via package
Anyone knows how to make this work on a self hosted on a ubuntu machine?
Which installation Method?
Via package
see your mail ;)
Working on 17.0.0 with docker compose.
Confirmed too it's working on 17.0.0 with docker compose
Anyone knows how to make this work on a self hosted on a ubuntu machine?
Which installation Method?
Via package
see your mail ;)
Could you send to me?
17.0.0 also works with Dockerfile
Anyone knows how to make this work on a self hosted on a ubuntu machine?
Which installation Method?
Via package
see your mail ;)
Can you send that to me too please? I'm running OpenProject 16.3.2 via package.
Anyone knows how to make this work on a self hosted on a ubuntu machine?
Which installation Method?
Via package
see your mail ;)
Can you send that to me too please?
still works :))
Thanks for the great work !
Working fine on 17.0.2 with the official docker-compose method : https://www.openproject.org/docs/installation-and-operations/installation/docker-compose/
I use this docker-compose.override.yml :
---
x-override-app: &override-app
env_file:
- .env
- .env.local
volumes:
- ./enterprise_token.rb:/app/app/models/enterprise_token.rb:ro
services:
web:
<<: *override-app
worker:
<<: *override-app
cron:
<<: *override-app
seeder:
<<: *override-app
db:
image: postgres:17
env_file:
- .env
- .env.local
proxy:
profiles:
- disabled
override-proxy:
build:
context: ./proxy
args:
APP_HOST: web
image: openproject/proxy
restart: unless-stopped
ports:
- "10.10.20.200:8083:80"
depends_on:
- web
networks:
- frontendhello y'all. confirmed works well in 17.0.2. thanks.
Is it just me or does everyone's login page defaults to the dark theme after upgrading to v17
edit: well after testing on other users' computers, I noticed that the login screen shows light or dark themes depending on the OS/system settings if dark mode.
Hey everyone. I have running the 17.0.0 as all in docker, is it possible to just rebuild the running container or should I build a new Image?
I am just a little bit afraid for data loss. Thx
Anyone knows how to make this work on a self hosted on a ubuntu machine?
Which installation Method?
Via package
see your mail ;)
I would also appreciate a message. We haven't installed it yet, but I would prefer package installation.
I tested this with docker, works smoothly.
Is there a way to integrate this as a patch with the openproject proxmox community script so it persists when the LXC updates?
(https://community-scripts.github.io/ProxmoxVE/scripts?id=openproject)
Thanks in advance!
Hey everyone. I have running the 17.0.0 as all in docker, is it possible to just rebuild the running container or should I build a new Image? I am just a little bit afraid for data loss. Thx
Hi,
Just to give you a quick update on what was done with the OpenProject setup.
Initially, the custom enterprise_token.rb file was copied to the path used in version 16 (/app/models/enterprise_token.rb). However, in version 17 the internal structure changed, and the correct path is now /app/app/models/enterprise_token.rb.
After identifying the correct location in v17, the Dockerfile was updated to copy the file into /app/app/models/enterprise_token.rb. The image was then rebuilt from the official openproject/openproject:17 base image, creating a custom image tagged as mi-openproject:17.
Once the image was rebuilt, the container was recreated using the new image. It was executed with the following command (private data omitted):
docker run -d --name openproject -p 80:80 -e OPENPROJECT_HOST__NAME= -e OPENPROJECT_HTTPS=false -e OPENPROJECT_DEFAULT__LANGUAGE=es -e SECRET_KEY_BASE=<generated_key> -v <pgdata_volume>:/var/openproject/pgdata -v <assets_volume>:/var/openproject/assets --restart unless-stopped mi-openproject:17
After restarting the container with the corrected image and path, the changes were successfully applied and verified.
Let me know if you need the Dockerfile or step-by-step details documented separately.
Best,
Cristian
I have tested it and it works for version 17.1.2. Thank you very much.
17.2 has been released.Please confirm this file is valid.Has any one tested ????
Not work with version 17.2
Sorry. I didn't test it thoroughly. This version of the Docker image isn't complete. So, there were some glitches, and after restarting with docker compose up -d --force-recreate , this code seems to work. I'm just exploring the features of the open project as a hobby, so I'm not sure if all the features added in this version actually work.
However, this version of the Docker image is still incomplete. For example, the curl package is missing, so health checks don't work properly.
This is unrelated to the code.
@hexagon1001 did you test 17.2 released yesterday or the older version
@markasoftware Have you blessed this release .Does the code work for you
Has anyone tested 17.0.0 yet?