vagrantでCoreOSをいれて何かOS上にRedmineをたてる

#**以下のページを参考というかそのままに実施しました**
http://qiita.com/bounscale/items/24cfee84ae1d4135ee43
http://qiita.com/sudahiroshi/items/bae1912b2f0e18148748


#**事前準備**
*　git
*　VirtualBox
*　vagrant
はインストールしておく
gitはGitBashを使えるようにするとWindowsでもsshできるので便利

#**CoreOSの準備**
##イメージの取得
```lang:GitBash
git clone https://github.com/coreos/coreos-vagrant/
```
##Vagrantfileの編集
CoreOSをHostOSと同一ネットワーク上に配置
80ポートのポートフォワーディングも設定

```lang:Vagrantfile
#line:121 config.vm.network :private_network, ip: ip
line:122 config.vm.network :public_network, bridge: \'en0: Ethernet\', type: "dhcp"
#line:123 config.vm.network :forwarded_port, guest: 80, host: 3000
```
#**CoreOSの起動**
```lang:GitBash
cd coreos-vagrant
vagrant up
```
```
Bringing machine 'core-01' up with 'virtualbox' provider...
==> core-01: Importing base box 'coreos-alpha'...
==> core-01: Matching MAC address for NAT networking...
==> core-01: Checking if box 'coreos-alpha' is up to date...
==> core-01: Setting the name of the VM: coreos-vagrant_core-01_1434551514011_27
186
==> core-01: Clearing any previously set network interfaces...
==> core-01: Specific bridge 'en0: Ethernet' not found. You may be asked to spec
ify
==> core-01: which network to bridge to.
==> core-01: Preparing network interfaces based on configuration...
    core-01: Adapter 1: nat
    core-01: Adapter 2: bridged
==> core-01: Forwarding ports...
    core-01: 80 => 3000 (adapter 1)
    core-01: 22 => 2222 (adapter 1)
==> core-01: Running 'pre-boot' VM customizations...
==> core-01: Booting VM...
==> core-01: Waiting for machine to boot. This may take a few minutes...
    core-01: SSH address: 127.0.0.1:2222
    core-01: SSH username: core
    core-01: SSH auth method: private key
    core-01: Warning: Connection timeout. Retrying...
==> core-01: Machine booted and ready!
==> core-01: Setting hostname...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

systemctl start system-cloudinit@-var-tmp-hostname.yml.service

Stdout from the command:



Stderr from the command:

Job for system-cloudinit@-var-tmp-hostname.yml.service failed because a configur
ed resource limit was exceeded. See "systemctl status system-cloudinit@-var-tmp-
hostname.yml.service" and "journalctl -xe" for details.
```
##起動確認
```lang:GitBash
vagrant status
```
```
Current machine states:
core-01                   running (virtualbox)
```
#**docker-composeをインストールする**
##CoreOSにsshでログインする
```lang:GitBash
vagrant ssh
```
または、Rlogonなどでsshする。addressやusernameはCoreOS起動時に出力されたものを利用する
private-keyは~/.vagrant.d/insecure_private_key
##docker-composeをインストールする
[docker-composeのリリースノート](https://github.com/docker/compose/releases)にあるコマンドを参考に

```lang:Rlogon
curl -L https://github.com/docker/compose/releases/download/1.3.0rc3/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
chmod +x docker-compose
./docker-compose --version
```
```
docker-compose version: 1.3.0rc3
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
```
#**docker-compose用の設定ファイルを作成**
```lang:Rlogon
vi docker-compose.yml
```
```docker-compose.yml
postgresql:
  image: sameersbn/postgresql:9.4
  volumes:
    - /home/core/postgresql/data:/var/lib/postgresql
  environment:
    - DB_USER=redmine
    - DB_PASS=admin123
    - DB_NAME=redmine
memcached:
  image: sameersbn/memcached:latest
redmine:
  image: sameersbn/redmine:3.0.3-1
  links:
    - postgresql:postgresql
    - memcached:memcached
  volumes:
    - /var/run/docker.sock:/run/docker.sock
    - /usr/bin/docker:/bin/docker
    - /home/core/redmine/data:/home/redmine/data
  environment:
    - DB_USER=redmine
    - DB_PASS=admin123
    - DB_NAME=redmine
    - SMTP_HOST=smtp_server_fqdn
    - SMTP_PORT=25
  ports:
    - "80:80"
```
#**Docker起動**
```lang:Rlogon
./docker-compose up -d
```
##起動確認

CoreOS上から起動確認
```
wget http://127.0.0.1/ --no-proxy
```
あとはブラウザで起動確認
[http://127.0.0.1:3000/](http://127.0.0.1:3000/)