forked from ustcck/docker-k8s-devops
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Peng Xiao <[email protected]>
- Loading branch information
1 parent
9fa7c2c
commit d056974
Showing
7 changed files
with
173 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
Vagrant.require_version ">= 1.6.0" | ||
|
||
boxes = [ | ||
{ | ||
:name => "gitlab", | ||
:eth1 => "192.168.211.10", | ||
:mem => "4096", | ||
:cpu => "2" | ||
}, | ||
{ | ||
:name => "gitlab-ci", | ||
:eth1 => "192.168.211.11", | ||
:mem => "1024", | ||
:cpu => "1" | ||
}, | ||
{ | ||
:name => "k8s-master", | ||
:eth1 => "192.168.211.20", | ||
:mem => "2048", | ||
:cpu => "1" | ||
}, | ||
{ | ||
:name => "k8s-node", | ||
:eth1 => "192.168.211.21", | ||
:mem => "2048", | ||
:cpu => "1" | ||
}, | ||
] | ||
|
||
Vagrant.configure(2) do |config| | ||
|
||
config.vm.box = "centos/7" | ||
|
||
boxes.each do |opts| | ||
config.vm.define opts[:name] do |config| | ||
config.vm.hostname = opts[:name] | ||
config.vm.provider "vmware_fusion" do |v| | ||
v.vmx["memsize"] = opts[:mem] | ||
v.vmx["numvcpus"] = opts[:cpu] | ||
end | ||
|
||
config.vm.provider "virtualbox" do |v| | ||
v.customize ["modifyvm", :id, "--memory", opts[:mem]] | ||
v.customize ["modifyvm", :id, "--cpus", opts[:cpu]] | ||
end | ||
|
||
config.vm.network :private_network, ip: opts[:eth1] | ||
end | ||
end | ||
|
||
config.vm.synced_folder "./labs", "/home/vagrant/labs" | ||
config.vm.provision "shell", privileged: true, path: "./setup.sh" | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# GitLab Server 的搭建 | ||
|
||
参考 https://about.gitlab.com/installation | ||
|
||
|
||
## 1. 准备工作 | ||
|
||
以Centos7为例,准备一台至少内存为4G的机器。 | ||
|
||
|
||
## 2. 安装依赖软件 | ||
|
||
|
||
``` | ||
sudo yum install -y git vim gcc glibc-static telnet | ||
sudo yum install -y curl policycoreutils-python openssh-server | ||
sudo systemctl enable sshd | ||
sudo systemctl start sshd | ||
sudo yum install postfix | ||
sudo systemctl enable postfix | ||
sudo systemctl start postfix | ||
``` | ||
|
||
|
||
## 3. 设置gitlab安装源 | ||
|
||
如果在国内的话,可以尝试使用清华大学的源。 | ||
|
||
新建 /etc/yum.repos.d/gitlab-ce.repo,内容为 | ||
|
||
``` | ||
[gitlab-ce] | ||
name=Gitlab CE Repository | ||
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/ | ||
gpgcheck=0 | ||
enabled=1 | ||
``` | ||
|
||
如果在国外的话,可以使用 | ||
|
||
``` | ||
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash | ||
``` | ||
|
||
## 4. 安装GitLab | ||
|
||
关于域名,如果要是设置域名,则如下,这个域名可以是真实购买的域名,如果您要把gitlab安装到公网比如阿里云上的话。 | ||
|
||
如果只是想本地测试,则可以像下面一样,设置一个example的域名,然后记得在本地你的笔记本设置host,如果是MAC就在 /etc/hosts里添加 一行 `192.168.211.10 gitlab.example.com` | ||
|
||
``` | ||
sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ce | ||
``` | ||
|
||
如果不想设置域名,或者想将来再考虑,可以直接 | ||
|
||
``` | ||
sudo yum install -y gitlab-ce | ||
``` | ||
|
||
安装完成以后,运行下面的命令进行配置 | ||
|
||
``` | ||
sudo gitlab-ctl reconfigure | ||
``` | ||
|
||
## 5. 登陆和修改密码 | ||
|
||
|
||
打开http://gitlab.example.com/ 修改root用户密码,然后使用root和新密码登陆。 | ||
|
||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[gitlab-ce] | ||
name=Gitlab CE Repository | ||
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/ | ||
gpgcheck=0 | ||
enabled=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#/bin/sh | ||
|
||
sudo yum install -y git vim gcc glibc-static telnet | ||
sudo yum install -y curl policycoreutils-python openssh-server | ||
sudo systemctl enable sshd | ||
sudo systemctl start sshd | ||
|
||
sudo yum install postfix | ||
sudo systemctl enable postfix | ||
sudo systemctl start postfix | ||
|
||
sudo cp gitlab-ce.repo /etc/yum.repos.d/ | ||
|
||
sudo yum makecache | ||
|
||
sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ce | ||
|
||
sudo gitlab-ctl reconfigure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#/bin/sh | ||
|
||
# install some tools | ||
sudo yum install -y git vim gcc glibc-static telnet bridge-utils | ||
|
||
# install docker | ||
curl -fsSL get.docker.com -o get-docker.sh | ||
sh get-docker.sh | ||
|
||
# start docker service | ||
sudo groupadd docker | ||
sudo gpasswd -a vagrant docker | ||
sudo systemctl start docker | ||
|
||
rm -rf get-docker.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#/bin/sh | ||
|
||
# install some tools | ||
sudo yum install -y git vim gcc glibc-static telnet |