惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
Google DeepMind News
Google DeepMind News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
P
Proofpoint News Feed
Recent Announcements
Recent Announcements
MongoDB | Blog
MongoDB | Blog
U
Unit 42
云风的 BLOG
云风的 BLOG
Recorded Future
Recorded Future
G
Google Developers Blog
I
InfoQ
Blog — PlanetScale
Blog — PlanetScale
A
About on SuperTechFans
Jina AI
Jina AI
量子位
宝玉的分享
宝玉的分享
The Cloudflare Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 聂微东
Last Week in AI
Last Week in AI
WordPress大学
WordPress大学
美团技术团队
The Hacker News
The Hacker News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Tailwind CSS Blog
博客园 - 司徒正美
博客园 - 叶小钗
Hugging Face - Blog
Hugging Face - Blog
P
Palo Alto Networks Blog
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
博客园 - 【当耐特】
Spread Privacy
Spread Privacy
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
Vercel News
Vercel News
Martin Fowler
Martin Fowler
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Forbes - Security
Forbes - Security
Attack and Defense Labs
Attack and Defense Labs
Google DeepMind News
Google DeepMind News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Azure Blog
Microsoft Azure Blog
P
Privacy International News Feed
G
GRAHAM CLULEY
The Last Watchdog
The Last Watchdog
C
Cyber Attacks, Cyber Crime and Cyber Security
AI
AI
V2EX - 技术
V2EX - 技术

博客园 - zakun

Gitlab CI 本地开发部署 Golang grpc 实践 Mongo 聚合演示 真・一键激活 JetBrains 全家桶! Kafka 分区细说 解决国内Homebrew安装 Homebrew How to Install PHP Install Elasticsearch with Docke wsl2 网络相关设置 php docker image nginx 反向代理常用设置说明 Golang常见的并发模式 Gin框架的几种热加载方法 协程 Mysql Full-Text Index 介绍 gitlab runner 使用摘要 Docker 简介 linux-查看文件夹大小 Linux 如何删除乱码文件-inode删除 Nginx反爬虫: 禁止某些User Agent抓取网站 PHP添加$_SERVER服务器环境变量
Gitlab Docker 使用摘要
zakun · 2023-11-24 · via 博客园 - zakun

官方文档: https://docs.gitlab.com/ee/install/docker.html#expose-gitlab-on-different-ports

设置本地目录

  • 设置环境变量 GITLAB_HOME
    • export GITLAB_HOME=/srv/gitlab

安装

  • 启动脚本start.sh
#!/bin/bash

export GITLAB_HOME=/srv/gitlab

sudo docker run --detach \
  --privileged \
  --hostname gitlab.example.com \
  --publish 8980:8980 --publish 8922:22 \
  --name gitlab \
  --network bridge \
  --volume $GITLAB_HOME/config:/etc/gitlab:Z \
  --volume $GITLAB_HOME/logs:/var/log/gitlab:Z \
  --volume $GITLAB_HOME/data:/var/opt/gitlab:Z \
  --shm-size 256m \
  gitlab/gitlab-ee:latest

配置

配置文件位置: /etc/gitlab/gitlab.rb

务必保证 /etc/gitlab/gitlab.rb 配置文件中的 external_url 是真实有效的可访问的地址

重启使配置生效

sudo docker restart gitlab

使用非默认端口

Gitlab 默认使用 80, 443, 22 等端口, 若不使用默认端口,则需修改配置文件 /etc/gitlab/gitlab.rb

若设置Web 端口

# For HTTP
external_url "http://gitlab.example.com:8929"

# or

# For HTTPS (notice the https)
# external_url "https://gitlab.example.com:8929"

若设置ssh端口

gitlab_rails['gitlab_shell_ssh_port'] = 2289

重新配置gitlab

gitlab-ctl reconfigure

重置root密码

首先需要登录gitlab容器内部,如果gitlab容器的名称为 gitlab, 进入容器 docker exec -it gitlab bash

Use a Rake task

gitlab-rake "gitlab:password:reset"

Use a Rails console

  1. 打开rails控制台

    gitlab-rails console
    
  2. 查找用户

    • By username

      user = User.find_by_username 'root'

    • By user ID(root 用户id为1)

      user = User.find(1)

    • By email address

      user = User.find_by(email: 'root@example.com')

  3. 重置密码

    • 设置随机密码

      new_password = ::User.random_password
      user.password = new_password
      user.password_confirmation = new_password
      user.password_automatically_set = false
      
    • 设置指定密码

      new_password = 'examplepassword'
      user.password = new_password
      user.password_confirmation = new_password
      user.password_automatically_set = false
      
  4. 保存

    user.save!
    
  5. 退出

    exit
    

Troubleshooting

  1. Email confirmation issues

If the new password doesn’t work, it might be an email confirmation issue. You can attempt to fix this issue in a Rails console. For example, if a new root password isn’t working:

  • Start a Rails console.
  • Find the user and skip reconfirmation:
user = User.find(1)
user.skip_reconfirmation!
  • Attempt to sign in again