docker: add delayed job worker to compose file.
This commit is contained in:
16
bin/wait-for-http
Executable file
16
bin/wait-for-http
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Script to wait until an http service is ready. Used by the Docker Compose
|
||||||
|
# file to wait until services are ready.
|
||||||
|
#
|
||||||
|
# Usage: bin/wait-for-http 3s http://google.com && echo ready
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
URL="$1"
|
||||||
|
DELAY="${2:-3s}"
|
||||||
|
|
||||||
|
until curl -sL "$URL" > /dev/null; do
|
||||||
|
echo "$URL not up yet; retrying in $DELAY"
|
||||||
|
sleep "$DELAY"
|
||||||
|
done
|
||||||
@@ -21,10 +21,7 @@ version: "3.4"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
danbooru:
|
danbooru:
|
||||||
image: evazion/danbooru
|
image: danbooru
|
||||||
# build:
|
|
||||||
# context: ../..
|
|
||||||
# dockerfile: config/docker/Dockerfile.danbooru
|
|
||||||
ports:
|
ports:
|
||||||
- "80:3000"
|
- "80:3000"
|
||||||
environment:
|
environment:
|
||||||
@@ -36,14 +33,21 @@ services:
|
|||||||
- "danbooru-images:/danbooru/public/data"
|
- "danbooru-images:/danbooru/public/data"
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
command: ["bash", "-c", "bin/rails db:setup; bin/rails server -b 0.0.0.0"]
|
command: ["bash", "-c", "bin/rails db:setup; bin/rails db:migrate && bin/rails server -b 0.0.0.0"]
|
||||||
user: root
|
user: root
|
||||||
|
|
||||||
|
delayed_jobs:
|
||||||
|
image: danbooru
|
||||||
|
environment:
|
||||||
|
- RAILS_ENV=production
|
||||||
|
- DATABASE_URL=postgresql://danbooru@postgres/danbooru
|
||||||
|
- DANBOORU_CANONICAL_URL=http://localhost
|
||||||
|
depends_on:
|
||||||
|
- danbooru
|
||||||
|
command: ["bash", "-c", "bin/wait-for-http http://danbooru:3000 3s && bin/delayed_job run"]
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
image: evazion/postgres
|
image: evazion/postgres
|
||||||
# build:
|
|
||||||
# context: .
|
|
||||||
# dockerfile: Dockerfile.postgres
|
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: danbooru
|
POSTGRES_USER: danbooru
|
||||||
POSTGRES_HOST_AUTH_METHOD: trust
|
POSTGRES_HOST_AUTH_METHOD: trust
|
||||||
|
|||||||
Reference in New Issue
Block a user