From 2d02728bdd4373c313790504bea5e0df74428875 Mon Sep 17 00:00:00 2001 From: Jarne Van Aerde Date: Fri, 27 Sep 2024 11:34:19 +0200 Subject: [PATCH 1/3] Updated README --- README.md | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 63849a8..2709d6c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,48 @@ # Info Support Tech Survey -## Introduction +## Setup for local development + +### Setup database + +1. Make sure docker desktop or another tool of your liking is installed on your machine. +2. Spin up a postgres database with the following command. You need to choose your own password and username: +```bash +docker run --name tech-survey -e "POSTGRES_USER=dummyusr" -e "POSTGRES_PASSWORD=dummypw" -e "POSTGRES_DB=tech-survey" -d -p 5432:5432 docker.io/postgres +``` +3. Make sure to also use that username and password inside of the `.env` file: +`DATABASE_URL="postgresql://dummyusr:pas$word@localhost:dummypw/tech-survey` +4. Run the following commands to setup your db locally. For the `npm run db:seed` command you need a CSV file to populate the database. You can ask your co-worker for this CSV file, or skip this if you don't want any data. +```bash +npm run db:generate +npm run db:push +npm run db:seed +``` +5. Now you should be ready to go! 🎉 You can check your local database by opening the studio of Primsa: +```bash +npm run db:studio +``` + +### Setup Azure AD authentication + +The Azure AD credentials can be found in the `.env` file: +``` +AZURE_AD_CLIENT_ID="dummy" +AZURE_AD_CLIENT_SECRET="dummy" +AZURE_AD_TENANT_ID="dummy" +``` + +You can go one of two ways to get your hands on these credentials: +- Get them yourself from the Azure AD on the Azure Environment of your company +- Ask a co-worker who has already worked on the project to sent those credentials to you in a secure manner + +### Setup NextAuth + +1. For using next auth, we need to setup a secret. This can be done in the .env file: +``` +NEXTAUTH_SECRET="dummy" +``` +2. Generate a new secret wit the following command: +```bash +openssl rand -base64 32 +``` +3. Update the `NEXTAUTH_SECRET` variable with the new value From 63318e36926228f488b8ec5cf1d8dc8294594fda Mon Sep 17 00:00:00 2001 From: Jarne Van Aerde Date: Fri, 27 Sep 2024 11:42:39 +0200 Subject: [PATCH 2/3] Small update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2709d6c..969e1f4 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ docker run --name tech-survey -e "POSTGRES_USER=dummyusr" -e "POSTGRES_PASSWORD=dummypw" -e "POSTGRES_DB=tech-survey" -d -p 5432:5432 docker.io/postgres ``` 3. Make sure to also use that username and password inside of the `.env` file: -`DATABASE_URL="postgresql://dummyusr:pas$word@localhost:dummypw/tech-survey` +`DATABASE_URL="postgresql://jarne:dummyusr@dummypw/tech-survey` 4. Run the following commands to setup your db locally. For the `npm run db:seed` command you need a CSV file to populate the database. You can ask your co-worker for this CSV file, or skip this if you don't want any data. ```bash npm run db:generate From 832577e70e9317e8e1afaf78f8a9967f4d5382e7 Mon Sep 17 00:00:00 2001 From: Jarne Van Aerde Date: Fri, 27 Sep 2024 15:16:25 +0200 Subject: [PATCH 3/3] Updated README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 969e1f4..1ef3097 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,14 @@ docker run --name tech-survey -e "POSTGRES_USER=dummyusr" -e "POSTGRES_PASSWORD=dummypw" -e "POSTGRES_DB=tech-survey" -d -p 5432:5432 docker.io/postgres ``` 3. Make sure to also use that username and password inside of the `.env` file: -`DATABASE_URL="postgresql://jarne:dummyusr@dummypw/tech-survey` -4. Run the following commands to setup your db locally. For the `npm run db:seed` command you need a CSV file to populate the database. You can ask your co-worker for this CSV file, or skip this if you don't want any data. +`DATABASE_URL="postgresql://dummyusr:dummypw@localhost/tech-survey` +4. Run the following commands to setup your db locally. For the `npm run db:seed` command you need a CSV file in the root of your project inside an 'import' folder to populate the database. You can ask your co-worker for this CSV file, or skip this if you don't want any data. Also important to note here is that you don't want to execture the `npm run db:seed` command multiple times, this will initiate the seed again and duplicate all of the data. If you want to run the seed again, you'll need to start with an empty database. ```bash npm run db:generate npm run db:push npm run db:seed ``` -5. Now you should be ready to go! 🎉 You can check your local database by opening the studio of Primsa: +5. Now you should be ready to go! 🎉 You can check your local database by opening the studio of Primsa. Here you should see that the database populated with questions, roles, etc. ```bash npm run db:studio ```