Enhance Docker and backend configurations for improved deployment
- Updated docker-compose.yml to include environment variable support for services, enhancing flexibility in configuration. - Refactored Dockerfile to utilize build arguments for VITE environment variables, allowing for better customization during builds. - Improved Nginx configuration to handle larger video uploads by increasing client_max_body_size to 5GB. - Enhanced backend Dockerfile to include wget for health checks and improved startup logging for database migrations. - Added validation for critical environment variables in the backend to ensure necessary configurations are present before application startup. - Updated content streaming logic to support direct HLS URL construction, improving streaming reliability and user experience. - Refactored various components and services to streamline access checks and improve error handling during content playback.
This commit is contained in:
@@ -4,9 +4,11 @@
|
||||
* Populates the PostgreSQL database with:
|
||||
* 1. Genres (Documentary, Drama, etc.)
|
||||
* 2. Test users with Nostr pubkeys and active subscriptions
|
||||
* 3. IndeeHub films (native delivery mode)
|
||||
* 4. TopDoc films (native delivery mode, YouTube streaming URLs)
|
||||
* 5. Projects and contents for both film sets
|
||||
* 3. IndeeHub films (native delivery mode, free)
|
||||
*
|
||||
* TopDoc documentary films are NOT seeded — they live in the frontend
|
||||
* mock data (src/data/topDocFilms.ts) and appear only when the user
|
||||
* switches to the "TopDoc Films" content source.
|
||||
*
|
||||
* Run: node dist/scripts/seed-content.js
|
||||
* Requires: DATABASE_HOST, DATABASE_PORT, DATABASE_USER, etc. in env
|
||||
@@ -24,7 +26,6 @@ const client = new Client({
|
||||
});
|
||||
|
||||
// ── Test Users ────────────────────────────────────────────────
|
||||
// Using the same dev personas from the frontend seed
|
||||
const testUsers = [
|
||||
{
|
||||
id: randomUUID(),
|
||||
@@ -70,7 +71,6 @@ const indeeHubFilms = [
|
||||
'A groundbreaking documentary exploring the intersection of faith, finance, and the future of money through the lens of Bitcoin.',
|
||||
poster: '/images/films/posters/god-bless-bitcoin.webp',
|
||||
genre: 'Documentary',
|
||||
categories: ['Documentary', 'Bitcoin', 'Religion'],
|
||||
deliveryMode: 'native',
|
||||
},
|
||||
{
|
||||
@@ -80,7 +80,6 @@ const indeeHubFilms = [
|
||||
'A compelling narrative exploring the emotional weight of our past.',
|
||||
poster: '/images/films/posters/thethingswecarry.webp',
|
||||
genre: 'Drama',
|
||||
categories: ['Drama'],
|
||||
deliveryMode: 'native',
|
||||
},
|
||||
{
|
||||
@@ -89,7 +88,6 @@ const indeeHubFilms = [
|
||||
synopsis: 'An intense confrontation that tests the limits of human resolve.',
|
||||
poster: '/images/films/posters/duel.png',
|
||||
genre: 'Action',
|
||||
categories: ['Drama', 'Action'],
|
||||
deliveryMode: 'native',
|
||||
},
|
||||
{
|
||||
@@ -100,66 +98,6 @@ const indeeHubFilms = [
|
||||
poster:
|
||||
'/images/films/posters/2b0d7349-c010-47a0-b584-49e1bf86ab2f.png',
|
||||
genre: 'Documentary',
|
||||
categories: ['Documentary', 'Finance', 'Bitcoin'],
|
||||
deliveryMode: 'native',
|
||||
},
|
||||
];
|
||||
|
||||
// ── TopDoc Films ──────────────────────────────────────────────
|
||||
const topDocFilms = [
|
||||
{
|
||||
id: 'tdf-god-bless-bitcoin',
|
||||
title: 'God Bless Bitcoin',
|
||||
synopsis:
|
||||
'Exploring the intersection of faith and Bitcoin.',
|
||||
poster: '/images/films/posters/topdoc/god-bless-bitcoin.jpg',
|
||||
streamingUrl: 'https://www.youtube.com/embed/3XEuqixD2Zg',
|
||||
genre: 'Documentary',
|
||||
categories: ['Documentary', 'Bitcoin'],
|
||||
deliveryMode: 'native',
|
||||
},
|
||||
{
|
||||
id: 'tdf-bitcoin-end-of-money',
|
||||
title: 'Bitcoin: The End of Money as We Know It',
|
||||
synopsis:
|
||||
'Tracing the history of money from barter to Bitcoin.',
|
||||
poster: '/images/films/posters/topdoc/bitcoin-end-of-money.jpg',
|
||||
streamingUrl: 'https://www.youtube.com/embed/zpNlG3VtcBM',
|
||||
genre: 'Documentary',
|
||||
categories: ['Documentary', 'Bitcoin', 'Economics'],
|
||||
deliveryMode: 'native',
|
||||
},
|
||||
{
|
||||
id: 'tdf-bitcoin-beyond-bubble',
|
||||
title: 'Bitcoin: Beyond the Bubble',
|
||||
synopsis:
|
||||
'An accessible explainer tracing currency evolution.',
|
||||
poster: '/images/films/posters/topdoc/bitcoin-beyond-bubble.jpg',
|
||||
streamingUrl: 'https://www.youtube.com/embed/URrmfEu0cZ8',
|
||||
genre: 'Documentary',
|
||||
categories: ['Documentary', 'Bitcoin', 'Economics'],
|
||||
deliveryMode: 'native',
|
||||
},
|
||||
{
|
||||
id: 'tdf-bitcoin-gospel',
|
||||
title: 'The Bitcoin Gospel',
|
||||
synopsis:
|
||||
'The true believers argue Bitcoin is a gamechanger for the global economy.',
|
||||
poster: '/images/films/posters/topdoc/bitcoin-gospel.jpg',
|
||||
streamingUrl: 'https://www.youtube.com/embed/2I6dXRK9oJo',
|
||||
genre: 'Documentary',
|
||||
categories: ['Documentary', 'Bitcoin'],
|
||||
deliveryMode: 'native',
|
||||
},
|
||||
{
|
||||
id: 'tdf-banking-on-bitcoin',
|
||||
title: 'Banking on Bitcoin',
|
||||
synopsis:
|
||||
'Chronicles idealists and entrepreneurs as they redefine money.',
|
||||
poster: '/images/films/posters/topdoc/banking-on-bitcoin.jpg',
|
||||
streamingUrl: 'https://www.youtube.com/embed/BbMT1Mhv7OQ',
|
||||
genre: 'Documentary',
|
||||
categories: ['Documentary', 'Bitcoin', 'Finance'],
|
||||
deliveryMode: 'native',
|
||||
},
|
||||
];
|
||||
@@ -169,7 +107,6 @@ async function seed() {
|
||||
await client.connect();
|
||||
|
||||
try {
|
||||
// Run inside a transaction
|
||||
await client.query('BEGIN');
|
||||
|
||||
// 1. Seed genres
|
||||
@@ -242,47 +179,15 @@ async function seed() {
|
||||
],
|
||||
);
|
||||
|
||||
// Create a content record for the film
|
||||
// Content with status 'completed' so it appears in public API listings
|
||||
const contentId = `content-${film.id}`;
|
||||
await client.query(
|
||||
`INSERT INTO contents (id, project_id, title, synopsis, status, "order", release_date, created_at, updated_at)
|
||||
VALUES ($1, $2, $3, $4, 'ready', 1, NOW(), NOW(), NOW())
|
||||
ON CONFLICT (id) DO UPDATE SET title = EXCLUDED.title`,
|
||||
[contentId, film.id, film.title, film.synopsis],
|
||||
);
|
||||
}
|
||||
|
||||
// 5. Seed TopDoc films
|
||||
console.log('[seed] Seeding TopDoc films...');
|
||||
for (const film of topDocFilms) {
|
||||
const genreId = genreLookup[film.genre] || null;
|
||||
await client.query(
|
||||
`INSERT INTO projects (id, name, title, slug, synopsis, poster, status, type, genre_id, delivery_mode, streaming_url, created_at, updated_at)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, 'published', 'film', $7, $8, $9, NOW(), NOW())
|
||||
`INSERT INTO contents (id, project_id, title, synopsis, status, "order", rental_price, release_date, created_at, updated_at)
|
||||
VALUES ($1, $2, $3, $4, 'completed', 1, 0, NOW(), NOW(), NOW())
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
title = EXCLUDED.title,
|
||||
synopsis = EXCLUDED.synopsis,
|
||||
poster = EXCLUDED.poster,
|
||||
delivery_mode = EXCLUDED.delivery_mode,
|
||||
streaming_url = EXCLUDED.streaming_url`,
|
||||
[
|
||||
film.id,
|
||||
film.title,
|
||||
film.title,
|
||||
film.id,
|
||||
film.synopsis,
|
||||
film.poster,
|
||||
genreId,
|
||||
film.deliveryMode,
|
||||
film.streamingUrl,
|
||||
],
|
||||
);
|
||||
|
||||
const contentId = `content-${film.id}`;
|
||||
await client.query(
|
||||
`INSERT INTO contents (id, project_id, title, synopsis, status, "order", release_date, created_at, updated_at)
|
||||
VALUES ($1, $2, $3, $4, 'ready', 1, NOW(), NOW(), NOW())
|
||||
ON CONFLICT (id) DO UPDATE SET title = EXCLUDED.title`,
|
||||
status = 'completed',
|
||||
rental_price = 0`,
|
||||
[contentId, film.id, film.title, film.synopsis],
|
||||
);
|
||||
}
|
||||
@@ -292,7 +197,6 @@ async function seed() {
|
||||
console.log(` - ${genres.length} genres`);
|
||||
console.log(` - ${testUsers.length} test users with subscriptions`);
|
||||
console.log(` - ${indeeHubFilms.length} IndeeHub films`);
|
||||
console.log(` - ${topDocFilms.length} TopDoc films`);
|
||||
} catch (error) {
|
||||
await client.query('ROLLBACK');
|
||||
console.error('[seed] Error seeding database:', error);
|
||||
|
||||
Reference in New Issue
Block a user