Snippets

bashell.com microblog running script

Created by Chaiwat Suttipongsakul
#!/bin/bash

RMQ_USER=__your_rabbitmq_user__
RMQ_PASS=__your_rabbitmq_password__
RMQ_VHOST=__your_rabbitmq_vhost__

docker run -d --restart=always --name=rabbitmq \
       -v /data/rabbitmq:/var/lib/rabbitmq:z \
       quay.io/bashell/alpine-rmq

docker run -d --restart=always --name=mongodb \
       -v /data/mongo:/data/db:z \
       docker.io/mongo

docker run -d --restart=always --name=ublog-web \
        --link=rabbitmq \
        --link=mongodb \
        -v /data/ublog-config:/app/config:z \
        -v /data/ublog-static:/app/static:z \
        -e MICROBLOGPUB_AMQP_BROKER=pyamqp://${RMQ_USER}:${RMQ_PASS}@rabbitmq/${RMQ_VHOST} \
        -e MICROBLOGPUB_MONGODB_HOST=mongodb:27017 \
        quay.io/bashell/microblogpub

docker run -d --restart=always --name=nginx \
        --link=rabbitmq \
        --link=ublog-web \
        -v /data/etc/letsencrypt:/etc/letsencrypt:z \
        -v /data/etc/nginx:/etc/nginx:z \
        -v /data/ublog-static:/ublog/static \
        -p 443:443 \
        quay.io/bashell/alpine-nginx

sleep 5  # wait for ublog-web and nginx running before start ublog-celery

docker run -d --restart=always --name=ublog-celery \
        --link=rabbitmq \
        --link=mongodb \
        -v /data/ublog-config:/app/config:z \
        -v /data/ublog-static:/app/static:z \
        -e MICROBLOGPUB_AMQP_BROKER=pyamqp://${RMQ_USER}:${RMQ_PASS}@rabbitmq/${RMQ_VHOST} \
        -e MICROBLOGPUB_MONGODB_HOST=mongodb:27017 \
        quay.io/bashell/microblogpub \
        /opt/ublog/bin/celery worker -l info -A tasks

Comments (0)