Merge branch 'gab_provision' of https://code.gab.com/gab/social/gab-social into develop

This commit is contained in:
admin 2021-01-27 16:16:48 -05:00
commit 87138932a0
28 changed files with 353 additions and 202 deletions

View File

@ -1,2 +1,3 @@
VAGRANT=true
LOCAL_DOMAIN=gabsocial.local
DB_HOST=/var/run/postgresql/

View File

@ -6,7 +6,7 @@ ruby '>= 2.4.0', '< 2.7.0'
gem 'pkg-config', '~> 1.3'
gem 'puma', '~> 5.0'
gem 'rails', '~> 5.2.3'
gem 'rails', '6.0.3.4'
gem 'thor', '~> 0.20'
gem 'hamlit-rails', '~> 0.2'
@ -59,7 +59,7 @@ gem 'kaminari', '~> 1.1'
gem 'link_header', '~> 0.0'
gem 'mime-types', '~> 3.2', require: 'mime/types/columnar'
gem 'nokogiri', '~> 1.10'
gem 'nsa', '~> 0.2'
# gem 'nsa', '~> 0.2'
gem 'oj', '~> 3.7'
gem 'ostatus2', '~> 2.0'
gem 'ox', '~> 2.10'
@ -68,7 +68,7 @@ gem 'pundit', '~> 2.0'
gem 'premailer-rails'
gem 'rack-attack', '~> 6.0'
gem 'rack-cors', '~> 1.0', require: 'rack/cors'
gem 'rails-i18n', '~> 5.1'
gem 'rails-i18n', '~> 6.0.0'
gem 'rails-settings-cached', '~> 0.6'
gem 'redis', '~> 4.2', require: ['redis', 'redis/connection/hiredis']
gem 'mario-redis-lock', '~> 1.2', require: 'redis_lock'
@ -127,6 +127,7 @@ group :development do
gem 'better_errors', '~> 2.5'
gem 'binding_of_caller', '~> 0.7'
gem 'bullet', '~> 6.0'
gem 'listen'
gem 'letter_opener', '~> 1.7'
gem 'letter_opener_web', '~> 1.3'
gem 'memory_profiler'
@ -146,7 +147,6 @@ end
group :production do
gem 'lograge', '~> 0.11'
gem 'redis-rails', '~> 5.0'
end
gem 'concurrent-ruby', require: false

View File

@ -15,53 +15,67 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.4.4)
actionpack (= 5.2.4.4)
actioncable (6.0.3.4)
actionpack (= 6.0.3.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.4.4)
actionpack (= 5.2.4.4)
actionview (= 5.2.4.4)
activejob (= 5.2.4.4)
actionmailbox (6.0.3.4)
actionpack (= 6.0.3.4)
activejob (= 6.0.3.4)
activerecord (= 6.0.3.4)
activestorage (= 6.0.3.4)
activesupport (= 6.0.3.4)
mail (>= 2.7.1)
actionmailer (6.0.3.4)
actionpack (= 6.0.3.4)
actionview (= 6.0.3.4)
activejob (= 6.0.3.4)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.4.4)
actionview (= 5.2.4.4)
activesupport (= 5.2.4.4)
actionpack (6.0.3.4)
actionview (= 6.0.3.4)
activesupport (= 6.0.3.4)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.4.4)
activesupport (= 5.2.4.4)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.3.4)
actionpack (= 6.0.3.4)
activerecord (= 6.0.3.4)
activestorage (= 6.0.3.4)
activesupport (= 6.0.3.4)
nokogiri (>= 1.8.5)
actionview (6.0.3.4)
activesupport (= 6.0.3.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_model_serializers (0.10.11)
actionpack (>= 4.1, < 6.1)
activemodel (>= 4.1, < 6.1)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_model_serializers (0.10.12)
actionpack (>= 4.1, < 6.2)
activemodel (>= 4.1, < 6.2)
case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
active_record_query_trace (1.8)
activejob (5.2.4.4)
activesupport (= 5.2.4.4)
activejob (6.0.3.4)
activesupport (= 6.0.3.4)
globalid (>= 0.3.6)
activemodel (5.2.4.4)
activesupport (= 5.2.4.4)
activerecord (5.2.4.4)
activemodel (= 5.2.4.4)
activesupport (= 5.2.4.4)
arel (>= 9.0)
activestorage (5.2.4.4)
actionpack (= 5.2.4.4)
activerecord (= 5.2.4.4)
activemodel (6.0.3.4)
activesupport (= 6.0.3.4)
activerecord (6.0.3.4)
activemodel (= 6.0.3.4)
activesupport (= 6.0.3.4)
activestorage (6.0.3.4)
actionpack (= 6.0.3.4)
activejob (= 6.0.3.4)
activerecord (= 6.0.3.4)
marcel (~> 0.3.1)
activesupport (5.2.4.4)
activesupport (6.0.3.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
airbrussh (1.4.0)
@ -69,23 +83,22 @@ GEM
annotate (2.7.5)
activerecord (>= 3.2, < 7.0)
rake (>= 10.4, < 13.0)
arel (9.0.0)
ast (2.4.1)
attr_encrypted (3.1.0)
encryptor (~> 3.0.0)
av (0.9.0)
cocaine (~> 0.5.3)
aws-eventstream (1.1.0)
aws-partitions (1.404.0)
aws-sdk-core (3.110.0)
aws-partitions (1.418.0)
aws-sdk-core (3.111.2)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.39.0)
aws-sdk-kms (1.41.0)
aws-sdk-core (~> 3, >= 3.109.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.86.0)
aws-sdk-s3 (1.87.0)
aws-sdk-core (~> 3, >= 3.109.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
@ -103,17 +116,17 @@ GEM
ffi (~> 1.10.0)
bootsnap (1.5.1)
msgpack (~> 1.0)
brakeman (4.10.0)
browser (5.1.0)
brakeman (4.10.1)
browser (5.3.0)
builder (3.2.4)
bullet (6.1.0)
bullet (6.1.3)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
bundler-audit (0.7.0.1)
bundler (>= 1.2.0, < 3)
thor (>= 0.18, < 2)
byebug (11.1.3)
capistrano (3.14.1)
capistrano (3.15.0)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
@ -143,26 +156,29 @@ GEM
activesupport (>= 4.0)
elasticsearch (>= 2.0.0)
elasticsearch-dsl
chunky_png (1.3.14)
chunky_png (1.4.0)
cld3 (3.2.6)
ffi (>= 1.1.0, < 1.12.0)
climate_control (0.2.0)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.3)
concurrent-ruby (1.1.7)
concurrent-ruby (1.1.8)
connection_pool (2.2.3)
crack (0.4.4)
crack (0.4.5)
rexml
crass (1.0.6)
css_parser (1.7.1)
css_parser (1.8.0)
addressable
debug_inspector (0.0.3)
derailed_benchmarks (1.8.1)
dead_end (1.1.3)
debug_inspector (1.0.0)
derailed_benchmarks (2.0.0)
benchmark-ips (~> 2)
dead_end
get_process_mem (~> 0)
heapy (~> 0)
memory_profiler (~> 0)
mini_histogram (>= 0.2.1)
memory_profiler (>= 0, < 2)
mini_histogram (>= 0.3.0)
rack (>= 1)
rake (> 10, < 14)
ruby-statistics (>= 2.1)
@ -183,7 +199,7 @@ GEM
devise (>= 4.0.0)
rpam2 (~> 4.0)
diff-lcs (1.4.4)
docile (1.3.2)
docile (1.3.5)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
doorkeeper (5.4.0)
@ -193,13 +209,13 @@ GEM
dotenv (= 2.7.6)
railties (>= 3.2)
e2mmap (0.1.0)
elasticsearch (7.10.0)
elasticsearch-api (= 7.10.0)
elasticsearch-transport (= 7.10.0)
elasticsearch-api (7.10.0)
elasticsearch (7.10.1)
elasticsearch-api (= 7.10.1)
elasticsearch-transport (= 7.10.1)
elasticsearch-api (7.10.1)
multi_json
elasticsearch-dsl (0.1.9)
elasticsearch-transport (7.10.0)
elasticsearch-transport (7.10.1)
faraday (~> 1)
multi_json
encryptor (3.0.0)
@ -210,11 +226,13 @@ GEM
fabrication (2.21.1)
faker (1.9.6)
i18n (>= 0.7)
faraday (1.1.0)
faraday (1.3.0)
faraday-net_http (~> 1.0)
multipart-post (>= 1.2, < 3)
ruby2_keywords
faraday-net_http (1.0.1)
fast_blank (1.0.0)
fastimage (2.2.0)
fastimage (2.2.1)
ffi (1.10.0)
fog-core (2.1.0)
builder
@ -229,10 +247,10 @@ GEM
fog-json (>= 1.0)
ipaddress (>= 0.8)
formatador (0.2.5)
fugit (1.4.1)
fugit (1.4.2)
et-orbi (~> 1.1, >= 1.1.8)
raabro (~> 1.4)
fuubar (2.5.0)
fuubar (2.5.1)
rspec-core (~> 3.0)
ruby-progressbar (~> 1.4)
get_process_mem (0.2.7)
@ -244,7 +262,7 @@ GEM
http (~> 3.0)
nokogiri (~> 1.8)
oj (~> 3.0)
hamlit (2.13.0)
hamlit (2.14.2)
temple (>= 0.8.2)
thor
tilt
@ -275,9 +293,9 @@ GEM
httplog (1.4.3)
rack (>= 1.0)
rainbow (>= 2.0.0)
i18n (1.8.5)
i18n (1.8.7)
concurrent-ruby (~> 1.0)
i18n-tasks (0.9.31)
i18n-tasks (0.9.33)
activesupport (>= 4.0.2)
ast (>= 2.1.0)
erubi
@ -291,16 +309,16 @@ GEM
ipaddress (0.8.3)
iso-639 (0.3.5)
jmespath (1.4.0)
json (2.3.1)
json (2.5.1)
json-canonicalization (0.2.0)
json-ld (3.1.5)
json-ld (3.1.7)
htmlentities (~> 4.3)
json-canonicalization (~> 0.2)
link_header (~> 0.0, >= 0.0.8)
multi_json (~> 1.14)
rack (~> 2.0)
rdf (~> 3.1)
json-ld-preloaded (3.1.3)
json-ld-preloaded (3.1.4)
json-ld (~> 3.1)
rdf (~> 3.1)
jsonapi-renderer (0.2.2)
@ -326,23 +344,26 @@ GEM
letter_opener (~> 1.0)
railties (>= 3.2)
link_header (0.0.8)
listen (3.4.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
lograge (0.11.2)
actionpack (>= 4)
activesupport (>= 4)
railties (>= 4)
request_store (~> 1.0)
loofah (2.8.0)
loofah (2.9.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
makara (0.4.1)
makara (0.5.0)
activerecord (>= 3.0.0)
marcel (0.3.3)
mimemagic (~> 0.3.2)
mario-redis-lock (1.2.1)
redis (>= 3.0.5)
memory_profiler (0.9.14)
memory_profiler (1.0.0)
method_source (1.0.0)
microformats (4.2.1)
json (~> 2.2)
@ -353,8 +374,8 @@ GEM
mimemagic (0.3.5)
mini_histogram (0.3.1)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.14.2)
mini_portile2 (2.5.0)
minitest (5.14.3)
msgpack (1.3.3)
multi_json (1.15.0)
multipart-post (2.1.1)
@ -363,16 +384,12 @@ GEM
net-ssh (>= 2.6.5, < 7.0.0)
net-ssh (6.1.0)
nio4r (2.5.4)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
nokogiri (1.11.1)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
nokogumbo (2.0.4)
nokogiri (~> 1.8, >= 1.8.4)
nsa (0.2.7)
activesupport (>= 4.2, < 6)
concurrent-ruby (~> 1.0, >= 1.0.2)
sidekiq (>= 3.5)
statsd-ruby (~> 1.4, >= 1.4.0)
oj (3.10.16)
oj (3.11.0)
omniauth (1.9.1)
hashie (>= 3.4.6)
rack (>= 1.6.2, < 3)
@ -388,7 +405,7 @@ GEM
addressable (~> 2.5)
http (~> 3.0)
nokogiri (~> 1.8)
ox (2.13.4)
ox (2.14.1)
paperclip (6.1.0)
activemodel (>= 4.2.0)
activesupport (>= 4.2.0)
@ -401,7 +418,7 @@ GEM
parallel (1.20.1)
parallel_tests (2.32.0)
parallel
parser (2.7.2.0)
parser (3.0.0.0)
ast (~> 2.4.1)
pastel (0.8.0)
tty-color (~> 0.5)
@ -426,11 +443,12 @@ GEM
pry-rails (0.3.9)
pry (>= 0.10.4)
public_suffix (4.0.6)
puma (5.1.0)
puma (5.1.1)
nio4r (~> 2.0)
pundit (2.1.0)
activesupport (>= 3.0.0)
raabro (1.4.0)
racc (1.5.2)
rack (2.2.3)
rack-attack (6.3.1)
rack (>= 1.0, < 3)
@ -440,18 +458,20 @@ GEM
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.4.4)
actioncable (= 5.2.4.4)
actionmailer (= 5.2.4.4)
actionpack (= 5.2.4.4)
actionview (= 5.2.4.4)
activejob (= 5.2.4.4)
activemodel (= 5.2.4.4)
activerecord (= 5.2.4.4)
activestorage (= 5.2.4.4)
activesupport (= 5.2.4.4)
rails (6.0.3.4)
actioncable (= 6.0.3.4)
actionmailbox (= 6.0.3.4)
actionmailer (= 6.0.3.4)
actionpack (= 6.0.3.4)
actiontext (= 6.0.3.4)
actionview (= 6.0.3.4)
activejob (= 6.0.3.4)
activemodel (= 6.0.3.4)
activerecord (= 6.0.3.4)
activestorage (= 6.0.3.4)
activesupport (= 6.0.3.4)
bundler (>= 1.3.0)
railties (= 5.2.4.4)
railties (= 6.0.3.4)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
@ -462,47 +482,31 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
rails-i18n (5.1.3)
rails-i18n (6.0.0)
i18n (>= 0.7, < 2)
railties (>= 5.0, < 6)
railties (>= 6.0.0, < 7)
rails-settings-cached (0.7.2)
rails (>= 4.2.0)
railties (5.2.4.4)
actionpack (= 5.2.4.4)
activesupport (= 5.2.4.4)
railties (6.0.3.4)
actionpack (= 6.0.3.4)
activesupport (= 6.0.3.4)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
thor (>= 0.20.3, < 2.0)
rainbow (3.0.0)
rake (12.3.3)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
rdf (3.1.7)
rdf (3.1.9)
hamster (~> 3.0)
link_header (~> 0.0, >= 0.0.8)
rdf-normalize (0.4.0)
rdf (~> 3.1)
redcarpet (3.5.0)
redcarpet (3.5.1)
redis (4.2.5)
redis-actionpack (5.2.0)
actionpack (>= 5, < 7)
redis-rack (>= 2.1.0, < 3)
redis-store (>= 1.1.0, < 2)
redis-activesupport (5.2.0)
activesupport (>= 3, < 7)
redis-store (>= 1.3, < 2)
redis-namespace (1.8.0)
redis (>= 3.0.4)
redis-rack (2.1.3)
rack (>= 2.0.8, < 3)
redis-store (>= 1.2, < 2)
redis-rails (5.0.2)
redis-actionpack (>= 5.0, < 6)
redis-activesupport (>= 5.0, < 6)
redis-store (>= 1.2, < 2)
redis-store (1.9.0)
redis (>= 4, < 5)
regexp_parser (1.8.2)
request_store (1.5.0)
rack (>= 1.4)
@ -543,16 +547,16 @@ GEM
rubocop-ast (>= 0.6.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.3.0)
rubocop-ast (1.4.0)
parser (>= 2.7.1.5)
ruby-progressbar (1.10.1)
ruby-progressbar (1.11.0)
ruby-saml (1.11.0)
nokogiri (>= 1.5.10)
ruby-statistics (2.1.2)
ruby2_keywords (0.0.2)
rufus-scheduler (3.6.0)
ruby2_keywords (0.0.4)
rufus-scheduler (3.7.0)
fugit (~> 1.1, >= 1.1.6)
sanitize (5.2.1)
sanitize (5.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.8.0)
nokogumbo (~> 2.0)
@ -563,7 +567,7 @@ GEM
rb-inotify (~> 0.9, >= 0.9.7)
scss_lint (0.59.0)
sass (~> 3.5, >= 3.5.5)
sidekiq (6.1.2)
sidekiq (6.1.3)
connection_pool (>= 2.2.2)
rack (~> 2.0)
redis (>= 4.2.0)
@ -585,7 +589,7 @@ GEM
simple_form (4.1.0)
actionpack (>= 5.0)
activemodel (>= 5.0)
simplecov (0.20.0)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
@ -598,15 +602,14 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sshkit (1.21.1)
sshkit (1.21.2)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
stackprof (0.2.16)
statsd-ruby (1.4.0)
stoplight (2.1.3)
streamio-ffmpeg (3.0.2)
multi_json (~> 1.8)
strong_migrations (0.7.3)
strong_migrations (0.7.6)
activerecord (>= 5)
temple (0.8.2)
terminal-table (2.0.0)
@ -622,7 +625,7 @@ GEM
tty-command (0.10.0)
pastel (~> 0.8)
tty-cursor (0.7.1)
tty-prompt (0.22.0)
tty-prompt (0.23.0)
pastel (~> 0.8)
tty-reader (~> 0.8)
tty-reader (0.9.0)
@ -632,18 +635,18 @@ GEM
tty-screen (0.8.1)
twitter-text (1.14.7)
unf (~> 0.1.0)
tzinfo (1.2.8)
tzinfo (1.2.9)
thread_safe (~> 0.1)
tzinfo-data (1.2020.4)
tzinfo-data (1.2020.6)
tzinfo (>= 1.0.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
unicode-display_width (1.7.0)
uniform_notifier (1.13.0)
uniform_notifier (1.13.2)
warden (1.2.9)
rack (>= 2.0.9)
webmock (3.10.0)
webmock (3.11.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
@ -660,6 +663,7 @@ GEM
wisper (2.0.1)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.4.2)
PLATFORMS
ruby
@ -718,6 +722,7 @@ DEPENDENCIES
letter_opener (~> 1.7)
letter_opener_web (~> 1.3)
link_header (~> 0.0)
listen
lograge (~> 0.11)
makara (~> 0.4)
mario-redis-lock (~> 1.2)
@ -726,7 +731,6 @@ DEPENDENCIES
mime-types (~> 3.2)
net-ldap (~> 0.10)
nokogiri (~> 1.10)
nsa (~> 0.2)
oj (~> 3.7)
omniauth (~> 1.9)
omniauth-cas (~> 1.1)
@ -748,15 +752,14 @@ DEPENDENCIES
pundit (~> 2.0)
rack-attack (~> 6.0)
rack-cors (~> 1.0)
rails (~> 5.2.3)
rails (= 6.0.3.4)
rails-controller-testing (~> 1.0)
rails-i18n (~> 5.1)
rails-i18n (~> 6.0.0)
rails-settings-cached (~> 0.6)
rdf-normalize (~> 0.3)
redcarpet (~> 3.4)
redis (~> 4.2)
redis-namespace (~> 1.5)
redis-rails (~> 5.0)
rqrcode (~> 0.10)
rspec-rails (~> 3.8)
rspec-sidekiq (~> 3.0)

11
Vagrantfile vendored
View File

@ -14,6 +14,12 @@ sudo apt-add-repository 'deb https://dl.yarnpkg.com/debian/ stable main'
# Add repo for NodeJS
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
# Add repo for Redis (so we can have a newer version than 3.0.6)
# Sidekiq 5+ requires Redis 4+
sudo add-apt-repository ppa:redislabs/redis
sudo apt-get update
# Add firewall rule to redirect 80 to PORT and save
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port #{ENV["PORT"]}
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections
@ -29,7 +35,7 @@ sudo apt-get install \
libxslt1-dev \
imagemagick \
nodejs \
redis-server \
redis \
redis-tools \
postgresql \
postgresql-contrib \
@ -42,6 +48,9 @@ sudo apt-get install \
libpam0g-dev \
-y
# Start Redis Server
sudo service redis-server start
# Install rvm
read RUBY_VERSION < .ruby-version

View File

@ -5,8 +5,6 @@ class ApplicationController < ActionController::Base
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
force_ssl if: :https_enabled?
include Localized
include UserTrackingConcern
include SessionTrackingConcern
@ -31,10 +29,6 @@ class ApplicationController < ActionController::Base
private
def https_enabled?
Rails.env.production?
end
def store_current_location
store_location_for(:user, request.url) if request.format == :html
end

View File

@ -25,7 +25,7 @@ class Settings::ProfilesController < Settings::BaseController
AccountUsernameChange.create!(
account: @account,
from_username: @account.username,
to_username: params[:account][:username]
to_username: params[:account][:username] || ''
)
end

View File

@ -3,7 +3,6 @@
#
# Table name: accounts
#
# id :bigint(8) not null, primary key
# username :string default(""), not null
# domain :string
# secret :string default(""), not null
@ -20,11 +19,11 @@
# url :string
# avatar_file_name :string
# avatar_content_type :string
# avatar_file_size :integer
# avatar_file_size :bigint(8)
# avatar_updated_at :datetime
# header_file_name :string
# header_content_type :string
# header_file_size :integer
# header_file_size :bigint(8)
# header_updated_at :datetime
# avatar_remote_url :string
# subscription_expires_at :datetime
@ -36,6 +35,7 @@
# shared_inbox_url :string default(""), not null
# followers_url :string default(""), not null
# protocol :integer default(0), not null
# id :bigint(8) not null, primary key
# memorial :boolean default(FALSE), not null
# moved_to_account_id :bigint(8)
# featured_collection_url :string
@ -43,10 +43,10 @@
# actor_type :string
# discoverable :boolean
# also_known_as :string is an Array
# silenced_at :datetime
# suspended_at :datetime
# is_pro :boolean default(FALSE), not null
# pro_expires_at :datetime
# silenced_at :datetime
# suspended_at :datetime
# is_verified :boolean default(FALSE), not null
# is_donor :boolean default(FALSE), not null
# is_investor :boolean default(FALSE), not null

View File

@ -7,7 +7,7 @@
# user_id :bigint(8)
# dump_file_name :string
# dump_content_type :string
# dump_file_size :integer
# dump_file_size :bigint(8)
# dump_updated_at :datetime
# processed :boolean default(FALSE), not null
# created_at :datetime not null

View File

@ -12,7 +12,7 @@
# is_approved :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
# unread_count :bigint(8) default(0), not null
# unread_count :bigint(8) default(0)
# chat_message_expiration_policy :string
# is_muted :boolean default(FALSE), not null
#

View File

@ -8,7 +8,7 @@
# domain :string
# image_file_name :string
# image_content_type :string
# image_file_size :integer
# image_file_size :bigint(8)
# image_updated_at :datetime
# created_at :datetime not null
# updated_at :datetime not null

View File

@ -8,7 +8,7 @@
# description :string not null
# cover_image_file_name :string
# cover_image_content_type :string
# cover_image_file_size :integer
# cover_image_file_size :bigint(8)
# cover_image_updated_at :datetime
# is_nsfw :boolean default(FALSE), not null
# is_featured :boolean default(FALSE), not null
@ -18,7 +18,7 @@
# member_count :integer default(0)
# slug :text
# is_private :boolean default(FALSE)
# is_visible :boolean default(FALSE)
# is_visible :boolean default(TRUE)
# tags :string default([]), is an Array
# password :string
# group_category_id :integer

View File

@ -6,7 +6,7 @@
# id :bigint(8) not null, primary key
# list_id :bigint(8) not null
# account_id :bigint(8) not null
# follow_id :bigint(8) default(1)
# follow_id :bigint(8)
#
class ListAccount < ApplicationRecord

View File

@ -3,11 +3,10 @@
#
# Table name: media_attachments
#
# id :bigint(8) not null, primary key
# status_id :bigint(8)
# file_file_name :string
# file_content_type :string
# file_file_size :integer
# file_file_size :bigint(8)
# file_updated_at :datetime
# remote_url :string default(""), not null
# created_at :datetime not null
@ -16,6 +15,7 @@
# type :integer default("image"), not null
# file_meta :json
# account_id :bigint(8)
# id :bigint(8) not null, primary key
# description :text
# scheduled_status_id :bigint(8)
# blurhash :string

View File

@ -9,7 +9,7 @@
# description :string default(""), not null
# image_file_name :string
# image_content_type :string
# image_file_size :integer
# image_file_size :bigint(8)
# image_updated_at :datetime
# type :integer default("link"), not null
# html :text default(""), not null

View File

@ -7,7 +7,7 @@
# var :string default(""), not null
# file_file_name :string
# file_content_type :string
# file_file_size :integer
# file_file_size :bigint(8)
# file_updated_at :datetime
# meta :json
# created_at :datetime not null

View File

@ -1,6 +1,5 @@
#!/usr/bin/env ruby
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = File.expand_path('..', __dir__)
@ -9,22 +8,25 @@ def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
chdir APP_ROOT do
# This script is a starting point to setup your application.
FileUtils.chdir APP_ROOT do
# This script is a way to setup or update your development environment automatically.
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
# Add necessary setup steps to this file.
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
system!('yarn install')
# Install JavaScript dependencies
# system('bin/yarn')
# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
# cp 'config/database.yml.sample', 'config/database.yml'
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
# end
puts "\n== Preparing database =="
system! 'bin/rails db:setup'
system! 'bin/rails db:prepare'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'

10
config/cable.yml Normal file
View File

@ -0,0 +1,10 @@
development:
adapter: async
test:
adapter: test
production:
adapter: redis
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
channel_prefix: gab_social_production

View File

@ -9,21 +9,18 @@ development:
<<: *default
adapter: postgresql_makara
prepared_statements: false
database: <%= ENV['DB_NAME'] || 'gabsocial_development' %>
username: <%= ENV['DB_USER'] %>
password: <%= ENV['DB_PASS'] %>
host: <%= ENV['DB_HOST'] %>
port: <%= ENV['DB_PORT'] %>
makara:
id: postgres
sticky: true
connections:
- role: master
blacklist_duration: 0
url: postgresql://<%= ENV['DB_USER']%>:<%= ENV['DB_PASS'] %>@<%= ENV['DB_HOST'] %>:<%= ENV['DB_PORT'] %>/<%= ENV['DB_NAME'] || 'gabsocial_development' %>
- role: slave
url: postgresql://<%= ENV['DB_USER']%>:<%= ENV['DB_PASS'] %>@<%= ENV['DB_HOST'] %>:<%= ENV['DB_PORT'] %>/<%= ENV['DB_NAME'] || 'gabsocial_development' %>
# database: <%= ENV['DB_NAME'] || 'gabsocial_development' %>
# username: <%= ENV['DB_USER'] %>
# password: <%= ENV['DB_PASS'] %>
# host: <%= ENV['DB_HOST'] %>
# port: <%= ENV['DB_PORT'] %>
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".

View File

@ -17,7 +17,7 @@ Rails.application.configure do
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :redis_store, ENV['REDIS_URL'], REDIS_CACHE_PARAMS
config.cache_store = :redis_cache_store, REDIS_CACHE_PARAMS.merge(url: ENV['REDIS_URL'])
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.to_i}",
@ -38,6 +38,9 @@ Rails.application.configure do
config.x.vapid_private_key = vapid_key.private_key
config.x.vapid_public_key = vapid_key.public_key
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
@ -49,6 +52,9 @@ Rails.application.configure do
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
@ -76,6 +82,8 @@ Rails.application.configure do
# Otherwise, use letter_opener, which launches a browser window to view sent mail.
config.action_mailer.delivery_method = (ENV['HEROKU'] || ENV['VAGRANT'] || ENV['REMOTE_DEV']) ? :letter_opener_web : :letter_opener
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.after_initialize do
Bullet.enable = true
Bullet.bullet_logger = true

View File

@ -41,9 +41,20 @@ Rails.application.configure do
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
# Allow to specify public IP of reverse proxy if it's needed
config.action_dispatch.trusted_proxies = ENV['TRUSTED_PROXY_IP'].split.map { |item| IPAddr.new(item) } if ENV['TRUSTED_PROXY_IP'].present?
# Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info').to_sym
@ -52,7 +63,7 @@ Rails.application.configure do
config.log_tags = [:request_id]
# Use a different cache store in production.
config.cache_store = :redis_store, ENV['CACHE_REDIS_URL'], REDIS_CACHE_PARAMS
config.cache_store = :redis_cache_store, REDIS_CACHE_PARAMS.merge(url: ENV['CACHE_REDIS_URL'])
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
@ -102,4 +113,25 @@ Rails.application.configure do
}
config.x.otp_secret = ENV.fetch('OTP_SECRET')
# Inserts middleware to perform automatic connection switching.
# The `database_selector` hash is used to pass options to the DatabaseSelector
# middleware. The `delay` is used to determine how long to wait after a write
# to send a subsequent read to the primary.
#
# The `database_resolver` class is used by the middleware to determine which
# database is appropriate to use based on the time delay.
#
# The `database_resolver_context` class is used by the middleware to set
# timestamps for the last write to the primary. The resolver uses the context
# class timestamps to determine how long to wait before reading from the
# replica.
#
# By default Rails will store a last write timestamp in the session. The
# DatabaseSelector middleware is designed as such you can define your own
# strategy for connection switching and pass that into the middleware through
# these configuration options.
# config.active_record.database_selector = { delay: 2.seconds }
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
end

View File

@ -27,6 +27,9 @@ Rails.application.configure do
# and should not be used.
config.cache_store = :memory_store
# Store uploaded files on the local file system in a temporary directory.
config.active_storage.service = :test
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false

View File

@ -0,0 +1,53 @@
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 6.0 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# Don't force requests from old versions of IE to be UTF-8 encoded.
Rails.application.config.action_view.default_enforce_utf8 = false
# Embed purpose and expiry metadata inside signed and encrypted
# cookies for increased security.
#
# This option is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.0.
# Rails.application.config.action_dispatch.use_cookies_with_metadata = true
# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification.
# Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false
# Return false instead of self when enqueuing is aborted from a callback.
Rails.application.config.active_job.return_false_on_aborted_enqueue = true
# Send Active Storage analysis and purge jobs to dedicated queues.
Rails.application.config.active_storage.queues.analysis = :active_storage_analysis
Rails.application.config.active_storage.queues.purge = :active_storage_purge
# When assigning to a collection of attachments declared via `has_many_attached`, replace existing
# attachments instead of appending. Use #attach to add new attachments without replacing existing ones.
Rails.application.config.active_storage.replace_on_assign_to_many = true
# Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail.
#
# The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob),
# will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions.
# If you send mail in the background, job workers need to have a copy of
# MailDeliveryJob to ensure all delivery jobs are processed properly.
# Make sure your entire app is migrated and stable on 6.0 before using this setting.
Rails.application.config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob"
# Enable the same cache key to be reused when the object being cached of type
# `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count)
# of the relation's cache key into the cache version to support recycling cache key.
Rails.application.config.active_record.collection_cache_versioning = true
# The Rails 6 default autoloader is Zeitwerk. Zeitwerk has specific expectations on where certain
# classes should be defined. It also requires that constants are not autoloaded in initializers.
# Enabling Zeitwerk would be good, but it'll take some work. Using the :classic autoloader gives
# us the same autoloading that Rails 5.2 had.
# Rails.application.config.autoloader = :zeitwerk
Rails.application.config.autoloader = :classic

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
if ENV['STATSD_ADDR'].present?
if false && ENV['STATSD_ADDR'].present?
host, port = ENV['STATSD_ADDR'].split(':')
statsd = ::Statsd.new(host, port)

View File

@ -12,10 +12,4 @@ workers ENV.fetch('WEB_CONCURRENCY') { 2 }
preload_app!
on_worker_boot do
ActiveSupport.on_load(:active_record) do
ActiveRecord::Base.establish_connection
end
end
plugin :tmp_restart

34
config/storage.yml Normal file
View File

@ -0,0 +1,34 @@
test:
service: Disk
root: <%= Rails.root.join("tmp/storage") %>
local:
service: Disk
root: <%= Rails.root.join("storage") %>
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
# amazon:
# service: S3
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
# region: us-east-1
# bucket: your_own_bucket
# Remember not to checkin your GCS keyfile to a repository
# google:
# service: GCS
# project: your_project
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
# bucket: your_own_bucket
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
# microsoft:
# service: AzureStorage
# storage_account_name: your_account_name
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
# container: your_container_name
# mirror:
# service: Mirror
# primary: local
# mirrors: [ amazon, google, microsoft ]

View File

@ -0,0 +1,10 @@
# This migration comes from active_storage (originally 20180723000244)
class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0]
def up
return if foreign_key_exists?(:active_storage_attachments, column: :blob_id)
if table_exists?(:active_storage_blobs)
add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id
end
end
end

View File

@ -2,18 +2,17 @@
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
# This file is the source Rails uses to define your schema when running `rails
# db:schema:load`. When creating a new database, `rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_01_17_210100) do
ActiveRecord::Schema.define(version: 2021_01_23_050026) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
enable_extension "plpgsql"
create_table "account_conversations", force: :cascade do |t|
@ -113,11 +112,11 @@ ActiveRecord::Schema.define(version: 2021_01_17_210100) do
t.string "url"
t.string "avatar_file_name"
t.string "avatar_content_type"
t.integer "avatar_file_size"
t.bigint "avatar_file_size"
t.datetime "avatar_updated_at"
t.string "header_file_name"
t.string "header_content_type"
t.integer "header_file_size"
t.bigint "header_file_size"
t.datetime "header_updated_at"
t.string "avatar_remote_url"
t.datetime "subscription_expires_at"
@ -136,10 +135,10 @@ ActiveRecord::Schema.define(version: 2021_01_17_210100) do
t.string "actor_type"
t.boolean "discoverable"
t.string "also_known_as", array: true
t.datetime "silenced_at"
t.datetime "suspended_at"
t.boolean "is_pro", default: false, null: false
t.datetime "pro_expires_at"
t.datetime "silenced_at"
t.datetime "suspended_at"
t.boolean "is_verified", default: false, null: false
t.boolean "is_donor", default: false, null: false
t.boolean "is_investor", default: false, null: false
@ -180,7 +179,7 @@ ActiveRecord::Schema.define(version: 2021_01_17_210100) do
t.bigint "user_id"
t.string "dump_file_name"
t.string "dump_content_type"
t.integer "dump_file_size"
t.bigint "dump_file_size"
t.datetime "dump_updated_at"
t.boolean "processed", default: false, null: false
t.datetime "created_at", null: false
@ -223,7 +222,7 @@ ActiveRecord::Schema.define(version: 2021_01_17_210100) do
t.boolean "is_approved", default: false, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "unread_count", default: 0, null: false
t.bigint "unread_count", default: 0
t.string "chat_message_expiration_policy"
t.boolean "is_muted", default: false, null: false
t.index ["account_id"], name: "index_chat_conversation_accounts_on_account_id"
@ -258,7 +257,7 @@ ActiveRecord::Schema.define(version: 2021_01_17_210100) do
t.string "domain"
t.string "image_file_name"
t.string "image_content_type"
t.integer "image_file_size"
t.bigint "image_file_size"
t.datetime "image_updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
@ -372,7 +371,7 @@ ActiveRecord::Schema.define(version: 2021_01_17_210100) do
t.string "description", null: false
t.string "cover_image_file_name"
t.string "cover_image_content_type"
t.integer "cover_image_file_size"
t.bigint "cover_image_file_size"
t.datetime "cover_image_updated_at"
t.boolean "is_nsfw", default: false, null: false
t.boolean "is_featured", default: false, null: false
@ -382,7 +381,7 @@ ActiveRecord::Schema.define(version: 2021_01_17_210100) do
t.integer "member_count", default: 0
t.text "slug"
t.boolean "is_private", default: false
t.boolean "is_visible", default: false
t.boolean "is_visible", default: true
t.string "tags", default: [], array: true
t.string "password"
t.integer "group_category_id"
@ -409,7 +408,7 @@ ActiveRecord::Schema.define(version: 2021_01_17_210100) do
create_table "list_accounts", force: :cascade do |t|
t.bigint "list_id", null: false
t.bigint "account_id", null: false
t.bigint "follow_id", default: 1
t.bigint "follow_id"
t.index ["account_id", "list_id"], name: "index_list_accounts_on_account_id_and_list_id", unique: true
t.index ["follow_id"], name: "index_list_accounts_on_follow_id"
t.index ["list_id", "account_id"], name: "index_list_accounts_on_list_id_and_account_id"
@ -439,7 +438,7 @@ ActiveRecord::Schema.define(version: 2021_01_17_210100) do
t.bigint "status_id"
t.string "file_file_name"
t.string "file_content_type"
t.integer "file_file_size"
t.bigint "file_file_size"
t.datetime "file_updated_at"
t.string "remote_url", default: "", null: false
t.datetime "created_at", null: false
@ -581,7 +580,7 @@ ActiveRecord::Schema.define(version: 2021_01_17_210100) do
t.string "description", default: "", null: false
t.string "image_file_name"
t.string "image_content_type"
t.integer "image_file_size"
t.bigint "image_file_size"
t.datetime "image_updated_at"
t.integer "type", default: 0, null: false
t.text "html", default: "", null: false
@ -684,7 +683,7 @@ ActiveRecord::Schema.define(version: 2021_01_17_210100) do
t.string "var", default: "", null: false
t.string "file_file_name"
t.string "file_content_type"
t.integer "file_file_size"
t.bigint "file_file_size"
t.datetime "file_updated_at"
t.json "meta"
t.datetime "created_at", null: false

View File

@ -43,7 +43,9 @@ module GabSocial
module MigrationHelpers
# Stub for Database.postgresql? from GitLab
def self.postgresql?
ActiveRecord::Base.configurations[Rails.env]['adapter'].casecmp('postgresql_makara').zero?
%w[postgresql postgresql_makara].any? do |adapter|
ActiveRecord::Base.configurations[Rails.env]['adapter'].casecmp(adapter).zero?
end
end
# Stub for Database.mysql? from GitLab