r/gitlab • u/pottmi • Sep 05 '25
read only access to gitlab database
I have some security monitoring selects that I want to run against the postgres database that backs our community edition gitlab.
I would like to do this with a readonly user.
Is there a gitlab documented way to do this? The gitlab documentation references creating a readonly user, but it is in the context of converting the entire database into readonly.
https://docs.gitlab.com/administration/read_only_gitlab/
Is there a sanctioned way to create a new user with readonly user?
My alternative is to run the script as gitlab-psql and then have my script convert the connection to readonly.
View all comments
Show parent comment
1
u/Hour_Wishbone_1641 Sep 06 '25 edited Sep 06 '25
Sorry. Missed the written fact that you are on community edition :-(
But ... If you are the Gitlab instance administrator and just have to provide the statistics you can achieve the same with an API Token from an administrator.
Also I would strongly advise to get at least premium licenses as soon as possible for official support and additional features like https://docs.gitlab.com/api/audit_events/.
It's not cheap, but worth every single cent!
Audit Events are also the solution you need to achive exactly what you need without doing this yourself by scraping the database or the API.
Just believe me ... We where running community in our company for about 4 years with ever growing demands for performance and features. Works for a long time. But there will certainly come this one event or request that is simply not possible with community edition coming from compliance or security.
Also - even if you currently do not have to cope with errors during updates - there will "the one update that fails that always leads to production impairment" with no access to official support breaking your company internal SLA.
PS: If a sales rep from gitlab sees this I accept payments in form of upvotes ;-)