|
16 | 16 | # See the License for the specific language governing permissions and
|
17 | 17 | # limitations under the License.
|
18 | 18 | #
|
| 19 | + |
| 20 | +include_recipe 'postgresql::server' |
19 | 21 | include_recipe 'database::postgresql'
|
20 | 22 |
|
21 | 23 | # Enable secure password generation
|
|
31 | 33 | end
|
32 | 34 | end
|
33 | 35 |
|
34 |
| -# Helper variables |
35 |
| -database = node['gitlab']['database']['database'] |
36 |
| -database_user = node['gitlab']['database']['username'] |
37 |
| -database_override_user = node['postgresql']['username'] |
38 |
| -database_password = node['gitlab']['database']['password'] |
39 |
| -database_host = node['gitlab']['database']['host'] |
40 |
| -database_userhost = node['gitlab']['database']['userhost'] |
41 |
| -database_connection = { |
42 |
| - host: database_host, |
43 |
| - port: '5432', |
44 |
| - username: database_override_user, |
45 |
| - password: node['postgresql']['password']['postgres'] |
46 |
| -} |
47 |
| - |
48 |
| -# Create the database |
49 |
| -postgresql_database database do |
50 |
| - connection database_connection |
| 36 | +# Create the database user |
| 37 | +postgresql_database_user node['gitlab']['database']['username'] do |
| 38 | + connection :host => 'localhost' |
| 39 | + password node['gitlab']['database']['password'] |
51 | 40 | action :create
|
52 | 41 | end
|
53 | 42 |
|
54 |
| -# Create the database user |
55 |
| -postgresql_database_user database_user do |
56 |
| - connection database_connection |
57 |
| - password database_password |
58 |
| - host database_userhost |
59 |
| - database_name database |
| 43 | +# Create the database |
| 44 | +postgresql_database node['gitlab']['database']['database'] do |
| 45 | + connection :host => 'localhost' |
| 46 | + owner node['gitlab']['database']['username'] |
60 | 47 | action :create
|
61 | 48 | end
|
62 | 49 |
|
63 |
| -# Grant all privileges to user on database |
64 |
| -postgresql_database_user database_user do |
65 |
| - connection database_connection |
66 |
| - database_name database |
67 |
| - action :grant |
68 |
| -end |
| 50 | +# FIXME: Add extension resource to postgresql cookbook |
| 51 | +node.force_override['postgresql']['database_name'] = node['gitlab']['database']['database'] |
| 52 | +include_recipe 'postgresql::contrib' |
0 commit comments