Gitlab Connect and bulk Modify Database account email address (top)

Source: Internet
Author: User
Tags postgresql psql

Recently, the company's domain name changed, resulting in the need to batch modify Gitlab account. This work for the OPS staff, the workload is relatively large. Therefore, you try to modify the database in batches by using a script.


The process is broadly divided into several stages:

1) Figuring out the GITLAB database structure

2) Use Python to modify the relevant fields, if you find the domain name ending with @xxx, replace it with the @aaa domain name automatically.

Note: The Gitlab installation method used in this article is the official default Yum installation


1) Gitlab database uses PostgreSQL, the connection library needs to modify the Pg_hba.conf file's related configuration

Vim/var/opt/gitlab/postgresql/data/pg_hba.conf

hostallallcidr/masktrust# Add the Host network address and subnet mask that need to connect to the database

2) Modify the postgresql.conf configuration local_ip_address

Vim postgresql.conf

listen_addresses = ' local_ip_address ' #local_ip_address为服务器ip

3) Restart the database

Gitlab-ctl Restart PostgreSQL

4) Connect to the database

cd/opt/gitlab/embedded/

Bin/psql-u gitlab-psql-d gitlabhq_production-h local_ip_address# tested successfully, able to connect to database

5) because PostgreSQL's SQL statements are not well understood, the Navicat for PostgreSQL tool is used for database connectivity

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/8D/27/wKiom1iPY1XRQSdAAABf8PJ3jDY925.png-wh_500x0-wm_3 -wmp_4-s_876224087.png "title=" 1.png "width=" "height=" 252 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:400px; height:252px; "alt=" Wkiom1ipy1xrqsdaaabf8pj3jdy925.png-wh_50 "/>

6) connecting to the database is OK, and finally we just need to focus on the changes.

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/8D/25/wKioL1iPY4PxPnauAABdaZh9aqM282.png-wh_500x0-wm_3 -wmp_4-s_3558078465.png "title=" 2.png "alt=" Wkiol1ipy4pxpnauaabdazh9aqm282.png-wh_50 "/>


Gitlab Connect and bulk Modify Database account email address (top)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.