Install and update memo: gitlab community edition with AMI on AWS 

# Install and update memo: gitlab community edition with AMI on AWS 

## objectives

- to know disk & system usage after upgrading to newest version
- step by step directions
  - first, web ui login
  - second, update to newest version

## system info

| ITEM | | 
| --- | --- |
| Region | Tokyo |
| AMI ID | ami-bbc7e0dc |
| Gitlab Version | 9.0.x |
| Instance Type | t2.medium |
| OS | ubuntu 14.04 |
| Disk | 10GB gp2 |
| SSH Login Username | ubuntu |

Note: At first, I deployed an AMI with t2.micro, but 502 error occurred. Then I change instance type to t2.medium. 

## security group

- AMI Default
    - open TCP 22, 80, 443

## login after deploying 

```shell-session
% ssh -i {private key} ubuntu@{EC2 ipv4 public ip or public dns name}
$ sudo gitlab-ctl reconfigure

(snip)

Chef Client finished, 318/421 resources updated in 25 minutes 31 seconds
gitlab Reconfigured!
```
Note: this output is on t2.micro

```shell-session
$ dpkg -l gitlab-ce
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                      Version           Architecture      Description
+++-=========================-=================-=================-=======================================================
ii  gitlab-ce                 9.0.0-ce.0        amd64             GitLab Community Edition (including NGINX, Postgres, Redis)

$ free
             total       used       free     shared    buffers     cached
Mem:       1016328     538596     477732      29920       3600      61544
-/+ buffers/cache:     473452     542876
Swap:            0          0          0

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      9.8G  2.0G  7.3G  22% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            492M   12K  492M   1% /dev
tmpfs           100M  324K   99M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            497M  4.0K  497M   1% /run/shm
none            100M     0  100M   0% /run/user
```

Note: this output is on t2.micro

## first access

- http://{ipv4 public IP}/

- change root user password
- sign in as root

## update from version 9.0.0 to 9.5.x

- https://about.gitlab.com/update/#ubuntu

```shell-session
$ sudo apt-get upgrade
$ sudo apt-get update && sudo apt-get install gitlab-ce
```

- https://docs.gitlab.com/omnibus/update/README.html

```shell-session
$ curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash

$ sudo apt-cache madison gitlab-ce | awk '{print $3}' | grep ^9.5 | head
9.5.10-ce.0
9.5.9-ce.0
9.5.8-ce.0
9.5.7-ce.0
9.5.6-ce.0
9.5.5-ce.0
9.5.4-ce.0
9.5.3-ce.0
9.5.2-ce.0
9.5.1-ce.0

$ sudo apt-get update && sudo apt-get install gitlab-ce=9.5.10-ce.0

$ sudo gitlab-ctl restart

$ sudo gitlab-rake gitlab:env:info

System information
System:         Ubuntu 14.04
Current User:   git
Using RVM:      no
Ruby Version:   2.3.5p376
Gem Version:    2.6.6
Bundler Version:1.13.7
Rake Version:   12.0.0
Redis Version:  3.2.5
Git Version:    2.13.5
Sidekiq Version:5.0.4
Go Version:     unknown

GitLab information
Version:        9.5.10
Revision:       76c4568
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     postgresql
URL:            http://{foobar}
HTTP Clone URL: http://{foobar}/some-group/some-project.git
SSH Clone URL:  git@{foobar}:some-group/some-project.git
Using LDAP:     no
Using Omniauth: no

GitLab Shell
Version:        5.8.0
Repository storage paths:
- default:      /var/opt/gitlab/git-data/repositories
Hooks:          /opt/gitlab/embedded/service/gitlab-shell/hooks
Git:            /opt/gitlab/embedded/bin/git
```

## update from version 9.5.x to 10.8.x

```shell-session
$ sudo apt-cache madison gitlab-ce | awk '{print $3}' | grep ^10.8 | head
10.8.7-ce.0
10.8.6-ce.0
10.8.5-ce.0
10.8.4-ce.0
10.8.3-ce.0
10.8.2-ce.0
10.8.1-ce.0
10.8.0-ce.0

$ sudo apt-get update && sudo apt-get install gitlab-ce=10.8.7-ce.0

$ sudo gitlab-ctl restart

$ sudo gitlab-rake gitlab:env:info

System information
System:         Ubuntu 14.04
Current User:   git
Using RVM:      no
Ruby Version:   2.3.7p456
Gem Version:    2.6.14
Bundler Version:1.13.7
Rake Version:   12.3.1
Redis Version:  3.2.11
Git Version:    2.16.4
Sidekiq Version:5.0.5
Go Version:     unknown

GitLab information
Version:        10.8.7
Revision:       eb600b0
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     postgresql
URL:            http://{foobar}
HTTP Clone URL: http://{foobar}/some-group/some-project.git
SSH Clone URL:  git@{foobar}:some-group/some-project.git
Using LDAP:     no
Using Omniauth: no

GitLab Shell
Version:        7.1.2
Repository storage paths:
- default:      /var/opt/gitlab/git-data/repositories
Hooks:          /opt/gitlab/embedded/service/gitlab-shell/hooks
Git:            /opt/gitlab/embedded/bin/git
```

## update from version 10.8.x to 11.7.x

```shell-session
$ sudo apt-cache madison gitlab-ce | awk '{print $3}' | grep ^11 | head
11.7.5-ce.0
11.7.4-ce.0
11.7.3-ce.0
11.7.0-ce.0
11.6.9-ce.0
11.6.8-ce.0
11.6.5-ce.0
11.6.4-ce.0
11.6.3-ce.0
11.6.2-ce.0

$ sudo apt-get update && sudo apt-get install gitlab-ce=11.7.5-ce.0

$ sudo gitlab-ctl restart

$ sudo gitlab-rake gitlab:env:info

System information
System:         Ubuntu 14.04
Current User:   git
Using RVM:      no
Ruby Version:   2.5.3p105
Gem Version:    2.7.6
Bundler Version:1.16.6
Rake Version:   12.3.2
Redis Version:  3.2.12
Git Version:    2.18.1
Sidekiq Version:5.2.3
Go Version:     unknown

GitLab information
Version:        11.7.5
Revision:       c5b5b18
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     postgresql
URL:            http://{foobar}
HTTP Clone URL: http://{foobar}/some-group/some-project.git
SSH Clone URL:  git@{foobar}:some-group/some-project.git
Using LDAP:     no
Using Omniauth: yes
Omniauth Providers:

GitLab Shell
Version:        8.4.4
Repository storage paths:
- default:      /var/opt/gitlab/git-data/repositories
Hooks:          /opt/gitlab/embedded/service/gitlab-shell/hooks
Git:            /opt/gitlab/embedded/bin/git
```
```shell-session
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            2.0G   12K  2.0G   1% /dev
tmpfs           396M  332K  395M   1% /run
/dev/xvda1      9.8G  4.0G  5.3G  43% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M     0  5.0M   0% /run/lock
none            2.0G  4.0K  2.0G   1% /run/shm
none            100M     0  100M   0% /run/user

$ free
             total       used       free     shared    buffers     cached
Mem:       4046876    3190052     856824      53732     120212     881412
-/+ buffers/cache:    2188428    1858448
Swap:            0          0          0
```