Manual mirror of https://git.twibooru.org/Twibooru/.git/ It was such a pain. I dunno if you received my reply floorb but I replied
Find a file
2025-10-01 04:53:52 -04:00
app fix: it cannot make it worse than it currently be 2025-09-21 22:26:19 -04:00
bin upgrade: upgrade to Rails 8.0; bump Ruby version 2025-01-29 23:33:37 -05:00
config fix: add missing < to avatar.yml 2025-10-01 04:53:52 -04:00
db feat: add Bayes spam filter for comments 2025-08-10 05:07:08 -04:00
doc/deploy Flipper -> Flipflop, remove a bunch of random junk. 2022-08-20 14:39:29 -04:00
lib feat: add Bayes spam filter for comments 2025-08-10 05:07:08 -04:00
log Add log .gitkeep 2021-11-10 17:38:29 -05:00
public upgrade: upgrade to Rails 8.0; bump Ruby version 2025-01-29 23:33:37 -05:00
script Update to Rails 6.0.3.2 2020-07-06 05:23:55 -04:00
spec fix(bans): fix manual IPv6 bans 2025-08-13 01:37:08 -04:00
test tests: add partly broken tests for IPv6 bans 2025-08-10 05:48:28 -04:00
util Stuff 2022-10-09 05:49:07 -04:00
vagrant Update to Rails 6.0.3.2 2020-07-06 05:23:55 -04:00
.gitattributes Make votes kind of work without JS 2021-03-11 03:47:59 -05:00
.gitignore Quick fix for ssrf_filter 2022-10-23 22:37:11 -04:00
.rspec Some testing stuff, fix pastes. 2021-03-01 08:59:35 -05:00
.rubocop.yml style: rubocop - Lint stuff 2024-08-27 00:32:52 -04:00
.rubocop_todo.yml Delete memes 2021-03-02 05:28:31 -05:00
.ruby-version upgrade: upgrade to Rails 8.0; bump Ruby version 2025-01-29 23:33:37 -05:00
.slim-lint.yml Update to Rails 6.0.3.2 2020-07-06 05:23:55 -04:00
babel.config.json Update a bunch of stuff, mainly remove old Sprockets 2022-03-30 06:16:04 -04:00
config.ru Stuff 2022-10-09 05:49:07 -04:00
falcon.rb Fix Falcon.rb 2022-03-30 05:03:55 -04:00
falcon_staging.rb Move that out there I guess 2022-03-30 04:04:54 -04:00
Gemfile feat: add Bayes spam filter for comments 2025-08-10 05:07:08 -04:00
Gemfile.lock feat: add Bayes spam filter for comments 2025-08-10 05:07:08 -04:00
Gemfile.old deps: bundle update; Rails 7.2 2024-08-25 16:26:31 -04:00
LICENSE +NIGGER 2021-09-08 22:46:34 -04:00
package.json fix 2022-08-19 13:33:50 -04:00
Passengerfile.json Let's try Passenger for fun. 2022-08-20 15:02:57 -04:00
Procfile feat(sources): finish initial functional implementation of multiple sources 2025-01-29 21:01:49 -05:00
Procfile.dev feat: initial work on multiple sources; horribly broken 2025-01-27 16:17:07 -05:00
Procfile.production fix: use separate queue for video processing so as to not overload the server 2024-08-27 01:13:58 -04:00
Procfile.staging Move that out there I guess 2022-03-30 04:00:45 -04:00
Rakefile Update to Rails 6.0.3.2 2020-07-06 05:23:55 -04:00
README.md Update README. 2021-05-31 11:34:57 -04:00
rollup.config.js Update a bunch of stuff, mainly remove old Sprockets 2022-03-30 06:16:04 -04:00
yarn.lock deps: yarn upgrade 2024-08-25 15:57:57 -04:00

twibooru-on-rails

If you're reading this, may the gods have mercy 'pon you.

Ignore almost everything below this line. It's wrong.

Installation (Easy mode - For development environments)

Prerequisites

  • Latest version of VirtualBox and the VM Extension Pack (download)
  • Latest version of Vagrant (download)

Installation

  1. Download and install the prerequisites
  2. Open Command Prompt/Terminal and run the following commands:
    vagrant plugin install vagrant-hostmanager
    vagrant plugin install vagrant-vbguest
    
  3. Download and extract the repo
  4. cd into the repo using Command Prompt/Terminal
  5. Run the following command: vagrant up
  6. This would be a good time to rewatch your favorite "PONIES The Anthology" installment, cook & have breakfast/lunch/dinner, walk the dog, clean your room, etc.
    By the time you get back the install will surely have completed.1
  7. ???
  8. Profit!

1 If the install did not finish by the time an activity is complete please select another activity to avoid crippling boredom.

Some Bash scripts are provided in the vagrant directory for your convenience. You can use vagrant/restart, vagrant/stop, vagrant/start and vagrant/status from the project root directory to manage the systemd service within the container. Likewise, vagrant/migrate and vagrant/rollback can be used to run or roll back database migrations, respectively.

If you run into any other issues or need direct command line access you can use vagrant ssh to log into the virtual environment's shell and run any commands you deem necessary.

Installation and requirements (Hard mode - For production, servers)

You should be able to install from top to bottom

OS

  • Linux (Debian stretch or newer, Ubuntu 18.04 will work)

Packages

Root install commands
# Add repositories and keys
apt-get update; apt-get -qq -y install apt-transport-https
echo "deb http://deb.debian.org/debian stretch-backports main" > /etc/apt/sources.list.d/stretch-backports.list
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" > /etc/apt/sources.list.d/elasticsearch-6.x.list
echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" > /etc/apt/sources.list.d/pgdg.list
echo "deb https://deb.nodesource.com/node_12.x stretch main" > /etc/apt/sources.list/nodesource.list
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | apt-key add -
wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
wget -qO - https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -

# Install dependencies
apt-get update
apt-get install elasticsearch ffmpeg gifsicle git libcurl4-openssl-dev \
  libicu-dev libjpeg-progs libopencv-dev libpq-dev libreadline-dev libxml2-dev \
  nodejs optipng libgit2-27 redis-server postgresql-11 nginx libbison-dev \
  libffi-dev libgdbm-dev libncurses5-dev libssl-dev libyaml-dev

# Configure PostgreSQL
sed -i -e 's/md5/trust/' /etc/postgresql/11/main/pg_hba.conf
service postgresql restart
sudo -u postgres createuser -s $APP_USER

# Configure Elasticsearch
# Set this to whatever you think is reasonable
sed -i -e 's/\(-Xm[sx]\)1g/\1256m/' /etc/elasticsearch/jvm.options
systemctl enable elasticsearch
systemctl start elasticsearch

# Follow the instructions at <https://ryanbigg.com/2014/10/ubuntu-ruby-ruby-install-chruby-and-you>
# to install chruby and ruby-install, using chruby 0.3.9 and ruby-install 0.7.0.
# Append these lines into ~/.bashrc for $APP_USER:
#   source /usr/local/share/chruby/chruby.sh
#   source /usr/local/share/chruby/auto.sh

# Then install ruby as follows:
ruby-install ruby 2.6.3

# You will need to manually configure nginx. Usually this is done by
# copying or symlinking config/nginx.conf.example into /etc/nginx/conf.d/.
#
# Then, run
systemctl enable nginx
systemctl start nginx
User install commands
# Install and configure the bundler gem
gem install bundler
bundler config github.https true

# Enter the app directory
cd $APP_DIR

# Run bundler
bin/bundle install

# Run setup
bin/setup
Compiling tools (needed for Ruby compilation and gems)
  • GCC
  • Make
Image processing
  • ImageMagick (6.7 or greater)
  • gifsicle (1.64 or greater)
  • optipng
  • jpegtran (libjpeg-progs)
  • Inkscape (for SVG rendering)
  • libopencv-dev (below 3, for dedupe)
  • ffmpeg (for WebMs)
General
  • Development headers for: libxml, libxslt, zlib1g, openssl (required for Ruby and Nokogiri gem; packages end in -dev)
  • node.js (8 or greater, for script compilation)
  • libicu-dev (for character conversion)
  • curl.h (required by Patron gem; libcurl4-openssl-dev and similar provide)
  • libreadline-dev (required for Ruby)
  • curl
  • Java runtime environment (default-jre-headless; required for Elasticsearch)
  • libgit2 (27; instructions here, use /usr for install path)

Services

  • Elasticsearch (6.0 or newer)
  • PostgreSQL (9.6 or newer)
  • Redis (redis-server)
  • nginx >1.6 (nginx)

Ruby

  • Using chruby, install the version of Ruby specified in .ruby-version.

Gems

  • Bundler gem (gem install bundler)
  • bundler config github.https true

Setup

Services autostart

  • sudo systemctl start postgresql elasticsearch redis

PostgreSQL

User creation

  • sudo -u postgres createuser $APP_USER

Localhost access

  • In /etc/postgresql/<version>/main/pg_hba.conf, change md5 on both lines to trust
host    all             all             127.0.0.1/32            md5
host    all             all             ::1/128                 md5
  • One-liner: sed -i -e 's/md5/trust/' /etc/postgresql/11/main/pg_hba.conf

Installation

  • git clone git@gitlab.com:derpibooru/derpibooru.git
  • cd derpibooru
  • Replace the default nginx site configuration (/etc/nginx/sites-enabled/default) with config/nginx.conf.example. Remember to adjust it if your app is somewhere other than /home/derpibooru.
  • ./bin/setup

You can rerun ./bin/setup whenever you need to reset your environment.
If setup is failing (particularly on schema loading), you can do:

  • rake db:drop
  • rake db:create
  • rake db:schema:load
  • rake db:seed DEV_SEED='y'

Configuring serving endpoints

The default configuration serves all content locally.

In config/booru/settings.yml:

# What's your public hostname? Used in creating email links
public_host: ''
# Where is your site? No trailing slash.
public_url_root: ""
# Where is your CDN root? Set this to an Amazon CloudFront distribution domain or CNAME origined at the public_url_root,
# or just set this to the same as public_url_root if you're not using CloudFront or a similar CDN. No trailing slash.
cdn_url_root: ""
# Where are images located? Match this with your nginx configuration; normally should be "/path" on your CDN,
# with no trailing slash.
image_url_root: "/img"

Testing

rails test

Deployment

You need a key installed on the server you target, and the git remote installed in your ssh configuration.

git remote add production derpibooru@<serverip>:derpibooru/

The general syntax is:

git push production master

And if everything goes wrong:

git reset HEAD^ --hard
git push -f production master

(to be repeated until it works again)