Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*~
*.exe
_vagrant/.vagrant
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ language: go
go:
- 1.3.1

services:
- redis-server

before_script:
- source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
- wget -qO- http://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
Expand Down
20 changes: 20 additions & 0 deletions _vagrant/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"

# rethinkdb
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.network "forwarded_port", guest: 28015, host: 28015
config.vm.network "forwarded_port", guest: 29015, host: 29015

# redis
config.vm.network "forwarded_port", guest: 6379, host: 6379

# load ansible playbook
config.vm.provision "shell", path: "deploy.sh"
end
14 changes: 14 additions & 0 deletions _vagrant/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

export DEBIAN_FRONTEND=noninteractive

apt-get update -qq
apt-get install -y python2.7 python-pip

pip install ansible

mkdir /etc/ansible
echo "localhost" > /etc/ansible/hosts

cd /vagrant
ansible-playbook -vvvv playbook.yml
46 changes: 46 additions & 0 deletions _vagrant/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
- hosts: 127.0.0.1
connection: local
sudo: true
tasks:
# install rethinkdb
- name: add rethinkdb sources
shell: . /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | tee /etc/apt/sources.list.d/rethinkdb.list
- name: add rethinkdb key
shell: wget -qO- http://download.rethinkdb.com/apt/pubkey.gpg | apt-key add -
- name: update apt cache
apt: update_cache=yes
- name: install rethinkdb
apt: pkg=rethinkdb state=present
# configure rethinkdb
- name: ensure group is present
group: name=rethinkdb state=present
- name: ensure user is present
user: name=rethinkdb state=present
- name: copy master config file
copy: src=./rethinkdb.conf dest=/etc/rethinkdb/instances.d/rethinkdb.conf owner=rethinkdb group=rethinkdb mode=664
- name: start rethinkdb
service: name=rethinkdb state=restarted
# install redis
- name: prepare a directory
shell: mkdir /tmp/redis-stable
- name: download redis
get_url: url=http://download.redis.io/redis-stable.tar.gz dest=/tmp/redis-stable.tar.gz
- name: unpack redis
unarchive: src=/tmp/redis-stable.tar.gz dest=/tmp/redis-stable copy=no
- name: make redis
shell: 'cd /tmp/redis-stable/redis-stable && make && make install'
- name: ensure group is present
group: name=redis state=present
- name: ensure user is present
user: name=redis state=present
- name: prepare config and storage directories for redis
shell: mkdir /etc/redis; mkdir /var/redis; sudo mkdir /var/redis/6379
- name: prepare the config and an init script for redis
shell: sudo cp /tmp/redis-stable/redis-stable/utils/redis_init_script /etc/init.d/redis_6379
- name: upload the config to the vm
copy: src=./redis.conf dest=/etc/redis/6379.conf owner=redis group=redis mode=664
- name: put the prepared config on the server
shell: sudo update-rc.d redis_6379 defaults
- name: start redis_6379
service: name=redis_6379 state=restarted
Loading