Skip to content

Instantly share code, notes, and snippets.

@hayajo

hayajo/Vagrantfile

Last active Sep 3, 2017
Embed
What would you like to do?
GitBucketのVagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
GITBUCKET_VERSION = "1.12"
HTTP_PORT = 8080
SSH_PORT = 29418
Vagrant.configure(2) do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :forwarded_port, guest: HTTP_PORT, host: HTTP_PORT
config.vm.network :forwarded_port, guest: SSH_PORT, host: SSH_PORT
config.vm.provision "shell", inline: <<-EOS
apt-get update
apt-get install -y openjdk-7-jre tomcat7
if [ ! -d /usr/share/tomcat7/.gitbucket ]; then
mkdir /usr/share/tomcat7/.gitbucket
chown tomcat7.tomcat7 /usr/share/tomcat7/.gitbucket
fi
cd /usr/local/src
wget -O gitbucket.war https://github.com/takezoe/gitbucket/releases/download/#{GITBUCKET_VERSION}/gitbucket.war
if [ ! -e /var/lib/tomcat7/webapps/ROOT.war ]; then
rm -rf /var/lib/tomcat7/webapps/ROOT
ln -s /usr/local/src/gitbucket.war /var/lib/tomcat7/webapps/ROOT.war
fi
EOS
end
@hayajo

This comment has been minimized.

Copy link
Owner Author

@hayajo hayajo commented Mar 27, 2014

Vagrant Share する手順は下記のとおり

$ vagrant up
$ vagrant login
$ vagrant share
@hayajo

This comment has been minimized.

Copy link
Owner Author

@hayajo hayajo commented Apr 3, 2014

SSH接続の手順(1.12+)

  1. http://localhost:8080/admin/system で "Enable SSH access to git repository" のチェックをオンにする(ポートは29418のまま)

  2. http://localhost:8080/<ユーザー>/_ssh で公開鍵を登録する。作り方はこんな感じ。

    $ ssh-keygen  -t rsa -f ~/.ssh/<秘密鍵>
    
  3. ~/.ssh/config に接続設定を記述

    Host localhost
      User <ユーザー>
      Port 29418
      Hostname localhost
      IdentityFile ~/.ssh/<秘密鍵>
      TCPKeepAlive yes
      IdentitiesOnly yes
    
  4. リポジトリのページに記載してあるSSHアドレスでリポジトリをclone

    $ git clone ssh://<ユーザー>@localhost:29418/<ユーザー>/<リポジトリ>.git
    
  5. あとはいつもどおりコードをガリガリ書いて commit -> push する

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.