Permalink
Browse files

Invoke ramfs recipe before creating clusters

ramfs recipe mounts /var/ramfs, so that should be taken care of first
  • Loading branch information...
BanzaiMan committed Jul 18, 2014
1 parent 2df3e8f commit 93330b9c6a5ee92ec6011a039ae2d1cc05479c56
Showing with 7 additions and 6 deletions.
  1. +7 −6 ci_environment/postgresql/recipes/ci_server.rb
@@ -8,11 +8,16 @@
# has been modified. This restriction should not be a problem for Travis CI usage.
#
+# Create base directory on RAMFS before creating cluster
+#
+include_recipe "ramfs" if node['postgresql']['data_on_ramfs']
+
# Create the database directory if you used a custom database dir
(Array(node['postgresql']['default_version']) + node['postgresql']['alternate_versions']).each do |version|
execute "Create PGDATA" do
- command "/usr/bin/pg_createcluster -D #{File.join(node['postgresql']['data_dir'], version)} #{version} main"
- not_if { File.exists?( File.join(node['postgresql']['data_dir'], version) ) }
+ data_dir = File.join(node['postgresql']['data_dir'], version)
+ command "/usr/bin/pg_createcluster -D #{data_dir} #{version} main"

This comment has been minimized.

Show comment Hide comment
@tjwebb

tjwebb Jul 23, 2014

Might want to also set --user travis. This will avoid the need for sudo when invoking pg_ctlcluster commands

@tjwebb

tjwebb Jul 23, 2014

Might want to also set --user travis. This will avoid the need for sudo when invoking pg_ctlcluster commands

This comment has been minimized.

Show comment Hide comment
@BanzaiMan

BanzaiMan Jul 23, 2014

Owner

travis and rails should be added as PostgreSQL superuser (https://github.com/travis-ci/travis-cookbooks/blob/4cbe536/ci_environment/postgresql/recipes/ci_server.rb#L41), which I believe makes sudo unnecessary.

@BanzaiMan

BanzaiMan Jul 23, 2014

Owner

travis and rails should be added as PostgreSQL superuser (https://github.com/travis-ci/travis-cookbooks/blob/4cbe536/ci_environment/postgresql/recipes/ci_server.rb#L41), which I believe makes sudo unnecessary.

This comment has been minimized.

Show comment Hide comment
@joshk

joshk Jul 23, 2014

Owner

does this have any security implications?

@joshk

joshk Jul 23, 2014

Owner

does this have any security implications?

This comment has been minimized.

Show comment Hide comment
@tjwebb

tjwebb Jul 23, 2014

It's the same thing. Setting travis as the cluster owner automatically sets up that user as the cluster owner and thus the Postgres superuser in that cluster. But I'm guessing that create_superusers_script maybe does special things.

@tjwebb

tjwebb Jul 23, 2014

It's the same thing. Setting travis as the cluster owner automatically sets up that user as the cluster owner and thus the Postgres superuser in that cluster. But I'm guessing that create_superusers_script maybe does special things.

+ not_if { File.exists?(data_dir) }
end
end
@@ -60,10 +65,6 @@
mode 0755
end
-#
-# Create base directory on RAMFS
-#
-include_recipe "ramfs" if node['postgresql']['data_on_ramfs']
#
# Tune PostgreSQL settings

0 comments on commit 93330b9

Please sign in to comment.