Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Run OopsyPad in Docker Compose #19

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM centos:7


RUN rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum -y install python36 python36-pip dos2unix git
RUN yum -y install gcc gcc-c++ make libcurl-devel

# workdir and user
WORKDIR /OopsyPad
# USER 0

COPY . .

# Get breakpad inside container
RUN rm -rf ./3rdparty/breakpad/*
RUN git submodule update --init --recursive

# Install dependencies
RUN dos2unix ./3rdparty/build.sh
RUN ./3rdparty/build.sh

# install OopsyPad
RUN python3 -m pip install .

EXPOSE 8000

ENV LC_ALL=en_US.utf-8
ENV LANG=en_US.utf-8

ENV OOPSY_HOST=http://localhost:8000

RUN dos2unix /OopsyPad/start.sh
ENTRYPOINT ["/bin/sh"]
CMD ["/OopsyPad/start.sh"]
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Note: Requires docker-comopse 1.10+.
version: "2"
services:

mongo:
image: mongo
ports:
- "27017:27017"

oopsypad:
build:
context: .
dockerfile: ./Dockerfile
image: oopsypad
ports:
- "8000:8000"
environment:
- MONGODB_HOST=mongo
- CELERY_BROKER_URL=mongodb://mongo
- CELERY_RESULT_BACKEND=mongodb://mongo
depends_on:
- mongo
21 changes: 15 additions & 6 deletions oopsypad/server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
PROD: 'oopsy_pad'
}

mongo_host = os.environ.get('MONGODB_HOST', 'localhost')

class Config:
SECRET_KEY = 'dev'
Expand All @@ -27,8 +28,8 @@ class Config:
DUMPS_DIR = os.path.join(ROOT_DIR, 'dumps')
SYMFILES_DIR = os.path.join(ROOT_DIR, 'symbols')

CELERY_BROKER_URL = 'redis://localhost:6379/1'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/1'
CELERY_BROKER_URL = os.environ.get('CELERY_BROKER_URL', 'redis://localhost:6379/1')
CELERY_RESULT_BACKEND = os.environ.get('CELERY_RESULT_BACKEND', 'redis://localhost:6379/1')

SECURITY_PASSWORD_HASH = 'sha512_crypt'
SECURITY_PASSWORD_SALT = SECRET_KEY
Expand All @@ -44,28 +45,36 @@ class Config:
ENABLE_SENTRY = False
SENTRY_DSN = ''


class DevConfig(Config):
DEBUG = True
CREATE_TEST_USERS = True

MONGODB_SETTINGS = {'DB': DB_NAMES[DEV]}
MONGODB_SETTINGS = {
'DB': DB_NAMES[DEV],
'HOST': mongo_host
}


class TestConfig(Config):
DEBUG = False
TESTING = True
CREATE_TEST_USERS = True

MONGODB_SETTINGS = {'DB': DB_NAMES[TEST]}
MONGODB_SETTINGS = {
'DB': DB_NAMES[TEST],
'HOST': mongo_host
}

LIVESERVER_PORT = 8000


class ProdConfig(Config):
DEBUG = False

MONGODB_SETTINGS = {'DB': DB_NAMES[PROD]}
MONGODB_SETTINGS = {
'DB': DB_NAMES[PROD],
'HOST': mongo_host
}

ENABLE_SENTRY = True

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
'flask-httpauth',
'flask-security',
'redis',
'celery',
'celery==4.4.7',
'python-dateutil',
'gunicorn',
'requests',
'raven',
'email_validator',
],
tests_require=[
'selenium',
Expand Down
6 changes: 6 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
set -e

oopsy_celery_worker run
oopsy_run_server --host 0.0.0.0 --port 8000
oopsy_celery_worker stop