[README] Update readme and install docs

Also remove the two dead/non-working installations scripts.
This commit is contained in:
Kira 2021-04-24 20:11:19 -07:00
parent 5843282986
commit 3933afc785
3 changed files with 10 additions and 360 deletions

View File

@ -1,182 +0,0 @@
#!/bin/bash
# Run: curl -L -s https://raw.githubusercontent.com/zwagoth/e621ng/master/INSTALL.debian -o install.sh ; chmod +x install.sh ; ./install.sh
export RUBY_VERSION=2.5.3
export GITHUB_INSTALL_SCRIPTS=https://raw.githubusercontent.com/zwagoth/e621ng/master/script/install
export VIPS_VERSION=8.7.0
if [[ "$(whoami)" != "root" ]] ; then
echo "You must run this script as root"
exit 1
fi
verlte() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
}
verlt() {
[ "$1" = "$2" ] && return 1 || verlte $1 $2
}
echo "* DANBOORU INSTALLATION SCRIPT"
echo "*"
echo "* This script will install all the necessary packages to run Danbooru on a "
echo "* Debian server."
echo
echo -n "* Enter the hostname for this server (ex: danbooru.donmai.us): "
read HOSTNAME
if [[ -z "$HOSTNAME" ]] ; then
echo "* Must enter a hostname"
exit 1
fi
echo -n "* Enter the VLAN IP address for this server (ex: 172.16.0.1, enter nothing to skip): "
read VLAN_IP_ADDR
# Install packages
echo "* Installing packages..."
if [ -n "$(uname -a | grep Ubuntu)" ] ; then
LIBSSL_DEV_PKG=libssl-dev
else
LIBSSL_DEV_PKG=$( verlt `lsb_release -sr` 9.0 && echo libssl-dev || echo libssl1.0-dev )
fi
apt-get update
apt-get -y install $LIBSSL_DEV_PKG build-essential automake libxml2-dev libxslt-dev ncurses-dev sudo libreadline-dev flex bison ragel memcached libmemcached-dev git curl libcurl4-openssl-dev sendmail-bin sendmail nginx ssh coreutils ffmpeg mkvtoolnix
apt-get -y install libpq-dev postgresql-client
apt-get -y install liblcms2-dev libjpeg-turbo8-dev libexpat1-dev libgif-dev libpng-dev libexif-dev
# vrack specific stuff
if [ -n "$VLAN_IP_ADDR" ] ; then
apt-get -y install vlan
modprobe 8021q
echo "8021q" >> /etc/modules
vconfig add eno2 99
ip addr add $VLAN_IP_ADDR/24 dev eno2.99
ip link set up eno2.99
curl -L -s $GITHUB_INSTALL_SCRIPTS/vrack-cfg.yaml -o /etc/netplan/01-netcfg.yaml
fi
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
curl -sSL https://deb.nodesource.com/setup_10.x | sudo -E bash -
apt-get update
apt-get -y install nodejs yarn
apt-get remove cmdtest
if [ $? -ne 0 ]; then
echo "* Error installing packages; aborting"
exit 1
fi
# compile and install libvips (the version in apt is too old)
cd /tmp
wget -q https://github.com/libvips/libvips/releases/download/v$VIPS_VERSION/vips-$VIPS_VERSION.tar.gz
tar xzf vips-$VIPS_VERSION.tar.gz
cd vips-$VIPS_VERSION
./configure --prefix=/usr
make install
ldconfig
# Create user account
useradd -m danbooru
chsh -s /bin/bash danbooru
usermod -G danbooru,sudo danbooru
# Set up Postgres
export PG_VERSION=`pg_config --version | egrep -o '[0-9]{1,}\.[0-9]{1,}'`
if verlte 9.5 $PG_VERSION ; then
# only do this on postgres 9.5 and above
git clone https://github.com/r888888888/test_parser.git /tmp/test_parser
cd /tmp/test_parser
make install
fi
# Install rbenv
echo "* Installing rbenv..."
cd /tmp
sudo -i -u danbooru git clone git://github.com/sstephenson/rbenv.git ~danbooru/.rbenv
sudo -i -u danbooru touch ~danbooru/.bash_profile
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~danbooru/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~danbooru/.bash_profile
sudo -i -u danbooru mkdir -p ~danbooru/.rbenv/plugins
sudo -i -u danbooru git clone git://github.com/sstephenson/ruby-build.git ~danbooru/.rbenv/plugins/ruby-build
sudo -i -u danbooru bash -l -c "rbenv install $RUBY_VERSION"
sudo -i -u danbooru bash -l -c "rbenv global $RUBY_VERSION"
# Generate secret token and secret key
echo "* Generating secret keys..."
sudo -i -u danbooru mkdir ~danbooru/.danbooru/
openssl rand -hex 32 > ~danbooru/.danbooru/secret_token
openssl rand -hex 32 > ~danbooru/.danbooru/session_secret_key
chown danbooru:danbooru ~danbooru/.danbooru/*
chmod 600 ~danbooru/.danbooru/*
# Install gems
echo "* Installing gems..."
sudo -i -u danbooru bash -l -c 'gem install --no-ri --no-rdoc bundler'
echo "* Install configuration scripts..."
# Update PostgreSQL
curl -L -s $GITHUB_INSTALL_SCRIPTS/postgresql_hba_conf -o /etc/postgresql/$PG_VERSION/main/pg_hba.conf
/etc/init.d/postgresql restart
sudo -u postgres createuser -s danbooru
sudo -i -u danbooru createdb danbooru2
# Setup nginx
curl -L -s $GITHUB_INSTALL_SCRIPTS/nginx.danbooru.conf -o /etc/nginx/sites-enabled/danbooru.conf
sed -i -e "s/__hostname__/$HOSTNAME/g" /etc/nginx/sites-enabled/danbooru.conf
/etc/init.d/nginx restart
# Setup logrotate
curl -L -s $GITHUB_INSTALL_SCRIPTS/danbooru_logrotate_conf -o /etc/logrotate.d/danbooru.conf
# Setup danbooru account
echo "* Enter a new password for the danbooru account"
passwd danbooru
echo "* Setting up SSH keys for the danbooru account"
sudo -i -u danbooru ssh-keygen
mkdir -p /var/www/danbooru2/shared/config
mkdir -p /var/www/danbooru2/shared/data
mkdir -p /var/www/danbooru2/shared/data/preview
mkdir -p /var/www/danbooru2/shared/data/sample
chown -R danbooru:danbooru /var/www/danbooru2
curl -L -s $GITHUB_INSTALL_SCRIPTS/database.yml.templ -o /var/www/danbooru2/shared/config/database.yml
curl -L -s $GITHUB_INSTALL_SCRIPTS/danbooru_local_config.rb.templ -o /var/www/danbooru2/shared/config/danbooru_local_config.rb
echo "* Almost done! You are now ready to deploy Danbooru onto this server."
echo "* Log into Github and fork https://github.com/zwagoth/e621ng into"
echo "* your own repository. Clone your fork onto your local development"
echo "* machine and modify the following files:"
echo "*"
echo "* config/deploy.rb (github repo url)"
echo "* config/deploy/production.rb (servers and users)"
echo "* config/unicorn/production.rb (users)"
echo "* config/application.rb (time zone)"
echo "*"
echo "* On the remote server you will want to modify this file:"
echo "*"
echo "* /var/www/danbooru2/shared/config/danbooru_local_config.rb"
echo "*"
read -p "Press [enter] to continue..."
echo "* Commit your changes and push them to your fork. You are now ready to"
echo "* deploy with the following command:"
echo "*"
echo "* bundle exec capistrano production deploy"
echo "*"
echo "* You can also run a server locally without having to deal with deploys"
echo "* by running the following command:"
echo "*"
echo "* bundle install"
echo "* bundle exec rake db:create db:migrate"
echo "* bundle exec rails server"
echo "*"
echo "* This will start a web process running on port 3000 that you can"
echo "* connect to. This is useful for development and testing purposes."
echo "* If something breaks post about it on the Danbooru Github. Good luck!"

View File

@ -1,114 +0,0 @@
#!/bin/bash
# Run: curl -L -s https://raw.githubusercontent.com/zwagoth/e621ng/master/INSTALL.debian -o install.sh ; chmod +x install.sh ; ./install.sh
export RUBY_VERSION=2.5.3
export GITHUB_INSTALL_SCRIPTS=https://raw.githubusercontent.com/zwagoth/e621ng/master/script/install
export VIPS_VERSION=8.7.0
verlte() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
}
verlt() {
[ "$1" = "$2" ] && return 1 || verlte $1 $2
}
# Install packages
echo "* Installing packages..."
if [ -n "$(uname -a | grep Ubuntu)" ] ; then
LIBSSL_DEV_PKG=libssl-dev
else
LIBSSL_DEV_PKG=$( verlt `lsb_release -sr` 9.0 && echo libssl-dev || echo libssl1.0-dev )
fi
sudo apt-get update
sudo apt-get -y install $LIBSSL_DEV_PKG build-essential automake libxml2-dev libxslt-dev ncurses-dev sudo libreadline-dev flex bison ragel memcached libmemcached-dev git curl libcurl4-openssl-dev sendmail-bin sendmail nginx ssh coreutils ffmpeg mkvtoolnix
sudo apt-get -y install libpq-dev postgresql-client postgresql postgresql-server-dev-10
sudo apt-get -y install liblcms2-dev libjpeg-turbo8-dev libexpat1-dev libgif-dev libpng-dev libexif-dev
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
curl -sSL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get update
sudo apt-get -y install nodejs yarn
sudo apt-get remove cmdtest
if [ $? -ne 0 ]; then
echo "* Error installing packages; aborting"
exit 1
fi
# compile and install libvips (the version in apt is too old)
cd /tmp
wget -q https://github.com/libvips/libvips/releases/download/v$VIPS_VERSION/vips-$VIPS_VERSION.tar.gz
tar xzf vips-$VIPS_VERSION.tar.gz
cd vips-$VIPS_VERSION
./configure --prefix=/usr
sudo make install
sudo ldconfig
# Set up Postgres
export PG_VERSION=`pg_config --version | egrep -o '[0-9]{1,}\.[0-9]{1,}'`
if verlte 9.5 $PG_VERSION ; then
# only do this on postgres 9.5 and above
git clone https://github.com/r888888888/test_parser.git /tmp/test_parser
cd /tmp/test_parser
sudo make install
fi
# Install rbenv
echo "* Installing rbenv..."
cd /tmp
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
touch ~/.bash_profile
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
mkdir -p ~/.rbenv/plugins
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install $RUBY_VERSION
rbenv global $RUBY_VERSION
# Generate secret token and secret key
echo "* Generating secret keys..."
mkdir ~/.danbooru/
openssl rand -hex 32 > ~/.danbooru/secret_token
openssl rand -hex 32 > ~/.danbooru/session_secret_key
chmod 600 ~/.danbooru/*
# Install gems
echo "* Installing gems..."
gem install --no-ri --no-rdoc bundler
echo "* Install configuration scripts..."
# Update PostgreSQL
curl -L -s $GITHUB_INSTALL_SCRIPTS/postgresql_hba_conf -o /etc/postgresql/$PG_VERSION/main/pg_hba.conf
/etc/init.d/postgresql restart
sudo -u postgres createuser -s danbooru
sudo -u postgres createdb danbooru2
# Setup nginx
curl -L -s $GITHUB_INSTALL_SCRIPTS/nginx.danbooru.conf -o /etc/nginx/sites-enabled/danbooru.conf
sed -i -e "s/__hostname__/$HOSTNAME/g" /etc/nginx/sites-enabled/danbooru.conf
/etc/init.d/nginx restart
echo "* Clone the repo into your home folder."
echo "* Copy the database.yml and danbooru_local_config.rb templates from the "
echo "* scripts/install folder into the config folder and edit them to your needs."
echo "* Remember to add 'user: danbooru' to the database yml file for development roles."
echo "* You can then run a server locally without having to deal with deploys"
echo "* by running the following command:"
echo "*"
echo "* bundle install"
echo "* yarn install"
echo "* RAILS_ENV=development bundle exec rake db:migrate"
echo "* bundle exec rails server"
echo "*"
echo "* Run RAILS_ENV=development bundle exec rake db:seed after you have"
echo "* created a new user!"
echo "*"
echo "* This will start a web process running on port 3000 that you can"
echo "* connect to. This is useful for development and testing purposes."
echo "* If something breaks post about it on the Github. Good luck!"

View File

@ -7,8 +7,8 @@
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-bindfs
vagrant plugin install vagrant-hostmanager
vagrant plugin install vagrant-bindfs
vagrant plugin install vagrant-vbguest
```
3. Download and extract the repo
@ -26,28 +26,20 @@ By the time you get back the install will surely have completed.<sup>1</sup>
In case the VM doesn't start with the error `VT-x not available` and the error description `WHvCapabilityCodeHypervisorPresent is FALSE!` the the following solution should resolve the issue:
This error usually occours, when the `Hyper-V` or the `Windows Hypervisor Platform` features are activated. <br/>
This error usually occurs, when the `Hyper-V` or the `Windows Hypervisor Platform` features are activated. <br/>
To deactivate these features, press the windows key and enter `Turn Windows features on or off`, here you can deactivate both features by unchecking their respective checkboxes.
Don't forget to restart the computer after deactivating the features.
## Installation
It is recommended that you install Danbooru on a Debian-based system
since most of the required packages are available on APT. Danbooru
has been successfully installed on Fedora, CentOS, FreeBSD, and OS X.
The INSTALL.debian install script is straightforward and should be
simple to adapt for other platforms.
Installation follows the same steps as the vagrant setup script. Ubuntu 20.04 is the current installation target.
There is no script that performs these steps for you, as you need to split them up to match your infrastructure.
Running a single machine install in production is possible, but is likely to be somewhat sluggish due to contention in disk between postgresql and elasticsearch.
Minimum RAM is 4GB. You will need to adjust values in config files to match how much RAM is available.
If you are targeting more than a hundred thousand posts and reasonable user volumes, you probably want to procure yourself a database server. See tuning guides for postgresql and elasticsearch for help planning these requirements.
For best performance, you will need at least 256MB of RAM for
PostgreSQL and Rails. The memory requirement will grow as your
database gets bigger.
On production Danbooru uses PostgreSQL 9.4, but any 9.x release should
work.
Use your operating system's package management system whenever
possible. This will simplify the process of installing init scripts,
which will not always happen when compiling from source.
There are some forks that contain full docker setups. If you are looking for a Docker deployment and don't want to wait for this repo to slowly get there, look into those.
## Troubleshooting
@ -69,55 +61,9 @@ debug your Nginx configuration file.
4) Check all log files.
## Services
Danbooru employs numerous external services to delegate some
functionality.
For development purposes, you can just run mocked version of these
services. They're available in `scrtip/mock_services` and can be started
automatically using Foreman and the provided Procfile.
### Amazon Web Services
In order to enable the following features, you will need an AWS SQS
account:
* Pool versions
* Post versions
* IQDB
* Saved searches
* Related tags
### Google APIs
The following features requires a Google API account:
* Bulk revert
* Post versions report
### IQDB Service
IQDB integration is delegated to the [IQDBS service](https://github.com/r888888888/iqdbs).
### Archive Service
In order to access versioned data for pools and posts you will
need to install and configure the [Archives service](https://github.com/r888888888/archives).
### Reportbooru Service
The following features are delegated to the [Reportbooru service](https://github.com/r888888888/reportbooru):
* Related tags
* Missed searches report
* Popular searches report
* Favorite searches
* Upload trend graphs
### Recommender Service
Post recommendations require the [Recommender service](https://github.com/r888888888/recommender).
IQDB integration is delegated to the [IQDBS service](https://github.com/zwagoth/iqdbs).
### Cropped Thumbnails