Skip to content

Commit

Permalink
Merge pull request #3228 from hughrun/user-export
Browse files Browse the repository at this point in the history
Fix user exports to deal with s3 storage
  • Loading branch information
BartSchuurmans authored Apr 13, 2024
2 parents 7d58175 + c3c4614 commit 21a39f8
Show file tree
Hide file tree
Showing 25 changed files with 730 additions and 303 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ ENABLE_THUMBNAIL_GENERATION=true
USE_S3=false
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
# seconds for signed S3 urls to expire
# this is currently only used for user export files
S3_SIGNED_URL_EXPIRY=900

# Commented are example values if you use a non-AWS, S3-compatible service
# AWS S3 should work with only AWS_STORAGE_BUCKET_NAME and AWS_S3_REGION_NAME
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# BookWyrm
.env
/images/
/exports/
/static/
bookwyrm/static/css/bookwyrm.css
bookwyrm/static/css/themes/
Expand Down
92 changes: 92 additions & 0 deletions bookwyrm/migrations/0193_auto_20240128_0249.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Generated by Django 3.2.23 on 2024-01-28 02:49

import bookwyrm.storage_backends
import django.core.serializers.json
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
("bookwyrm", "0192_sitesettings_user_exports_enabled"),
]

operations = [
migrations.AddField(
model_name="bookwyrmexportjob",
name="export_json",
field=models.JSONField(
encoder=django.core.serializers.json.DjangoJSONEncoder, null=True
),
),
migrations.AddField(
model_name="bookwyrmexportjob",
name="json_completed",
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name="bookwyrmexportjob",
name="export_data",
field=models.FileField(
null=True,
storage=bookwyrm.storage_backends.ExportsFileStorage,
upload_to="",
),
),
migrations.CreateModel(
name="AddFileToTar",
fields=[
(
"childjob_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="bookwyrm.childjob",
),
),
(
"parent_export_job",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="child_edition_export_jobs",
to="bookwyrm.bookwyrmexportjob",
),
),
],
options={
"abstract": False,
},
bases=("bookwyrm.childjob",),
),
migrations.CreateModel(
name="AddBookToUserExportJob",
fields=[
(
"childjob_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="bookwyrm.childjob",
),
),
(
"edition",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="bookwyrm.edition",
),
),
],
options={
"abstract": False,
},
bases=("bookwyrm.childjob",),
),
]
13 changes: 13 additions & 0 deletions bookwyrm/migrations/0196_merge_20240318_1737.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Generated by Django 3.2.23 on 2024-03-18 17:37

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("bookwyrm", "0193_auto_20240128_0249"),
("bookwyrm", "0195_alter_user_preferred_language"),
]

operations = []
13 changes: 13 additions & 0 deletions bookwyrm/migrations/0197_merge_20240324_0235.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Generated by Django 3.2.25 on 2024-03-24 02:35

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("bookwyrm", "0196_merge_20240318_1737"),
("bookwyrm", "0196_merge_pr3134_into_main"),
]

operations = []
23 changes: 23 additions & 0 deletions bookwyrm/migrations/0198_alter_bookwyrmexportjob_export_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.25 on 2024-03-26 11:37

import bookwyrm.models.bookwyrm_export_job
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("bookwyrm", "0197_merge_20240324_0235"),
]

operations = [
migrations.AlterField(
model_name="bookwyrmexportjob",
name="export_data",
field=models.FileField(
null=True,
storage=bookwyrm.models.bookwyrm_export_job.select_exports_storage,
upload_to="",
),
),
]
13 changes: 13 additions & 0 deletions bookwyrm/migrations/0199_merge_20240326_1217.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Generated by Django 3.2.25 on 2024-03-26 12:17

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("bookwyrm", "0198_alter_bookwyrmexportjob_export_data"),
("bookwyrm", "0198_book_search_vector_author_aliases"),
]

operations = []
27 changes: 27 additions & 0 deletions bookwyrm/migrations/0200_auto_20240327_1914.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 3.2.25 on 2024-03-27 19:14

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("bookwyrm", "0199_merge_20240326_1217"),
]

operations = [
migrations.RemoveField(
model_name="addfiletotar",
name="childjob_ptr",
),
migrations.RemoveField(
model_name="addfiletotar",
name="parent_export_job",
),
migrations.DeleteModel(
name="AddBookToUserExportJob",
),
migrations.DeleteModel(
name="AddFileToTar",
),
]
13 changes: 13 additions & 0 deletions bookwyrm/migrations/0205_merge_20240413_0232.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Generated by Django 3.2.25 on 2024-04-13 02:32

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("bookwyrm", "0200_auto_20240327_1914"),
("bookwyrm", "0204_merge_20240409_1042"),
]

operations = []
Loading

0 comments on commit 21a39f8

Please sign in to comment.