Svolence


  • Home

  • Categories

  • About

  • Archives

  • Tags
Svolence

Install docker on ubuntu

Posted on  |  2016-11-21   |   In docker   |     |   Visitors

下载ubuntu镜像

1
sudo docker pull ubuntu:16.04

创建一个容器,运行bash

1
2
3
4
5
6
7
sudo docker run -it ubuntu:16.04 /bin/bash
# 参数:
# -i:表示以“交互模式”运行容器,-i 则让容器的标准输入保持打开
# -t:表示容器启动后会进入其命令行,-t 选项让Docker分配一个伪终端(pseudo-tty)并绑定到容器的标准输入上
# -v:表示需要将本地哪个目录挂载到容器中,格式:-v <宿主机目录>:<容器目录>,-v 标记来创建一个数据卷并挂载到容器里。在一次 run 中多次使用可以挂载多个数据卷。
# -p:指定对外80端口
# 不一定要使用“镜像 ID”,也可以使用“仓库名:标签名”

保存docker中的修改

  • 列出所有容器

    1
    sudo docker ps
  • 提交修改

    1
    2
    3
    sudo docker commit {containerId}
    # 会返回一个id
    sudo docker tag {id} oceanwen/test:1.0
  • 杀死所有正在运行的容器

    1
    docker kill $(docker ps -a -q)
  • 删除所有已经停止的容器

    1
    docker rm $(docker ps -a -q)
  • 删除所有镜像

    1
    docker rmi $(docker ps -a -q)
  • 查看容器信息

    1
    docker inspect {containerId}
Read more »
Svolence

gitlab Troubleshoting

Posted on  |  2016-11-21   |   In gitlab   |     |   Visitors

GitLab 碰到的问题

502 Whoops, GitLab is taking too much time to respond.

1.查看8080端口是否被占用

1
netstat -plnt | grep 8080

==> /var/log/gitlab/unicorn/unicorn_stderr.log <==
Errno::EADDRINUSE: Address already in use - bind(2) for 127.0.0.1:8080

编辑/etc/gitlab/gitlab.rb L439 unicorn['port'] = 1234

2.sudo gitlab-ctl tail 查看相关错误日志发现:

error: proxyRoundTripper: GET “/“ failed with:
“dial unix /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket: connect: connection refused”

GitLab安装对服务器硬件有一定的要求

Svolence

NFS config & mount

Posted on  |  2016-11-21   |   In gitlab   |     |   Visitors

1.安装NFS

Server

1
server$ sudo apt-get update && apt-get install nfs-kernel-server

Client

1
client$ sudo apt-get update && apt-get install nfs-common

2.服务端创建共享目录

1
server$ sudo mkdir /var/nfs/general -p
1
2
# 修改目录所属组
server$ sudo chown nobody:nogroup /var/nfs/general -R
Read more »
Svolence

pgsql basic usage

Posted on  |  2016-11-21   |   In gitlab   |     |   Visitors

postgresql 使用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
cd /var/opt/gitlab/postgresql/data
vim pg_hba.conf
host all all 0.0.0.0/0 md5 #0.0.0.0为地址段,0为多少二进制位
host all all 10.96.23.0/24 trust 添加这行:10.96.23.0/24这个段的ip地址不需要密码可以连接
host all all 10.96.23.0/24 md5 添加这行:10.96.23.0/24这个段的ip链接需要密码
vim postgresql.conf
listen_addresses = '10.96.23.104' 修改监听地址为ip
gitlab-ctl restart postgresql
cd /opt/gitlab/embedded/
bin/psql -U gitlab -d gitlabhq_production -h 10.96.23.102 不用输入密码就可进来
psql (9.2.18)
Type "help" for help.

命令行登陆数据库

1
psql -U gitlab -d gitlabhq_production -h 10.96.23.104
Read more »
Svolence

Gitlab HA

Posted on  |  2016-11-21   |   In gitlab   |     |   Visitors

GitLab 高可用

GitLab支持几种不同的高可用和集群类型.方案的选择将基于业务的可扩展性和可用性,最简单的解决方案应该是可扩展的.

方案一(一主一备)

一主一备配置

利用DRBD(分布式快设备)保持数据同步,DRBD需要一个低延迟的链接保持同步

方案二(双主)

双主配置
优点:可以很容易扩展,通过NFS进行集群,每一个应用都单独部署

以下针对方案二进行详细配置

  1. 分别在每一台GitLab application server安装NFS client
    Read more »
123
Svolence

Svolence

Talk is cheap, show me the code!!!

15 posts
9 categories
16 tags
© 2017 Svolence
Powered by Hexo
Theme - NexT.Mist