Be explicit about db user and name in Docker compose setup

This commit is contained in:
Marcin Kulik 2017-04-15 00:01:31 +02:00
parent 5c374f2b77
commit 3e0971d704
2 changed files with 14 additions and 8 deletions

View File

@ -4,11 +4,11 @@ MAINTAINER Marcin Kulik <support@asciinema.org>
# A quickstart:
#
# docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=mypass --name=postgres postgres
# docker run -d -p 5432:5432 -e POSTGRES_USER=asciinema -e POSTGRES_PASSWORD=sekrit --name=postgres postgres
# docker run -d -p 6379:6379 --name=redis redis
# docker run --rm -e DATABASE_URL="postgresql://postgres:mypass@postgres/asciinema" asciinema/asciinema.org bundle exec rake db:setup
# docker run -d -e DATABASE_URL="postgresql://postgres:mypass@postgres/asciinema" asciinema/asciinema.org bundle exec sidekiq
# docker run -d -e DATABASE_URL="postgresql://postgres:mypass@postgres/asciinema" -p 3000:80 asciinema/asciinema.org
# docker run --rm -e DATABASE_URL="postgresql://asciinema:sekrit@postgres/asciinema" asciinema/asciinema.org bundle exec rake db:setup
# docker run -d -e DATABASE_URL="postgresql://asciinema:sekrit@postgres/asciinema" asciinema/asciinema.org bundle exec sidekiq
# docker run -d -e DATABASE_URL="postgresql://asciinema:sekrit@postgres/asciinema" -p 3000:80 asciinema/asciinema.org
#
# You can override the address/port that is sent in email with login token by passing HOST="host:port" environment variable when starting the web server.
@ -104,7 +104,7 @@ RUN cd a2png && lein cljsbuild once main && lein cljsbuild once page
COPY . /app
ENV DATABASE_URL "postgresql://postgres:mypass@postgres/asciinema"
ENV DATABASE_URL "postgresql://asciinema:sekrit@postgres/asciinema"
ENV REDIS_URL "redis://redis:6379"
RUN cd src && make

View File

@ -11,6 +11,11 @@ services:
postgres:
image: postgres
container_name: asciinema_postgres
environment:
POSTGRES_USER: "asciinema"
POSTGRES_PASSWORD: "sekrit"
# see https://hub.docker.com/_/postgres/ for more configuration options
# for this image
redis:
image: redis
@ -24,7 +29,7 @@ services:
- postgres
- smtp
environment:
DATABASE_URL: "postgresql://postgres:mypass@postgres/asciinema"
DATABASE_URL: "postgresql://asciinema:sekrit@postgres/asciinema"
REDIS_URL: "redis://redis:6379"
HOST: "localhost:3000"
command: "bundle exec sidekiq"
@ -37,6 +42,7 @@ services:
environment:
MAILNAME: "localhost"
# see https://github.com/namshi/docker-smtp for more SMTP configuration options
# for this image
web:
image: asciinema/asciinema.org
@ -48,7 +54,7 @@ services:
depends_on:
- sidekiq
environment:
DATABASE_URL: "postgresql://postgres:mypass@postgres/asciinema"
DATABASE_URL: "postgresql://asciinema:sekrit@postgres/asciinema"
REDIS_URL: "redis://redis:6379"
HOST: "localhost:3000" # replace with actual hostname/ip.... ${HOSTNAME} doesn't seem to work..
ports:
@ -61,5 +67,5 @@ services:
links:
- postgres
environment:
DATABASE_URL: "postgresql://postgres:mypass@postgres/asciinema"
DATABASE_URL: "postgresql://asciinema:sekrit@postgres/asciinema"
command: "bundle exec rake db:setup"