diff --git a/Berksfile b/Berksfile index 2256783..fa7535c 100644 --- a/Berksfile +++ b/Berksfile @@ -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' diff --git a/Berksfile.lock b/Berksfile.lock index fab450f..baf13d7 100644 --- a/Berksfile.lock +++ b/Berksfile.lock @@ -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) diff --git a/site-cookbooks/kosmos-ipfs/metadata.rb b/site-cookbooks/kosmos-ipfs/metadata.rb index d84c988..cda9ca4 100644 --- a/site-cookbooks/kosmos-ipfs/metadata.rb +++ b/site-cookbooks/kosmos-ipfs/metadata.rb @@ -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' diff --git a/site-cookbooks/kosmos-mastodon/attributes/default.rb b/site-cookbooks/kosmos-mastodon/attributes/default.rb index 9d99cea..eb91556 100644 --- a/site-cookbooks/kosmos-mastodon/attributes/default.rb +++ b/site-cookbooks/kosmos-mastodon/attributes/default.rb @@ -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"] diff --git a/site-cookbooks/kosmos-mastodon/metadata.rb b/site-cookbooks/kosmos-mastodon/metadata.rb index 68ca72c..0db3753 100644 --- a/site-cookbooks/kosmos-mastodon/metadata.rb +++ b/site-cookbooks/kosmos-mastodon/metadata.rb @@ -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" diff --git a/site-cookbooks/kosmos-mastodon/recipes/default.rb b/site-cookbooks/kosmos-mastodon/recipes/default.rb index 0e4dba9..0555a8f 100644 --- a/site-cookbooks/kosmos-mastodon/recipes/default.rb +++ b/site-cookbooks/kosmos-mastodon/recipes/default.rb @@ -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