LoginSignup
1
0

More than 5 years have passed since last update.

Gitbucketを試すv4.6

Last updated at Posted at 2016-11-19

GitBucketを試す
http://qiita.com/ymko/items/3fc4c469b3361921d183
の今版です。

簡単にためす

$ docker run  --rm -p 8080:8080 -p 29418:29418 -i -t centos:centos7 /bin/bash
# curl -LO https://github.com/gitbucket/gitbucket/releases/download/4.6/gitbucket.war
# yum install -y java-1.8.0-openjdk
# java -jar gitbucket.war

あとはhttp://[addr]:8080 でwebインターフェイスにアクセスできましたまる
管理者アカウントはrootでパスワードもrootです

curlの -LO オプションは必須。LつけずにDLしたらhtmlファイルが落ちてきていてエラーでハマった。

# java -jar gitbucket.war
Error: Invalid or corrupt jarfile gitbucket.war
# file gitbucket.war
gitbucket.war: HTML document, ASCII text, with very long lines, with no line terminators

System administration > User Management の設定

  • rootを無効化して個人ユーザーを作る

System administration > System Settings の設定

  • [Base URL] "http://サーバーのIP:8080"  (SSHを使う場合は要求されるので入れる)
  • [Anonymous access] を Deny に変更
  • [Enable SSH access to git repository] のチェックをつける
  • [SSH Host] に "サーバーのIP" を入力
  • [Apply changes] ボタン押す

Account settings > SSH Keys の設定

  • id_rsa.pubの中身を書く

永続化

$ mkdir gitbucket
$ cd gitbucket
$ pwd
/home/ymko/gitbucket
$ curl -LO https://github.com/gitbucket/gitbucket/releases/download/4.6/gitbucket.war
$ ls
gitbucket.war

Dockerfileを作る
(冗長だが気にしない)

$ cat Dockerfile
FROM centos:7
MAINTAINER ymko
EXPOSE 8080
EXPOSE 29418

RUN yum install -y java-1.8.0-openjdk
RUN mkdir /data \
 && chmod 777 /data \
 && cd /data

# /dataに置くので不要
#RUN curl -LO https://github.com/gitbucket/gitbucket/releases/download/4.6/gitbucket.war

VOLUME /data
WORKDIR /data

CMD /usr/bin/java -jar gitbucket.war --gitbucket.home=/data/storage

実行

$ docker build -t my_gitbucket .
Successfully built b6726241af99
$ docker run -d -p 8080:8080 -p 29418:29418 -v /home/ymko/gitbucket:/data -t my_gitbucket

参考

Dockerfile の書き方「私的」なベストプラクティス - ようへいの日々精進XP http://inokara.hateblo.jp/entry/2013/12/28/121828

DockerのVolume機能について実験してみたことをまとめます - Qiita http://qiita.com/namutaka/items/f6a574f75f0997a1bb1d

memorycraft: Dockerってなんじゃ?(Dockerfileでビルド) http://memocra.blogspot.jp/2014/02/dockerdockerfile.html

DockerのVOLUMEを調べてみた。 - Less is Best http://yss44.hatenablog.com/entry/2014/01/08/010022

Dockerfile ベストプラクティス (仮) - Qoosky https://www.qoosky.io/techs/f38c112ca9

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0