Loading .env 0 → 100644 +3 −0 Original line number Diff line number Diff line DB_USER=postgres DB_PASSWORD=postgres DB_DB=postgres No newline at end of file Dockerfile +1 −2 Original line number Diff line number Diff line FROM kontr2/base-pipenv MAINTAINER barbora.kompisova@gmail.com RUN apk add --update --no-cache g++ gcc libxslt-dev postgresql-dev postgresql-libs openldap-dev python3-dev ADD . /app WORKDIR /app Loading @@ -9,7 +9,6 @@ EXPOSE 8000 ONBUILD COPY Pipfile Pipfile ONBUILD COPY Pipfile.lock Pipfile.lock RUN apk add --update --no-cache g++ gcc libxslt-dev postgresql-dev postgresql-libs RUN pipenv install --system ENTRYPOINT ["sh", "run.sh"] Loading docker-compose.yml +52 −3 Original line number Diff line number Diff line version: '3' services: portal: build: . container_name: 'kontr-portal' image: 'kontr2/portal' command: > gunicorn -b 0.0.0.0:8000 --access-logfile - --reload "app:app" ports: - "8000:8000" environment: CELERY_BROKER_URL: "redis://redis:6379/0" SQLALCHEMY_DATABASE_URI: "postgresql://${DB_USER}:${DB_PASSWORD}@postgres:5432/${DB_DB}" networks: - async_nw - db_nw depends_on: - db - redis redis: image: "redis:alpine" networks: - async_nw db: image: 'postgres' networks: - db_nw environment: POSTGRES_USER: ${DB_USER} POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_DB: ${DB_DB} celery: build: . privileged: true container_name: 'kontr-portal-async-celery' command: "celery worker -l info -A app.celery" environment: CELERY_BROKER_URL: 'redis://redis:6379/0' SQLALCHEMY_DATABASE_URI: "postgresql://${DB_USER}:${DB_PASSWORD}@postgres:5432/${DB_DB}" depends_on: - redis - portal - db networks: - async_nw - db_nw networks: db_nw: driver: bridge async_nw: driver: bridge No newline at end of file portal.local.cfg +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ FRONTEND_URL = "http://kontr.pstanko.net/gitlabLogin" # URI to connect to the database # if 'sqlite://' - the in memory database will be used #SQLALCHEMY_DATABASE_URI = f"sqlite:////{ROOT_DIR}/devel.db" SQLALCHEMY_DATABASE_URI = f"postgresql://postgres:postgres@localhost:5432/postgres" #SQLALCHEMY_DATABASE_URI = f"postgresql://postgres:postgres@localhost:5432/postgres" #SQLALCHEMY_ECHO=False #SQLALCHEMY_RECORD_QUERIES Loading portal/config.py +9 −9 Original line number Diff line number Diff line Loading @@ -31,28 +31,28 @@ class Config(object): LOGGER_NAME = "flask" API_PREFIX = os.environ.get('PORTAL_API_PREFIX', default="/api/v1.0/") CORS_SUPPORT_CREDENTIALS = True EMAIL_BACKEND = 'tests.utils.email_backend.EmailBackend' CELERY_RESULT_BACKEND = None BROKER_URL = None BROKER_URL = os.getenv('CELERY_BROKER_URL', 'redis://localhost:6379/0') CELERY_RESULT_BACKEND = os.getenv('CELERY_RESULT_BACKEND', BROKER_URL) SQLALCHEMY_DATABASE_URI = os.getenv('SQLALCHEMY_DATABASE_URI', f"sqlite:///{paths.ROOT_DIR}/devel.db") class DevelopmentConfig(Config): """Development configuration """ SQLALCHEMY_DATABASE_URI = f"sqlite:///{paths.ROOT_DIR}/devel.db" #SQLALCHEMY_DATABASE_URI = f"postgresql://postgres:postgres@localhost:5432/postgres" SQLALCHEMY_DATABASE_URI = os.getenv('SQLALCHEMY_DATABASE_URI', f"sqlite:///{paths.ROOT_DIR}/devel.db") SQLALCHEMY_TRACK_MODIFICATIONS = True PORTAL_ENV = 'dev' PORTAL_ADMIN_USER_PASSWORD = '789789' DEBUG = True CELERY_RESULT_BACKEND = 'redis://localhost:6379/0' BROKER_URL = 'redis://localhost:6379/0' PORTAL_STORAGE_BASE_DIR = f"{tempfile.gettempdir()}/kontr-portal" PORTAL_STORAGE_TEST_FILES_DIR = f"{PORTAL_STORAGE_BASE_DIR}/test-files" PORTAL_STORAGE_WORKSPACE_DIR = f"{PORTAL_STORAGE_BASE_DIR}/workspace" PORTAL_STORAGE_SUBMISSIONS_DIR = f"{PORTAL_STORAGE_BASE_DIR}/submissions" PORTAL_STORAGE_RESULTS_DIR = f"{PORTAL_STORAGE_BASE_DIR}/results" UPLOAD_FOLDER = f"{PORTAL_STORAGE_BASE_DIR}/upload" EMAIL_BACKEND = 'tests.utils.email_backend.EmailBackend' class ProductionConfig(Config): Loading Loading @@ -80,8 +80,8 @@ class TestConfig(Config): EMAIL_PORT = "1025" EMAIL_DEFAULT_FROM = "kontr@example.com" CORS_ORIGINS = '*' CELERY_RESULT_BACKEND = 'redis://' BROKER_URL = 'redis://' CELERY_RESULT_BACKEND = BROKER_URL # pylint: enable=too-few-public-methods Loading Loading
.env 0 → 100644 +3 −0 Original line number Diff line number Diff line DB_USER=postgres DB_PASSWORD=postgres DB_DB=postgres No newline at end of file
Dockerfile +1 −2 Original line number Diff line number Diff line FROM kontr2/base-pipenv MAINTAINER barbora.kompisova@gmail.com RUN apk add --update --no-cache g++ gcc libxslt-dev postgresql-dev postgresql-libs openldap-dev python3-dev ADD . /app WORKDIR /app Loading @@ -9,7 +9,6 @@ EXPOSE 8000 ONBUILD COPY Pipfile Pipfile ONBUILD COPY Pipfile.lock Pipfile.lock RUN apk add --update --no-cache g++ gcc libxslt-dev postgresql-dev postgresql-libs RUN pipenv install --system ENTRYPOINT ["sh", "run.sh"] Loading
docker-compose.yml +52 −3 Original line number Diff line number Diff line version: '3' services: portal: build: . container_name: 'kontr-portal' image: 'kontr2/portal' command: > gunicorn -b 0.0.0.0:8000 --access-logfile - --reload "app:app" ports: - "8000:8000" environment: CELERY_BROKER_URL: "redis://redis:6379/0" SQLALCHEMY_DATABASE_URI: "postgresql://${DB_USER}:${DB_PASSWORD}@postgres:5432/${DB_DB}" networks: - async_nw - db_nw depends_on: - db - redis redis: image: "redis:alpine" networks: - async_nw db: image: 'postgres' networks: - db_nw environment: POSTGRES_USER: ${DB_USER} POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_DB: ${DB_DB} celery: build: . privileged: true container_name: 'kontr-portal-async-celery' command: "celery worker -l info -A app.celery" environment: CELERY_BROKER_URL: 'redis://redis:6379/0' SQLALCHEMY_DATABASE_URI: "postgresql://${DB_USER}:${DB_PASSWORD}@postgres:5432/${DB_DB}" depends_on: - redis - portal - db networks: - async_nw - db_nw networks: db_nw: driver: bridge async_nw: driver: bridge No newline at end of file
portal.local.cfg +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ FRONTEND_URL = "http://kontr.pstanko.net/gitlabLogin" # URI to connect to the database # if 'sqlite://' - the in memory database will be used #SQLALCHEMY_DATABASE_URI = f"sqlite:////{ROOT_DIR}/devel.db" SQLALCHEMY_DATABASE_URI = f"postgresql://postgres:postgres@localhost:5432/postgres" #SQLALCHEMY_DATABASE_URI = f"postgresql://postgres:postgres@localhost:5432/postgres" #SQLALCHEMY_ECHO=False #SQLALCHEMY_RECORD_QUERIES Loading
portal/config.py +9 −9 Original line number Diff line number Diff line Loading @@ -31,28 +31,28 @@ class Config(object): LOGGER_NAME = "flask" API_PREFIX = os.environ.get('PORTAL_API_PREFIX', default="/api/v1.0/") CORS_SUPPORT_CREDENTIALS = True EMAIL_BACKEND = 'tests.utils.email_backend.EmailBackend' CELERY_RESULT_BACKEND = None BROKER_URL = None BROKER_URL = os.getenv('CELERY_BROKER_URL', 'redis://localhost:6379/0') CELERY_RESULT_BACKEND = os.getenv('CELERY_RESULT_BACKEND', BROKER_URL) SQLALCHEMY_DATABASE_URI = os.getenv('SQLALCHEMY_DATABASE_URI', f"sqlite:///{paths.ROOT_DIR}/devel.db") class DevelopmentConfig(Config): """Development configuration """ SQLALCHEMY_DATABASE_URI = f"sqlite:///{paths.ROOT_DIR}/devel.db" #SQLALCHEMY_DATABASE_URI = f"postgresql://postgres:postgres@localhost:5432/postgres" SQLALCHEMY_DATABASE_URI = os.getenv('SQLALCHEMY_DATABASE_URI', f"sqlite:///{paths.ROOT_DIR}/devel.db") SQLALCHEMY_TRACK_MODIFICATIONS = True PORTAL_ENV = 'dev' PORTAL_ADMIN_USER_PASSWORD = '789789' DEBUG = True CELERY_RESULT_BACKEND = 'redis://localhost:6379/0' BROKER_URL = 'redis://localhost:6379/0' PORTAL_STORAGE_BASE_DIR = f"{tempfile.gettempdir()}/kontr-portal" PORTAL_STORAGE_TEST_FILES_DIR = f"{PORTAL_STORAGE_BASE_DIR}/test-files" PORTAL_STORAGE_WORKSPACE_DIR = f"{PORTAL_STORAGE_BASE_DIR}/workspace" PORTAL_STORAGE_SUBMISSIONS_DIR = f"{PORTAL_STORAGE_BASE_DIR}/submissions" PORTAL_STORAGE_RESULTS_DIR = f"{PORTAL_STORAGE_BASE_DIR}/results" UPLOAD_FOLDER = f"{PORTAL_STORAGE_BASE_DIR}/upload" EMAIL_BACKEND = 'tests.utils.email_backend.EmailBackend' class ProductionConfig(Config): Loading Loading @@ -80,8 +80,8 @@ class TestConfig(Config): EMAIL_PORT = "1025" EMAIL_DEFAULT_FROM = "kontr@example.com" CORS_ORIGINS = '*' CELERY_RESULT_BACKEND = 'redis://' BROKER_URL = 'redis://' CELERY_RESULT_BACKEND = BROKER_URL # pylint: enable=too-few-public-methods Loading