Skip to content

Commit

Permalink
Add the "testfarm" as a way to instantiante two test pods
Browse files Browse the repository at this point in the history
This allows to intantiate two pods to test federation on.

"vagrant-group" vagrant plugin is used to group VMs.
The testfarm may be started with:
vagrant group up testfarm

Also requires "vagrant-hosts" plugin.
  • Loading branch information
cmrd-senya committed Mar 30, 2016
1 parent 59850a7 commit 19d6009
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
src
capistrano/.capistrano
capistrano/bin
*~
23 changes: 22 additions & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,23 @@ Vagrant.configure("2") do |config|
puppet.options = "--verbose"
end

(1..2).each do |number|
config.vm.define "pod#{number}" do |dev|
dev.vm.hostname = "pod#{number}.diaspora.local"
dev.vm.network :private_network, ip: "192.168.11.#{4+number*2}"
dev.vm.synced_folder "src/", "/home/vagrant/diaspora_src/", create: true
dev.vm.provider "virtualbox" do |vb|
vb.memory = 2048
end

dev.vm.provision :hosts, :sync_hosts => true
end
end

config.vm.define "development" do |dev|
dev.vm.hostname = "development.diaspora.local"
dev.vm.network :private_network, ip: "192.168.11.2"
dev.vm.synced_folder "src/", "/home/vagrant/diaspora_src/", create: true, type: "nfs"
dev.vm.synced_folder "src/", "/home/vagrant/diaspora_src/", create: true
dev.vm.provider "virtualbox" do |vb|
vb.memory = 2048
end
Expand All @@ -45,4 +58,12 @@ Vagrant.configure("2") do |config|
end
end

if Vagrant.has_plugin?('vagrant-group')
config.group.groups = {
"testfarm" => [
"pod1",
"pod2",
],
}
end
end
1 change: 1 addition & 0 deletions capistrano/Capfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ require 'capistrano/deploy'

require 'capistrano/rvm'
require 'capistrano/rails'
require 'capistrano/rails/collection'

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('tasks/*.cap').each { |r| import r }
1 change: 1 addition & 0 deletions capistrano/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ source 'https://rubygems.org'
gem 'capistrano'
gem 'capistrano-rvm'
gem 'capistrano-rails'
gem 'capistrano-rails-collection', github: "zonkeynir/capistrano-rails-collection"
11 changes: 11 additions & 0 deletions capistrano/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
GIT
remote: git://github.com/zonkeynir/capistrano-rails-collection.git
revision: 919929ae447a9376938614ac1c91f83d6a687e0b
specs:
capistrano-rails-collection (0.0.3)
capistrano-rails (~> 1.1.0)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -33,4 +40,8 @@ PLATFORMS
DEPENDENCIES
capistrano
capistrano-rails
capistrano-rails-collection!
capistrano-rvm

BUNDLED WITH
1.10.6
31 changes: 31 additions & 0 deletions capistrano/config/deploy/test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
set :stage, :test

set :repo_url, "file:///home/vagrant/diaspora_src"
set :branch, ENV['BRANCH'] || "develop"

#role :web, [ENV['SERVER_URL']]
role :app, [ENV['SERVER_URL']]
role :db, [ENV['SERVER_URL']]

ssh_options = {
keys: %w(ssh_keys/diaspora),
forward_agent: true,
auth_methods: %w(publickey password)
}

set :rvm_type, :system
set :rvm_ruby_version, '2.2@diaspora'

set :rails_env, 'development'
set :bundle_without, []

set :assets_roles, [:none] # No assets compile for development

set :keep_releases, 1

server ENV['SERVER_URL'], user: 'diaspora', roles: [], ssh_options: ssh_options

namespace :deploy do
before :migrate, 'rails:rake:db:drop'
before :migrate, 'rails:rake:db:setup'
end
8 changes: 4 additions & 4 deletions capistrano/tasks/diaspora.cap
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace :diaspora do
task :load do
on roles(:app) do
within "#{current_path}" do
with rails_env: "#{fetch(:stage)}" do
with rails_env: "#{fetch(:rails_env)}" do
execute :bundle, :exec, "eye load #{fetch(:eye_config)}"
end
end
Expand All @@ -16,7 +16,7 @@ namespace :diaspora do
task cmd do
on roles(:app) do
within "#{current_path}" do
with rails_env: "#{fetch(:stage)}" do
with rails_env: "#{fetch(:rails_env)}" do
execute :bundle, :exec, :eye, cmd, fetch(:eye_application)
end
end
Expand All @@ -28,7 +28,7 @@ namespace :diaspora do
task :info do
on roles(:app) do
within "#{current_path}" do
with rails_env: "#{fetch(:stage)}" do
with rails_env: "#{fetch(:rails_env)}" do
puts capture(:bundle, :exec, :eye, :info, fetch(:eye_application))
end
end
Expand All @@ -39,7 +39,7 @@ namespace :diaspora do
task :quit do
on roles(:app) do
within "#{current_path}" do
with rails_env: "#{fetch(:stage)}" do
with rails_env: "#{fetch(:rails_env)}" do
execute :bundle, :exec, :eye, :quit
end
end
Expand Down
48 changes: 48 additions & 0 deletions puppet/manifests/site.pp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,51 @@
sidekiq_namespace => 'diaspora'
}
}

node 'pod1.diaspora.local' {
class { 'diaspora':
hostname => 'pod1.diaspora.local',
environment => 'development',
rvm_version => '1.26.11',
ruby_version => '2.2',
app_directory => '/home/diaspora',
user => 'diaspora',
group => 'diaspora',
db_provider => 'mysql',
db_host => 'localhost',
db_port => '3306',
db_name => 'diaspora_development',
db_username => 'diaspora',
db_password => 'diaspora',
db_root_password => 'diaspora_root',
unicorn_worker => 4,
sidekiq_concurrency => 5,
sidekiq_retry => 10,
sidekiq_namespace => 'diaspora',
enable_captcha => false
}
}

node 'pod2.diaspora.local' {
class { 'diaspora':
hostname => 'pod2.diaspora.local',
environment => 'development',
rvm_version => '1.26.11',
ruby_version => '2.2',
app_directory => '/home/diaspora',
user => 'diaspora',
group => 'diaspora',
db_provider => 'mysql',
db_host => 'localhost',
db_port => '3306',
db_name => 'diaspora_development',
db_username => 'diaspora',
db_password => 'diaspora',
db_root_password => 'diaspora_root',
unicorn_worker => 4,
sidekiq_concurrency => 5,
sidekiq_retry => 10,
sidekiq_namespace => 'diaspora',
enable_captcha => false
}
}
2 changes: 1 addition & 1 deletion puppet/modules/diaspora

0 comments on commit 19d6009

Please sign in to comment.