Merge pull request 'fixes for Docker and Mail configuration' (#63) from saint/pyfedi:main into main

Reviewed-on: https://codeberg.org/rimu/pyfedi/pulls/63
This commit is contained in:
rimu 2024-02-26 18:21:09 +00:00
commit 3f0799a1c4
5 changed files with 10 additions and 5 deletions

4
.gitignore vendored
View file

@ -166,3 +166,7 @@ celery_worker.py
# sensitive data
.env.docker
.gunicorn.conf.py
# local volumes for docker
media/
pgdata/

View file

@ -4,7 +4,7 @@ FROM --platform=$BUILDPLATFORM python:3-alpine AS builder
RUN apk update
RUN apk add pkgconfig
RUN apk add --virtual build-deps gcc python3-dev musl-dev
RUN apk add --virtual build-deps gcc python3-dev musl-dev tesseract-ocr tesseract-ocr-data-eng
WORKDIR /app
COPY . /app

View file

@ -97,7 +97,7 @@ def create_app(config_class=Config):
secure = ()
mail_handler = SMTPHandler(
mailhost=(app.config['MAIL_SERVER'], app.config['MAIL_PORT']),
fromaddr='errors@rimu.geek.nz',
fromaddr=(app.config['MAIL_FROM']),
toaddrs=app.config['ADMINS'], subject='PieFed error',
credentials=auth, secure=secure)
mail_handler.setLevel(logging.ERROR)

View file

@ -5,7 +5,7 @@ services:
env_file:
- ./.env.docker
volumes:
- pgdata:/var/lib/postgresql/data
- ./pgdata:/var/lib/postgresql/data
redis:
image: redis
env_file:
@ -29,6 +29,7 @@ services:
volumes:
- ./.env:/app/.env
- ./.gunicorn.conf.py:/app/gunicorn.conf.py
- ./media/:/app/app/static/media/
ports:
- '8080:5000'
adminer:
@ -36,7 +37,5 @@ services:
restart: always
ports:
- 8888:8080
volumes:
pgdata:

View file

@ -16,6 +16,8 @@ class Config(object):
MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS') is not None
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
MAIL_FROM = os.environ.get('MAIL_FROM')
ADMINS = os.environ.get('ADMINS')
RECAPTCHA_PUBLIC_KEY = os.environ.get("RECAPTCHA_PUBLIC_KEY")
RECAPTCHA_PRIVATE_KEY = os.environ.get("RECAPTCHA_PRIVATE_KEY")
MODE = os.environ.get('MODE') or 'development'