feat: improve startup and routing

- Create scripts/init-db.sql for DB schema initialization
- Enhance start-services.sh to auto-initialize DB if needed
- Fix users admin handler: change root route from '/users' to '/' to avoid double prefix
- Remove deprecated handlers (departments/designations/employees) from users service
- Add missing admin route mappings for users and approval/case endpoints in gateway
- Update gateway to correctly handle /api/admin/users, /api/admin/approvals, etc.
- Update .env.example and docs

These changes enable running the stack without Docker and fix admin panel routing.
This commit is contained in:
Ashwin Kumar 2026-04-07 22:12:37 +02:00
parent 7928e21a21
commit 23c2edd567
25 changed files with 2182 additions and 3 deletions

41
Dockerfile.template Normal file
View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin ${BIN_NAME}
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/${BIN_NAME} ./${BIN_NAME}
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./${BIN_NAME}"]

View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin catering_services
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/catering_services ./catering_services
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./catering_services"]

41
apps/companies/Dockerfile Normal file
View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin companies
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/companies ./companies
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./companies"]

41
apps/customers/Dockerfile Normal file
View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin customers
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/customers ./customers
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./customers"]

View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin developers
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/developers ./developers
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./developers"]

41
apps/employees/Dockerfile Normal file
View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin employees
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/employees ./employees
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./employees"]

View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin fitness_trainers
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/fitness_trainers ./fitness_trainers
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./fitness_trainers"]

41
apps/gateway/Dockerfile Normal file
View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin gateway
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/gateway ./gateway
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./gateway"]

View file

@ -85,7 +85,10 @@ impl Services {
|| path.starts_with("/api/packages")
|| path.starts_with("/api/support")
|| path.starts_with("/api/admin/roles")
|| path.starts_with("/api/admin/users")
|| path.starts_with("/api/admin/verifications")
|| path.starts_with("/api/admin/approvals")
|| path.starts_with("/api/admin/approval-cases")
|| path.starts_with("/api/admin/external-roles")
|| path.starts_with("/api/admin/dashboard-config")
|| path.starts_with("/api/admin/onboarding-config")
@ -179,11 +182,14 @@ impl Services {
else if path.starts_with("/api/admin/runtime-configs") {
Some(self.users_url.clone())
}
// Catch-all for any other admin endpoints → users service
else if path.starts_with("/api/admin/") {
Some(self.users_url.clone())
}
else {
None
}
}
}
fn build_cors() -> CorsLayer {

View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin graphic_designers
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/graphic_designers ./graphic_designers
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./graphic_designers"]

View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin job_seekers
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/job_seekers ./job_seekers
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./job_seekers"]

View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin makeup_artists
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/makeup_artists ./makeup_artists
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./makeup_artists"]

41
apps/payments/Dockerfile Normal file
View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin payments
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/payments ./payments
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./payments"]

View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin photographers
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/photographers ./photographers
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./photographers"]

View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin social_media_managers
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/social_media_managers ./social_media_managers
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./social_media_managers"]

41
apps/tutors/Dockerfile Normal file
View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin tutors
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/tutors ./tutors
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./tutors"]

View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin ugc_content_creators
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/ugc_content_creators ./ugc_content_creators
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./ugc_content_creators"]

41
apps/users/Dockerfile Normal file
View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin users
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/users ./users
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./users"]

View file

@ -13,10 +13,10 @@ use sqlx::FromRow;
pub fn router() -> Router<AppState> {
Router::new()
.route("/users", get(list_users))
.route("/", get(list_users))
.route("/customers", get(list_customers))
.route("/candidates", get(list_candidates))
.route("/users/{id}/status", axum::routing::patch(update_user_status))
.route("/{id}/status", axum::routing::patch(update_user_status))
}
#[derive(Deserialize)]

View file

@ -0,0 +1,41 @@
# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin video_editors
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/video_editors ./video_editors
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./video_editors"]

View file

@ -12,12 +12,27 @@ services:
- '5432:5432'
volumes:
- pgdata:/var/lib/postgresql/data
- ./scripts/init-db.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U nxtgauge -d nxtgauge_db']
interval: 5s
timeout: 5s
retries: 10
redis:
image: redis:7-alpine
restart: unless-stopped
ports:
- '6379:6379'
volumes:
- redisdata:/data
command: redis-server --appendonly yes
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 5s
retries: 10
# ── Core Services ────────────────────────────────────────────────────────
gateway:
@ -40,11 +55,14 @@ services:
FITNESS_TRAINERS_SERVICE_URL: http://fitness_trainers:8092
CATERING_SERVICES_SERVICE_URL: http://catering_services:8093
PAYMENTS_SERVICE_URL: http://payments:8094
REDIS_URL: redis://redis:6379
ports:
- '8000:8000'
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
users:
build:
@ -53,6 +71,7 @@ services:
environment:
PORT: 8080
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
JWT_EXPIRY_MINUTES: 15
REFRESH_TOKEN_EXPIRY_DAYS: 30
@ -64,6 +83,8 @@ services:
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
companies:
build:
@ -72,10 +93,13 @@ services:
environment:
PORT: 8081
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
job_seekers:
build:
@ -84,10 +108,13 @@ services:
environment:
PORT: 8082
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
customers:
build:
@ -96,10 +123,13 @@ services:
environment:
PORT: 8083
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
# ── 9 Profession Services ─────────────────────────────────────────────────
@ -110,10 +140,13 @@ services:
environment:
PORT: 8085
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
makeup_artists:
build:
@ -122,10 +155,13 @@ services:
environment:
PORT: 8086
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
tutors:
build:
@ -134,10 +170,13 @@ services:
environment:
PORT: 8087
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
developers:
build:
@ -146,10 +185,13 @@ services:
environment:
PORT: 8088
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
video_editors:
build:
@ -158,10 +200,13 @@ services:
environment:
PORT: 8089
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
graphic_designers:
build:
@ -170,10 +215,13 @@ services:
environment:
PORT: 8090
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
social_media_managers:
build:
@ -182,10 +230,13 @@ services:
environment:
PORT: 8091
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
fitness_trainers:
build:
@ -194,10 +245,13 @@ services:
environment:
PORT: 8092
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
catering_services:
build:
@ -206,10 +260,13 @@ services:
environment:
PORT: 8093
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
# ── Payments ──────────────────────────────────────────────────────────────
@ -220,12 +277,46 @@ services:
environment:
PORT: 8094
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
RAZORPAY_KEY_ID: ${RAZORPAY_KEY_ID:-}
RAZORPAY_KEY_SECRET: ${RAZORPAY_KEY_SECRET:-}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
employees:
build:
context: .
dockerfile: apps/employees/Dockerfile
environment:
PORT: 8095
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
ugc_content_creators:
build:
context: .
dockerfile: apps/ugc_content_creators/Dockerfile
environment:
PORT: 8096
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
volumes:
pgdata:
redisdata:

1
gateway.pid Normal file
View file

@ -0,0 +1 @@
97314

1321
scripts/init-db.sql Normal file

File diff suppressed because it is too large Load diff

View file

@ -5,6 +5,27 @@ set -a
source .env
set +a
# ── Initialize PostgreSQL database if needed ────────────────────────────────────
echo "Initializing database..."
# Use DATABASE_URL from .env to run init script
export PGPASSWORD=${POSTGRES_PASSWORD:-nxtgauge_dev}
# Check if database is accessible and if the 'roles' table exists as a heuristic
if psql "${DATABASE_URL:-postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@localhost:5432/nxtgauge_db}" -c '\q' 2>/dev/null; then
# Try to see if the schema is already initialized (check for 'roles' table)
if ! psql "${DATABASE_URL:-postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@localhost:5432/nxtgauge_db}" -t -c "SELECT to_regname('roles');" 2>/dev/null | grep -q '^roles$'; then
echo "Applying database schema..."
psql "${DATABASE_URL:-postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@localhost:5432/nxtgauge_db}" -f scripts/init-db.sql
else
echo "Database schema already initialized."
fi
else
echo "ERROR: Cannot connect to PostgreSQL. Make sure PostgreSQL is running on localhost:5432."
echo "Start PostgreSQL and try again."
exit 1
fi
echo "Building workspace..."
cargo build --workspace

1
users.pid Normal file
View file

@ -0,0 +1 @@
96200