一.错误总类
1.进程启动是成功的,但是浏览器访问就是无反应。
2.报错502
二.安装参考
###1.拉取镜像
docker pull gitlab/gitlab-ce:latest
###2.启动
docker run \
-itd \
-p 9443:443 \
-p 9908:80 \
-p 9902:22 \
-v /usr/local/gitlab-test/etc:/etc/gitlab \
-v /usr/local/gitlab-test/log:/var/log/gitlab \
-v /usr/local/gitlab-test/opt:/var/opt/gitlab \
--restart always \
--privileged=true \
--name gitlab-test \
gitlab/gitlab-ce
###3.进入容器
docker exec -it gitlab-test /bin/bash
接下来是修改配置:
###4.修改访问地址external_url
vi /etc/gitlab/gitlab.rb
# 配置http协议:'http://192.168.1.xx,不能写192.168.1.xx:9908
external_url '192.168.1.xx'
# 配置ssh协议所使用的访问地址和端口,同上
gitlab_rails['gitlab_ssh_host'] = '192.168.1.xx'
gitlab_rails['gitlab_shell_ssh_port'] = 9902# 此端口是run时22端口映射的9902端口
三.坑所在位置
external_url 必须是80端口,而不是暴露出去的映射端口。
当出现502错误时,请耐心等待几十秒,再次刷新就Ok了。
还有一个密码重置时,进入初始化密码的命令,没有最后的production
四.密码重置
进入ruby
gitlab-rails console
--------------------------------------------------------------------------------
Ruby: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
GitLab: 14.1.3 (132256d76b1) FOSS
GitLab Shell: 13.19.1
PostgreSQL: 12.6
--------------------------------------------------------------------------------
Loading production environment (Rails 6.1.3.2)
irb(main):001:0>
错误的做法
gitlab-rails console production
Traceback (most recent call last):
8: from bin/rails:4:in `<main>'
7: from bin/rails:4:in `require'
6: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/commands.rb:18:in `<top (required)>'
5: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/command.rb:50:in `invoke'
4: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/command/base.rb:69:in `perform'
3: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
2: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
1: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/commands/console/console_command.rb:95:in `perform': wrong number of arguments (given 1, expected 0) (ArgumentError)
9: from bin/rails:4:in `<main>'
8: from bin/rails:4:in `require'
7: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/commands.rb:18:in `<top (required)>'
6: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/command.rb:50:in `invoke'
5: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/command/base.rb:69:in `perform'
4: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
3: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
2: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:20:in `run'
1: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:34:in `rescue in run'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/base.rb:525:in `handle_argument_error': ERROR: "rails console" was called with arguments ["production"] (Thor::InvocationError)
Usage: "rails console [options]"
查找用户
irb(main):001:0> u=User.where(id:1).first
=> #<User id:1 @root>
#通过u.password='root@12345'设置密码
irb(main):002:0> u.password='root@12345'
=> "root@12345"
# 通过u.password_confirmation='root@12345' 再次确认密码
irb(main):003:0> u.password_confirmation='root@12345'
=> "root@12345"
#通过 u.save!进行保存(切记切记 后面的 !)
irb(main):004:0> u.save!
Enqueued ActionMailer::MailDeliveryJob (Job ID: 00ea0b5a-e0d1-4410-8c39-e35a295ac972) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007ffb72e830a8 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
参考链接:
https://blog.csdn.net/hnmpf/article/details/80518460?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-1.essearch_pc_relevant&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-1.essearch_pc_relevant
https://www.cnblogs.com/diaomina/p/12830449.html