Commit Graph

394 Commits

Author SHA1 Message Date
evazion
0fed4b557b Remove Unicorn.
No longer used now that we use Puma in production. If you still used
Unicorn in your install, switch to `bin/rails server` instead. See
config/puma.rb for config settings.
2021-09-20 06:17:57 -05:00
evazion
68769c7c3b Remove Capistrano.
No longer used now that we use Kubernetes to deploy the site instead of
Capistrano.

If you run your own installation of Danbooru, and you used Capistrano to
deploy your site, it is recommended that you switch to either the Docker
Compose file (for personal installs), the Procfile (for non-Dockerized,
development environments), or Kubernetes (for production environments;
see https://github.com/danbooru/danbooru-infrastructure/tree/master/k8s
for Danbooru's production configuration).
2021-09-20 04:57:41 -05:00
evazion
051f2be93f gems: remove whenever gem.
We're now using the `clockwork` gem for cronjobs in production. See
config/initializers/clockwork.rb.
2021-09-20 01:30:52 -05:00
evazion
d854bf6b53 BURs: update posts in parallel.
When processing an alias, rename, implication, mass update, or nuke,
update the posts in parallel. This means that if we alias foo to bar,
for example, then we use four processes at once to retag the posts from
foo to bar.

This doesn't mean that if we have two aliases in a BUR, we process both
aliases in parallel. It simply means that when processing an alias, we
update the posts in parallel for that alias.
2021-09-20 01:12:14 -05:00
evazion
9552b41c0a Update Ruby gems and Yarn packages. 2021-09-14 05:39:18 -05:00
evazion
4cc8dd41ec puma: add rack-timeout gem.
Unlike Unicorn, Puma doesn't have a builtin HTTP request timeout
mechanism, so we have to use Rack::Timeout instead.

See the caveats in the Rack::Timeout documentation [1]. In Unicorn, a
timeout would send a SIGKILL to the worker, immediately killing it. This
would result in a dropped connection and a Cloudflare 502 error to the
user. In Puma, it raises an exception, which we can catch and return a
better error to the user. On the other hand, raising an exception can
potentially corrupt application state if it's sent at the wrong time, or
be delayed indefinitely if the app is stuck in IO or C extension code.

The default request timeout is 65 seconds. 65 seconds is to give things
like HTTP requests on a 60 second timeout enough time to complete. Set
the RACK_REQUEST_TIMEOUT environment variable to change the timeout.

1: https://github.com/sharpstone/rack-timeout#further-documentation
2021-09-12 09:32:12 -05:00
evazion
23b2a37050 puma: add puma worker killer gem. 2021-09-12 05:51:09 -05:00
evazion
0aab81440f puma: add Prometheus metrics exporter.
To test it, run `bin/rails server` then do `curl http://localhost:9393`.

https://github.com/harmjanblok/puma-metrics
2021-09-11 10:09:58 -05:00
evazion
540a3e111a Replace streamio-ffmpeg library.
Replace the streamio-ffmpeg library with our own very thin FFmpeg wrapper.
2021-09-05 06:54:56 -05:00
evazion
88e379f9cc Update DText gem. 2021-08-31 21:48:53 -05:00
evazion
3348e1000c Update Ruby gems. 2021-08-28 04:53:33 -05:00
evazion
8f24e789b6 newrelic: fix crash during bootup caused by Rails.logger.
Using `Rails.logger` here causes server boot to fail with a `Undefined
method 'tagged'` error, possibly because `Rails.logger` isn't ready yet
during early initialization.
2021-08-15 02:16:57 -05:00
evazion
c6855261fe gems: update activerecord-hierarchical_query gem.
The bug that blocked Rails 6.1 support was finally fixed upstream.
2021-06-23 06:23:29 -05:00
evazion
7fab2231c0 Update Ruby gems and Yarn packages. 2021-06-23 06:23:29 -05:00
evazion
3c79888610 Update Ruby gems and Yarn packages. 2021-06-17 04:56:42 -05:00
evazion
9b59ba780b gems: add solargraph gem
Add the Solargraph gem to enable Ruby language integration for
supporting text editors.

This enables various features, including code completion, inline
documentation, type checking, syntax checking, linting, and jump to
definition/references.

Usage:

  Install Solargraph extension for your editor (see https://solargraph.org/guides)
  Run `bin/solargraph download-core` to install core Ruby language docs.
  Run `bin/solargraph bundle` to install Ruby gem docs.

See also:

* https://github.com/castwide/solargraph
* https://solargraph.org/guides/getting-started
* https://marketplace.visualstudio.com/items?itemName=castwide.solargraph
2021-06-17 04:10:26 -05:00
evazion
aab19a8cbb Update Ruby gems and Yarn packages. 2021-05-25 15:09:53 -05:00
evazion
f65f24be0b docker: add cron service to compose file. 2021-05-25 01:16:59 -05:00
evazion
ca8bfb9149 Update Ruby gems and Yarn packages. 2021-05-15 02:48:13 -05:00
evazion
de5ade7641 Add bcrypt_pbkdf gem.
Add the bcrypt_pbkdf gem. This is required to be able to use manually
configured SSH keys with the SFTP storage manager.
2021-04-30 04:59:17 -05:00
evazion
9b0fcec7d0 Update Ruby gems and Yarn packages. 2021-04-06 15:51:01 -05:00
evazion
07720b04a5 Update Ruby gems and Yarn packages. 2021-03-29 03:01:02 -05:00
evazion
7984575210 mimemagic: update to 0.3.8 (#4776). 2021-03-25 14:50:42 -05:00
evazion
442d0f8dd3 gems: remove meta_request fork.
Remove a workaround added in 2c06766c9. meta_request had a bug that
caused Rails to fail to launch under Rails 6.1. The fix was finally
merged upstream.

hxxps://github.com/dejan/rails_panel/pull/177.
2021-03-24 17:37:48 -05:00
evazion
c11f13050b Fix #4776: docker-compose.simple.yaml - fails to find mimemagic gem 2021-03-24 13:31:22 -05:00
evazion
92225177a8 Update oauth2 gem.
Fixes a critical bug introduced in oauth2 1.4.5 that caused the Pawoo
source strategy to fail.
2021-03-19 16:49:14 -05:00
evazion
1a7a108d47 discord: add /tagme command. 2021-03-19 04:44:22 -05:00
evazion
1fd23c344a Update ruby gems and yarn packages. 2021-03-18 21:35:17 -05:00
evazion
2c8c7ff80a discord: add initial slash command integration.
Add initial support for the `/count <tags>` and `/posts <tags>` slash commands.

Slash commands are basically like webhooks; we register a command, and
when anybody types that command in Discord, Discord sends us a HTTP
request that we respond to.

* https://discord.com/developers/docs/interactions/slash-commands
* https://support.discord.com/hc/en-us/articles/1500000368501-Slash-Commands-FAQ
2021-03-11 03:04:10 -06:00
evazion
f235b72b3f Export public database dumps to BigQuery.
* Export daily public database dumps to BigQuery and Google Cloud Storage.
* Only data visible to anonymous users is exported. Some tables have
  null or missing fields because of this.
* The bans table is excluded because some bans have an expires_at
  timestamp set beyond year 9999, which BigQuery doesn't support.
* The favorites table is excluded because it's too slow to dump (it
  doesn't have an id index, which is needed by find_each).
* Version tables are excluded because dumping them every day is
  inefficient, streaming insertions should be used instead.

Links:

* https://console.cloud.google.com/bigquery?project=danbooru1
* https://console.cloud.google.com/storage/browser/danbooru_public
* https://storage.googleapis.com/danbooru_public/data/posts.json
2021-03-10 02:52:16 -06:00
evazion
ba9313c0d7 gems: add benchmark-ips gem to development group. 2021-03-08 03:51:29 -06:00
evazion
250e7657b5 Update Ruby gems and Yarn packages. 2021-03-07 18:34:40 -06:00
evazion
340eeec023 Update Ruby gems and Yarn packages. 2021-02-28 17:48:30 -06:00
evazion
1c1d784547 css: rework color scheme to use new color palette.
Add a new color palette and rework all site colors (both light mode and dark mode) to
use the new palette.

This ensures that colors are used consistently, from a carefully designed color palette,
instead of being chosen at random.

Before, colors in light mode were chosen on an ad-hoc basis, which resulted in a lot of
random colors and inconsistent design.

The new palette has 7 hues: red, orange, yellow, green, blue, azure (a lighter blue), and
purple. There's also a greyscale. Each hue has 10 shades of brightness, which (including
grey) gives us 80 total colors.

Colors are named like this:

    var(--red-0);    /* very light red */
    var(--red-2);    /* light red */
    var(--red-5);    /* medium red */
    var(--red-7);    /* dark red */
    var(--red-9);    /* very dark red */
    var(--green-7);  /* dark green */
    var(--blue-5);   /* medium blue */
    var(--purple-3); /* light purple */
                     /* etc */

The color palette is designed to meet the following criteria:

* To have close equivalents to the main colors used in the old color scheme,
  especially tag colors, so that changes to major colors are minimized.
* To produce a set of colors that can be used as as main text colors, as background
  colors, and as accent colors, both in light mode and dark mode.
* To ensure that colors at the same brightness level have the same perceived brightness.
  Green-4, blue-4, red-4, purple-4, etc should all have the same brightness and contrast
  ratios. This way colors look balanced. This is actually a difficult problem, because human
  color perception is non-linear, so you can't just scale brightness values linearly.

There's a color palette test page at https://danbooru.donmai/static/colors

Notable changes to colors in light mode:

* Username colors are the same as tag colors.
* Copyright tags are a deeper purple.
* Builders are a deeper purple (fixes #4626).
* Moderators are green.
* Gold users are orange.
* Parent borders are a darker green.
* Child borders are a darker orange.
* Unsaved notes have a thicker red border.
* Selected notes have a thicker blue (not green) border.
2021-02-22 02:32:49 -06:00
evazion
bcca0ca53a Update Ruby gems and Yarn packages. 2021-02-18 19:11:21 -06:00
evazion
db8991babf Update ruby gems and yarn packages. 2021-02-13 18:22:28 -06:00
evazion
12c61860e1 Update ruby gems and yarn packages. 2021-02-07 23:28:50 -06:00
evazion
9a0a988572 tests: fix test breakage in Github CI.
Fix tests not working in Github. They were failing because the latest
version of Webpack needs a version of Node newer than the version in
shipped Ubuntu 20.04.

Also fix the Docker build failing because of the system timezone
database not being installed in Ubuntu 20.10.
2021-02-05 03:40:16 -06:00
evazion
e90f792e20 Update ruby gems and yarn packages. 2021-02-03 21:12:33 -06:00
evazion
896e5cb763 Add BetterErrors gem. 2021-01-30 14:19:37 -06:00
evazion
af84386d77 webpack: fix hot reloading not working.
Upgrade to webpacker-6.0.0.beta.4 to fix a bug where bin/webpack-dev-server
didn't respect the host/port config options in config/webpacker.yml,
which made it listen on the wrong port, breaking hot reloading.
2021-01-29 02:09:30 -06:00
evazion
90cd3293eb Upgrade to Webpacker 6.0. 2021-01-28 00:22:49 -06:00
evazion
3137284292 Update ruby gems and yarn packages. 2021-01-27 00:02:35 -06:00
evazion
2c06766c9e gems: workaround meta_request failure in Rails 6.1.
meta_request fails in Rails 6.1 with a `SystemStackError: stack level
too deep` error. Switch to a patched fork until the mainline gem is
fixed.

* hxxps://www.github.com/dejan/rails_panel/pull/177
* hxxps://www.github.com/dejan/rails_panel/issues/178
2021-01-24 19:26:25 -06:00
evazion
7ed4523152 Update ruby gems and yarn packages. 2021-01-24 19:18:04 -06:00
evazion
b6008b02b4 Update ruby gems and yarn packages. 2021-01-17 23:28:45 -06:00
evazion
6ca007ee1f Fix #4670: Replace RequestStore with AS::CurrentAttributes.
This also requires replacing CurrentUser.name with CurrentUser.user.name
because the `name` method had a conflict with CurrentAttributes.
2021-01-16 12:43:20 -06:00
evazion
1b30b71a07 posts: refactor post previews to use ViewComponent.
Refactor the post preview html to use the ViewComponent framework. This
lets us encapsulate all the HTML, CSS, and helper methods for a UI
component in a single place.

See https://viewcomponent.org.
2021-01-14 21:17:57 -06:00
evazion
1878fc4049 Update ruby gems and yarn packages. 2021-01-11 05:12:09 -06:00
evazion
886e43ad11 Update ruby gems and yarn packages. 2021-01-05 00:05:49 -06:00