Latest revision |
Your text |
Line 61: |
Line 61: |
|
| |
|
| {{ic|libpqxx}} is required for libpq-ruby to build. | | {{ic|libpqxx}} is required for libpq-ruby to build. |
|
| |
| Then, initialize and start the database.
| |
|
| |
| {{bc|
| |
| # /usr/pgsql-9.6/bin/postgresql96-setup initdb
| |
| # systemctl start postgresql-9.6
| |
| }}
| |
|
| |
|
| Now log in and create the moebooru database and user with createdb permissions: (make sure to give it a very good password!) | | Now log in and create the moebooru database and user with createdb permissions: (make sure to give it a very good password!) |
Line 108: |
Line 101: |
| ''For most small sites'', Ruby 2.3 and higher with the Unicorn server is sufficient. | | ''For most small sites'', Ruby 2.3 and higher with the Unicorn server is sufficient. |
|
| |
|
| ''A site with heavier traffic'' may find it helpful to use Rubinius with the Puma server [https://blog.engineyard.com/2014/ruby-app-server-arena-pt1to make better use of concurrent multithreading,] but this may require compilation, which can be fiendishly difficult. | | ''A site with heavier traffic'' may find it helpful to use Rubinius with the Puma server [https://blog.engineyard.com/2014/ruby-app-server-arena-pt1to make better use of concurrent multithreading,] but this may require compilation. |
| | |
| {{Warning|If you can't get Rubinius to work or to compile your gems, don't waste your time on it anymore. Just use standard Ruby 2.3.}}
| |
|
| |
|
| === Method 1: Set up Normal Ruby 2.3 or newer === | | === Method 1: Set up Normal Ruby 2.3 or newer === |
Line 120: |
Line 111: |
|
| |
|
| === Method 2: Installing Rubinius Binaries with chruby === | | === Method 2: Installing Rubinius Binaries with chruby === |
|
| |
| {{hc|Debian/Ubuntu|
| |
| sudo apt-get install openssl libreadline6 libreadline6-dev \
| |
| curl zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 \
| |
| libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev libtool \
| |
| pkg-config libgdbm-dev ncurses-dev libffi-dev
| |
| }}
| |
|
| |
| {{hc|Red Hat/CentOS|
| |
| sudo yum install ruby
| |
| sudo yum install -y patch autoconf libtool sqlite-devel
| |
| }}
| |
|
| |
|
| Rubinius is particularly tough to compile, and as of 2017-01-28 we have not been able to compile it with Debian Jessie. Instead, [https://rubinius.com/install/ Rubinius provides Ubuntu 14.04 binaries designed for use with Travis-Cl.] | | Rubinius is particularly tough to compile, and as of 2017-01-28 we have not been able to compile it with Debian Jessie. Instead, [https://rubinius.com/install/ Rubinius provides Ubuntu 14.04 binaries designed for use with Travis-Cl.] |
Line 180: |
Line 159: |
| {{bc| | | {{bc| |
| sudo yum install ruby | | sudo yum install ruby |
| sudo yum install -y patch autoconf patch automake libtool bison sqlite-devel bzip2 zlib-devel libyaml-devel readline-devel openssl-devel | | sudo yum install -y patch autoconf patch automake libtool bison sqlite-devel |
| }} | | }} |
|
| |
|
Line 352: |
Line 331: |
| https://zonio.net/rubinius_rpm_packages/ | | https://zonio.net/rubinius_rpm_packages/ |
| --> | | --> |
|
| |
| {{Note|If you encounter any issues with gems that say "Ignoring because extensions are not built", run {{ic|gem pristine --all}}}}
| |
|
| |
|
| == Mandatory Access Control == | | == Mandatory Access Control == |
Line 472: |
Line 449: |
|
| |
|
| {{bc|bundle exec rake db:reset}} | | {{bc|bundle exec rake db:reset}} |
|
| |
| {{Note|If you have trouble creating databases because they set to SQL_ASCII by default, [https://gist.github.com/amolkhanorkar/8706915 follow this guide to require UTF-8 to be set by default.] }}
| |
|
| |
|
| {{Note|Whenever you update moebooru using {{ic|git pull}}, make sure to migrate the database table schema with the command below.}} | | {{Note|Whenever you update moebooru using {{ic|git pull}}, make sure to migrate the database table schema with the command below.}} |
Line 695: |
Line 670: |
|
| |
|
| {{bc|bundle exec puma -C shared/puma.rb}} | | {{bc|bundle exec puma -C shared/puma.rb}} |
|
| |
| == Separate subdomain for images and static content ==
| |
|
| |
| It's often a better idea to have static content served from another subdomain entirely, where it will be cached for much longer than ever changing text. And sometimes the files could be located on an entirely different server.
| |
|
| |
| Edit your {{ic|config/local_config.rb}} to activate the {{ic|assets.}} and {{ic|files.}} subdomains.
| |
|
| |
| {{hc|config/local_config.rb|<nowiki>
| |
| # Servers for static files (assets and uploaded files)
| |
| CONFIG[:file_hosts] = { :files => "files.eikonos.org", :assets => "assets.eikonos.org" }
| |
| </nowiki>}}
| |
|
| |
| Then, create these two nginx configs (customize the server_name to your subdomains, must start with {{ic|assets.}} and {{ic|files.}}):
| |
|
| |
| {{hc|/etc/nginx/conf.d/moebooru_assets.conf|<nowiki>server {
| |
| listen 127.0.0.1:8080; # tells Nginx to listen for traffic passed by Varnish if unencrypted http
| |
| server_name assets.eikonos.org;
| |
|
| |
| # directory of static assets, first generate with the command:
| |
| # RAILS_ENV=production bundle exec rake assets:precompile
| |
| root /home/moe/booru/public;
| |
|
| |
| error_page 500 502 503 504 /500.html;
| |
| keepalive_timeout 10;
| |
|
| |
| location ^~ / {
| |
| expires 1M;
| |
| access_log off;
| |
| add_header Cache-Control "public";
| |
| try_files $uri =404;
| |
| }
| |
|
| |
| # users must access files.eikonos.org for full images, though thumbs are shared through assets
| |
| location ^~ /data/images/ { deny all; }
| |
| }
| |
| </nowiki>}}
| |
|
| |
| {{hc|/etc/nginx/conf.d/moebooru_files.conf|<nowiki>
| |
| server {
| |
| listen 127.0.0.1:8080; # tells Nginx to listen for traffic passed by Varnish if unencrypted http
| |
| server_name files.eikonos.org;
| |
|
| |
| # directory of full size files
| |
| root /home/moe/booru/public/;
| |
|
| |
| error_page 500 502 503 504 /500.html;
| |
| keepalive_timeout 10;
| |
|
| |
| location ^~ /data/ {
| |
| expires 1M;
| |
| access_log off;
| |
| add_header Cache-Control "public";
| |
| try_files $uri =404;
| |
| }
| |
| location ^~ /assets/ { deny all; } # users must access assets.eikonos.org for this
| |
| }
| |
| </nowiki>}}
| |
|
| |
|
| == Systemd Service == | | == Systemd Service == |
Line 887: |
Line 805: |
|
| |
|
| then import the sql dump with that user. | | then import the sql dump with that user. |
|
| |
| == Troubleshooting ==
| |
|
| |
| === Pagination not showing in Post#index ===
| |
|
| |
| {{Note|This issue only occurs when you are using the default cache instead of Memcached. We strongly recommend using Memcached for this reason.}}
| |
|
| |
| https://github.com/moebooru/moebooru/issues/42
| |
|
| |
| === Atom RSS Canonical URL Problem ===
| |
|
| |
| Bloo had met an issue with the [https://github.com/moebooru/moebooru/issues/71 Atom RSS URLs pointing to his IP instead of the domain name.] Here's the patch he used:
| |
|
| |
| {{bc|
| |
| --- a/app/helpers/application_helper.rb
| |
| +++ b/app/helpers/application_helper.rb
| |
| @@ -126,7 +126,7 @@ module ApplicationHelper
| |
|
| |
| elsif post.is_a?(Array)
| |
| posts = post
| |
| - new_params = params.to_unsafe_h.merge :only_path => true
| |
| + new_params = params.to_unsafe_h.merge :host=>'otakupaper.com'
| |
|
| |
| if posts.previous_page.present?
| |
| html << tag("link", :href => url_for(new_params.merge :page => 1), :rel => "first", :title => "First Page")
| |
| diff --git a/app/helpers/post_helper.rb b/app/helpers/post_helper.rb
| |
| index 32cf04f..cf98cb5 100644
| |
| --- a/app/helpers/post_helper.rb
| |
| +++ b/app/helpers/post_helper.rb
| |
| @@ -18,7 +18,7 @@ module PostHelper
| |
| "type" => tag_options[:type] || "application/#{type}+xml",
| |
| "title" => tag_options[:title] || type.to_s.upcase,
| |
| "id" => tag_options[:id],
| |
| - "href" => url_options.is_a?(Hash) ? url_for(url_options.merge(:only_path => false)) : url_options
| |
| + "href" => url_options.is_a?(Hash) ? url_for(url_options.merge(:host => CONFIG["server_host"])) : url_options
| |
| )
| |
| end
| |
| }}
| |
|
| |
|
| == Sources == | | == Sources == |
|
| |
|
| * Get configuration tips from here: http://wiki.douglasqsantos.com.br/doku.php/deploying_a_rails_app_on_debian_jessie_with_capistrano_nginx_and_puma_en | | * Get configuration tips from here: http://wiki.douglasqsantos.com.br/doku.php/deploying_a_rails_app_on_debian_jessie_with_capistrano_nginx_and_puma_en |