Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace pnpm with bun #555

Merged
merged 4 commits into from
Sep 29, 2023
Merged

replace pnpm with bun #555

merged 4 commits into from
Sep 29, 2023

Conversation

lihebi
Copy link
Collaborator

@lihebi lihebi commented Sep 28, 2023

Pnpm has one major problem: the .pnpm-store is not compatible with docker-stack. The problem is due to pnpm's choice to link folders instead of copying. Ref from https://pnpm.io/docker:

It is impossible to create reflinks or hardlinks between a Docker container and the host filesystem during build time.

This creates the problem that one can either install packages in docker stack, or on the host, but not both. This is pretty inconvenient.

Now bun 1.0 is available, and it seems to work well across the host and docker-stack.

Therefore, this PR uses bun as a package manager to replace pnpm.

TODOs:

  • replace node-with-bun.Dockerfile with native oven/bun:1 docker image. This isn't possible yet due to some compatibility issues with graphql (ref) & prisma (ref). But since I'll probably replace both soon, then we should replace node-with-bun.Dockerfile with oven/bun:1.
    - [ ] replace primsa with drizzle
    - [ ] replace graphql with tRPC
  • bun seems also a better JS/TS runtime. replace node runtime with bun

@lihebi
Copy link
Collaborator Author

lihebi commented Sep 29, 2023

Update: the setup container is removed. We need to install node packages on the host for IDE linting anyway.

The new developer workflow:

  1. install node_modules in your host OS
bun install
  1. migrate DB if this is the first time:
cd packages/prisma
# e.g., "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}?schema=public"
export DATABASE_URL=...
bunx prisma migrate dev
  1. start docker stack
cd compose/web
docker compose up -d

TODOS:

  • update developer manual
  • use a hosted DB instead even for development

@lihebi lihebi merged commit 400bbc5 into codepod-io:main Sep 29, 2023
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