Skip to content

Commit 24f36bd

Browse files
docs: add note about ffmpeg prerequisite and improve dev scripts documentation (#161)
* feat: ask for database username + password with defaults when setting up dev env * feat(dx): better explanation of what pnpm dev:setup-env does * feat(dx): let devs know that ffmpeg is required * Apply suggestions from code review --------- Co-authored-by: Lamparter <71598437+Lamparter@users.noreply.github.com>
1 parent 34206d0 commit 24f36bd

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ In order to get started with developing Lapse, run these commands:
1515
# Install all packages
1616
pnpm install
1717

18-
# Set up the development environment
18+
# Set up the development environment (opens the environment variables wizard)
1919
pnpm dev:setup-env
2020

2121
# Start the web client and backend
2222
pnpm dev
2323
```
2424

25+
Lapse relies on ffmpeg for its serverside video processing.
26+
You can install ffmpeg [from their website](https://ffmpeg.org/download.html) by downloading the appropriate ffmpeg binary for your operating system.
2527
To start and stop the development environment, use `pnpm dev:start-env` and `pnpm dev:stop-env` respectively.
2628

2729
When developing, it's a good idea to re-compile all packages on the fly!

‎apps/devscripts/src/setup-dev-env.ts‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,21 @@ const __dirname = dirname(__filename);
1717
const DEFAULT_DATABASE_PORT = 5432;
1818
const DEFAULT_SERVER_PORT = 3123;
1919
const DEFAULT_REDIS_PORT = 6379;
20+
const DEFAULT_DATABASE_USER = "postgres";
21+
const DEFAULT_DATABASE_PASSWORD = "postgres";
2022

2123
let databasePort = DEFAULT_DATABASE_PORT;
2224
let serverPort = DEFAULT_SERVER_PORT;
2325
let redisPort = DEFAULT_REDIS_PORT;
26+
let databaseUser = DEFAULT_DATABASE_USER;
27+
let databasePassword = DEFAULT_DATABASE_PASSWORD;
2428

2529
function getDatabaseUrl() {
26-
return `postgresql://postgres:postgres@localhost:${databasePort}/lapse?schema=public`;
30+
return `postgresql://${databaseUser}:${databasePassword}@localhost:${databasePort}/lapse?schema=public`;
2731
}
2832

2933
function getRedisUrl() {
30-
return `redis://localhost:${redisPort}`;
34+
return `redis://localhost:${redisPort}`;
3135
}
3236

3337
let S3_ENDPOINT = "http://s3.localhost.localstack.cloud:4566";
@@ -270,7 +274,7 @@ async function updateEnvFiles(envVars: {
270274
writeEnvFile(clientDir, envVars.client),
271275
writeEnvFile(workerDir, envVars.worker),
272276
]);
273-
277+
274278
spinner.succeed(chalk.green("Environment variables updated successfully"));
275279
logInfo(`Updated .env files for ${chalk.italic("server")}, ${chalk.italic("client")}, and ${chalk.italic("worker")}`);
276280
}
@@ -363,7 +367,7 @@ async function updateDockerComposeFile(localstackImage: string | null) {
363367
async function runSetup() {
364368
console.clear();
365369

366-
const TOTAL_STEPS = 8;
370+
const TOTAL_STEPS = 9;
367371
let currentStep = 0;
368372

369373
try {
@@ -379,6 +383,16 @@ async function runSetup() {
379383
serverPort = await askForPort("API server", DEFAULT_SERVER_PORT);
380384
redisPort = await askForPort("Redis", DEFAULT_REDIS_PORT);
381385

386+
logStep(++currentStep, TOTAL_STEPS, "Configuring database credentials...");
387+
databaseUser = await input({
388+
message: `Enter database username (default: ${DEFAULT_DATABASE_USER}): `,
389+
default: DEFAULT_DATABASE_USER,
390+
});
391+
databasePassword = await input({
392+
message: `Enter database password (default: ${DEFAULT_DATABASE_PASSWORD}): `,
393+
default: DEFAULT_DATABASE_PASSWORD,
394+
});
395+
382396
logStep(++currentStep, TOTAL_STEPS, "Configuring storage backend...");
383397
localstackORr2 = await askLocalstackOrR2();
384398

@@ -500,7 +514,7 @@ async function main() {
500514
await startDockerCompose();
501515
return;
502516
}
503-
517+
504518
await runSetup();
505519
});
506520

0 commit comments

Comments
 (0)