magic_recipes 0.0.21 → 0.0.22
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/magic_recipes/postgresql.rb +10 -2
- metadata +1 -1
@@ -47,13 +47,21 @@ module MagicRecipes
|
|
47
47
|
end
|
48
48
|
after "deploy:install", "postgresql:install"
|
49
49
|
|
50
|
-
desc "Create a database for this application."
|
50
|
+
desc "Create a database and user for this application."
|
51
51
|
task :create_database, roles: :db, only: {primary: true} do
|
52
|
-
run %Q{#{sudo} -u postgres psql -c "create user #{postgresql_user} with password '#{postgresql_password}';"}
|
52
|
+
#run %Q{#{sudo} -u postgres psql -c "create user #{postgresql_user} with password '#{postgresql_password}';"}
|
53
|
+
# make a superuser .. to be able to install extensions like hstore
|
54
|
+
run %Q{#{sudo} -u postgres psql -c "CREATE ROLE #{postgresql_user} WITH SUPERUSER CREATEDB CREATEROLE LOGIN ENCRYPTED PASSWORD '#{postgresql_password}';"}
|
53
55
|
run %Q{#{sudo} -u postgres psql -c "create database #{postgresql_database} owner #{postgresql_user};"}
|
54
56
|
end
|
55
57
|
after "deploy:setup", "postgresql:create_database"
|
56
58
|
|
59
|
+
desc "Create a postgres-user for this application."
|
60
|
+
task :create_user, roles: :db, only: {primary: true} do
|
61
|
+
# make a superuser .. to be able to install extensions like hstore
|
62
|
+
run %Q{#{sudo} -u postgres psql -c "CREATE ROLE #{postgresql_user} WITH SUPERUSER CREATEDB CREATEROLE LOGIN ENCRYPTED PASSWORD '#{postgresql_password}';"}
|
63
|
+
end
|
64
|
+
|
57
65
|
desc "Generate the database.yml configuration file."
|
58
66
|
task :setup, roles: :app do
|
59
67
|
run "mkdir -p #{shared_path}/config"
|