Skip to content
Snippets Groups Projects
Commit 111a71f2 authored by Marin Jankovski's avatar Marin Jankovski
Browse files

Update of the cookbook

parent aef7b971
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -74,28 +74,7 @@ Vagrant.configure("2") do |config|
 
config.vm.provision :chef_solo do |chef|
chef.json = {
:postfix => {
:mail_type => "client",
:myhostname => "mail.localhost",
:mydomain => "localhost",
:myorigin => "mail.localhost",
:smtp_use_tls => "no"
},
:postgresql => {
:password => {
:postgres => "psqlpass"
}
},
:mysql => {
:server_root_password => "rootpass",
:server_repl_password => "replpass",
:server_debian_password => "debianpass"
},
:gitlab => {
:database_adapter => "mysql",
:database_password => "datapass",
:env => "production"
}
# Specify attributes you want to override here
}
chef.run_list = [
"apt",
Loading
Loading
Loading
Loading
@@ -16,7 +16,7 @@ default['gitlab']['ruby'] = "2.0.0-p247"
 
# GitLab shell
default['gitlab']['shell_repository'] = "https://github.com/gitlabhq/gitlab-shell.git"
default['gitlab']['shell_revision'] = "v1.7.1"
default['gitlab']['shell_revision'] = "v1.7.4"
 
# GitLab hq
default['gitlab']['repository'] = "https://github.com/gitlabhq/gitlabhq.git"
Loading
Loading
@@ -37,3 +37,23 @@ default['gitlab']['support_email'] = "support@localhost"
 
# Gems
default['gitlab']['bundle_install'] = "bundle install --path=.bundle --deployment"
# Assumed defaults
# database: mysql (option: postgresql)
# environment: production (option: development)
default['gitlab']['database_adapter'] = "mysql"
default['gitlab']['database_password'] = "datapass"
default['gitlab']['env'] = "production"
default['mysql']['server_root_password'] = "rootpass"
default['mysql']['server_repl_password'] = "replpass"
default['mysql']['server_debian_password'] = "debianpass"
default['postgresql']['password']['postgres'] = "psqlpass"
default['postfix']['mail_type'] = "client"
default['postfix']['myhostname'] = "mail.localhost"
default['postfix']['mydomain'] = "localhost"
default['postfix']['myorigin'] = "mail.localhost"
default['postfix']['smtp_use_tls'] = "no"
Loading
Loading
@@ -58,11 +58,11 @@ end
# Ruby block is compiled at compilation time but only executed during execution time
# allowing us to create a resource.
 
ruby_block "Copy from example Unicorn config" do
ruby_block "Copy unicorn config file from example" do
block do
resource = Chef::Resource::File.new("unicorn.rb", run_context)
resource.path File.join(gitlab['path'], 'config', 'unicorn.rb')
resource.content IO.read("#{File.join(gitlab['path'], 'config', 'unicorn.rb.example')}")
resource.content IO.read(File.join(gitlab['path'], 'config', 'unicorn.rb.example'))
resource.owner gitlab['user']
resource.group gitlab['group']
resource.run_action :create
Loading
Loading
@@ -88,7 +88,7 @@ ruby_block "Copy from example rack attack config" do
block do
resource = Chef::Resource::File.new("rack_attack.rb", run_context)
resource.path File.join(gitlab['path'], 'config', 'initializers', 'rack_attack.rb')
resource.content IO.read("#{File.join(gitlab['path'], 'config', 'initializers', 'rack_attack.rb.example')}")
resource.content IO.read(File.join(gitlab['path'], 'config', 'initializers', 'rack_attack.rb.example'))
resource.owner gitlab['user']
resource.group gitlab['group']
resource.mode 0644
Loading
Loading
@@ -217,7 +217,7 @@ when 'production'
block do
resource = Chef::Resource::File.new("gitlab_init", run_context)
resource.path "/etc/init.d/gitlab"
resource.content IO.read("#{File.join(gitlab['path'], "lib", "support", "init.d", "gitlab")}")
resource.content IO.read(File.join(gitlab['path'], "lib", "support", "init.d", "gitlab"))
resource.mode 0755
resource.run_action :create
if resource.updated?
Loading
Loading
@@ -251,7 +251,7 @@ when 'production'
block do
resource = Chef::Resource::File.new("logrotate", run_context)
resource.path "/etc/logrotate.d/gitlab"
resource.content IO.read("#{File.join(gitlab['path'], "lib", "support", "logrotate", "gitlab")}")
resource.content IO.read(File.join(gitlab['path'], "lib", "support", "logrotate", "gitlab"))
resource.mode 0644
resource.run_action :create
end
Loading
Loading
#
# Cookbook Name:: gitlab
# Recipe:: opsworks_setup
# Recipe:: opsworks_gitlab_deploy
#
# Used for AWS OpsWorks configure section
gitlab = node['gitlab']
Loading
Loading
Loading
Loading
@@ -62,18 +62,19 @@ describe "gitlab::gitlab" do
end
 
it 'copies unicorn.rb example file' do
expect(chef_run).to create_remote_file('/home/git/gitlab/config/unicorn.rb').with(source: "file:///home/git/gitlab/config/unicorn.rb.example")
expect(chef_run).to run_ruby_block('Copy unicorn config file from example')
end
 
it 'copies rack_attack.rb example file' do
expect(chef_run).to create_remote_file('/home/git/gitlab/config/initializers/rack_attack.rb').with(mode: 0644, source: "file:///home/git/gitlab/config/initializers/rack_attack.rb.example")
expect(chef_run).to run_ruby_block('Copy from example rack attack config')
end
 
describe "creating rack_attack.rb" do
let(:copied_file) { chef_run.remote_file('/home/git/gitlab/config/initializers/rack_attack.rb') }
 
it 'triggers uncommenting the line in application.rb' do
expect(copied_file).to notify('bash[Enable rack attack in application.rb]').to(:run).immediately
# TODO Write the test that will check if notification is triggered within the ruby_block
expect(chef_run).to run_ruby_block('Copy from example rack attack config')
# expect(copied_file).to notify('bash[Enable rack attack in application.rb]').to(:run).immediately
end
end
 
Loading
Loading
@@ -274,15 +275,15 @@ describe "gitlab::gitlab" do
end
 
it 'copies gitlab init example file' do
expect(chef_run).to create_remote_file('/etc/init.d/gitlab').with(source: "file:///home/git/gitlab/lib/support/init.d/gitlab")
expect(chef_run).to run_ruby_block('Copy from example gitlab init config')
end
 
describe "creating gitlab init" do
let(:copied_file) { chef_run.remote_file('/etc/init.d/gitlab') }
describe "for production" do
# TODO Write the test that will check if notification is triggered within the ruby_block
it 'triggers service defaults update' do
expect(copied_file).to notify('execute[set gitlab to start on boot]').to(:run).immediately
expect(chef_run).to run_ruby_block('Copy from example gitlab init config')
# expect(chef_run).to notify('execute[set gitlab to start on boot]').to(:run).immediately
end
end
 
Loading
Loading
@@ -363,18 +364,19 @@ describe "gitlab::gitlab" do
end
 
it 'copies unicorn.rb example file' do
expect(chef_run).to create_remote_file('/home/git/gitlab/config/unicorn.rb').with(source: "file:///home/git/gitlab/config/unicorn.rb.example")
expect(chef_run).to run_ruby_block('Copy unicorn config file from example')
end
 
it 'copies rack_attack.rb example file' do
expect(chef_run).to create_remote_file('/home/git/gitlab/config/initializers/rack_attack.rb').with(mode: 0644, source: "file:///home/git/gitlab/config/initializers/rack_attack.rb.example")
expect(chef_run).to run_ruby_block('Copy from example rack attack config')
end
 
describe "creating rack_attack.rb" do
let(:copied_file) { chef_run.remote_file('/home/git/gitlab/config/initializers/rack_attack.rb') }
 
it 'triggers uncommenting the line in application.rb' do
expect(copied_file).to notify('bash[Enable rack attack in application.rb]').to(:run).immediately
# TODO Write the test that will check if notification is triggered within the ruby_block
expect(chef_run).to run_ruby_block('Copy from example rack attack config')
# expect(copied_file).to notify('bash[Enable rack attack in application.rb]').to(:run).immediately
end
end
 
Loading
Loading
@@ -575,15 +577,16 @@ describe "gitlab::gitlab" do
end
 
it 'copies gitlab init example file' do
expect(chef_run).to create_remote_file('/etc/init.d/gitlab').with(source: "file:///home/git/gitlab/lib/support/init.d/gitlab")
expect(chef_run).to run_ruby_block('Copy from example gitlab init config')
end
 
describe "creating gitlab init" do
let(:copied_file) { chef_run.remote_file('/etc/init.d/gitlab') }
 
describe "for production" do
# TODO Write the test that will check if notification is triggered within the ruby_block
it 'triggers service defaults update' do
expect(copied_file).to notify('execute[set gitlab to start on boot]').to(:run).immediately
expect(chef_run).to run_ruby_block('Copy from example gitlab init config')
# expect(chef_run).to notify('execute[set gitlab to start on boot]').to(:run).immediately
end
end
 
Loading
Loading
@@ -595,7 +598,7 @@ describe "gitlab::gitlab" do
end
 
it 'copies gitlab init example file' do
expect(chef_run).to_not create_remote_file('/etc/init.d/gitlab').with(source: "file:///home/git/gitlab/lib/support/init.d/gitlab")
expect(chef_run).to_not run_ruby_block("Copy from example gitlab init config")
end
 
it 'includes phantomjs recipe' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment