Skip to content

Commit

Permalink
Fixes to database recipe and small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
vindimy committed Sep 28, 2013
1 parent 952aeb5 commit 489e433
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
24 changes: 15 additions & 9 deletions cookbooks/altcointip/recipes/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
include_recipe "git"

$altcointip_dir = node[:altcointip][:install_dir]
unless File.directory?($altcointip_dir)
unless File.directory?($altcointip_dir) and File.file?(File.join($altcointip_dir, 'mysql_db_created'))

directory $altcointip_dir do
action :create
Expand All @@ -31,14 +31,16 @@

# Clone Git repository

script "git_clone" do
action :run
interpreter "bash"
cwd $altcointip_dir
user node[:altcointip][:user]
code <<-EOH
git clone #{node[:altcointip][:git_repos][:altcointip]} #{$altcointip_dir}/altcointip || exit 1
EOH
unless File.file?(File.join($altcointip_dir, 'altcointip/altcointip.sql'))
script "git_clone" do
action :run
interpreter "bash"
cwd $altcointip_dir
user node[:altcointip][:user]
code <<-EOH
git clone #{node[:altcointip][:git_repos][:altcointip]} #{$altcointip_dir}/altcointip || exit 1
EOH
end
end

# Set up database
Expand Down Expand Up @@ -75,4 +77,8 @@
action :grant
end

file ::File.join($altcointip_dir, 'mysql_db_created') do
action :create
end

end
5 changes: 3 additions & 2 deletions cookbooks/altcointip/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

# Install cryptocoins

directory ::File.join(node[:altcointip][:install_dir], 'coins') do
directory File.join(node[:altcointip][:install_dir], 'coins') do
action :create
mode '0755'
user node[:altcointip][:user]
Expand Down Expand Up @@ -67,7 +67,7 @@
port coin[:rpcport]
rpcpassword node[:altcointip][:cryptocoins]["#{coin[:name]}"][:rpcpassword]
group node[:altcointip][:user_group]
home ::File.join(node[:altcointip][:install_dir], 'coins', coin[:name])
home File.join(node[:altcointip][:install_dir], 'coins', coin[:name])
end

service coin[:name] do
Expand Down Expand Up @@ -128,6 +128,7 @@
user node[:altcointip][:user]
code <<-EOH
cp #{$altcointip_dir}/altcointip/src/sample-config.yml #{$altcointip_dir}/altcointip/src/config.yml
chmod 640 #{$altcointip_dir}/altcointip/src/config.yml
sed -i 's mysqldb #{node[:altcointip][:mysql_db_name]} g' #{$altcointip_dir}/altcointip/src/config.yml
sed -i 's mysqluser #{node[:altcointip][:mysql_username]} g' #{$altcointip_dir}/altcointip/src/config.yml
sed -i 's mysqlpass #{node[:altcointip][:mysql_password]} g' #{$altcointip_dir}/altcointip/src/config.yml
Expand Down

0 comments on commit 489e433

Please sign in to comment.