Mastodon improvements #102

Merged
greg merged 7 commits from feature/mastodon_improvements into master 2019-10-09 11:02:47 +00:00
6 changed files with 23 additions and 25 deletions

View File

@ -15,11 +15,9 @@ cookbook 'composer', '~> 2.6.1'
cookbook 'poise-ruby-build', '~> 1.1.0'
cookbook 'application', '~> 5.2.0'
cookbook 'application_javascript', '~> 1.0.0'
cookbook 'application_ruby', '~> 4.1.0'
cookbook 'application_git', '= 1.1.0' # 1.2.0 doesn't work with knife-solo
cookbook 'poise', '~> 2.8.2'
cookbook 'poise-languages', '~> 2.1.1'
cookbook 'poise-ruby', '~> 2.4.0'
cookbook 'poise-javascript', git: 'https://github.com/67p/poise-javascript.git',
ref: 'd85078f'
cookbook 'poise-archive', '~> 1.5.0'
@ -53,3 +51,4 @@ cookbook 'ipfs',
git: 'https://github.com/67P/ipfs-cookbook.git',
ref: 'v0.4.1'
cookbook 'elasticsearch', '= 4.2.0'
cookbook 'java', '~> 4.3.0'

View File

@ -3,7 +3,6 @@ DEPENDENCIES
application (~> 5.2.0)
application_git (= 1.1.0)
application_javascript (~> 1.0.0)
application_ruby (~> 4.1.0)
apt (~> 7.0.0)
ark (= 3.1.0)
build-essential (~> 8.2.1)
@ -21,6 +20,7 @@ DEPENDENCIES
git: https://github.com/67P/ipfs-cookbook.git
revision: 5c31191ff8571bc8425375fbf938913ac64aa2ee
ref: v0.4.1
java (~> 4.3.0)
logrotate (= 2.2.0)
mariadb (= 0.3.1)
mediawiki
@ -42,7 +42,6 @@ DEPENDENCIES
revision: d85078fe59bd4f16d05a9ffe6e0fc449015e4440
ref: d85078f
poise-languages (~> 2.1.1)
poise-ruby (~> 2.4.0)
poise-ruby-build (~> 1.1.0)
poise-service (~> 1.5.2)
postfix (= 5.0.2)
@ -68,11 +67,6 @@ GRAPH
poise (~> 2.0)
poise-javascript (~> 1.0)
poise-service (~> 1.0)
application_ruby (4.1.0)
application (~> 5.0)
poise (~> 2.0)
poise-ruby (~> 2.1)
poise-service (~> 1.0)
apt (7.0.0)
ark (3.1.0)
build-essential (>= 0.0.0)
@ -107,6 +101,9 @@ GRAPH
hostsfile (2.4.5)
ipfs (0.4.1)
ark (>= 0.0.0)
java (4.3.0)
homebrew (>= 0.0.0)
windows (>= 0.0.0)
logrotate (2.2.0)
mariadb (0.3.1)
apt (>= 0.0.0)

View File

@ -4,9 +4,10 @@ maintainer_email 'mail@kosmos.org'
license 'MIT'
description 'Installs/Configures kosmos-ipfs'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.2.0'
version '0.3.0'
depends 'ipfs'
depends 'kosmos-base'
depends 'kosmos-nginx'
depends 'firewall'
depends 'application_javascript'

View File

@ -4,6 +4,8 @@ node.default["kosmos-mastodon"]["streaming_port"] = 4000
node.default["kosmos-mastodon"]["server_name"] = "kosmos.social"
node.default["kosmos-mastodon"]["redis_url"] = "redis://localhost:6379/1"
node.default["kosmos-mastodon"]["sidekiq_threads"] = 25
# Allocate this amount of RAM to the Java heap for Elasticsearch
node.default["kosmos-mastodon"]["elasticsearch"]["allocated_memory"] = "1536m"
node.override["tor"]["HiddenServices"]["mastodon"] = {
"HiddenServicePorts" => ["80 127.0.0.1:80"]

View File

@ -10,10 +10,11 @@ depends "kosmos-nginx"
depends "kosmos-nodejs"
depends "kosmos-redis"
depends "poise-ruby-build"
depends "application_ruby"
depends "application_javascript"
depends "application"
depends "application_git"
depends "postgresql"
depends "kosmos-postgresql"
depends "backup"
depends "elasticsearch"
depends "tor-full"
depends "java"

View File

@ -27,6 +27,7 @@
include_recipe "kosmos-nodejs"
include_recipe "kosmos-redis"
include_recipe "kosmos-postgresql"
include_recipe "java"
elasticsearch_user 'elasticsearch'
@ -36,7 +37,7 @@ elasticsearch_install 'elasticsearch' do
end
elasticsearch_configure 'elasticsearch' do
allocated_memory '1536m'
allocated_memory node["kosmos-mastodon"]["elasticsearch"]["allocated_memory"]
end
elasticsearch_service 'elasticsearch'
@ -78,7 +79,7 @@ package %w(imagemagick ffmpeg libxml2-dev libxslt1-dev file git curl pkg-config
libprotobuf-dev protobuf-compiler libidn11 libidn11-dev libjemalloc1)
npm_package "yarn" do
version "1.6.0"
version "1.17.3"
end
ruby_version = "2.6.1"
@ -127,7 +128,11 @@ application mastodon_path do
owner "mastodon"
group "mastodon"
environment "HOME" => mastodon_path
# Take care of application restarts manually, in the git resource
action_on_update false
environment "HOME" => mastodon_path,
"PATH" => "/opt/ruby_build/builds/#{ruby_version}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
ruby_runtime ruby_version do
provider :ruby_build
@ -139,6 +144,8 @@ application mastodon_path do
group mastodon_user
repository "https://gitea.kosmos.org/kosmos/mastodon.git"
revision "production"
# Restart services on deployments
notifies :restart, "application[#{mastodon_path}]", :delayed
end
mastodon_credentials = data_bag_item('credentials', 'mastodon')
@ -173,18 +180,12 @@ application mastodon_path do
end
execute "yarn install" do
environment "HOME" => mastodon_path
environment "HOME" => mastodon_path, "NODE_ENV" => "production"
user mastodon_user
cwd mastodon_path
command "yarn install --pure-lockfile"
end
rails do
migrate false
rails_env "production"
precompile_assets false # buggy, done manually below
end
execute 'rake db:migrate' do
environment "RAILS_ENV" => "production", "HOME" => mastodon_path
user mastodon_user
@ -193,9 +194,6 @@ application mastodon_path do
command "PATH=\"/opt/ruby_build/builds/#{ruby_version}/bin:$PATH\" bundle exec rake db:migrate"
end
# This is the only way I could find that makes compiling the assets
# successfully for now. application_ruby's precompile_assets crashes because
# it cannot find the bundled gems
execute 'rake assets:precompile' do
environment "RAILS_ENV" => "production", "HOME" => mastodon_path
user mastodon_user