Editing
GitLab V18 Upgrade
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Method 2: Persistent Grant (via Helm `values.yaml`)== This is the preferred method for Helm deployments as it ensures the grant is applied consistently. You can inject an initialization script into the PostgreSQL container that grants the necessary permissions. This typically involves using the `postgresql.initdb` configuration in your `values.yaml`. ===Example `values.yaml` addition:=== # Add this to your values.yaml file postgresql: # This section assumes you are using the bundled PostgreSQL with the GitLab chart. # If using an external PostgreSQL, you would need to run this command on your external DB. initdb: ## @param initdb.scripts Allows mounting scripts into /docker-entrypoint-initdb.d/ to be executed at first boot of the Postgres container ## This can be used for custom grants or other database initialization. scripts: grant-wal-permissions.sql: | DO $do$ BEGIN IF EXISTS (SELECT 1 FROM pg_catalog.pg_proc p JOIN pg_catalog.pg_namespace n ON p.pronamespace = n.oid WHERE p.proname = 'pg_ls_waldir' AND n.nspname = 'pg_catalog') THEN GRANT EXECUTE ON FUNCTION pg_catalog.pg_ls_waldir() TO gitlab; -- Replace 'gitlab' with your actual GitLab database user if different END IF; -- Also consider granting pg_monitor role if appropriate for your security model IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'pg_monitor') THEN GRANT pg_monitor TO gitlab; -- Replace 'gitlab' with your actual GitLab database user if different END IF; END $do$; ===Explanation of the `initdb.scripts` addition:=== * `initdb.scripts`: This section allows you to define custom SQL scripts that will be run when the PostgreSQL container is first initialized. * `grant-wal-permissions.sql`: This is a descriptive name for your script. * `DO $$BEGIN ... END$$;`: This is an anonymous PL/pgSQL block, which allows for conditional logic (like checking if the function exists before trying to grant). * `IF EXISTS (...) THEN ... END IF;`: This checks if `pg_ls_waldir` function exists (useful for PostgreSQL version compatibility) and if the `pg_monitor` role exists before attempting the `GRANT`. * `TO gitlab;`: **Crucially, replace `gitlab` with the actual database user GitLab uses.** This is usually configured in your GitLab Helm chart's `global.psql.username` or `global.postgresql.username` setting, or if you're using the bundled PostgreSQL, it's often `gitlab`. ===After modifying `values.yaml`:=== Run the `helm upgrade` command again: helm upgrade <your-gitlab-release-name> gitlab/gitlab -f your_values.yaml --version <new-gitlab-version>
Summary:
Please note that all contributions to WilliamsNet Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
WilliamsNet Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Navigation
Commons
Architecture
How-To
Systems
Hardware
SysAdmin
Kubernetes
OpenSearch
Special
Pages to create
All pages
Recent changes
Random page
Help about MediaWiki
Formatting Help
Tools
What links here
Related changes
Special pages
Page information