Skip to content

Instantly share code, notes, and snippets.

@aydrian
Last active December 15, 2022 00:42
Show Gist options
  • Save aydrian/41612c54e4f47b8ddf1e31ae46df07b5 to your computer and use it in GitHub Desktop.
Save aydrian/41612c54e4f47b8ddf1e31ae46df07b5 to your computer and use it in GitHub Desktop.

CockroachDB Serverless Remix Demo Script

Remixing a Stack to Use CockroachDB Serverless

  1. Create a new Remix Indie Stack application npx create-remix --template remix-run/indie-stack Template calls prisma generate, migrate deploy, and seed.
  2. Download ccloud CLI using Homebrew brew install cockroachdb/tap/ccloud
  3. Create a new Cluster using ccloud quickstart (Choose AWS, us-east-1)
    1. Choose AWS
    2. Choose us-east-1
    3. Create New SQL User: victor
    4. SQL Password: pAssw0rd1234
    5. Database: indie_stack
    6. Connect to Cluster: General connection string
    7. Copy connection string to DATABASE_URL in .env
  4. Update prisma.schema to use cockroachdb provider
    datasource db {
     provider = "cockroachdb"
     url      = env("DATABASE_URL")
    }
    
  5. Remove migrations folder: rm -rf prisma/migrations
  6. Create new init migration: npx prisma migrate dev --name init
  7. Rerun setup npm run setup
  8. Start the app: npm run dev
  9. Open http://localhost:3000 and log in
    1. Username: rachel@remix.run
    2. Password: racheliscool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment