From 869df8572f1676b86930e5e2bca440fcaa053e31 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 23 Nov 2022 15:48:31 -0800 Subject: dumps: use main partition path in prod --- extra/sql_dumps/Makefile | 2 +- extra/sql_dumps/dump_idents.sql | 20 ++++++++++---------- extra/sql_dumps/ident_table_snapshot.sh | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'extra/sql_dumps') diff --git a/extra/sql_dumps/Makefile b/extra/sql_dumps/Makefile index 01607d34..a653d422 100644 --- a/extra/sql_dumps/Makefile +++ b/extra/sql_dumps/Makefile @@ -18,7 +18,7 @@ create_datadir: $(DATADIR)/.IDENTS: sudo -u postgres DATABASE_URL=$(DATABASE_URL) ./ident_table_snapshot.sh $(DATADIR) - sudo -u postgres mv /tmp/fatcat_ident_*.tsv $(DATADIR) + sudo -u postgres mv /srv/fatcat/tmp/fatcat_ident_*.tsv $(DATADIR) touch $@ $(DATADIR)/release_export_expanded.json.gz: $(DATADIR)/.IDENTS diff --git a/extra/sql_dumps/dump_idents.sql b/extra/sql_dumps/dump_idents.sql index d9777ea1..528ebfaa 100644 --- a/extra/sql_dumps/dump_idents.sql +++ b/extra/sql_dumps/dump_idents.sql @@ -1,15 +1,15 @@ BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE READ ONLY DEFERRABLE; -COPY (SELECT id FROM changelog ORDER BY id DESC LIMIT 1) TO '/tmp/fatcat_ident_latest_changelog.tsv' WITH NULL ''; -COPY (SELECT id, rev_id, redirect_id FROM creator_ident WHERE is_live=true) TO '/tmp/fatcat_ident_creators.tsv' WITH NULL ''; -COPY (SELECT id, rev_id, redirect_id FROM container_ident WHERE is_live=true) TO '/tmp/fatcat_ident_containers.tsv' WITH NULL ''; -COPY (SELECT id, rev_id, redirect_id FROM file_ident WHERE is_live=true) TO '/tmp/fatcat_ident_files.tsv' WITH NULL ''; -COPY (SELECT id, rev_id, redirect_id FROM fileset_ident WHERE is_live=true) TO '/tmp/fatcat_ident_filesets.tsv' WITH NULL ''; -COPY (SELECT id, rev_id, redirect_id FROM webcapture_ident WHERE is_live=true) TO '/tmp/fatcat_ident_webcaptures.tsv' WITH NULL ''; -COPY (SELECT id, rev_id, redirect_id FROM release_ident WHERE is_live=true) TO '/tmp/fatcat_ident_releases.tsv' WITH NULL ''; -COPY (SELECT id, rev_id, redirect_id FROM work_ident WHERE is_live=true) TO '/tmp/fatcat_ident_works.tsv' WITH NULL ''; -COPY (SELECT id, editgroup_id, timestamp FROM changelog) TO '/tmp/fatcat_ident_changelog.tsv' WITH NULL ''; +COPY (SELECT id FROM changelog ORDER BY id DESC LIMIT 1) TO '/srv/fatcat/tmp/fatcat_ident_latest_changelog.tsv' WITH NULL ''; +COPY (SELECT id, rev_id, redirect_id FROM creator_ident WHERE is_live=true) TO '/srv/fatcat/tmp/fatcat_ident_creators.tsv' WITH NULL ''; +COPY (SELECT id, rev_id, redirect_id FROM container_ident WHERE is_live=true) TO '/srv/fatcat/tmp/fatcat_ident_containers.tsv' WITH NULL ''; +COPY (SELECT id, rev_id, redirect_id FROM file_ident WHERE is_live=true) TO '/srv/fatcat/tmp/fatcat_ident_files.tsv' WITH NULL ''; +COPY (SELECT id, rev_id, redirect_id FROM fileset_ident WHERE is_live=true) TO '/srv/fatcat/tmp/fatcat_ident_filesets.tsv' WITH NULL ''; +COPY (SELECT id, rev_id, redirect_id FROM webcapture_ident WHERE is_live=true) TO '/srv/fatcat/tmp/fatcat_ident_webcaptures.tsv' WITH NULL ''; +COPY (SELECT id, rev_id, redirect_id FROM release_ident WHERE is_live=true) TO '/srv/fatcat/tmp/fatcat_ident_releases.tsv' WITH NULL ''; +COPY (SELECT id, rev_id, redirect_id FROM work_ident WHERE is_live=true) TO '/srv/fatcat/tmp/fatcat_ident_works.tsv' WITH NULL ''; +COPY (SELECT id, editgroup_id, timestamp FROM changelog) TO '/srv/fatcat/tmp/fatcat_ident_changelog.tsv' WITH NULL ''; COPY ( SELECT release_ident.id, @@ -25,6 +25,6 @@ COPY ( AND release_ident.rev_id IS NOT NULL ORDER BY release_rev.work_ident_id ASC NULLS LAST -) TO '/tmp/fatcat_ident_releases_by_work.tsv' WITH NULL ''; +) TO '/srv/fatcat/tmp/fatcat_ident_releases_by_work.tsv' WITH NULL ''; ROLLBACK; diff --git a/extra/sql_dumps/ident_table_snapshot.sh b/extra/sql_dumps/ident_table_snapshot.sh index b287a0ce..62ee7dba 100755 --- a/extra/sql_dumps/ident_table_snapshot.sh +++ b/extra/sql_dumps/ident_table_snapshot.sh @@ -18,11 +18,11 @@ echo "Will move output to '${OUTPUT_DIR}'" echo "Running SQL (from '${DATABASE_URL}')..." psql $DATABASE_URL < ./dump_idents.sql -CHANGELOG_REV="`head -n1 /tmp/fatcat_ident_latest_changelog.tsv`" +CHANGELOG_REV="`head -n1 /srv/fatcat/tmp/fatcat_ident_latest_changelog.tsv`" OUTFILE="${OUTPUT_DIR}/fatcat_idents.$DATESLUG.r$CHANGELOG_REV.tar.gz" echo "Compressing..." -tar -C /tmp -c --verbose \ +tar -C /srv/fatcat/tmp -c --verbose \ --use-compress-program=pigz \ -f $OUTFILE \ fatcat_ident_latest_changelog.tsv \ -- cgit v1.2.3