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.
This commit is contained in:
evazion
2021-09-24 08:07:47 -05:00
parent 463e6d7b49
commit c183237b6b
3 changed files with 17 additions and 19 deletions

View File

@@ -2,22 +2,20 @@
## Quickstart ## Quickstart
Clone this repository and run `bin/danbooru` to start a basic Danbooru instance: Run this to start a basic Danbooru instance:
```sh ```sh
git clone https://github.com/danbooru/danbooru curl -sSL https://raw.githubusercontent.com/danbooru/danbooru/master/bin/danbooru | sh
cd danbooru
./bin/danbooru
``` ```
This will install [Docker Compose](https://docs.docker.com/compose/) and use it This will install [Docker Compose](https://docs.docker.com/compose/) and use it
to start Danbooru. This will take several minutes and produce lots of output. to start Danbooru. When it's done, Danbooru will be running at http://localhost:3000.
When it's done, Danbooru will be running at http://localhost.
Alternatively, if you already have Docker Compose installed, you can just do: Alternatively, if you already have Docker Compose installed, you can just do:
```sh ```sh
docker-compose -f config/docker/docker-compose.simple.yaml up wget https://raw.githubusercontent.com/danbooru/danbooru/master/docker-compose.yaml
docker-compose up
``` ```
## Manual Installation ## Manual Installation

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/bin/sh
# #
# This script starts Danbooru by installing Docker and Docker Compose, then # This script starts Danbooru by installing Docker and Docker Compose, then
# starting Danbooru in a container. Danbooru will be available at http://localhost. # starting Danbooru in a container. Danbooru will be available at http://localhost:3000.
# #
# Usage: # Usage:
# #
@@ -15,11 +15,11 @@
# #
# This script is just a wrapper for that command. # This script is just a wrapper for that command.
set -euxo pipefail set -eux
# Check if program exists. # Check if program exists.
has() { has() {
type -p "$1" > /dev/null type "$1" > /dev/null 2>&1
} }
# Install Docker and Docker Compose if they're not installed already. # Install Docker and Docker Compose if they're not installed already.

View File

@@ -1,7 +1,7 @@
# A Docker Compose file that launches a minimal Danbooru instance. This is # A Docker Compose file that launches a minimal Danbooru instance. This is
# suitable as a quick demo or for personal use, not for public-facing sites. # suitable as a quick demo or for personal use, not for public-facing sites.
# #
# This will start a Danbooru instance running on http://localhost. # This will start a Danbooru instance running on http://localhost:3000.
# #
# Usage: # Usage:
# #
@@ -22,28 +22,28 @@ version: "3.4"
services: services:
danbooru: danbooru:
user: root user: root
image: ghcr.io/danbooru/danbooru image: ghcr.io/danbooru/danbooru:production
ports: ports:
- "80:3000" - "3000:3000"
environment: environment:
- RAILS_ENV=production - RAILS_ENV=production
- RAILS_SERVE_STATIC_FILES=true - RAILS_SERVE_STATIC_FILES=true
- PUMA_WORKERS=1
- DATABASE_URL=postgresql://danbooru@postgres/danbooru - DATABASE_URL=postgresql://danbooru@postgres/danbooru
- DANBOORU_REDIS_URL=redis://redis:6379 - DANBOORU_REDIS_URL=redis://redis:6379
- DANBOORU_IQDB_URL=http://iqdb:5588 - DANBOORU_IQDB_URL=http://iqdb:5588
- DANBOORU_CANONICAL_URL=http://localhost - DANBOORU_CANONICAL_URL=http://localhost:3000
volumes: volumes:
- "danbooru-images:/danbooru/public/data" - "danbooru-images:/danbooru/public/data"
tmpfs: tmpfs:
- /tmp - /tmp
depends_on: depends_on:
- postgres - postgres
command: ["bash", "-c", "bin/rails db:setup; bin/rails db:migrate && bin/rails server -b 0.0.0.0"] command: ["bash", "-c", "bin/rails db:prepare && bin/rails server -b 0.0.0.0"]
user: root
cron: cron:
user: root user: root
image: ghcr.io/danbooru/danbooru image: ghcr.io/danbooru/danbooru:production
environment: environment:
- RAILS_ENV=production - RAILS_ENV=production
- DATABASE_URL=postgresql://danbooru@postgres/danbooru - DATABASE_URL=postgresql://danbooru@postgres/danbooru
@@ -59,7 +59,7 @@ services:
delayed_jobs: delayed_jobs:
# We need root to write temp upload files in the images directory (/danbooru/public/data) # We need root to write temp upload files in the images directory (/danbooru/public/data)
user: root user: root
image: ghcr.io/danbooru/danbooru image: ghcr.io/danbooru/danbooru:production
environment: environment:
- RAILS_ENV=production - RAILS_ENV=production
- DATABASE_URL=postgresql://danbooru@postgres/danbooru - DATABASE_URL=postgresql://danbooru@postgres/danbooru