Skip to content

Setup Guide

NedaVasilisk edited this page Sep 17, 2024 · 5 revisions

Setup Guide

Requirements

  • Docker
  • Docker Compose
  • Node.js (for client dependencies)

Step 1: Clone the Repository

git clone https://github.com/IIIA-KO/Trendlink.git

Step 2: Create an .env file

Navigate to the src/client-app directory and create an .env file with the following content:

VITE_API_URL="YOUR API"
VITE_GOOGLE_CLIENT_ID="YOUR GOOGLE CLIENT ID"

Step 3: Configure secrets.json file

Run the following command in the project directory:

dotnet user-secrets init

The values are stored in a JSON file in the local machine's user profile folder:

Windows: %APPDATA%\Microsoft\UserSecrets\<user_secrets_id>\secrets.json

Linux/MacOS: ~/.microsoft/usersecrets/<user_secrets_id>/secrets.json

Define the following secrets in the secrets.json file:

{
  "Keycloak:TokenUrl": "http://trendlink-idp:8080/realms/trendlink/protocol/openid-connect/token",
  "Keycloak:RedirectUri": "http://localhost:18080/realms/trendlink/broker/google/endpoint",
  "Keycloak:Realm": "trendlink",
  "Keycloak:BaseUrl": "http://trendlink-idp:8080",
  "Keycloak:Authority": "http://trendlink-idp:8080/auth/realms/trendlink",
  "Keycloak:AuthClientSecret": "<your-auth-client-secret>",
  "Keycloak:AuthClientId": "trendlink-auth-client",
  "Keycloak:AdminUrl": "http://trendlink-idp:8080/admin/realms/trendlink/",
  "Keycloak:AdminClientSecret": "<your-admin-client-secret>",
  "Keycloak:AdminClientId": "trendlink-admin-client",
  "Kestrel:Certificates:Development:Password": "<your-kestrel-certificates-password>",
  "Instagram:UserInfoUrl": "https://graph.instagram.com/",
  "Instagram:TokenUrl": "https://graph.facebook.com/v20.0/oauth/access_token",
  "Instagram:RenewRedirectUri": "<your-instagram-renew-redirect-uri>",
  "Instagram:RedirectUri": "<your-instagram-redirect-uri>",
  "Instagram:ClientSecret": "<your-instagram-client-secret>",
  "Instagram:ClientId": "<your-instagram-client-id>",
  "Instagram:BaseUrl": "https://graph.facebook.com/v20.0/",
  "Google:UserInfoUrl": "https://www.googleapis.com/oauth2/v2/userinfo",
  "Google:TokenUrl": "https://oauth2.googleapis.com/token",
  "Google:RedirectUri": "<your-google-redirect-uri>",
  "Google:ClientSecret": "<your-google-client-secret>",
  "Google:ClientId": "<your-google-client-id>",
  "Countries-API-URL": "https://countriesnow.space/api/v0.1/countries/states",
  "Authentication:ValidIssuer": "http://trendlink-idp:8080/realms/trendlink",
  "Authentication:RequireHttpsMetadata": "False",
  "Authentication:MetadataUrl": "http://trendlink-idp:8080/realms/trendlink/.well-known/openid-configuration",
  "Authentication:Audience": "account"
}

Step 4: Build Docker Compose project

Navigate to the root directory of the project, where the docker-compose.yml file is located, and run:

docker-compose build

Step 5: Start the application

In the same directory of the project, run:

docker-compose up -d

Step 6: Install client dependencies and run the application

Navigate to the src/client-app directory and run:

npm install
npm start

Access the Application

Client application:

https://localhost:3000

Server application:

http://localhost:5000
or
https://localhost:5001

To login, use the following credentials:

email: user1@trendlink.com
password: Pa$$w0rd