Compare commits
2 commits
4d43eb5691
...
ae4e52dfdb
Author | SHA1 | Date | |
---|---|---|---|
ae4e52dfdb | |||
f9fa7e0390 |
9 changed files with 139 additions and 3 deletions
|
@ -212,7 +212,7 @@ CHANNEL_LAYERS = {
|
||||||
'default': {
|
'default': {
|
||||||
'BACKEND': 'channels_redis.core.RedisChannelLayer',
|
'BACKEND': 'channels_redis.core.RedisChannelLayer',
|
||||||
'CONFIG': {
|
'CONFIG': {
|
||||||
'hosts': [('localhost', 6379)],
|
'hosts': [(os.getenv('REDIS_HOST', 'localhost'), 6379)],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
36
core/mail/migrations/0007_email_raw_file.py
Normal file
36
core/mail/migrations/0007_email_raw_file.py
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# Generated by Django 4.2.7 on 2024-11-08 20:37
|
||||||
|
from django.core.files.base import ContentFile
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('mail', '0006_alter_eventaddress_address'),
|
||||||
|
]
|
||||||
|
|
||||||
|
def move_raw_mails_to_file(apps, schema_editor):
|
||||||
|
Email = apps.get_model('mail', 'Email')
|
||||||
|
for email in Email.objects.all():
|
||||||
|
raw_content = email.raw
|
||||||
|
email.raw_file = ContentFile(raw_content)
|
||||||
|
email.raw = None
|
||||||
|
email.save()
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='email',
|
||||||
|
name='raw_file',
|
||||||
|
field=models.FileField(null=True, upload_to='raw_mail/'),
|
||||||
|
),
|
||||||
|
migrations.RunPython(move_raw_mails_to_file),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='email',
|
||||||
|
name='raw',
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='email',
|
||||||
|
name='raw_file',
|
||||||
|
field=models.FileField(upload_to='raw_mail/'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -19,7 +19,7 @@ class Email(SoftDeleteModel):
|
||||||
recipient = models.CharField(max_length=255)
|
recipient = models.CharField(max_length=255)
|
||||||
reference = models.CharField(max_length=255, null=True, unique=True)
|
reference = models.CharField(max_length=255, null=True, unique=True)
|
||||||
in_reply_to = models.CharField(max_length=255, null=True)
|
in_reply_to = models.CharField(max_length=255, null=True)
|
||||||
raw = models.TextField()
|
raw_file = models.FileField(upload_to='raw_mail/')
|
||||||
issue_thread = models.ForeignKey(IssueThread, models.SET_NULL, null=True, related_name='emails')
|
issue_thread = models.ForeignKey(IssueThread, models.SET_NULL, null=True, related_name='emails')
|
||||||
event = models.ForeignKey(Event, models.SET_NULL, null=True)
|
event = models.ForeignKey(Event, models.SET_NULL, null=True)
|
||||||
|
|
||||||
|
|
|
@ -233,7 +233,7 @@ def receive_email(envelope, log=None):
|
||||||
|
|
||||||
email = Email.objects.create(
|
email = Email.objects.create(
|
||||||
sender=sender, recipient=recipient, body=body, subject=subject, reference=header_message_id,
|
sender=sender, recipient=recipient, body=body, subject=subject, reference=header_message_id,
|
||||||
in_reply_to=header_in_reply_to, raw=envelope.content, event=target_event,
|
in_reply_to=header_in_reply_to, raw_file=ContentFile(envelope.content), event=target_event,
|
||||||
issue_thread=active_issue_thread)
|
issue_thread=active_issue_thread)
|
||||||
for attachment in attachments:
|
for attachment in attachments:
|
||||||
email.attachments.add(attachment)
|
email.attachments.add(attachment)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
REDIS_HOST=localhost
|
||||||
DB_HOST=localhost
|
DB_HOST=localhost
|
||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
DB_NAME=c3lf_sys3
|
DB_NAME=c3lf_sys3
|
||||||
|
|
11
deploy/testing/Dockerfile.backend
Normal file
11
deploy/testing/Dockerfile.backend
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
FROM python:3.11-bookworm
|
||||||
|
LABEL authors="lagertonne"
|
||||||
|
|
||||||
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
RUN mkdir /code
|
||||||
|
WORKDIR /code
|
||||||
|
COPY requirements.prod.txt /code/
|
||||||
|
RUN apt update && apt install -y mariadb-client
|
||||||
|
RUN pip install -r requirements.prod.txt
|
||||||
|
RUN pip install mysqlclient
|
||||||
|
COPY .. /code/
|
6
deploy/testing/Dockerfile.frontend
Normal file
6
deploy/testing/Dockerfile.frontend
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
FROM docker.io/node:22
|
||||||
|
|
||||||
|
RUN mkdir /web
|
||||||
|
WORKDIR /web
|
||||||
|
COPY package.json /web/
|
||||||
|
RUN npm install
|
55
deploy/testing/docker-compose.yml
Normal file
55
deploy/testing/docker-compose.yml
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
services:
|
||||||
|
redis:
|
||||||
|
image: redis
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: mariadb
|
||||||
|
environment:
|
||||||
|
MARIADB_RANDOM_ROOT_PASSWORD: true
|
||||||
|
MARIADB_DATABASE: system3
|
||||||
|
MARIADB_USER: system3
|
||||||
|
MARIADB_PASSWORD: system3
|
||||||
|
volumes:
|
||||||
|
- mariadb_data:/var/lib/mysql
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
|
|
||||||
|
core:
|
||||||
|
build:
|
||||||
|
context: ../../core
|
||||||
|
dockerfile: ../deploy/testing/Dockerfile.backend
|
||||||
|
command: bash -c 'python manage.py migrate && python /code/server.py'
|
||||||
|
environment:
|
||||||
|
- HTTP_HOST=core
|
||||||
|
- REDIS_HOST=redis
|
||||||
|
- DB_HOST=db
|
||||||
|
- DB_PORT=3306
|
||||||
|
- DB_NAME=system3
|
||||||
|
- DB_USER=system3
|
||||||
|
- DB_PASSWORD=system3
|
||||||
|
volumes:
|
||||||
|
- ../../core:/code
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
- redis
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
build:
|
||||||
|
context: ../../web
|
||||||
|
dockerfile: ../deploy/testing/Dockerfile.frontend
|
||||||
|
command: npm run serve
|
||||||
|
volumes:
|
||||||
|
- ../../web:/web:ro
|
||||||
|
- /web/node_modules
|
||||||
|
- ./vue.config.js:/web/vue.config.js
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
depends_on:
|
||||||
|
- core
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mariadb_data:
|
27
deploy/testing/vue.config.js
Normal file
27
deploy/testing/vue.config.js
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
// vue.config.js
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
devServer: {
|
||||||
|
headers: {
|
||||||
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
"Access-Control-Allow-Headers": "*",
|
||||||
|
"Access-Control-Allow-Methods": "*"
|
||||||
|
},
|
||||||
|
proxy: {
|
||||||
|
'^/media/2': {
|
||||||
|
target: 'http://core:8000/',
|
||||||
|
},
|
||||||
|
'^/api/2': {
|
||||||
|
target: 'http://core:8000/',
|
||||||
|
},
|
||||||
|
'^/api/1': {
|
||||||
|
target: 'http://core:8000/',
|
||||||
|
},
|
||||||
|
'^/ws/2': {
|
||||||
|
target: 'http://core:8000/',
|
||||||
|
ws: true,
|
||||||
|
logLevel: 'debug',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue