AWSのMarketplaceにあるbitnamiのAMIをインストールしてみました。
デフォルトでインストールするとホスト名が、ec2-XX-XX-XX-XX.ap-northeast-1.compute.amazonaws.comになります。
今回は、ドメイン名に変更する手順のメモになります。
(よくわかっていないですが、忘れないためのメモ)
参考サイト
インストールは、以下の参考サイトから行いました。
設定手順
- ホスト名の変更(ymlファイルの変更)
- スクリプトの変更(020_update_ipのif文を変更)
- シェルスクリプトの変更
- Gitlabの再起動
ホスト名の変更(ymlファイルの変更)
viで下記ファイルを編集
host: ec2-XX-XX-XX-XX.ap-northeast-1.compute.amazonaws.comの部分をドメインに変更
# vi /opt/bitnami/apps/gitlab/htdocs/config/gitlab.yml
## GitLab settings
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: ec2-XX-XX-XX-XX.ap-northeast-1.compute.amazonaws.com
port: 80 # Set to 443 if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
https: false # Set to true if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
gitユーザ側のgit-shellのconfig.yml変更
(なぜか、これをドメインに変更したらGitlabの各ユーザで設定したSSHが読み込みできた。。)
su git
cd /home/git/gitlab-shell
vi config.yml
configファイルを開いたら、gitlab_url:部分のEC2ドメインを各自のドメインに変更する
スクリプトの変更(020_update_ipのif文を変更)
viで下記ファイルのif文を編集
# vi /opt/bitnami/var/init/post-start/020_update_ip
if [ "x$1" != "x" ]; then
PUBLIC_IP=$1
elif [ -n $GITLABHOST ]; then
PUBLIC_IP=$GITLABHOST
else
PUBLIC_IP=`get_server_domain`
fi
シェルスクリプトの変更
viで下記ファイルを開き、最後の行に下記を追加する
# vi /opt/bitnami/scripts/setenv.sh
GITLABHOST="gitlab.your.hostname"
export GITLABHOST
Gitlabの再起動
設定ファイルの変更が終わったら、再起動を行なう
# /opt/bitnami/ctlscript.sh restart