Compare commits
5 Commits
5fcf5cb0d4
...
4ccd937aa9
Author | SHA1 | Date |
---|---|---|
fox | 4ccd937aa9 | |
Rin | aa24b2d072 | |
Rin | 0cd76aa22a | |
Rin | 06a2259577 | |
Rin | 7bf26a1094 |
|
@ -1,5 +1,6 @@
|
||||||
[production]
|
[production]
|
||||||
defaults
|
defaults
|
||||||
|
not IE 11
|
||||||
not dead
|
not dead
|
||||||
|
|
||||||
[development]
|
[development]
|
||||||
|
|
|
@ -19,4 +19,3 @@ postgres14
|
||||||
redis
|
redis
|
||||||
elasticsearch
|
elasticsearch
|
||||||
chart
|
chart
|
||||||
data
|
|
||||||
|
|
3
Gemfile
3
Gemfile
|
@ -3,9 +3,6 @@
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
ruby '>= 2.6.0', '< 3.1.0'
|
ruby '>= 2.6.0', '< 3.1.0'
|
||||||
|
|
||||||
|
|
||||||
gem 'psych', '< 4'
|
|
||||||
|
|
||||||
gem 'pkg-config', '~> 1.4'
|
gem 'pkg-config', '~> 1.4'
|
||||||
gem 'rexml', '~> 3.2'
|
gem 'rexml', '~> 3.2'
|
||||||
|
|
||||||
|
|
|
@ -478,7 +478,6 @@ GEM
|
||||||
pry (>= 0.13, < 0.15)
|
pry (>= 0.13, < 0.15)
|
||||||
pry-rails (0.3.9)
|
pry-rails (0.3.9)
|
||||||
pry (>= 0.10.4)
|
pry (>= 0.10.4)
|
||||||
psych (3.3.4)
|
|
||||||
public_suffix (5.0.0)
|
public_suffix (5.0.0)
|
||||||
puma (5.6.5)
|
puma (5.6.5)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
|
@ -814,7 +813,6 @@ DEPENDENCIES
|
||||||
private_address_check (~> 0.5)
|
private_address_check (~> 0.5)
|
||||||
pry-byebug (~> 3.10)
|
pry-byebug (~> 3.10)
|
||||||
pry-rails (~> 0.3)
|
pry-rails (~> 0.3)
|
||||||
psych (< 4)
|
|
||||||
puma (~> 5.6)
|
puma (~> 5.6)
|
||||||
pundit (~> 2.2)
|
pundit (~> 2.2)
|
||||||
rack (~> 2.2.4)
|
rack (~> 2.2.4)
|
||||||
|
@ -860,9 +858,3 @@ DEPENDENCIES
|
||||||
webpacker (~> 5.4)
|
webpacker (~> 5.4)
|
||||||
webpush!
|
webpush!
|
||||||
xorcist (~> 1.1)
|
xorcist (~> 1.1)
|
||||||
|
|
||||||
RUBY VERSION
|
|
||||||
ruby 3.0.4p208
|
|
||||||
|
|
||||||
BUNDLED WITH
|
|
||||||
2.3.26
|
|
||||||
|
|
|
@ -13,11 +13,8 @@ end
|
||||||
$provision = <<SCRIPT
|
$provision = <<SCRIPT
|
||||||
# see SETUP.md for details
|
# see SETUP.md for details
|
||||||
|
|
||||||
export RAILS_ENV=development
|
# packages
|
||||||
export NODE_ENV=development
|
#all | sudo pacman -Syu --noconfirm base-devel
|
||||||
export NODE_OPTIONS=--openssl-legacy-provider
|
|
||||||
|
|
||||||
echo '[treehouse-vagrant] install packages'
|
|
||||||
sudo pacman -Syu --noconfirm base-devel git libidn
|
sudo pacman -Syu --noconfirm base-devel git libidn
|
||||||
sudo pacman -Syu --noconfirm ruby ruby-bundler ruby-irb redis postgresql yarn
|
sudo pacman -Syu --noconfirm ruby ruby-bundler ruby-irb redis postgresql yarn
|
||||||
git clone https://aur.archlinux.org/ruby-foreman.git
|
git clone https://aur.archlinux.org/ruby-foreman.git
|
||||||
|
@ -27,51 +24,42 @@ yes | sudo -u vagrant makepkg -si
|
||||||
# treehouse mastodon files are synced here
|
# treehouse mastodon files are synced here
|
||||||
cd /vagrant
|
cd /vagrant
|
||||||
|
|
||||||
echo '[treehouse-vagrant] init database'
|
## database
|
||||||
if [ -d "data/" ]; then rm -rf data/; fi
|
if [ -d "data/" ]; then rm -rf data/; fi
|
||||||
mkdir -p data/
|
mkdir -p data/
|
||||||
pg_ctl -D data/postgres initdb -o '-U mastodon --auth-host=trust'
|
pg_ctl -D data/postgres initdb -o '-U mastodon --auth-host=trust'
|
||||||
echo 'unix_socket_directories = .' >> data/postgres/postgresql.conf
|
echo 'unix_socket_directories = .' >> data/postgres/postgresql.conf
|
||||||
pg_ctl -D data/postgres start --silent
|
pg_ctl -D data/postgres start --silent
|
||||||
|
|
||||||
echo '[treehouse-vagrant] start redis'
|
# redis
|
||||||
mkdir -p data/redis
|
mkdir -p data/redis
|
||||||
redis-server ./redis-dev.conf
|
redis-server ./redis-dev.conf
|
||||||
|
|
||||||
echo '[treehouse-vagrant] bundle install'
|
# ruby
|
||||||
|
export RAILS_ENV=development
|
||||||
if [ -d "vendor/bundle/" ]; then rm -rf vendor/bundle/; fi
|
if [ -d "vendor/bundle/" ]; then rm -rf vendor/bundle/; fi
|
||||||
bundle config set --local path 'vendor/bundle/'
|
bundle config set --local path 'vendor/bundle/'
|
||||||
bundle install
|
bundle install
|
||||||
|
|
||||||
echo '[treehouse-vagrant] yarn install'
|
|
||||||
yarn add webpack
|
|
||||||
git restore package.json yarn.lock
|
|
||||||
yarn install
|
yarn install
|
||||||
|
bundle exec rake db:setup
|
||||||
|
|
||||||
echo '[treehouse-vagrant] bundle db'
|
# run mastodon
|
||||||
bundle exec rake db:setup || exit
|
export NODE_ENV=development
|
||||||
|
bundle exec rake assets:precompile
|
||||||
echo '[treehouse-vagrant] bundle assets'
|
|
||||||
bundle exec rake assets:precompile || exit
|
|
||||||
|
|
||||||
echo '[treehouse-vagrant] foreman start'
|
|
||||||
foreman start
|
foreman start
|
||||||
|
|
||||||
SCRIPT
|
SCRIPT
|
||||||
|
|
||||||
# TODO: allow `vagrant up`
|
$start = <<SCRIPT
|
||||||
# this requires persistent storage
|
|
||||||
# i.e., not saving data, assets, etc to /vagrant
|
export NODE_ENV=development
|
||||||
#$start = <<SCRIPT
|
export RAILS_ENV=development
|
||||||
#
|
cd /vagrant
|
||||||
#export NODE_ENV=development
|
pg_ctl -D data/postgres start --silent
|
||||||
#export RAILS_ENV=development
|
redis-server ./redis-dev.conf
|
||||||
#cd /vagrant
|
foreman start
|
||||||
#pg_ctl -D data/postgres start --silent
|
|
||||||
#redis-server ./redis-dev.conf
|
SCRIPT
|
||||||
#foreman start
|
|
||||||
#
|
|
||||||
#SCRIPT
|
|
||||||
|
|
||||||
Vagrant.configure("2") do |config|
|
Vagrant.configure("2") do |config|
|
||||||
|
|
||||||
|
@ -80,7 +68,7 @@ Vagrant.configure("2") do |config|
|
||||||
config.vm.box = "archlinux/archlinux"
|
config.vm.box = "archlinux/archlinux"
|
||||||
config.vm.hostname = "mastodon.local"
|
config.vm.hostname = "mastodon.local"
|
||||||
|
|
||||||
# vagrant ssh -- -L 3000:localhost:3000 (:
|
# vagrant ssh -- -R 3000:localhost:3000 (:
|
||||||
#config.vm.network :forwarded_port, guest: 3000, host: 3000
|
#config.vm.network :forwarded_port, guest: 3000, host: 3000
|
||||||
|
|
||||||
config.vm.synced_folder ".", "/vagrant",
|
config.vm.synced_folder ".", "/vagrant",
|
||||||
|
@ -89,7 +77,7 @@ Vagrant.configure("2") do |config|
|
||||||
rsync__exclide: ".git/"
|
rsync__exclide: ".git/"
|
||||||
|
|
||||||
config.vm.provision :shell, inline: $provision, privileged: false
|
config.vm.provision :shell, inline: $provision, privileged: false
|
||||||
#config.vm.provision :shell, inline: $start, run: 'always', privileged: false
|
config.vm.provision :shell, inline: $start, run: 'always', privileged: false
|
||||||
|
|
||||||
config.vm.provider :libvirt do |libvirt|
|
config.vm.provider :libvirt do |libvirt|
|
||||||
libvirt.driver = "kvm"
|
libvirt.driver = "kvm"
|
||||||
|
|
|
@ -285,28 +285,23 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@mixin focusable {
|
|
||||||
outline: 0;
|
|
||||||
background: lighten($ui-base-color, 4%);
|
|
||||||
|
|
||||||
&.status.status-direct {
|
|
||||||
background: lighten($ui-base-color, 12%);
|
|
||||||
|
|
||||||
&.muted {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.detailed-status,
|
|
||||||
.detailed-status__action-bar {
|
|
||||||
background: lighten($ui-base-color, 8%);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.focusable {
|
.focusable {
|
||||||
&:focus,
|
&:focus {
|
||||||
&:hover {
|
outline: 0;
|
||||||
@include focusable;
|
background: lighten($ui-base-color, 4%);
|
||||||
|
|
||||||
|
&.status.status-direct {
|
||||||
|
background: lighten($ui-base-color, 12%);
|
||||||
|
|
||||||
|
&.muted {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailed-status,
|
||||||
|
.detailed-status__action-bar {
|
||||||
|
background: lighten($ui-base-color, 8%);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,8 @@ class LinkFooter extends React.PureComponent {
|
||||||
{' '}
|
{' '}
|
||||||
<a href='https://joinmastodon.org' target='_blank'><FormattedMessage id='footer.about' defaultMessage='About' /></a>
|
<a href='https://joinmastodon.org' target='_blank'><FormattedMessage id='footer.about' defaultMessage='About' /></a>
|
||||||
{' · '}
|
{' · '}
|
||||||
|
<a href='https://joinmastodon.org/apps' target='_blank'><FormattedMessage id='footer.get_app' defaultMessage='Get the app' /></a>
|
||||||
|
{' · '}
|
||||||
<Link to='/keyboard-shortcuts'><FormattedMessage id='footer.keyboard_shortcuts' defaultMessage='Keyboard shortcuts' /></Link>
|
<Link to='/keyboard-shortcuts'><FormattedMessage id='footer.keyboard_shortcuts' defaultMessage='Keyboard shortcuts' /></Link>
|
||||||
{' · '}
|
{' · '}
|
||||||
<a href={source_url} rel='noopener noreferrer' target='_blank'><FormattedMessage id='footer.source_code' defaultMessage='View source code' /></a>
|
<a href={source_url} rel='noopener noreferrer' target='_blank'><FormattedMessage id='footer.source_code' defaultMessage='View source code' /></a>
|
||||||
|
|
|
@ -33,11 +33,11 @@ module Mastodon
|
||||||
end
|
end
|
||||||
|
|
||||||
def repository
|
def repository
|
||||||
ENV.fetch('GIT_REPOSITORY', false) || ENV.fetch('GITHUB_REPOSITORY', false) || 'treehouse/mastodon'
|
ENV.fetch('GITHUB_REPOSITORY', 'glitch-soc/mastodon')
|
||||||
end
|
end
|
||||||
|
|
||||||
def source_base_url
|
def source_base_url
|
||||||
ENV.fetch('SOURCE_BASE_URL', "https://gitea.treehouse.systems/#{repository}")
|
ENV.fetch('SOURCE_BASE_URL', "https://github.com/#{repository}")
|
||||||
end
|
end
|
||||||
|
|
||||||
# specify git tag or commit hash here
|
# specify git tag or commit hash here
|
||||||
|
@ -46,13 +46,8 @@ module Mastodon
|
||||||
end
|
end
|
||||||
|
|
||||||
def source_url
|
def source_url
|
||||||
if source_tag && source_base_url =~ /gitea/
|
if source_tag
|
||||||
suffix = if !str[/\H/]
|
"#{source_base_url}/tree/#{source_tag}"
|
||||||
"commit/#{source_tag}"
|
|
||||||
else
|
|
||||||
"branch/#{source_tag}"
|
|
||||||
end
|
|
||||||
"#{source_base_url}/#{suffix}"
|
|
||||||
else
|
else
|
||||||
source_base_url
|
source_base_url
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,107 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require 'pathname'
|
|
||||||
|
|
||||||
DATA_DIR = Pathname.new('data')
|
|
||||||
POSTGRES_DIR = DATA_DIR / 'postgres'
|
|
||||||
POSTGRES_CONF_FILE = POSTGRES_DIR / 'postgresql.conf'
|
|
||||||
POSTGRES_SOCKET_FILE = POSTGRES_DIR / '.s.PGSQL.5432'
|
|
||||||
POSTGRES_PID_FILE = POSTGRES_DIR / 'postmaster.pid'
|
|
||||||
REDIS_DIR = DATA_DIR / 'redis'
|
|
||||||
REDIS_PID_FILE = REDIS_DIR / 'redis-dev.pid'
|
|
||||||
|
|
||||||
def get_pid(pid_file)
|
|
||||||
return false unless File.file?(pid_file)
|
|
||||||
pid = File.read(pid_file).to_i
|
|
||||||
|
|
||||||
Process.kill(0, pid)
|
|
||||||
pid
|
|
||||||
rescue Errno::ESRCH
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def postgres_running?
|
|
||||||
get_pid POSTGRES_PID_FILE
|
|
||||||
end
|
|
||||||
|
|
||||||
directory REDIS_DIR.to_s
|
|
||||||
|
|
||||||
namespace :deps do
|
|
||||||
task start: ['postgres:start', 'redis:start']
|
|
||||||
task stop: ['postgres:stop', 'redis:stop']
|
|
||||||
|
|
||||||
namespace :postgres do
|
|
||||||
namespace :setup do
|
|
||||||
task all: [POSTGRES_DIR.to_s]
|
|
||||||
|
|
||||||
file POSTGRES_DIR.to_s do
|
|
||||||
if POSTGRES_CONF_FILE.exist?
|
|
||||||
puts 'Postgres conf exists, skipping initdb'
|
|
||||||
next
|
|
||||||
end
|
|
||||||
sh %(printf '%s\\n' pg_ctl -D data/postgres initdb -o '-U mastodon --auth-host=trust')
|
|
||||||
end
|
|
||||||
|
|
||||||
task configure: [POSTGRES_DIR.to_s] do
|
|
||||||
next if File.foreach(POSTGRES_CONF_FILE).detect? { |line| line == /^unix_socket_directories = \.\s*$/ }
|
|
||||||
|
|
||||||
POSTGRES_CONF_FILE.open('at') do |f|
|
|
||||||
f.write("\n", PG_SOCKET_DIRECTORIES_LINE, "\n")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
task start: ['setup:all'] do
|
|
||||||
if (pid = get_pid POSTGRES_PID_FILE)
|
|
||||||
puts "Postgres is running (pid #{pid})!"
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
puts 'Starting postgres...'
|
|
||||||
puts '=========='
|
|
||||||
sh %(pg_ctl -D ./data/postgres start)
|
|
||||||
puts '=========='
|
|
||||||
end
|
|
||||||
|
|
||||||
task :stop do
|
|
||||||
unless (pid = get_pid POSTGRES_PID_FILE)
|
|
||||||
puts "Postgres isn't running!"
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
puts "Stopping Postgres (pid #{pid})...\n=========="
|
|
||||||
sh %(pg_ctl -D ./data/postgres stop)
|
|
||||||
puts '=========='
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
namespace :redis do
|
|
||||||
task init: [REDIS_DIR.to_s] do
|
|
||||||
end
|
|
||||||
|
|
||||||
task start: [:init] do
|
|
||||||
if (pid = get_pid REDIS_PID_FILE)
|
|
||||||
puts "Redis is running (pid #{pid})!"
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
puts 'Starting redis...'
|
|
||||||
puts '=========='
|
|
||||||
sh %(redis-server redis-dev.conf)
|
|
||||||
puts '=========='
|
|
||||||
end
|
|
||||||
|
|
||||||
task :stop do
|
|
||||||
unless (pid = get_pid REDIS_PID_FILE)
|
|
||||||
puts "Redis isn't running!"
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
puts "Stopping Redis (pid #{pid})...\n=========="
|
|
||||||
Process.kill(:TERM, pid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
namespace :memcached do
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -36,13 +36,12 @@
|
||||||
"@rails/ujs": "^6.1.7",
|
"@rails/ujs": "^6.1.7",
|
||||||
"abortcontroller-polyfill": "^1.7.5",
|
"abortcontroller-polyfill": "^1.7.5",
|
||||||
"array-includes": "^3.1.5",
|
"array-includes": "^3.1.5",
|
||||||
"arrow-key-navigation": "^1.2.0",
|
|
||||||
"atrament": "0.2.4",
|
"atrament": "0.2.4",
|
||||||
|
"arrow-key-navigation": "^1.2.0",
|
||||||
"autoprefixer": "^9.8.8",
|
"autoprefixer": "^9.8.8",
|
||||||
"axios": "^1.1.3",
|
"axios": "^1.1.3",
|
||||||
"babel-loader": "^8.2.5",
|
"babel-loader": "^8.2.5",
|
||||||
"babel-plugin-lodash": "^3.3.4",
|
"babel-plugin-lodash": "^3.3.4",
|
||||||
"babel-plugin-macros": "^3.1.0",
|
|
||||||
"babel-plugin-preval": "^5.1.0",
|
"babel-plugin-preval": "^5.1.0",
|
||||||
"babel-plugin-react-intl": "^6.2.0",
|
"babel-plugin-react-intl": "^6.2.0",
|
||||||
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
||||||
|
@ -174,6 +173,5 @@
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"bufferutil": "^4.0.7",
|
"bufferutil": "^4.0.7",
|
||||||
"utf-8-validate": "^5.0.10"
|
"utf-8-validate": "^5.0.10"
|
||||||
},
|
}
|
||||||
"packageManager": "yarn@3.3.0"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,8 +87,8 @@ describe InstancePresenter do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#source_url' do
|
describe '#source_url' do
|
||||||
it 'returns the default URL' do
|
it 'returns "https://github.com/glitch-soc/mastodon"' do
|
||||||
expect(instance_presenter.source_url).to eq('https://gitea.treehouse.systems/treehouse/mastodon')
|
expect(instance_presenter.source_url).to eq('https://github.com/glitch-soc/mastodon')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue