user/mastodon: upgrade to 4.1.4

This commit is contained in:
Antoine Martin 2023-07-12 17:16:04 -04:00
parent 37d1ce98d5
commit 31a53678e1
Signed by: forge
GPG key ID: D62A472A4AA7D541
12 changed files with 305 additions and 595 deletions

View file

@ -1,509 +0,0 @@
diff --git a/Gemfile.lock.orig b/Gemfile.lock
index 28c6e73..7e21b2d 100644
--- a/Gemfile.lock.orig
+++ b/Gemfile.lock
@@ -90,22 +90,22 @@ GEM
attr_required (1.0.1)
awrence (1.2.1)
aws-eventstream (1.2.0)
- aws-partitions (1.587.0)
- aws-sdk-core (3.130.2)
+ aws-partitions (1.656.0)
+ aws-sdk-core (3.166.0)
aws-eventstream (~> 1, >= 1.0.2)
- aws-partitions (~> 1, >= 1.525.0)
+ aws-partitions (~> 1, >= 1.651.0)
+ aws-sigv4 (~> 1.5)
+ jmespath (~> 1, >= 1.6.1)
+ aws-sdk-kms (1.59.0)
+ aws-sdk-core (~> 3, >= 3.165.0)
aws-sigv4 (~> 1.1)
- jmespath (~> 1.0)
- aws-sdk-kms (1.56.0)
- aws-sdk-core (~> 3, >= 3.127.0)
- aws-sigv4 (~> 1.1)
- aws-sdk-s3 (1.114.0)
- aws-sdk-core (~> 3, >= 3.127.0)
+ aws-sdk-s3 (1.117.1)
+ aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
- aws-sigv4 (1.5.0)
+ aws-sigv4 (1.5.2)
aws-eventstream (~> 1, >= 1.0.2)
- bcrypt (3.1.17)
+ bcrypt (3.1.18)
better_errors (2.9.1)
coderay (>= 1.0.0)
erubi (>= 1.0.0)
@@ -117,7 +117,7 @@ GEM
erubi (~> 1.4)
parser (>= 2.4)
smart_properties
- bindata (2.4.10)
+ bindata (2.4.14)
binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1)
blurhash (0.1.6)
@@ -125,7 +125,7 @@ GEM
bootsnap (1.13.0)
msgpack (~> 1.2)
brakeman (5.3.1)
- browser (4.2.0)
+ browser (5.3.1)
brpoplpush-redis_script (0.1.2)
concurrent-ruby (~> 1.0, >= 1.0.5)
redis (>= 1.0, <= 5.0)
@@ -142,7 +142,7 @@ GEM
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
- capistrano-bundler (2.0.1)
+ capistrano-bundler (2.1.0)
capistrano (~> 3.1)
capistrano-rails (1.6.2)
capistrano (~> 3.1)
@@ -152,7 +152,7 @@ GEM
sshkit (~> 1.3)
capistrano-yarn (2.0.2)
capistrano (~> 3.0)
- capybara (3.37.1)
+ capybara (3.38.0)
addressable
matrix
mini_mime (>= 0.1.3)
@@ -165,7 +165,7 @@ GEM
activesupport
cbor (0.5.9.6)
charlock_holmes (0.7.7)
- chewy (7.2.4)
+ chewy (7.2.6)
activesupport (>= 5.2)
elasticsearch (>= 7.12.0, < 7.14.0)
elasticsearch-dsl
@@ -176,15 +176,15 @@ GEM
color_diff (0.1)
concurrent-ruby (1.1.10)
connection_pool (2.3.0)
- cose (1.2.1)
+ cose (1.3.0)
cbor (~> 0.5.9)
openssl-signature_algorithm (~> 1.0)
crack (0.4.5)
rexml
crass (1.0.6)
- css_parser (1.7.1)
+ css_parser (1.12.0)
addressable
- debug_inspector (1.0.0)
+ debug_inspector (1.1.0)
devise (4.8.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
@@ -203,7 +203,7 @@ GEM
diff-lcs (1.5.0)
discard (1.2.1)
activerecord (>= 4.2, < 8)
- docile (1.3.4)
+ docile (1.4.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
doorkeeper (5.6.0)
@@ -226,11 +226,11 @@ GEM
erubi (1.11.0)
et-orbi (1.2.7)
tzinfo
- excon (0.76.0)
+ excon (0.93.1)
fabrication (2.30.0)
faker (2.23.0)
i18n (>= 1.8.11, < 2)
- faraday (1.9.3)
+ faraday (1.10.2)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
@@ -246,8 +246,8 @@ GEM
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
- faraday-multipart (1.0.3)
- multipart-post (>= 1.2, < 3)
+ faraday-multipart (1.0.4)
+ multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
@@ -271,8 +271,8 @@ GEM
fog-core (>= 1.45, <= 2.1.0)
fog-json (>= 1.0)
ipaddress (>= 0.8)
- formatador (0.2.5)
- fugit (1.7.1)
+ formatador (0.3.0)
+ fugit (1.7.2)
et-orbi (~> 1, >= 1.2.7)
raabro (~> 1.4)
fuubar (2.5.1)
@@ -284,7 +284,7 @@ GEM
openid_connect (~> 1.2)
globalid (1.0.0)
activesupport (>= 5.0)
- hamlit (2.13.0)
+ hamlit (3.0.2)
temple (>= 0.8.2)
thor
tilt
@@ -330,10 +330,11 @@ GEM
jmespath (1.6.1)
json (2.6.2)
json-canonicalization (0.3.0)
- json-jwt (1.13.0)
+ json-jwt (1.15.3)
activesupport (>= 4.2)
aes_key_wrap
bindata
+ httpclient
json-ld (3.2.3)
htmlentities (~> 4.3)
json-canonicalization (~> 0.3)
@@ -341,11 +342,11 @@ GEM
multi_json (~> 1.15)
rack (~> 2.2)
rdf (~> 3.2, >= 3.2.9)
- json-ld-preloaded (3.2.0)
+ json-ld-preloaded (3.2.2)
json-ld (~> 3.2)
rdf (~> 3.2)
jsonapi-renderer (0.2.2)
- jwt (2.4.1)
+ jwt (2.5.0)
kaminari (1.2.2)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.2)
@@ -385,15 +386,18 @@ GEM
loofah (2.19.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
- mail (2.7.1)
+ mail (2.8.0.rc1)
mini_mime (>= 0.1.1)
+ net-imap
+ net-pop
+ net-smtp
makara (0.5.1)
activerecord (>= 5.2.0)
marcel (1.0.2)
mario-redis-lock (1.2.1)
redis (>= 3.0.5)
matrix (0.4.2)
- memory_profiler (1.0.0)
+ memory_profiler (1.0.1)
method_source (1.0.0)
microformats (4.4.1)
json (~> 2.2)
@@ -402,25 +406,31 @@ GEM
mime-types-data (~> 3.2015)
mime-types-data (3.2022.0105)
mini_mime (1.1.2)
- mini_portile2 (2.8.0)
minitest (5.16.3)
- msgpack (1.5.4)
+ msgpack (1.6.0)
multi_json (1.15.0)
- multipart-post (2.1.1)
+ multipart-post (2.2.3)
+ net-imap (0.3.1)
+ net-protocol
net-ldap (0.17.1)
- net-scp (4.0.0.rc1)
+ net-pop (0.1.2)
+ net-protocol
+ net-protocol (0.1.3)
+ timeout
+ net-scp (4.0.0)
net-ssh (>= 2.6.5, < 8.0.0)
+ net-smtp (0.3.3)
+ net-protocol
net-ssh (7.0.1)
nio4r (2.5.8)
- nokogiri (1.13.8)
- mini_portile2 (~> 2.8.0)
+ nokogiri (1.13.9-x86_64-linux)
racc (~> 1.4)
nsa (0.2.8)
activesupport (>= 4.2, < 7)
concurrent-ruby (~> 1.0, >= 1.0.2)
sidekiq (>= 3.5)
statsd-ruby (~> 1.4, >= 1.4.0)
- oj (3.13.21)
+ oj (3.13.22)
omniauth (1.9.2)
hashie (>= 3.4.6)
rack (>= 1.6.2, < 3)
@@ -434,17 +444,18 @@ GEM
omniauth-saml (1.10.3)
omniauth (~> 1.3, >= 1.3.2)
ruby-saml (~> 1.9)
- openid_connect (1.3.0)
+ openid_connect (1.4.2)
activemodel
attr_required (>= 1.0.0)
- json-jwt (>= 1.5.0)
- rack-oauth2 (>= 1.6.1)
- swd (>= 1.0.0)
+ json-jwt (>= 1.15.0)
+ net-smtp
+ rack-oauth2 (~> 1.21)
+ swd (~> 1.3)
tzinfo
validate_email
validate_url
- webfinger (>= 1.0.1)
- openssl (3.0.0)
+ webfinger (~> 1.2)
+ openssl (3.0.1)
openssl-signature_algorithm (1.2.1)
openssl (> 2.0, < 3.1)
orm_adapter (0.5.0)
@@ -455,14 +466,14 @@ GEM
parslet (2.0.0)
pastel (0.8.0)
tty-color (~> 0.5)
- pg (1.4.3)
+ pg (1.4.4)
pghero (2.8.3)
activerecord (>= 5)
pkg-config (1.4.9)
posix-spawn (0.3.15)
- premailer (1.14.2)
+ premailer (1.18.0)
addressable
- css_parser (>= 1.6.0)
+ css_parser (>= 1.12.0)
htmlentities (>= 4.0.0)
premailer-rails (1.11.1)
actionmailer (>= 3)
@@ -476,6 +487,7 @@ GEM
pry (>= 0.13, < 0.15)
pry-rails (0.3.9)
pry (>= 0.10.4)
+ psych (3.3.4)
public_suffix (5.0.0)
puma (5.6.5)
nio4r (~> 2.0)
@@ -488,13 +500,13 @@ GEM
rack (>= 1.0, < 3)
rack-cors (1.1.1)
rack (>= 2.0.0)
- rack-oauth2 (1.19.0)
+ rack-oauth2 (1.21.3)
activesupport
attr_required
httpclient
json-jwt (>= 1.11.0)
rack (>= 2.1.0)
- rack-proxy (0.7.0)
+ rack-proxy (0.7.4)
rack
rack-test (2.0.2)
rack (>= 1.3)
@@ -525,7 +537,7 @@ GEM
rails-i18n (6.0.0)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 7)
- rails-settings-cached (0.6.6)
+ rails-settings-cached (0.7.2)
rails (>= 4.2.0)
railties (6.1.7)
actionpack (= 6.1.7)
@@ -540,10 +552,10 @@ GEM
rdf-normalize (0.5.0)
rdf (~> 3.2)
redcarpet (3.5.1)
- redis (4.5.1)
+ redis (4.8.0)
redis-namespace (1.9.0)
redis (>= 4)
- regexp_parser (2.5.0)
+ regexp_parser (2.6.0)
request_store (1.5.1)
rack (>= 1.4)
responders (3.0.1)
@@ -556,14 +568,14 @@ GEM
chunky_png (~> 1.0)
rqrcode_core (~> 1.0)
rqrcode_core (1.2.0)
- rspec-core (3.11.0)
- rspec-support (~> 3.11.0)
- rspec-expectations (3.11.0)
+ rspec-core (3.12.0)
+ rspec-support (~> 3.12.0)
+ rspec-expectations (3.12.0)
diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.11.0)
- rspec-mocks (3.11.1)
+ rspec-support (~> 3.12.0)
+ rspec-mocks (3.12.0)
diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.11.0)
+ rspec-support (~> 3.12.0)
rspec-rails (5.1.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
@@ -575,26 +587,27 @@ GEM
rspec-sidekiq (3.1.0)
rspec-core (~> 3.0, >= 3.0.0)
sidekiq (>= 2.4.0)
- rspec-support (3.11.1)
+ rspec-support (3.12.0)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
- rubocop (1.30.1)
+ rubocop (1.38.0)
+ json (~> 2.3)
parallel (~> 1.10)
- parser (>= 3.1.0.0)
+ parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
- rubocop-ast (>= 1.18.0, < 2.0)
+ rubocop-ast (>= 1.23.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
- rubocop-ast (1.18.0)
+ rubocop-ast (1.23.0)
parser (>= 3.1.1.0)
- rubocop-rails (2.15.0)
+ rubocop-rails (2.17.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
- rubocop (>= 1.7.0, < 2.0)
+ rubocop (>= 1.33.0, < 2.0)
ruby-progressbar (1.11.0)
- ruby-saml (1.13.0)
+ ruby-saml (1.14.0)
nokogiri (>= 1.10.5)
rexml
ruby2_keywords (0.0.5)
@@ -609,8 +622,8 @@ GEM
activerecord (>= 4.0.0)
railties (>= 4.0.0)
semantic_range (3.0.0)
- sidekiq (6.5.7)
- connection_pool (>= 2.2.5)
+ sidekiq (6.5.8)
+ connection_pool (>= 2.2.5, < 3)
rack (~> 2.0)
redis (>= 4.5.0, < 5)
sidekiq-bulk (0.2.0)
@@ -635,7 +648,7 @@ GEM
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
- simplecov_json_formatter (0.1.2)
+ simplecov_json_formatter (0.1.4)
smart_properties (1.17.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
@@ -644,25 +657,26 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
- sshkit (1.21.2)
+ sshkit (1.21.3)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
stackprof (0.2.22)
statsd-ruby (1.5.0)
stoplight (3.0.0)
- strong_migrations (0.7.9)
- activerecord (>= 5)
+ strong_migrations (0.8.0)
+ activerecord (>= 5.2)
swd (1.3.0)
activesupport (>= 3)
attr_required (>= 0.0.5)
httpclient (>= 2.4)
- temple (0.8.2)
+ temple (0.9.1)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
terrapin (0.6.0)
climate_control (>= 0.0.3, < 1.0)
thor (1.2.1)
tilt (2.0.11)
+ timeout (0.3.0)
tpm-key_attestation (0.11.0)
bindata (~> 2.4)
openssl (> 2.0, < 3.1)
@@ -682,7 +696,7 @@ GEM
unf (~> 0.1.0)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
- tzinfo-data (1.2022.4)
+ tzinfo-data (1.2022.6)
tzinfo (>= 1.0.0)
unf (0.1.4)
unf_ext
@@ -725,10 +739,10 @@ GEM
xorcist (1.1.3)
xpath (3.2.0)
nokogiri (~> 1.8)
- zeitwerk (2.6.0)
+ zeitwerk (2.6.5)
PLATFORMS
- ruby
+ x86_64-linux-musl
DEPENDENCIES
active_model_serializers (~> 0.10)
@@ -787,6 +801,7 @@ DEPENDENCIES
letter_opener_web (~> 2.0)
link_header (~> 0.0)
lograge (~> 0.12)
+ mail (~> 2.8.0.rc1)
makara (~> 0.5)
mario-redis-lock (~> 1.2)
memory_profiler
@@ -810,6 +825,7 @@ DEPENDENCIES
private_address_check (~> 0.5)
pry-byebug (~> 3.10)
pry-rails (~> 0.3)
+ psych (< 4)
puma (~> 5.6)
pundit (~> 2.2)
rack (~> 2.2.4)
@@ -854,3 +870,9 @@ DEPENDENCIES
webpacker (~> 5.4)
webpush!
xorcist (~> 1.1)
+
+RUBY VERSION
+ ruby 3.1.2p20
+
+BUNDLED WITH
+ 2.3.24
diff --git a/Gemfile.orig b/Gemfile
index 3489996..b2c91d3 100644
--- a/Gemfile.orig
+++ b/Gemfile
@@ -1,7 +1,7 @@
# frozen_string_literal: true
source 'https://rubygems.org'
-ruby '>= 2.6.0', '< 3.1.0'
+ruby '>= 2.6.0', '< 3.2.0'
gem 'pkg-config', '~> 1.4'
gem 'rexml', '~> 3.2'
@@ -154,5 +154,7 @@ gem 'concurrent-ruby', require: false
gem 'connection_pool', require: false
gem 'xorcist', '~> 1.1'
+gem 'mail', '~> 2.8.0.rc1'
+gem 'psych', '< 4'
gem 'cocoon', '~> 1.2'

View file

@ -0,0 +1,23 @@
From e48894bfe303b0d8b8f1c1bdf43f07e1baca3176 Mon Sep 17 00:00:00 2001
From: CSDUMMI <csdummi.misquality@simplelogin.co>
Date: Sat, 11 Mar 2023 18:21:53 +0100
Subject: [PATCH] Prefer the stored locatio in the omniauth callback controller
over the root path
---
app/controllers/auth/omniauth_callbacks_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/auth/omniauth_callbacks_controller.rb b/app/controllers/auth/omniauth_callbacks_controller.rb
index 3d7962de56cb..9e0fb942aaff 100644
--- a/app/controllers/auth/omniauth_callbacks_controller.rb
+++ b/app/controllers/auth/omniauth_callbacks_controller.rb
@@ -33,7 +33,7 @@ def self.provides_callback_for(provider)
def after_sign_in_path_for(resource)
if resource.email_present?
- root_path
+ stored_location_for(resource) || root_path
else
auth_setup_path(missing_email: '1')
end

View file

@ -2,56 +2,30 @@
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=mastodon
pkgver=4.0.0_rc2
_gittag=4.0.0rc2
pkgrel=1
_pkgname=$pkgname
pkgver=4.1.4
_gittag=v$pkgver
pkgrel=0
pkgdesc="Self-hosted social media and network server based on ActivityPub and OStatus"
arch="all"
url="https://github.com/tootsuite/mastodon"
arch="!armv7 all"
url="https://github.com/mastodon/mastodon"
license="AGPL-3.0-only"
_ruby_duplicate="
ruby-addressable
ruby-builder
ruby-charlock_holmes
ruby-concurrent-ruby
ruby-erubi
ruby-ffi
ruby-i18n
ruby-minitest
ruby-multi_json
ruby-net-imap
ruby-net-ldap
ruby-net-pop
ruby-net-smtp
ruby-nokogiri
ruby-ox
ruby-pg
ruby-posix-spawn
ruby-public_suffix
ruby-rake
ruby-rexml
ruby-thor
ruby-unf_ext
"
[ "$CARCH" = "armhf" ] && _ruby_duplicate="${_ruby_duplicate/ruby-ox/}"
[ "$CARCH" = "armv7" ] && _ruby_duplicate="${_ruby_duplicate/ruby-ox/}"
depends="
$pkgname-assets=$pkgver-r$pkgrel
ffmpeg
file
gcompat
imagemagick
nodejs
npm
protobuf
redis
ruby
ruby-bigdecimal
ruby-bundler
ruby-etc
ruby-io-console
ruby-irb
ruby-json
ruby2.7
ruby2.7-bundler
ruby2.7-bigdecimal
ruby2.7-etc
ruby2.7-io-console
yarn
$_ruby_duplicate
"
makedepends="
gnu-libiconv-dev
@ -63,25 +37,34 @@ makedepends="
openssl-dev
postgresql-dev
protobuf-dev
ruby-dev
ruby-rdoc
ruby2.7-dev
yaml-dev
zlib-dev
"
install="
$pkgname.pre-install
$pkgname.post-upgrade
$pkgname.post-install
"
source="
mastodon-$_gittag.tar.gz::https://github.com/tootsuite/mastodon/archive/v$_gittag.tar.gz
mastodon-web.initd
mastodon-sidekiq.initd
mastodon-streaming.initd
0001-ruby-3.1-support.patch
mastodon-$_gittag.tar.gz::https://github.com/mastodon/mastodon/archive/$_gittag.tar.gz
24073_prefer-stored-location-as-after-sign-in-path.patch
mastodon.initd
mastodon.web.initd
mastodon.sidekiq.initd
mastodon.streaming.initd
mastodon.logrotate
bin-wrapper.in
"
subpackages="$pkgname-openrc"
subpackages="$pkgname-openrc $pkgname-assets::noarch"
options="!check" # No test suite
builddir="$srcdir"/$pkgname-$_gittag
_prefix="usr/lib/bundles/$_pkgname"
export BUNDLE_DEPLOYMENT=true
export BUNDLE_FORCE_RUBY_PLATFORM=true
export BUNDLE_FROZEN=true
export BUNDLE_JOBS=${JOBS:-2}
prepare() {
default_prepare
@ -96,42 +79,128 @@ prepare() {
}
build() {
pwd
bundle config build.nokogiri --use-system-libraries --with-iconv-lib=/usr/lib --with-iconv-include=/usr/include
bundle config set deployment 'false'
bundle config set without 'development test'
bundle config set no-cache 'true'
bundle install -j"$(getconf _NPROCESSORS_ONLN)"
yarn install --pure-lockfile --ignore-engines
RAILS_ENV='production' OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder bundle exec rails assets:precompile
local bundle_without='exclude development'
msg "Installing Ruby gems..."
bundle config --local build.nokogiri --use-system-libraries \
--with-xml2-include=/usr/include/libxml2 \
--with-xslt-include=/usr/include/libxslt
bundle config --local build.ffi --enable-system-libffi
bundle config --local build.idn --enable-system-libidn
bundle config --local path "vendor/bundle"
bundle config --local set deployment 'false'
bundle config --local set without "$bundle_without"
bundle install --no-cache -j"$(getconf _NPROCESSORS_ONLN)"
msg "Installing npm modules..."
yarn install --production --frozen-lockfile
(
msg "Compiling assets..."
export NODE_ENV=production
export RAILS_ENV=production
OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder bundle exec rails assets:precompile
)
msg "Cleaning assets gems..."
bundle config --local without "$bundle_without"
bundle clean
# Create executables in bin/*.
# See also https://github.com/bundler/bundler/issues/6149.
bundle binstubs --force bundler puma sidekiq
}
package() {
local destdir="$pkgdir"/$_prefix
local datadir="$pkgdir/var/lib/gitlab"
# directory creation
install -dm 755 \
"$pkgdir"/usr/share/webapps \
"$destdir" \
"$datadir" \
"$pkgdir"/etc/init.d
cp -a "$builddir" "$pkgdir"/usr/share/webapps/mastodon
# Install application files.
rmdir "$destdir"
cp -a "$builddir" "$destdir"
install -m755 -t "$destdir"/bin/ \
bin/bundle \
bin/rails \
bin/rake \
bin/sidekiq \
bin/sidekiqmon \
bin/tootctl \
bin/puma
cd "$destdir"/vendor/bundle/ruby/*/
# Remove tests, documentations and other useless files.
find gems/ \( -name 'doc' \
-o -name 'spec' \
-o -name 'test' \) \
-type d -maxdepth 2 -exec rm -fr "{}" +
find gems/ \( -name 'README*' \
-o -name 'CHANGELOG*' \
-o -name 'CONTRIBUT*' \
-o -name '*LICENSE*' \
-o -name 'Rakefile' \
-o -name '.*' \) \
-type f -delete
# Remove assets, they are already compiled.
rm -r gems/doorkeeper-*/app/assets
rm -r gems/pghero-*/app/assets
# Remove build logs and cache.
rm -rf build_info/ cache/
find extensions/ \( -name gem_make.out -o -name mkmf.log \) -delete
cat > "$datadir"/.profile <<-EOF
export RAILS_ENV=production
export NODE_ENV=production
export EXECJS_RUNTIME=Disabled
EOF
# Install wrapper scripts to /usr/bin.
local name; for name in rake rails tootctl; do
sed "s/__COMMAND__/$name/g" "$srcdir"/bin-wrapper.in \
> "$builddir"/mastodon-$name
install -m755 -D "$builddir"/mastodon-$name "$pkgdir"/usr/bin/mastodon-$name
done
# Put the config file in /etc and link to it
touch "$pkgdir"/etc/mastodon.conf
ln -s /etc/mastodon.conf "$pkgdir"/usr/share/webapps/mastodon/.env.production
ln -s /usr/bin/node "$pkgdir"/usr/share/webapps/mastodon/node
ln -s /etc/mastodon.conf "$destdir"/.env.production
ln -s /usr/bin/node "$destdir"/node
install -Dm 755 "$srcdir"/*.initd "$pkgdir"/etc/init.d/
for i in $_ruby_duplicate; do
rm -R "$pkgdir"/usr/share/webapps/mastodon/vendor/bundle/ruby/*/gems/${i/ruby-/}*
for file in $_pkgname $_pkgname.sidekiq $_pkgname.web $_pkgname.streaming; do
install -m755 -D "$srcdir"/$file.initd "$pkgdir"/etc/init.d/$file
done
# Removing all prebuilt artifacts
rm -R "$pkgdir"/usr/share/webapps/mastodon/node_modules/*/prebuilds 2>&1 || true
rm -R "$destdir"/node_modules/*/prebuilds 2>&1 || true
install -m644 -D "$srcdir"/$_pkgname.logrotate \
"$pkgdir"/etc/logrotate.d/$_pkgname
}
assets() {
depends=""
amove $_prefix/public/assets
}
sha512sums="
dcde85a48b08216cffe99a13f5bdc5908b24c539e4bd4259c6d63a710e2377414e708d9be9a0cd4754c1c6168a7140beabd40b093935ffba0417888dda44499c mastodon-4.0.0rc2.tar.gz
9e77061fbdebe90492398f8089a7d2612ff4b6e70b5462dd67330b66d9788cb0133eab38c372b1f27a7214aacdd9f7f70381d4ecc6e92c8c38d794404ae0f840 mastodon-web.initd
06ebff4b4f51e0c7122db9ed175958fbcadf7e25d1d33c4cfd43992865b1ba183dbe6b4c8c244575f30a45a72d7d4ea3d887c597060e9cf2203bb00ae1a7ac79 mastodon-sidekiq.initd
eb8af0188c49b3507f9eedf54baf9d848f11288ce475963bde70686a1e5ff8960d32560771479651597703728bf0c8663a7bd068ccd8d32b620eba442a9a8ff1 mastodon-streaming.initd
6582b938342979268ef4226a13ac5605df66a69204507c62ff8b440b0f685998c3daeb8be02a05bc4ab48e17c157660071b7f3c5cb4257b967c371c6f7a8d3f1 0001-ruby-3.1-support.patch
e29e89c05939e583862cc7c07126b63224528e25d8b1029eb0ecd33a15b43e2e8f4a41676d2c03af4920e28da222296cb3b0773331b4eb79150c7d33ee6b5239 mastodon-v4.1.4.tar.gz
730d3bef92b0da2ef400b5205fd8ab7159a458d654fa4d9a16cc0b579331ac67bec8b302096dff3470a3363b88a770ec857f1db7a0112effd07275da661c654a 24073_prefer-stored-location-as-after-sign-in-path.patch
36604cd630f0f5b4d88b630b1512cd26e922f859e5d19cbb85106ff29fc9048d2349f926d5c4b6947c655f67e60ec33e2f524a8154405a4369f283e00be7cdce mastodon.initd
9e77061fbdebe90492398f8089a7d2612ff4b6e70b5462dd67330b66d9788cb0133eab38c372b1f27a7214aacdd9f7f70381d4ecc6e92c8c38d794404ae0f840 mastodon.web.initd
6dacafca86dd39f6a6efa773cfe35b4632098175605a7c64488027237b01028d9785e50a3a0532b88ebf8f857c9a594c7b68f9e577b46e95104e7cffde51ccf8 mastodon.sidekiq.initd
63b67ec16107e4d1747ae956cdd41edd03be71da1ed96d21a18710cbba69ce37c856f4abc080a61f172a10859d0b9a33ba9290fc69213e1bc15a1ce8f8d40108 mastodon.streaming.initd
83b3bae5b6fdb4d0dbc1cbe546c62c0aa77397b97d1a5d5377af032466677de188065b556710c0d96576bbae89cc76800f1ffb8cd718155eb2784da818f27619 mastodon.logrotate
dfd0e43ac6c28387bd4aa57fd98ae41aeb5a098b6deb3e44b89f07818e2470773b025364afee7ef6fd0f664cb86bbbbe8796c9f222f5436c256a787282fbe3e1 bin-wrapper.in
"

View file

@ -0,0 +1,15 @@
#!/bin/sh
BUNDLE_DIR='/usr/lib/bundles/mastodon'
export RAILS_ENV='production'
export NODE_ENV='production'
export EXECJS_RUNTIME='Disabled'
cd $BUNDLE_DIR
if [ "$(id -un)" != 'mastodon' ]; then
exec su mastodon -c '"$0" "$@"' -- bin/__COMMAND__ "$@"
else
exec bin/__COMMAND__ "$@"
fi

View file

@ -0,0 +1,40 @@
#!/sbin/openrc-run
name="Mastodon"
description="Meta script for starting/stopping all the Mastodon components"
subservices="mastodon.sidekiq mastodon.streaming mastodon.web"
depend() {
use net
}
start() {
local ret=0
ebegin "Starting all Mastodon components"
local svc; for svc in $subservices; do
service $svc start || ret=1
done
eend $ret
}
stop() {
local ret=0
ebegin "Stopping all Mastodon components"
local svc; for svc in $subservices; do
service $svc stop || ret=1
done
eend $ret
}
status() {
local ret=0
local svc; for svc in $subservices; do
echo "$svc:"
service $svc status || ret=1
done
eend $ret
}

View file

@ -0,0 +1,11 @@
/var/log/mastodon/*.log {
compress
copytruncate
delaycompress
maxsize 10M
minsize 1M
missingok
sharedscripts
rotate 10
weekly
}

View file

@ -1,6 +1,27 @@
#!/bin/sh
set -eu
RAILS_ENV='production' OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder bundle exec rails assets:precompile
exit 0
if [ "${0##*.}" = 'post-upgrade' ]; then
cat >&2 <<-EOF
*
* To finish Mastodon upgrade run:
*
* mastodon-rails db:migrate
*
EOF
else
cat >&2 <<-EOF
*
* 1. Adjust settings in /etc/mastodon.conf
*
* 2. Create database for Mastodon:
*
* psql -c "CREATE ROLE mastodon PASSWORD 'top-secret' INHERIT LOGIN;"
* psql -c "CREATE DATABASE mastodon OWNER mastodon ENCODING 'UTF-8';"
* psql -d mastodon -c "CREATE EXTENSION pg_trgm; CREATE EXTENSION btree_gist;"
* psql -c "ALTER DATABASE name OWNER TO new_owner;"
*
* 3. Run "mastodon-rake db:migrate"
*
EOF
fi

View file

@ -1,8 +0,0 @@
#!/bin/sh
echo "To upgrade the database schema, run:
# su - mastodon -s /bin/sh -c \"RAILS_ENV=production bundle exec rails db:migrate\"
To pre-compile assets, run:
# su - mastodon -s /bin/sh -c \"RAILS_ENV=production bundle exec rails assets:precompile\""
exit 0

View file

@ -0,0 +1 @@
mastodon.post-install

View file

@ -1,7 +1,54 @@
#!/bin/sh
# It's very important to set user/group correctly.
addgroup -S -g 82 www-data 2>/dev/null
adduser -S -D -H -h /var/lib/mastodon -s /sbin/nologin -g www-data -G mastodon mastodon 2>/dev/null
mastodon_dir='/var/lib/mastodon'
if ! getent group mastodon 1>/dev/null; then
echo '* Creating group mastodon' 1>&2
addgroup -S mastodon
fi
if ! id mastodon 2>/dev/null 1>&2; then
echo '* Creating user mastodon' 1>&2
adduser -DHS -G mastodon -h "$mastodon_dir" -s /bin/sh \
-g "added by apk for mastodon" mastodon
passwd -u mastodon 1>/dev/null # unlock
fi
if ! id -Gn mastodon | grep -Fq redis; then
echo '* Adding user mastodon to group redis' 1>&2
addgroup mastodon redis
fi
if [ "$(id -gn mastodon)" != 'mastodon' ]; then
cat >&2 <<-EOF
!!
!! User mastodon has primary group $(id -gn mastodon). We strongly recommend to change
!! mastodon's primary group to mastodon.
!!
EOF
# Add it at least as a supplementary group.
adduser mastodon mastodon
fi
user_home="$(getent passwd mastodon | cut -d: -f6)"
if [ "$user_home" != "$mastodon_dir" ]; then
cat >&2 <<-EOF
!!
!! User mastodon has home directory in $user_home, but this package assumes
!! $mastodon_dir. Although it's possible to use a different directory,
!! it's really not easy.
!!
!! Please change mastodon's home directory to $mastodon_dir, or adjust settings
!! and move files yourself. Otherwise Mastodon will not work!
!!
EOF
fi
exit 0

View file

@ -20,7 +20,7 @@ start() {
--user="mastodon" \
--make-pidfile --pidfile="${pidfile}" \
-1 "${logfile}" -2 "${logfile}" \
--exec /usr/bin/env -- RAILS_ENV=production DB_POOL=5 bundle exec sidekiq -c 5 -q default -q mailers -q pull -q push
--exec /usr/bin/env -- RAILS_ENV=production DB_POOL=25 MALLOC_ARENA_MAX=2 bundle exec sidekiq -c 25
eend $?
}

View file

@ -20,7 +20,7 @@ start() {
--user="mastodon" \
--make-pidfile --pidfile="${pidfile}" \
--stdout "${logfile}" --stderr "${logfile}" \
--exec /usr/bin/env -- NODE_ENV=production PORT=4000 /usr/bin/npm run start
--exec /usr/bin/env -- NODE_ENV=production PORT=4000 /usr/bin/node ./streaming/index.js
eend $?
}