Skip to content

fix(setup): resolve first-run friction for new clones#56

Merged
atlanticplatformgroup merged 3 commits into
mainfrom
fix/setup-first-run-friction
May 27, 2026
Merged

fix(setup): resolve first-run friction for new clones#56
atlanticplatformgroup merged 3 commits into
mainfrom
fix/setup-first-run-friction

Conversation

@atlanticplatformgroup
Copy link
Copy Markdown
Owner

What changed

  • scripts/setup.mjs: Detects and reuses an existing container instead of crashing with a Docker name conflict. Also auto-detects whether Usage: docker compose [OPTIONS] COMMAND

Define and run multi-container applications with Docker

Options:
--all-resources Include all resources, even those not
used by services
--ansi string Control when to print ANSI control
characters ("never"|"always"|"auto")
(default "auto")
--compatibility Run compose in backward compatibility mode
--dry-run Execute command in dry run mode
--env-file stringArray Specify an alternate environment file
-f, --file stringArray Compose configuration files
--parallel int Control max parallelism, -1 for
unlimited (default -1)
--profile stringArray Specify a profile to enable
--progress string Set type of progress output (auto,
tty, plain, json, quiet)
--project-directory string Specify an alternate working directory
(default: the path of the, first
specified, Compose file)
-p, --project-name string Project name

Management Commands:
bridge Convert compose files into another model

Commands:
attach Attach local standard input, output, and error streams to a service's running container
build Build or rebuild services
commit Create a new image from a service container's changes
config Parse, resolve and render compose file in canonical format
cp Copy files/folders between a service container and the local filesystem
create Creates containers for a service
down Stop and remove containers, networks
events Receive real time events from containers
exec Execute a command in a running container
export Export a service container's filesystem as a tar archive
images List images used by the created containers
kill Force stop service containers
logs View output from containers
ls List running compose projects
pause Pause services
port Print the public port for a port binding
ps List containers
publish Publish compose application
pull Pull service images
push Push service images
restart Restart service containers
rm Removes stopped service containers
run Run a one-off command on a service
scale Scale services
start Start services
stats Display a live stream of container(s) resource usage statistics
stop Stop services
top Display the running processes
unpause Unpause services
up Create and start containers
version Show the Docker Compose version information
volumes List volumes
wait Block until containers of all (or specified) services stop.
watch Watch build context for service and rebuild/refresh containers when files are updated

Run 'docker compose COMMAND --help' for more information on a command. (v2 plugin) or Usage: docker compose [OPTIONS] COMMAND

Define and run multi-container applications with Docker

Options:
--all-resources Include all resources, even those not
used by services
--ansi string Control when to print ANSI control
characters ("never"|"always"|"auto")
(default "auto")
--compatibility Run compose in backward compatibility mode
--dry-run Execute command in dry run mode
--env-file stringArray Specify an alternate environment file
-f, --file stringArray Compose configuration files
--parallel int Control max parallelism, -1 for
unlimited (default -1)
--profile stringArray Specify a profile to enable
--progress string Set type of progress output (auto,
tty, plain, json, quiet)
--project-directory string Specify an alternate working directory
(default: the path of the, first
specified, Compose file)
-p, --project-name string Project name

Management Commands:
bridge Convert compose files into another model

Commands:
attach Attach local standard input, output, and error streams to a service's running container
build Build or rebuild services
commit Create a new image from a service container's changes
config Parse, resolve and render compose file in canonical format
cp Copy files/folders between a service container and the local filesystem
create Creates containers for a service
down Stop and remove containers, networks
events Receive real time events from containers
exec Execute a command in a running container
export Export a service container's filesystem as a tar archive
images List images used by the created containers
kill Force stop service containers
logs View output from containers
ls List running compose projects
pause Pause services
port Print the public port for a port binding
ps List containers
publish Publish compose application
pull Pull service images
push Push service images
restart Restart service containers
rm Removes stopped service containers
run Run a one-off command on a service
scale Scale services
start Start services
stats Display a live stream of container(s) resource usage statistics
stop Stop services
top Display the running processes
unpause Unpause services
up Create and start containers
version Show the Docker Compose version information
volumes List volumes
wait Block until containers of all (or specified) services stop.
watch Watch build context for service and rebuild/refresh containers when files are updated

Run 'docker compose COMMAND --help' for more information on a command. (legacy) is available.

  • .env.example + packages/api/.env.example: Aligned credentials, replaced ambiguous placeholder values with obvious strings, and removed the default since Redis is not part of the local dev stack.
  • README.md + docs/developer/local-development.md: Added to setup instructions since already exists.

Why

A fresh clone into a new directory (or a second worktree) would fail at step 4 because the hardcoded container name collided with an existing one. The env files also had divergent defaults that would break the database connection out of the box.

Verification

  • Run �[1mOriCMS Setup�[0m

�[1m[1/8]�[0m Checking prerequisites
�[32m✓�[0m Node.js v25.9.0
�[32m✓�[0m npm 11.12.1
�[32m✓�[0m Docker is running
�[32m✓�[0m git version 2.50.1 (Apple Git-155)

�[1m[2/8]�[0m Installing dependencies
�[36m→�[0m Installing dependencies (this may take a minute)...

up to date, audited 1168 packages in 2s

344 packages are looking for funding
run npm fund for details

26 vulnerabilities (15 moderate, 11 high)

To address issues that do not require attention, run:
npm audit fix

To address all issues (including breaking changes), run:
npm audit fix --force

Run npm audit for details.
�[32m✓�[0m Dependencies installed

�[1m[3/8]�[0m Copying environment files
�[36m→�[0m .env already exists, skipping
�[36m→�[0m packages/api/.env already exists, skipping
�[33m⚠�[0m .env: JWT_SECRET is missing or looks like a placeholder
�[33m⚠�[0m packages/api/.env: JWT_SECRET is missing or looks like a placeholder
�[33m⚠�[0m packages/api/.env: ENCRYPTION_KEY is missing or not a 64-character hex string

�[1m[4/8]�[0m Starting Postgres
�[36m→�[0m Starting Postgres via Docker...
�[36m→�[0m Removing existing oricms-postgres container...
�[36m→�[0m Waiting for Postgres to be ready...
.�[32m✓�[0m Postgres is ready

�[1m[5/8]�[0m Building shared package
�[36m→�[0m Building @ori/shared...

@ori/shared@2.0.0 build
tsc

�[32m✓�[0m @ori/shared built

�[1m[6/8]�[0m Generating Prisma client
�[36m→�[0m Generating Prisma client...

@ori/api@2.0.0 db:generate
prisma generate

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (v5.22.0) to ./../../node_modules/@prisma/client in 64ms

Start by importing your Prisma Client (See: https://pris.ly/d/importing-client)

Tip: Curious about the SQL queries Prisma ORM generates? Optimize helps you enhance your visibility: https://pris.ly/tip-2-optimize

�[32m✓�[0m Prisma client generated

�[1m[7/8]�[0m Running migrations
�[36m→�[0m Running database migrations...

@ori/api@2.0.0 db:migrate
prisma migrate dev

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "oricms", schema "public" at "localhost:5432"

�[31m✗�[0m Command failed: npm run db:migrate -w @ori/api in a fresh worktree

  • Run �[1mOriCMS Setup�[0m

�[1m[1/8]�[0m Checking prerequisites
�[32m✓�[0m Node.js v25.9.0
�[32m✓�[0m npm 11.12.1
�[32m✓�[0m Docker is running
�[32m✓�[0m git version 2.50.1 (Apple Git-155)

�[1m[2/8]�[0m Installing dependencies
�[36m→�[0m Installing dependencies (this may take a minute)...

up to date, audited 1168 packages in 1s

344 packages are looking for funding
run npm fund for details

26 vulnerabilities (15 moderate, 11 high)

To address issues that do not require attention, run:
npm audit fix

To address all issues (including breaking changes), run:
npm audit fix --force

Run npm audit for details.
�[32m✓�[0m Dependencies installed

�[1m[3/8]�[0m Copying environment files
�[36m→�[0m .env already exists, skipping
�[36m→�[0m packages/api/.env already exists, skipping
�[33m⚠�[0m .env: JWT_SECRET is missing or looks like a placeholder
�[33m⚠�[0m packages/api/.env: JWT_SECRET is missing or looks like a placeholder
�[33m⚠�[0m packages/api/.env: ENCRYPTION_KEY is missing or not a 64-character hex string

�[1m[4/8]�[0m Starting Postgres
�[36m→�[0m Starting Postgres via Docker...
�[36m→�[0m Existing oricms-postgres container is already running; reusing it
�[32m✓�[0m Postgres is ready

�[1m[5/8]�[0m Building shared package
�[36m→�[0m Building @ori/shared...

@ori/shared@2.0.0 build
tsc

�[32m✓�[0m @ori/shared built

�[1m[6/8]�[0m Generating Prisma client
�[36m→�[0m Generating Prisma client...

@ori/api@2.0.0 db:generate
prisma generate

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (v5.22.0) to ./../../node_modules/@prisma/client in 60ms

Start by importing your Prisma Client (See: https://pris.ly/d/importing-client)

Tip: Easily identify and fix slow SQL queries in your app. Optimize helps you enhance your visibility: https://pris.ly/--optimize

�[32m✓�[0m Prisma client generated

�[1m[7/8]�[0m Running migrations
�[36m→�[0m Running database migrations...

@ori/api@2.0.0 db:migrate
prisma migrate dev

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "oricms", schema "public" at "localhost:5432"

�[31m✗�[0m Command failed: npm run db:migrate -w @ori/api again in the same worktree (should reuse container)

  • Run �[1mOriCMS Setup�[0m

�[1m[1/8]�[0m Checking prerequisites
�[32m✓�[0m Node.js v25.9.0
�[32m✓�[0m npm 11.12.1
�[32m✓�[0m Docker is running
�[32m✓�[0m git version 2.50.1 (Apple Git-155)

�[1m[2/8]�[0m Installing dependencies
�[36m→�[0m Installing dependencies (this may take a minute)...

up to date, audited 1168 packages in 1s

344 packages are looking for funding
run npm fund for details

26 vulnerabilities (15 moderate, 11 high)

To address issues that do not require attention, run:
npm audit fix

To address all issues (including breaking changes), run:
npm audit fix --force

Run npm audit for details.
�[32m✓�[0m Dependencies installed

�[1m[3/8]�[0m Copying environment files
�[36m→�[0m .env already exists, skipping
�[36m→�[0m packages/api/.env already exists, skipping
�[33m⚠�[0m .env: JWT_SECRET is missing or looks like a placeholder
�[33m⚠�[0m packages/api/.env: JWT_SECRET is missing or looks like a placeholder
�[33m⚠�[0m packages/api/.env: ENCRYPTION_KEY is missing or not a 64-character hex string

�[1m[4/8]�[0m Starting Postgres
�[36m→�[0m Starting Postgres via Docker...
�[36m→�[0m Removing existing oricms-postgres container...
�[36m→�[0m Removing existing database container (--reset-db)...
�[36m→�[0m Waiting for Postgres to be ready...
.�[32m✓�[0m Postgres is ready

�[1m[5/8]�[0m Building shared package
�[36m→�[0m Building @ori/shared...

@ori/shared@2.0.0 build
tsc

�[32m✓�[0m @ori/shared built

�[1m[6/8]�[0m Generating Prisma client
�[36m→�[0m Generating Prisma client...

@ori/api@2.0.0 db:generate
prisma generate

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (v5.22.0) to ./../../node_modules/@prisma/client in 64ms

Start by importing your Prisma Client (See: https://pris.ly/d/importing-client)

Tip: Need your database queries to be 1000x faster? Accelerate offers you that and more: https://pris.ly/tip-2-accelerate

�[32m✓�[0m Prisma client generated

�[1m[7/8]�[0m Running migrations
�[36m→�[0m Running database migrations...

@ori/api@2.0.0 db:migrate
prisma migrate dev

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "oricms", schema "public" at "localhost:5432"

�[31m✗�[0m Command failed: npm run db:migrate -w @ori/api (should recreate container)

Closes nothing — discovered during local dogfooding.

Previously, running setup in a fresh clone or second worktree crashed
with a Docker name conflict because oricms-postgres was already in use.
Now the script checks for an existing container and reuses it if running,
or removes it before starting fresh.

Also detects whether docker compose (v2 plugin) or docker-compose
(legacy) is available and uses the right command.
Both .env.example files now share consistent DATABASE_URL credentials
(postgresql://oricms:oricms@localhost:5432/oricms) so a first-time user
can connect to the Docker Postgres without editing the file.

JWT_SECRET and ENCRYPTION_KEY use clearly fake placeholder strings
(REPLACE_ME...) instead of values that look like they might be real.
This makes it obvious when someone has forgotten to set them.

Also removes the default RATE_LIMIT_REDIS_URL from the root example
since Redis is not part of the local dev compose stack.
The README and local-development guide now tell users to run nvm use
before setup if they have nvm installed, matching the existing .nvmrc
file that was already in the repo but not referenced in docs.
@atlanticplatformgroup atlanticplatformgroup merged commit b6e7e93 into main May 27, 2026
1 check failed
@atlanticplatformgroup atlanticplatformgroup deleted the fix/setup-first-run-friction branch May 27, 2026 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant