tortoisegit

git config --global user.email "-----@gmail.com" git config --global user.name "tky" git config --global core.quotepath.false git config --global core.autocrlf false git config --global push.default upstream #TortoiseGit [TortoiseGit-1.8.6.0-32bit.msi] #TortoiseGit 日本語言語パック [TortoiseGit-LanguagePack-1.8.6.0-32bit-ja.msi] #TortoiseGit -> Setting General Language Japanese C:\work\tgit-repo #tgit-repoフォルダ作成 Gitここにリポジトリを作成(Y),Bareを生成(git --bare init --shared)☑ #Gitクローン(複製) #URL C:\work\tgit-repo #ディレクトリ C:\work\tutorial-repo #tgit-repo共有リポジトリ、tutorial-repo開発作業に利用するローカルリポジトリ /git-tut01.html

Vagrant

#Virtualbox インストール,ホストオンリーネットワーク設定
#vagrant インストール#環境パス C:\vagrant\bin 確認

 

============================
vagrant --vesion
vagrant init precise64 http://files.vagrantup.com/precise64.box
vagrant up
vagrant ssh
vagrant destroy

---------------------------
#EC2

/Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "dummy"
config.vm.provider :aws do |aws, override|
aws.access_key_id = '<your access_key_id>'
aws.secret_access_key = '<your access_secret_key>'
aws.keypair_name = "tky's keys"
aws.region = "ap-northeast-1"
aws.ami = "ami-39b23d38"
end
end
vagrant up --provider=aws
#アクセスキー/シークレットアクセス作成
#EC ssh2キーペア作成
vagrant plugin install vagrant-aws
vagrant box add dummy https://github.com/mickellh/vagrant-aws/raw/master/dummy.box
vagrant init
/Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "dummy"
config.vm.provider :aws do |aws, override|
aws.access_key_id = '...'
aws.secret_access_key = '...'
aws.keypair_name = "tky's keys"
aws.instance_type = "t1.micro"
aws.region = "ap-northeast-1"
## Amazon Linux AMI 2013.03.1
aws.ami = "ami-39b23d38"
aws.security_groups = [ 'vagrant' ]
aws.tags = { 'Name' => 'vagrant-test' }
override.ssh.username = 'ec2-user'
override.ssh.private_key_path = '~/.ssh/aws-tkyskey.pem'
end
end
vagrant up --provider=aws
vagrant status
vagrant ssh
vagrant ssh-config --host=vagrant-test
vagrant destroy /vagrant halt
vagrant ssh
sudo visudo
/etc/sudoers
Defalts requiretty #コメントアウト
echo "Hello, Vagrant" > hoge.txt
vagrant provision
vagrant ssh -c "cat /vagrant/hoge.txt"

/Vagrantfile
config.vm.provider :aws do |aws, override|
aws.access_key_id = ENV['AWS_ACCESS_KEY_ID']
aws.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
...

~/.awsinit
export AMAZON_ACCESS_KEY_ID="..."
export AMAZON_SECRET_ACCES_KEY="..."

sorce ~/.awsinit
##EC2プロビジョニング
...............
packer
---------------------------
---------------------------

mkdir vagrant_book_example
cd vagrant_book_example
vagrant init precise64 http://files.vagrant

/Vagrantfile
Vagrant::Config.run do |config|
config.vm.box = "precise64"
config.vm.share_folder "v-root", "/vagrant", "."
config.vm.provision "shell" do |s|
s.path = "script.sh"
end
end

vagrant status
vagrant ssh
/Vagrantfile
vagrant reload
vagrant ssh
vagrant suspend
vagrant status
vagrant up
vagrant halt
vagrant status
vagrant halt --force
vagrant up
vagrant destroy
vagrant status
vagrant destroy --force
vagrant up

--------------------------
#vagrantfile 詳細
/Vagrant
Vagrant::Config.run do |config|
#V1設定
end
Vagrant::Configure("2") do |config|
#V2設定
end
/Vagrantfile
Vagrant::Config.run do |config|
config.vm.box = "precise64"
config.vm.box_url = "http:fils.vagrantup.com/precise64"
end
/Vagrantfile
Vagrant::Config.run do |config|
#...
config.vm.share_folder "v-root", "/foo","."
end
/Vagrantfile
Vagrant::Config.run do |config|
#...
config.vm.share_folder "data", "/data","./data"
end
/Vagrantfile
Vagrant::Config.run do |config|
#...
config.vm.forward_port 80, 8080
end
--------------------------
プロビジョニング
....
-------------------------------------
---------------------------------------
#Rails vagrant
cd ~/projects/baukis
vagarnt up
vagarnt ssh
echo "HELLO" > /vagrant/test.txt
exit
cat test.txt
rm text.txt

cd ~/projects/baukis
vagarnt ssh
rails new baukis -d mysql --skip-test-unit
----------------------------------------
------------------------------------------
#DevOps vagarnt
vagrant init

/Vagrantfile
#-*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure (2) do |config|
config.vm.box = "centos/7"
config.vm.hostname = "demo"
config.vm.network :private_network, ip: "192.168.33.10"
config.vm.synced_folder ".", "/home/vagrant/sync", disabled: true
end
vagarnt up
vagarnt ssh
uname -n
vagarnt halt
vagarnt destory
/Vagrantfile
#-*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure (2) do |config|
config.vm.box = "centos/7"
config.vm.hostname = "demo"
config.vm.network :private_network, ip: "192.168.33.10"
config.vm.synced_folder ".", "/home/vagrant/sync", disabled: true
config.vm.provision "shell", inline: $script
end
$script = <<SCRIPT
yum -y install epel-release
yum -y install nginx
echo "hello, vagarnt" > /usr/share/nginx/html/index.html/index
SCRIPT
vagarnt provision
curl http://192.168.33.10/
-------------------------------------------
-----------------------------------------
#Chef vagarnt
vagarnt init centos/7
vagarnt up
vagarnt -v
vagrant box opscode-centos-6.5 http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode-centos-6.5_chef-provisionerless.box
vagarnt init opscode-centos-6.5
vagarnt up
vagarnt ssh
vagarnt halt / vagarnt destory
vagarnt ssh-config --host webdb >> ~/.ssh/config
/Vagrantfile
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "opscode-centos-6.5"
config.vm.network :private_network, ip: "192.168.33.10"
end
vagarnt halt
vagarnt up
------------
/Vagrantfile
# -*- mode: ruby -*-
#vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "opscode-centos-6.5"
config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode-centos-6.5_chef-provisionerless.box"
#Chef Clientの最新版を利用可能にする
config.omnibus.chef_version = :latest
config.vm.provision :chef_solo do |chef|
#クックブックの配置場所を指定
chef.cookbooks_path = "./cookbooks"
#Attributeの定義
chef.json = {
nginx: {
env: "ruby"
},
mysql: {
server_root_pasword: 'rootpass'
}
}
#適用するクックブックの定義
chef.run_list = %w{
recipe[yum-epal]
recipe[nginx]
recipe[mysql]
recipe[fluentd]
}
end
end
vagarnt plugin install vagrant-omnibus
/vagrantfile
config.omnibus.chef_version = :latest
vagarnt up --provision
vagarnt provision
...

EC2,メモよりも試行回数

EC2
サービス
キーペア、キーペア名my-keypair、my-keypar.pem保存
セキュリティーグループ、セキュリティーグループ名=説明my-security-group、VPCデフォルト、ルールの追加、SSH任意の場所、HTTP任意の場所、カスタムTCPルールポート範囲3000任意の場所
インスタンスインスタンス作成、AMI、セキュリティグループ名既存から選択、インスタンスの表示
ElasticIP、新しいアドレスの割り当て、割り当て、アクション、アドレスの関連づけ、インスタンス、my..
SSH,http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/putty.html
windows SSH Putty/winscp(リモート接続)http://www.atmarkit.co.jp/ait/articles/1006/25/news095.html


①生成(putty
公開鍵秘密鍵 puttygen
SSH-2 RSA 2048(デフォルト設定) generate
public公開鍵/private秘密鍵/メモ帳にssh-rsaも保存 puttyフォルダに置いておくといい
Category/Connection/SSH/AuthのBrowthボタンクリック
.ppkファイルを選択 saved session 完了
②ゲスト側設置
③ホスト側登録で接続可能
winscp
IPv4アドレスーホスト名(AWSAMIの場合ec2-user)
------------http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/putty.html#putty-private-key

- インスタンスのプライベートキーを指定します。[Private key] に対して、秘密キーのパスを入力するか、[...] ボタンを選択して、ファイルを参照します。WinSCP の新しいバージョンでは、[Advanced] を選択して、高度なサイト設定を開き、[SSH] の [Authentication] を選択して、[Private key file] 設定を見つける必要があります。

- Note
WinSCPPuTTY 秘密キーファイル (.ppk) ファイルを必要とします。PuTTYgen を使って、.pem セキュリティキーファイルを .ppk フォーマットに変換することができます。詳細については、「PuTTYgen を使用した秘密キーの変換」を参照してください。

- (オプション) 左側のパネルで [Directories] を選択し、ファイルを追加するディレクトリのパスを [Remote directory] に入力します。WinSCP の新しいバージョンでは、[Advanced] を選択して、高度なサイト設定を開き、[Environment] の [Directories] を選択して、[Remote directory] 設定を見つける必要があります。

- [Login] を選択して接続し、[Yes] を選択してホストのフィンガープリントをホストのキャッシュに追加します。

-------
必要情報
sshサーバー情報 MYPC
IPアドレス 192.168.11.8(windows
SSHポート番号 22
ユーザー tky
MYPC
windows 192.168.11.8
virtualboxはゲストOSのコマンドプロンプトからわかる
VirtualBox Host-Only Network 192.168.56.1
VirtualBox Host-Only Network #2 192.168.140.1
ubuntu 192.168.11.9
IPアドレス 調べ方ipconfig

putty 接続 windows virtualbox

http://sc1.cc.kochi-u.ac.jp/~murakami/cgi-bin/FSW/fswiki.cgi?page=%28VirtualBox%29%A5%DB%A5%B9%A5%C8OS%A4%AB%A4%E9%A5%B2%A5%B9%A5%C8OS%A4%CB%C0%DC%C2%B3%28SSH%29

puttyとかsublinetextの国際化
言語フォルダのファイルをアプリケーションと同じ階層のフォルダに移しておく

OpenSSH
http://qiita.com/dskst/items/391fc55018fbf3cf795e

SSHの種類
OpenSSH公開鍵(IPアドレスとゲスト先の登録)

pwd
ls -F
ls -a
cp fileA fileB
mv
rm -rf
cat fileA
sudo apt-get
echo
echo HELLO > A.txt 上書き HELLO >> A.txt 追記
source ./fileA = . ./restart
export
printenv
wget http:// wget -O dirA http://
zip fileA abc.txt xyz.txt zip -r fliezip filaA
unzip
tar xzf/zjf file.tar.gz/tar.bz2
~ ホームディレクト
Tab
ls M tab →ls Music 例、Tab 補完機能 Tab二回で一覧

git
clone
pull

rbenv インストール、更新
touch ~/.bashrc
cp -f ~/.bashrc ~/.bashrc.bak  戻すcp -f ~/.bashrc.bak ~/.bashrc
sudo apt-get update
sudo apt-get
sudo apt-get -y install build-essential
sudo apt-get -y install git zlib1g-dev libssl-dev libreadline-dev
sudo apt-get -y install libxml2-dev libxslt-dev libsqlite3-dev
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
mkdir -p ~/.rbenv/plugins
cd ~/.rbenv/plugins
git clone git://github.com/sstephenson/ruby-buid.git
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get -y install libruby2.3:i386
sudo apt-get -y install libreadline-dev:i386 libssl-dev:i386
、更新
rbenv --version
cd ~/.rbenv
git pull
cd plugins/ruby-build
git pull

ruby -e "puts 1 + 1"

gem list
gem install
gem bpdate

nvm install
nvm ls
nvm use
nvm alias
nvm deactivate
nvmインストール、更新
touch ~/.bashrc
cd /tmp
wget http://rawgit.com/creationix/nvm/v0.31.1/install.sh
bash install.sh
rm -f install.sh
source ~/.bashrc
、更新
nvm --version

railsインストール、更新
gem install rails --version=5.0.0.1

SSH公開鍵 生成
ls ~/.ssh
ssh-keygen -q

xclip -selection clipboard < ~/.ssh/id_rsa.pub

github,bitbaketに登録
------------------------------------------

楽観的/悲観的ロック HTTP 書き込み

 

楽観的ロック
リクエスト

レスポンス

GET /1120002 HTTP/1.1
Host: zip.ricollab.jp

HTTP/1.1 200 OK
Content-Type: application/json
ETag: sample-etag-value

{
"": "",
"": {
"": "",
"": "",
"": ""
},
"yomi": {
"": "",
"": "",
"": ""
}
}

 

HTTP/1.1 200 OK
Content-Type: application/json
ETag: sample-etag-value

{
"": "",
"": {
"": "",
"": "",
"": ""
},
"yomi": {
"": "",
"": "",
"": ""
}
}

HTTP/1.1 200 OK

 

DELETE
Host
Content-Type
If-March

HTTP/1.1 200 OK
----------------------
悲観的ロック
LOCK/UNLOK

LOCK /1120002 HTTO/1.1

HTTP/1.1 200 OK

HTTP/1.1 423 Locked

PUT /1120002 HTTP/1.1

HTTP/1.1 200 OK

UNLOCK /1120034 HTTP/1.1

HTTP/1.1 200 OK

POST /1120034 HTTP/1.1

HTTP/1.1 201 Created
Location: http:

DELETE /1120034/lock HTTP/1.1
HOST: zip.ricollab.jp
Authorization: Basic ...

HTTP/1.1 200 OK
----------------------
----------------------
----------------------
----------------------
----------------------
----------------------
----------------------
----------------------
----------------------
----------------------
----------------------
----------------------
----------------------
----------------------