Update the kosmos-mastodon cookbook to use the new postgresql cookbook
Don't depend on the deprecated database cookbook to create the database
This commit is contained in:
@@ -13,5 +13,5 @@ depends "poise-ruby-build"
|
||||
depends "application_ruby"
|
||||
depends "application_javascript"
|
||||
depends "postgresql"
|
||||
depends "database"
|
||||
depends "kosmos-postgresql"
|
||||
depends "backup"
|
||||
|
||||
@@ -8,23 +8,21 @@
|
||||
#
|
||||
include_recipe "kosmos-nodejs"
|
||||
include_recipe "kosmos-redis"
|
||||
include_recipe "kosmos-postgresql"
|
||||
|
||||
node.override['postgresql']['enable_pgdg_apt'] = false
|
||||
include_recipe "postgresql::server"
|
||||
include_recipe "postgresql::ruby"
|
||||
unless node.chef_environment == "development"
|
||||
node.override['postgresql']['config_pgtune']['db_type'] = "web"
|
||||
include_recipe "postgresql::config_pgtune"
|
||||
end
|
||||
# Remove the condition once we have migrated mastodon to andromeda
|
||||
unless platform?('ubuntu') && node[:platform_version].to_f < 18.04
|
||||
postgresql_data_bag_item = data_bag_item('credentials', 'postgresql')
|
||||
|
||||
postgresql_database 'mastodon' do
|
||||
connection(
|
||||
host: '127.0.0.1',
|
||||
port: 5432,
|
||||
username: 'postgres',
|
||||
password: node['postgresql']['password']['postgres']
|
||||
)
|
||||
action :create
|
||||
postgresql_user 'mastodon' do
|
||||
action :create
|
||||
password postgresql_data_bag_item['mastodon_user_password']
|
||||
end
|
||||
|
||||
postgresql_database 'mastodon' do
|
||||
owner 'mastodon'
|
||||
action :create
|
||||
end
|
||||
end
|
||||
|
||||
mastodon_path = node["kosmos-mastodon"]["directory"]
|
||||
@@ -112,7 +110,7 @@ application mastodon_path do
|
||||
revision "production"
|
||||
end
|
||||
|
||||
mastodon_credentials = Chef::EncryptedDataBagItem.load('credentials', 'mastodon')
|
||||
mastodon_credentials = data_bag_item('credentials', 'mastodon')
|
||||
|
||||
template ".env.production" do
|
||||
source "env.production.erb"
|
||||
@@ -132,7 +130,8 @@ application mastodon_path do
|
||||
aws_secret_access_key: mastodon_credentials['aws_secret_access_key'],
|
||||
s3_region: "eu-west-1",
|
||||
vapid_private_key: mastodon_credentials['vapid_private_key'],
|
||||
vapid_public_key: mastodon_credentials['vapid_public_key']
|
||||
vapid_public_key: mastodon_credentials['vapid_public_key'],
|
||||
db_pass: postgresql_data_bag_item['mastodon_user_password']
|
||||
end
|
||||
|
||||
bundle_install do
|
||||
@@ -184,8 +183,13 @@ end
|
||||
|
||||
unless node.chef_environment == "development"
|
||||
node.override["backup"]["postgresql"]["host"] = "localhost"
|
||||
node.override["backup"]["postgresql"]["username"] = "postgres"
|
||||
node.override["backup"]["postgresql"]["password"] = node['postgresql']['password']['postgres']
|
||||
unless platform?('ubuntu') && node[:platform_version].to_f < 18.04
|
||||
node.override["backup"]["postgresql"]["username"] = "mastodon"
|
||||
node.override["backup"]["postgresql"]["password"] = postgres_password
|
||||
else
|
||||
node.override["backup"]["postgresql"]["username"] = "postgres"
|
||||
node.override["backup"]["postgresql"]["password"] = node['postgresql']['password']['postgres']
|
||||
end
|
||||
unless node["backup"]["postgresql"]["databases"].include? 'mastodon'
|
||||
node.override["backup"]["postgresql"]["databases"] =
|
||||
node["backup"]["postgresql"]["databases"].to_a << "mastodon"
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
# Service dependencies
|
||||
REDIS_URL=<%= @redis_url %>
|
||||
DB_HOST=localhost
|
||||
DB_USER=postgres
|
||||
DB_NAME=mastodon
|
||||
# Remove the condition once we have migrated mastodon to andromeda
|
||||
<% if node[:platform_version].to_f < 18.04 -%>
|
||||
DB_USER=postgres
|
||||
DB_PASS=<%= node['postgresql']['password']['postgres'] %>
|
||||
<% else -%>
|
||||
DB_USER=mastodon
|
||||
DB_PASS=<%= @db_pass %>
|
||||
<% end -%>
|
||||
DB_PORT=5432
|
||||
|
||||
# Federation
|
||||
|
||||
Reference in New Issue
Block a user