e3-software / e3-virtualizer

Virtualization Service
https://e3-virtualizer.vercel.app
0 stars 0 forks source link

Getting Started

Code

Download the repo.

Install dependencies

npm install

You'll need a .env file which will not be committed to the repo since it contains secrets. Get that from a coworker.

Database Brew or DOCKER

I prefer docker

Brew

[Here is a great article] (https://www.codementor.io/@engineerapart/getting-started-with-postgresql-on-mac-osx-are8jcopb) install postgres for development

brew install postgresql

Ensure it runs on startup (if you want)

brew services start postgresql@14

create the development user and database

createuser local_dev --createdb
createdb e3_virtualizer -U local_dev

Docker

First install docker desktop from docker.com

Build the image from the dockerfile

docker build -t pg .

Run the container

docker run -d -p 5432:5432 pg

Check that the container is running

docker ps

Populate the database

Generate a client

npx prisma generate

push the schema to your database

npx prisma db push

run the seeder

npx prisma db seed

view the data in app OR

npx prisma studio

Creating and running migrations.

Migrations will be automatically run in production environment. To Create a new migration, change schema.prisma then run

npx prisma migrate dev --name {some name for the migration}

View the migration at prisma/migrations/...

Creating a User

You'll need a clerk user so lets create on of those first. After a clerk user is created. Copy the user id. Navigate to seed.mjs and add the new user with the user id.

Shell into db

psql -d e3_virtualizer --username=local_dev -W