Part 1: Plan limits kept 0 when installing GDK or self-hosted instance from scratch
What does this MR do and why?
New self-hosted GitLab instances are created with only one plan Default
. According to this documentation, the default plan should have a limit of 1000 for active versioned Pages deployments.
However, when installing a new self-hosted instance, the rails db:prepare
command does not apply older migrations.
This means the migration 20240404134450_insert_active_versioned_pages_deployments_limit_by_namespace.rb
is never executed.
As a result, new self-hosted instances end up with the default plan limit set to 0, making it impossible to use the Parallel Pages Deployments feature.
Proposed Solution
Set a default value of 1000 for plan_limits.active_versioned_pages_deployments_limit_by_namespace
. This ensures that all new self-hosted instances will have the correct limit.
Thoughts on performance
As far as I can see, there can be a total of 10 plans on gitlab.com and there is only one Default
plan for a self-hosted instance. It's 1 to 1 relationship between Plan
and PlanLimits
. So I assume that any updates on these tables should be relatively fast, but please correct me if I am missing any potential pitfalls here.
Additional Steps (outside of this MR)
Backfill Data for Existing Self-Hosted Instances
Any instance installed between the original migration (20240404134450_insert_active_versioned_pages_deployments_limit_by_namespace.rb
) and this MR Part 1 will still have a 0 limit.
A separate Part 2 migration will be added to backfill the missing data for affected instances.
Follow-Up MR for GDK
GDK is also affected by this behavior.
The solution for GDK will be to explicitly set limits in the seed file (ee/db/fixtures/development/27_plans.rb
). This will ensure that all accounts in GDK receive appropriate limits based on GitLab SaaS limits.
Note: I followed this guide on how to add a new default value to a table column https://docs.gitlab.com/ee/development/database/avoiding_downtime_in_migrations.html#changing-column-defaults.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
./bin/rails db:migrate
DEPRECATION WARNING: Support for Rails versions < 7.1 is deprecated and will be removed from ViewComponent 4.0.0 (ViewComponent v4 will remove support for Rails versions < 7.1 no earlier than April 1, 2025) (called from <main> at /Users/alisafrunza/Documents/work/gdk/gitlab/config/environment.rb:7)
main: == [advisory_lock_connection] object_id: 130520, pg_backend_pid: 66203
main: == 20250206114301 ChangeDefaultActiveVersionedPagesDeploymentLimit: migrating =
main: -- change_column_default(:plan_limits, :active_versioned_pages_deployments_limit_by_namespace, 1000)
main: -> 0.0331s
main: == 20250206114301 ChangeDefaultActiveVersionedPagesDeploymentLimit: migrated (0.0365s)
main: == [advisory_lock_connection] object_id: 130520, pg_backend_pid: 66203
ci: == [advisory_lock_connection] object_id: 130780, pg_backend_pid: 66206
ci: == 20250206114301 ChangeDefaultActiveVersionedPagesDeploymentLimit: migrating =
ci: -- change_column_default(:plan_limits, :active_versioned_pages_deployments_limit_by_namespace, 1000)
ci: -> 0.0185s
ci: == 20250206114301 ChangeDefaultActiveVersionedPagesDeploymentLimit: migrated (0.0269s)
ci: == [advisory_lock_connection] object_id: 130780, pg_backend_pid: 66206
--------------------------------
VERSION=20250206114301 rails db:migrate:down:main
DEPRECATION WARNING: Support for Rails versions < 7.1 is deprecated and will be removed from ViewComponent 4.0.0 (ViewComponent v4 will remove support for Rails versions < 7.1 no earlier than April 1, 2025) (called from <main> at /Users/alisafrunza/Documents/work/gdk/gitlab/config/environment.rb:7)
main: == [advisory_lock_connection] object_id: 130200, pg_backend_pid: 73067
main: == 20250206114301 ChangeDefaultActiveVersionedPagesDeploymentLimit: reverting =
main: -- change_column_default(:plan_limits, :active_versioned_pages_deployments_limit_by_namespace, 0)
main: -> 0.0295s
main: == 20250206114301 ChangeDefaultActiveVersionedPagesDeploymentLimit: reverted (0.0329s)
main: == [advisory_lock_connection] object_id: 130200, pg_backend_pid: 73067
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Related to #515560 (closed)