Files
danbooru/bin/danbooru
evazion c183237b6b docker: update docker-compose file.
* Listen on port 3000 instead of port 80. Port 80 is prone to conflicts
  with other webservers.

* Use the production version of the Danbooru Docker image. It's less
  likely to have bugs than master.

* Fix the autoinstall script to work with `curl ... | sh`.

* Lower PUMA_WORKERS to 1 to reduce memory usage.
2021-09-24 08:40:33 -05:00

57 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
#
# This script starts Danbooru by installing Docker and Docker Compose, then
# starting Danbooru in a container. Danbooru will be available at http://localhost:3000.
#
# Usage:
#
# bin/danbooru up # start Danbooru
# bin/danbooru down # stop and remove Danbooru container.
# bin/danbooru help # show Docker Compose help
#
# Alternatively, if you already have Docker installed, you can just do:
#
# docker-compose up
#
# This script is just a wrapper for that command.
set -eux
# Check if program exists.
has() {
type "$1" > /dev/null 2>&1
}
# Install Docker and Docker Compose if they're not installed already.
install_docker_compose() {
if has docker && has docker-compose; then
return
fi
# Debian and Ubuntu
if has apt-get; then
sudo apt-get update
sudo apt-get install -y docker.io docker-compose
# Fedora
elif has dnf; then
sudo dnf install -y docker docker-compose
# Arch Linux
elif has pacman; then
sudo pacman -Sy --noconfirm docker docker-compose
else
echo "Error: Couldn't automatically install docker-compose. Install docker-compose manually."
exit 1
fi
}
# Start Docker if it's not running already.
start_docker() {
if ! sudo docker version > /dev/null; then
sudo systemctl start docker
fi
}
install_docker_compose
start_docker
sudo docker-compose "${@:-up}"