add npm run mongo:start to quickly spin up fake replicated mongodb server for prisma

This commit is contained in:
Brandon Egger 2023-03-15 03:50:58 -05:00
parent ad75aea294
commit ffab3010b3
3 changed files with 2 additions and 25 deletions

View File

@ -6,13 +6,6 @@
# secrets in it. If you are cloning this repo, create a copy of this file named
# ".env" and populate it with your secrets.
# When adding additional environment variables, the schema in "/src/env.mjs"
# should be updated accordingly.
# Prisma
# https://www.prisma.io/docs/reference/database-reference/connection-urls#env
DATABASE_URL="file:./db.sqlite"
# Next Auth
# You can generate a new secret on the command line with:
# openssl rand -base64 32
@ -22,7 +15,7 @@ NEXTAUTH_URL="http://localhost:3000"
# MongoDB
# mongo DB details
MONGO_DATABASE=
MONGO_DATABASE=atr_db
DATABASE_URL=
MONGO_ROOT_USERNAME=
MONGO_ROOT_PASSWORD=

View File

@ -1,16 +0,0 @@
version: '3.7'
services:
atr_mongodb:
image: mongo:latest
restart: always
environment:
- MONGO_ROOT_USERNAME
- MONGO_ROOT_PASSWORD
ports:
- 27017:27017
volumes:
- mongodb_container:/data/db
volumes:
mongodb_container:

View File

@ -8,7 +8,7 @@
"postinstall": "prisma generate",
"lint": "next lint",
"start": "next start",
"mongodb:up": "docker compose up"
"mongo:start": "docker run --rm -d -p 27017:27017 -h $(hostname) --name uiowa_atr_mongo mongo:4.4.3 --replSet=test && sleep 4 && docker exec mongo mongo --eval \"rs.initiate();\""
},
"prisma": {
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"