Skip to content

Commit f2b2864

Browse files
refactor(env): update environment variables and improve documentation for local development
1 parent f3bebcd commit f2b2864

File tree

1 file changed

+75
-32
lines changed

1 file changed

+75
-32
lines changed

.env.example

Lines changed: 75 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,60 @@
44
###############################################
55
# - To use: `./copy-env.sh .env.dev.example .env`
66
###############################################
7+
# - ONLY FOLLOWING ENV VARIABLES ARE REQUIRED
8+
# - JWT_SECRET
9+
# - OPENAI_API_KEY
10+
# - OPENAI_MODEL ( Not required but recommended)
11+
# - MONGO_URL (Local or on Atlas)
12+
# - GRAFANA_ADMIN_USER (defaut is admin, but recommended to change it)
13+
# - GRAFANA_ADMIN_PASSWORD (defaut is admin, but recommended to change it)
14+
###############################################
15+
716

817
##########################
918
# 📦 Application Version
1019
##########################
1120

1221
APP_VERSION=1.0.0-dev # Version of the SkillForge application (used in metrics and service info)
1322

23+
##########################
24+
# (OPTIONAL) For Traefik Reverse Proxy (Emulate Production mode)
25+
##########################
26+
CLIENT_HOST=client.localhost
27+
SERVER_HOST=server.localhost
28+
GENAI_HOST=genai.localhost
29+
PROMETHEUS_HOST=prometheus.localhost
30+
ALERTMANAGER_HOST=alertmanager.localhost
31+
GRAFANA_HOST=grafana.localhost
32+
MAILHOG_HOST=mail.localhost
33+
#
34+
35+
# > NOTE: They must be set in (/etc/hosts) using
36+
# echo "127.0.0.1 client.localhost" >> /etc/hosts
37+
# echo "127.0.0.1 server.localhost" >> /etc/hosts
38+
# echo "127.0.0.1 genai.localhost" >> /etc/hosts
39+
# echo "127.0.0.1 prometheus.localhost" >> /etc/hosts
40+
# echo "127.0.0.1 grafana.localhost" >> /etc/hosts
41+
# echo "127.0.0.1 alertmanager.localhost" >> /etc/hosts
42+
# echo "127.0.0.1 mail.localhost" >> /etc/hosts
43+
44+
45+
##########################
46+
# 🍏 Spring Boot Profile
47+
##########################
48+
49+
SPRING_PROFILES_ACTIVE=docker # (default: docker)
50+
51+
1452
##########################
1553
# 🗃️ MongoDB Settings
1654
##########################
1755

1856
# MongoDB exposed port (defaults to 27017)
1957
MONGODB_EXPOSED_PORT=27017 # (default: 27017)
2058
MONGODB_DATABASE=skillforge_dev # Name of the database to create/use
21-
MONGODB_USERNAME=dev_user # MongoDB username (choose any)
22-
MONGODB_PASSWORD=dev_password # MongoDB password (choose any)
59+
MONGODB_USERNAME=dev_user # MongoDB username (choose any) - default is root
60+
MONGODB_PASSWORD=dev_password # MongoDB password (choose any) - default is password
2361
MONGO_URL=mongodb://dev_user:dev_password@mongo:27017/skillforge-dev?authSource=admin
2462

2563
##########################
@@ -28,36 +66,42 @@ MONGO_URL=mongodb://dev_user:dev_password@mongo:27017/skillforge-dev?authSource=
2866

2967
# Port for the gateway service (defaults to 8081)
3068
SERVER_PORT_GATEWAY=8081 # (default: 8081)
31-
# Spring Boot active profile
32-
SPRING_PROFILE_ACTIVES=docker # (default: docker)
69+
JWT_SECRET=dev-secret # 🔑 JWT signing secret (REQUIRED!)
3370

3471
##########################
3572
# 👤 User Service
3673
##########################
3774

3875
# Port for user service (defaults to 8082)
3976
SERVER_PORT_USER=8082 # (default: 8082)
40-
# User service connects to MongoDB (host: mongo, matches compose service name)
41-
MONGODB_HOST=mongo
4277
JWT_SECRET=dev-secret # 🔑 JWT signing secret (generate one)
4378
JWT_EXPIRATION_MS=3600000 # JWT expiration (ms, default: 1h = 3600000)
4479

80+
##########################
81+
# 📘 Course Service
82+
##########################
83+
84+
# Port for course service (defaults to 8083)
85+
SERVER_PORT_COURSE=8083 # (default: 8083)
86+
87+
4588
##########################
4689
# 🖥️ Client Frontend (Vite/React)
4790
##########################
4891

4992
# Vite dev server port (defaults to 3000)
5093
VITE_PORT=3000 # (default: 3000)
94+
BUILD_MODE=production # (default: production)
5195
VITE_APP_NAME=SkillForge.ai # (default: SkillForge.ai)
52-
VITE_APP_VERSION=1.0.0 # (default: 1.0.0)
96+
VITE_APP_VERSION=1.0.0-dev # (default: 1.0.0)
5397
VITE_API_BASE_URL=/api # (default: /api)
5498
VITE_API_VERSION=v1 # (default: v1)
55-
BUILD_MODE=production # (default: production)
5699

57100
# Used for Nginx/Reverse proxy
58101
VITE_API_INTERNAL_HOST=server-gateway # (default: server-gateway, matches docker service)
59102
VITE_API_INTERNAL_PORT=8081 # (default: 8081)
60-
VITE_PUBLIC_API_URL=http://server.localhost:8081/api # (default: http://server.localhost:8081/api)
103+
VITE_PUBLIC_API_URL=http://server.localhost:8081/api # (default: http://server.localhost:8081/api) (SHOULD BE SETUP IN YOUR YOUR local HOSTS FILE (/etc/hosts))
104+
61105

62106
##########################
63107
# 🧠 GenAI Service
@@ -71,42 +115,41 @@ CORS_ALLOW_ORIGINS=* # (default: *)
71115
SERVER_HOST_GENAI=skillforge-genai
72116
SERVER_PORT_GENAI=8888
73117

118+
############################
119+
# 💡 Weaviate Vector Database
120+
############################
121+
122+
# Weaviate exposed port (defaults to 8080)
123+
WEAVIATE_HOST=skillforge-weaviate # (default: skillforge-weaviate)
124+
WEAVIATE_HTTP_PORT=8080 # (default: 8080)
125+
WEAVIATE_GRPC_PORT=50051 # (default: 50051)
126+
74127
##########################
75-
# 🤖 LLM Provider (OpenAI or other)
128+
# 🤖 Genai Service
76129
##########################
77-
130+
GENAI_PORT=8888 # (default: 8888)
131+
GENAI_APP_NAME=SkillForge GenAI # (default: SkillForge GenAI)
132+
GENAI_APP_VERSION=1.0.0 # (default: 1.0.0)
133+
UVICORN_WORKERS=2 # (default: 2)
134+
CORS_ALLOW_ORIGINS=* # (default: *)
78135
LLM_PROVIDER=openai # (default: openai)
79136
OPENAI_API_BASE=https://api.openai.com/v1 # (default: https://api.openai.com/v1)
80137
OPENAI_API_KEY=sk-xxxxxxxxxxxxxx # 🔑 OpenAI API key (get from https://platform.openai.com)
81-
OPENAI_MODEL=gpt-4o-mini # (default: gpt-4o-mini)
82-
83-
##########################
84-
# 🦾 Weaviate Vector DB
85-
##########################
138+
OPENAI_MODEL=gpt-4o-mini # (default: gpt-4o)
86139

87-
WEAVIATE_HOST=weaviate-db # (default: weaviate-db, matches compose service)
88-
WEAVIATE_EXPOSED_HTTP_PORT=8080 # (default: 8080)
89-
WEAVIATE_EXPOSED_GRPC_PORT=50051 # (default: 50051)
90140

91141
##########################
92-
# 📊 Monitoring Ports
142+
# 📊 Monitoring
93143
##########################
94144
# Host-side ports for monitoring stack services
95145
PROMETHEUS_PORT=9090 # (default: 9090)
96146
ALERTMANAGER_PORT=9093 # (default: 9093)
97147
GRAFANA_EXPOSED_PORT=3001 # (default: 3001)
98148
LOKI_PORT=3100 # (default: 3100)
99149
MONGO_EXPORTER_PORT=9216 # (default: 9216)
150+
MAILHOG_PORT=8025 # (default: 8025)
100151

101-
##########################
102-
# For Production mode
103-
##########################
104-
CLIENT_HOST=client.localhost
105-
SERVER_HOST=server.localhost
106-
GENAI_HOST=genai.localhost
107-
###############################################
108-
# ⚠️ Notes:
109-
# - Secrets like JWT_SECRET and OPENAI_API_KEY should NEVER be committed!
110-
# - All defaults match those in docker-compose and Dockerfiles.
111-
# - To use: `./copy-env.sh .env.dev.example .env`
112-
###############################################
152+
153+
154+
GRAFANA_ADMIN_USER=admin # (default: admin)
155+
GRAFANA_ADMIN_PASSWORD=admin # (default: admin)

0 commit comments

Comments
 (0)