Danbooru

How do I install latest Danbooru on Ubuntu 9.10?

Posted under General

The guide from Ubuntu's wiki is outdated and well, I haven't used Linux much before so I don't know what to do. I've installed the OS and had tried to follow the guide but things didn't really work out. I'm not even sure of how to install a webserver on Ubuntu either.

So is there anyone who can guide (or write a guide/link me to a guide) that will teach me of all the things needed to run Danbooru?

Updated by albert

Oh yeah, I remember that Wiki on the Ubuntu website. It's terribly out-dated (PostgrSQL 8.1?).

But if you want a more up-to-date guide, check-out forum #27530. There should be a bash script there that can help you out.

Or, if you're on another distro (such as Gentoo, which I use), reading-through the script will give a very good idea of the processes and dependencies needed to get a Danbooru server up-and-running.

Edit: It seems the script has been purged from the Pastebin website. I would upload a copy of it, but I don't have it on me. Maybe someone else will be able to help you with that.

I was just using Gentoo as an example, because the bash script was Ubuntu-specific. I was implying that even though the instructions wouldn't be applicable to Gentoo, reading-over it manually would've still been very helpful.

For example, the script automates the installation of certain packages using apt-get (which is Ubuntu/Debian-specific), but would still be useful, as you would have an idea of what Gentoo-specific packages you would need.

With that said, I must ask you: Do you know what you're doing? If you're not at least passably proficient with Linux system administration, database administration, Ruby, and webserver setup, then this is probably something you should not try to pursue; I don't think anyone is going to walk you through, step-by-step, on how to get a Danbooru server running - much less give you distro-specific instructions.

Not trying to be mean here, though. Just saying.

I am not proficient with Linux at all. I've been spoiled with Window's GUI and hence never really needed to learn much of command-line related stuff. I am willing to learn, though.

Are you at least able to tell me what are some things I need set up before I follow any Danbooru installation guide? Or do I only need, as a base, a Webserver and SVN?

Yup, that's fair enough.

But here's what I consider the core parts of Danbooru:

  • The Ruby interpreter
  • Ruby Gems
  • Rails
  • PostgreSQL
  • The server

At minimum, you would want to retrieve the Danbooru source. Go to a terminal, and type this in:

svn co svn://donmai.us/danbooru/trunk danbooru

Then run the following to install Ruby, Ruby Gems, PostgreSQL, and Ruby On Rails:

sudo apt-get install ruby rubygems postgresql-8.4
sudo gem install rails

Note: Danbooru was made to work with an older version of Rails, and PostgreSQL 8.3, but I've still gotten it to work on the latest versions.

Now, cd into the directory, and run:

rake gems:install

This will attempt to install the gems required by Danbooru. You will probably run into some errors, but you'll at least have a good chunk of the software you need now.

There is also still a matter of missing packages that you need installed. But since the script is unvailable, I don't know what they are, and can't help you with that (I really should've saved a copy of it, or took note of the required packages). But if you had the script, it could've automated the entire process of setting Danbooru up for you - all the way from downloading and installing the Ruby interpreter, Ruby Gems, Rails, getting the Danbooru source, and setting-up the database.

So, now, learn the following: Ruby, the Ruby on Rails framework, and SQL/PostgreSQL. I'd also suggest looking at the documentation that comes with the Danbooru source. It's probably out-dated, but it might still prove useful.

Once again, a cautionary note: If you want to deploy a web application, be prepared to learn a variety of skills, and encounter challenges.

Thanks for your help.

I'm a web developer who uses PHP. I'd like to learn Ruby. The problem is that I've barely ever used Linux as Windows was much more convenient for me. *shrug*

Truth be told, I'm using a Virtual Machine to do everything as I'm too comfortable with Windows.

I'm not sure what's wrong; are you able to help me with this?

danbooru@Danbooru:/var/www/danbooru$ RAILS_ENV=production rake db:migrate
(in /var/www/danbooru)
== RemoveNotesFromArtists: migrating =========================================
rake aborted!
An error has occurred, this and all later migrations canceled:

PGError: ERROR: column "other_names_array" does not exist
LINE 1: SELECT artists.*, coalesce(array_to_string(other_names_array...
^
: SELECT artists.*, coalesce(array_to_string(other_names_array, ', '), '') AS other_names_string FROM "artists" WHERE (notes <> '' and notes is not null)

(See full trace by running task with --trace)
danbooru@Danbooru:/var/www/danbooru$

Pretty much I have a few more steps to go:
- Run the migrations: "RAILS_ENV=production rake db:migrate"
- Start the job daemon: "RAILS_ENV=production app/daemons/job_task_processor_ctl.rb start"
- You now need a way of managing the Rails process. The preferred method is using the Phusion Passenger module (see section below). Alternatively you can use Mongrel or fastcgi, there are several examples on the web.
- You should now be able to connect to your Danbooru instance. The first account you create will automatically become the administrator, so you should do this first.

Updated

Looks to me like you haven't configured your PostgreSQL database, or edited `config/database.yml' to match your database settings yet.

Like I said, you must learn Ruby, RoR, and PostgreSQL first. Because if you get an error like that and don't understand how to fix it or what causes it, you've got to learn you some learns. To put it frankly, I'm not a tutorial service and won't be helping you with every problem you might run into (and there may be many).

If you want to work with Danbooru -- a Ruby on Rails application -- get some basic knowledge of how to get build, deploy, and test your own Rails app from scratch (there's dozens of great tutorials out there) - it's a great way to learn the RoR API. Then after you've got the basics down, come back and give Danbooru a shot again - setting Danbooru up is not something that is trivial, so you'll have to know what you're doing first.

Ugh, I'm really not trying to sound discouraging, but that's what you gotta do: ween yourself off of Windows, learn the basics, tinker-around, and get some working knowledge. That will take a bit of commitment.

Google for some Linux/command-line tutorials, Ruby (on Rails) tutorials, and then take a quick crash-course on PostgreSQL. There are many good ones out there, and there are definitely communities out there more-than willing to lend you a hand with your endeavors. But what you're basically asking for here is just out of scope; I'd be glad to help you out with this, but you need to nail-down some things on your own first =]

Well, I know for a fact that its more of a PostgreSQL error that's halting the script. I'm not too surprised as I'm using the trunk and not a tag'd version. And I didn't want to just delete the migrate file that caused the error because I thought something important was probably of relation.

For me, I tend to like to have a software "there" first and then start messing with it. That's how I learned HTML. That's how I learned CSS. That's how I learned MySQL. That's how I learned PHP. And that's probably how I'll learn Ruby + RoR (and maybe PostgreSQL).

Ok, I've seemed to have got it "mostly" done.

When I go to http://localhost/danbooru, the following text is displayed:
Something broke. Either there's a bug or the database timed out. An email has been sent to the developers.

Is there a way to traceback what happened?

Also, when I tried to restart nginx, this is outputted:
danbooru@Danbooru:/var/www/danbooru$ sudo /etc/init.d/nginx restart
Restarting nginx: [warn]: conflicting server name "localhost" on 0.0.0.0:80, ignored
[warn]: conflicting server name "localhost" on 0.0.0.0:80, ignored
[warn]: conflicting server name "localhost" on 0.0.0.0:80, ignored
the configuration file /etc/nginx/nginx.conf syntax is ok
configuration file /etc/nginx/nginx.conf test is successful
[warn]: conflicting server name "localhost" on 0.0.0.0:80, ignored
[warn]: conflicting server name "localhost" on 0.0.0.0:80, ignored
[warn]: conflicting server name "localhost" on 0.0.0.0:80, ignored
nginx.

Is this ignorable?

Contents of the default.conf AND danbooru.conf:
http://pastebin.mozilla.org/693978

This is what I see in the error log:

2009/12/30 16:01:42 [error] 2894#0: *19 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8052/", host: "localhost"
2009/12/30 16:01:42 [error] 2894#0: *19 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8050/", host: "localhost"
2009/12/30 16:01:42 [error] 2894#0: *19 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8051/", host: "localhost"

Apothem said:
When I go to http://localhost/danbooru, the following text is displayed:
Something broke. Either there's a bug or the database timed out. An email has been sent to the developers.

Is there a way to traceback what happened?

Set your Rails environment to development instead of production in your webserver config.

Apothem said:
This is what I see in the error log:

2009/12/30 16:01:42 [error] 2894#0: *19 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8052/", host: "localhost"
2009/12/30 16:01:42 [error] 2894#0: *19 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8050/", host: "localhost"
2009/12/30 16:01:42 [error] 2894#0: *19 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8051/", host: "localhost"

I'm guessing you have nginx proxying requests to mongrel. Make sure that mongrel is running and that it's configured to listen on the same ports that nginx is forwarding.

Thanks.

So I got Danbooru to finally work, but there are still a few problems.
1) If I'm not logged in, this error page shows: http://pastebin.com/m64fa2372
2) For some reason, a 403 Forbidden page is shown for an image I uploaded.

I can start up Mongrel using "mongrel_rails start -p 8050" but that doesn't cover all the ports and also is annoying to retype over and over again.

That'd be an error related to your advertising configuration. Disabling advertising in your config should fix this.

Go to `config/default_config.rb', and find the line:
CONFIG["can_see_ads"] = lambda do |user|

And just below it, comment-out `user.is_member_or_lower?' and then uncomment the `false' just under that.

2) For some reason, a 403 Forbidden page is shown for an image I uploaded.

Sounds like an nginx configuration problem. Images are stored under public/data. Make sure that nginx is set up to serve files from this location (I'm not an nginx person so I can't give you instructions on how to do this myself).

Just for posterity sake, Nginx will read ANY file in the conf directory, including backup files ending with ~. That's why you're getting the 'conflicting server name "localhost"' warnings, because it's trying to load two config files.

1