fixes #225 - dockerized problem in the sidekiq-in-container

docker-smtp
Bartosz Ptaszynski 8 years ago
parent 14f7ae310f
commit f3949ce553

@ -86,7 +86,7 @@ RUN rbenv local $RUBY_VERSION && \
mkdir -p tmp && \
touch tmp/restart.txt
VOLUME ["/app/config", "/app/log"]
VOLUME ["/app/config", "/app/log", "/app/uploads"]
# 172.17.42.1 is the docker0 address
ENV DATABASE_URL "postgresql://postgres:mypass@172.17.42.1/asciinema"
@ -95,7 +95,7 @@ ENV RAILS_ENV "development"
# when using Docker Toolbox/Virtualbox this is going to be your address
# set to whatever FQDN/address you want asciinema to advertise itself as
# for ex. asciinema.example.com
ENV HOST "192.168.99.100:3000"
ENV HOST "localhost:3000"
ENTRYPOINT ["rbenv", "exec"]
CMD ["bundle", "exec", "rails", "server"]

@ -21,16 +21,16 @@ Below you'll find setup instructions in case you want to contribute, play with
it on your local machine, or setup your own instance for private use or for
your organization.
### Using Docker
### Quickstart Using Docker Compose
Required:
- [Docker](https://docs.docker.com/engine/getstarted/step_one/#step-1-get-docker)
- [docker-compose 1.5+](https://docs.docker.com/compose/install/)
```bash
$ docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=mypass --name=postgres postgres
$ docker run -d -p 6379:6379 --name=redis redis
$ docker run --rm --link postgres:postgres -e DATABASE_URL="postgresql://postgres:mypass@postgres/asciinema" --link redis:redis -e REDIS_URL="redis://redis:6379" asciinema/asciinema.org bundle exec rake db:setup
# starting sidekiq using the provided start_sidekiq.rb file will also start sendmail service if you don't want to use SMTP
# otherwise start sidekiq by starting: bundle exec sidekiq
$ docker run -d --link postgres:postgres -e DATABASE_URL="postgresql://postgres:mypass@postgres/asciinema" --link redis:redis -e REDIS_URL="redis://redis:6379" asciinema/asciinema.org ruby start_sidekiq.rb
$ docker run -d --link postgres:postgres -e DATABASE_URL="postgresql://postgres:mypass@postgres/asciinema" --link redis:redis -e REDIS_URL="redis://redis:6379" -p 3000:3000 asciinema/asciinema.org
$ wget https://raw.githubusercontent.com/asciinema/asciinema.org/master/docker-compose.yml
$ docker-compose up -d asciinema
$ docker-compose run --rm db_init
```
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.

@ -0,0 +1,55 @@
version: '2'
# Quickstart:
# docker-compose up -d asciinema
# docker-compose run --rm db_init
# To cleanup:
# docker-compose stop && docker-compose rm
services:
postgres:
image: postgres
container_name: postgres
redis:
image: redis
container_name: redis
sidekiq:
image: asciinema/asciinema.org
links:
- redis
- postgres
environment:
DATABASE_URL: "postgresql://postgres:mypass@postgres/asciinema"
REDIS_URL: "redis://redis:6379"
HOST: "localhost:3000"
command: "ruby start_sidekiq.rb"
volumes:
- /tmp/asciinema/uploads:/app/uploads
asciinema:
image: asciinema/asciinema.org
container_name: asciinema
links:
- redis
- postgres
depends_on:
- sidekiq
environment:
DATABASE_URL: "postgresql://postgres:mypass@postgres/asciinema"
REDIS_URL: "redis://redis:6379"
HOST: "localhost:3000" # replace with actual hostname/ip.... ${HOSTNAME} doesn't seem to work..
ports:
- "3000:3000"
volumes:
- /tmp/asciinema/uploads:/app/uploads
db_init:
image: asciinema/asciinema.org
links:
- redis
- postgres
environment:
DATABASE_URL: "postgresql://postgres:mypass@postgres/asciinema"
REDIS_URL: "redis://redis:6379"
command: "bundle exec rake db:setup"
Loading…
Cancel
Save