Skip to content

Instantly share code, notes, and snippets.

@markasoftware
Last active June 5, 2025 09:12
Show Gist options
  • Save markasoftware/f5b2e55a2c2e3abb1f9eefcdf0bfff45 to your computer and use it in GitHub Desktop.
Save markasoftware/f5b2e55a2c2e3abb1f9eefcdf0bfff45 to your computer and use it in GitHub Desktop.
OpenProject Enterprise mode for free
############ 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
def current
self.new
end
def allows_to?(feature)
true
end
def active?
true
end
def hide_banners?
true
end
def show_banners?
false
end
def banner_type_for(feature:)
nil
end
end
def token_object
Class.new do
def has_feature?(feature)
true
end
def will_expire?
false
end
def mail
"[email protected]"
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
[]
end
def plan
"markasoftware_free_enterprise_mode"
end
def features
[]
end
def version
69
end
end.new
end
def will_expire?
false
end
def mail
"[email protected]"
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
[]
end
def plan
"markasoftware_free_enterprise_mode"
end
def features
[]
end
def version
69
end
def allows_to?(action)
true
end
def expired?(reprieve: true)
false
end
def invalid_domain?
false
end
end
@christophwolff
Copy link

should work fine in 16

@chihilock
Copy link

work v15.5?

@CC1119
Copy link

CC1119 commented May 7, 2025

work v15.5?

Yes, perfectly fine

@CC1119
Copy link

CC1119 commented May 7, 2025

No need to change values for banner_type_for(). Keep it as the original:

def show_banners?(feature: nil)
  false
end

def banner_type_for(feature:)
  if !active?
    :no_token
  elsif !allows_to?(feature)
    :upsell
  end
end

@chihilock
Copy link

Thank you. I was worried about what to do about that part.

No need to change values for banner_type_for(). Keep it as the original:

def show_banners?(feature: nil)
  false
end

def banner_type_for(feature:)
  if !active?
    :no_token
  elsif !allows_to?(feature)
    :upsell
  end
end

@supaeasy
Copy link

with openproject 15.1.1 it is working for me just added this line in docker-compose file:

    volumes:
      - /mnt/data/openproject/enterprise_token.rb:/app/app/models/enterprise_token.rb:ro

Can confirm this is still working very fine with 15.5.1.

To everyone who is confused on where to put this: this needs to go in the same volumes section as the /data volumes. NOT in the /db part.
Also, of course change /mnt/data/openproject/ to the actual location you downloaded enterprise_token.rb to.

@scalenow
Copy link

version 16 released today for openproject ,Has anyone tried to see whether the file is compatible

@perexwi
Copy link

perexwi commented May 21, 2025

Not working with version 16, you probably will get a 500 Internal Server Error

@scalenow
Copy link

Yes that was my suspicion @markasoftware any intelligent insights

@3115fcfc-2c0b-4076-927f-ae6531c76061

@markasoftware
Copy link
Author

markasoftware commented May 21, 2025

I have just updated this to OpenProject 16.

Also: The "enterprise edition" section in the settings will now work!

@markasoftware
Copy link
Author

I have also just verified that this is backward-compatible with opf 15. Thanks for the reports everyone! Would appreciate more testers to ensure my latest change didn't break anything else.

@markasoftware
Copy link
Author

and also thanks @3115fcfc-2c0b-4076-927f-ae6531c76061 you beat me by 25 minutes :)

@scalenow
Copy link

@djtilo-ol
Copy link

@markasoftware I have upgraded my 15.5.1 manual installation and added your modified file - it works as it should. Thank you and @3115fcfc-2c0b-4076-927f-ae6531c76061

@3115fcfc-2c0b-4076-927f-ae6531c76061

also just verified that this is backward-compatible with opf 15. Thanks for the reports everyone! Would appreciate more testers to ensure my latest change didn't break anything else.

@markasoftware Thank you. Works flawlessly for me in 15.5.1 and 16.0.0 with docker-compose and replacing.

@supaeasy
Copy link

Did someone manage to upgrade the Postgresql Database from 13 to 17 as recommended when upgrading to 16.0?
I tried their Guide but it aborts with Current and new postgres version are identical. Aborting.

@CC1119
Copy link

CC1119 commented May 23, 2025

Did someone manage to upgrade the Postgresql Database from 13 to 17 as recommended when upgrading to 16.0? I tried their Guide but it aborts with Current and new postgres version are identical. Aborting.

What version does psql --version return on your end?
Also after upgrading, I had to force-refresh the info page in OP (/admin/info). It was still showing the old version until I did that.

@supaeasy
Copy link

I am running this in docker. So as far as I understand the procedure

docker run --rm -it \
  -v /var/lib/openproject/pgdata:/var/openproject/pgdata \
  -v /var/lib/openproject/pgdata-next:/var/openproject/pgdata-next \
  openproject/openproject:15 root ./docker/prod/postgres-db-upgrade

The docker image openproject/openproject:15 should simply take the v13 Stuff in pgdata, and convert it to v17. Am I wrong?

I also tried to use pg_update but this messed up the database because I couldn't use the username I am using for my openproject database (or didnt know how to) so that didnt work either. Any recommendations?

@supaeasy
Copy link

I just learned I am not alone: https://community.openproject.org/topics/19208

@3115fcfc-2c0b-4076-927f-ae6531c76061

Did someone manage to upgrade the Postgresql Database from 13 to 17 as recommended when upgrading to 16.0? I tried their Guide but it aborts with Current and new postgres version are identical. Aborting.

@supaeasy @CC1119 The link sends you to the old version stable/15. The person from this post (https://community.openproject.org/topics/19208) mentioned: "This message comes from the "postgres-db-upgrade" script." If it is this resource "https://github.com/opf/openproject/blob/dev/docker/prod/postgres-db-upgrade" than it shouldn't work because there it is still set to NEW_PGVERSION="13".

Same shouldn't work for the docker-compose because there and the Docker Hub images 16.0.0 and 16.0.0-slim are still ENV PGVERSION=13 and ENV NEXT_PGVERSION=15.
Change the values manually and try it again.

@supaeasy
Copy link

Thank you for pointing this out! I created a pull request.

@3115fcfc-2c0b-4076-927f-ae6531c76061

@supaeasy Good. Me too because there are more places to fix the versions for Postgres and OpenProject:
opf/openproject#19011
opf/openproject-docker-compose#112

@positiveque
Copy link

Works great on OpenProject 16.0 via "Compose-based installation". Thanks!

@OussamaBeyGahar
Copy link

Hi guys,

how to do this for an openproject that's not installed with docker ? meaning installed directly on centos machine

@derguenner
Copy link

Hi guys,

how to do this for an openproject that's not installed with docker ? meaning installed directly on centos machine

just replace the file directly

@OussamaBeyGahar
Copy link

thnx, my stuped self didn't read the file :p, i just did it thnx

@supaeasy
Copy link

supaeasy commented Jun 4, 2025

Openprojects GitHub Management as well as their support is a disaster. Didnt manage to update my database yet and nobody reacts to anything if you don't REALLY annoy people directly as I did about https://gist.github.com/markasoftware/f5b2e55a2c2e3abb1f9eefcdf0bfff45?permalink_comment_id=5591479#gistcomment-5591479

@OussamaBeyGahar
Copy link

i agree, for exemple i'm stuck with the upgrade to new version, each time i try it following their docs i get the same error with ruby on rails about data base migration error

@scalenow
Copy link

scalenow commented Jun 5, 2025

Hi guys,
how to do this for an openproject that's not installed with docker ? meaning installed directly on centos machine

just replace the file directly

yes just cut copy and paste

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment