From d67f139f0ce5cdc0c0ee27f7aa1cfe9e37052ce3 Mon Sep 17 00:00:00 2001 From: Kostya Deev Date: Tue, 8 Dec 2020 21:57:49 -0600 Subject: [PATCH 1/3] Dockerize it --- Dockerfile | 29 +++++++++++++++++++++++++++++ README.md | 2 +- docker-compose.yml | 25 +++++++++++++++++++++++++ oopsypad/server/config.py | 17 +++++++++++++---- setup.py | 1 + start.sh | 9 +++++++++ 6 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 start.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..61cb1a0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +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 + +RUN dos2unix /OopsyPad/start.sh +ENTRYPOINT ["/bin/sh"] +CMD ["/OopsyPad/start.sh"] diff --git a/README.md b/README.md index 6802bad..cb3f94c 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ OopsyPad is a Breakpad minidumps processing tool for [RedisDesktopManager](https ## Server ### Installation ```shell -git clone --recursive https://github.com/RedisDesktop/OopsyPad.git +git clone --recursive https://github.com/kdeyev/OopsyPad.git cd OopsyPad/ ./3rdparty/build.sh pip install . diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..17270ab --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +# Note: Requires docker-comopse 1.10+. +version: "2" +services: + + mongo: + image: mongo + ports: + - "27017:27017" + + redis: + image: redis + ports: + - "6379:6379" + + oopsypad: + build: + context: . + dockerfile: ./Dockerfile + image: oopsypad + ports: + - "8000:8000" + environment: + - MONGODB_HOST=mongo + depends_on: + - mongo \ No newline at end of file diff --git a/oopsypad/server/config.py b/oopsypad/server/config.py index 8e494a3..49a8b38 100644 --- a/oopsypad/server/config.py +++ b/oopsypad/server/config.py @@ -8,6 +8,7 @@ PROD: 'oopsy_pad' } +mongo_host = os.environ.get('MONGODB_HOST', 'localhost') class Config: SECRET_KEY = 'dev' @@ -44,12 +45,14 @@ 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): @@ -57,7 +60,10 @@ class TestConfig(Config): TESTING = True CREATE_TEST_USERS = True - MONGODB_SETTINGS = {'DB': DB_NAMES[TEST]} + MONGODB_SETTINGS = { + 'DB': DB_NAMES[TEST], + 'HOST': mongo_host + } LIVESERVER_PORT = 8000 @@ -65,7 +71,10 @@ class TestConfig(Config): class ProdConfig(Config): DEBUG = False - MONGODB_SETTINGS = {'DB': DB_NAMES[PROD]} + MONGODB_SETTINGS = { + 'DB': DB_NAMES[PROD], + 'HOST': mongo_host + } ENABLE_SENTRY = True diff --git a/setup.py b/setup.py index 1b7f616..9f8aba6 100644 --- a/setup.py +++ b/setup.py @@ -22,6 +22,7 @@ 'gunicorn', 'requests', 'raven', + 'email_validator', ], tests_require=[ 'selenium', diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..51649ff --- /dev/null +++ b/start.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +export LC_ALL=en_US.utf-8 +export LANG=en_US.utf-8 + +# oopsy_celery_worker run +oopsy_run_server --host 0.0.0.0 --port 8000 +# oopsy_celery_worker stop \ No newline at end of file From e1b5d64dd23ded0fe8d43315f6140f01b17668e8 Mon Sep 17 00:00:00 2001 From: Kostya Deev Date: Tue, 8 Dec 2020 23:08:41 -0600 Subject: [PATCH 2/3] fix docker compose --- Dockerfile | 5 +++++ docker-compose.yml | 7 ++----- oopsypad/server/config.py | 4 ++-- setup.py | 2 +- start.sh | 7 ++----- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 61cb1a0..976bfd2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,6 +24,11 @@ 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"] diff --git a/docker-compose.yml b/docker-compose.yml index 17270ab..e2ede0d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,11 +7,6 @@ services: ports: - "27017:27017" - redis: - image: redis - ports: - - "6379:6379" - oopsypad: build: context: . @@ -21,5 +16,7 @@ services: - "8000:8000" environment: - MONGODB_HOST=mongo + - CELERY_BROKER_URL=mongodb://mongo + - CELERY_RESULT_BACKEND=mongodb://mongo depends_on: - mongo \ No newline at end of file diff --git a/oopsypad/server/config.py b/oopsypad/server/config.py index 49a8b38..01cc74d 100644 --- a/oopsypad/server/config.py +++ b/oopsypad/server/config.py @@ -28,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 diff --git a/setup.py b/setup.py index 9f8aba6..a5df199 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ 'flask-httpauth', 'flask-security', 'redis', - 'celery', + 'celery==4.4.7', 'python-dateutil', 'gunicorn', 'requests', diff --git a/start.sh b/start.sh index 51649ff..c30ceb7 100644 --- a/start.sh +++ b/start.sh @@ -1,9 +1,6 @@ #!/bin/sh set -e -export LC_ALL=en_US.utf-8 -export LANG=en_US.utf-8 - -# oopsy_celery_worker run +oopsy_celery_worker run oopsy_run_server --host 0.0.0.0 --port 8000 -# oopsy_celery_worker stop \ No newline at end of file +oopsy_celery_worker stop \ No newline at end of file From 29f2248601f579277a6d5892237018c575c063af Mon Sep 17 00:00:00 2001 From: Kostya Deev Date: Thu, 10 Dec 2020 08:11:13 -0600 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cb3f94c..6802bad 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ OopsyPad is a Breakpad minidumps processing tool for [RedisDesktopManager](https ## Server ### Installation ```shell -git clone --recursive https://github.com/kdeyev/OopsyPad.git +git clone --recursive https://github.com/RedisDesktop/OopsyPad.git cd OopsyPad/ ./3rdparty/build.sh pip install .