diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..547675a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,37 @@ +# Git +.git +.gitignore +.github + +# IDE +.vscode +.kiro +.idea + +# Build artifacts +bin/ +*.exe +*.dll +*.so +*.dylib + +# Test files +*_test.go +*.test +*.out + +# Environment files +.env +.env.local + +# Documentation +*.md +docs/ + +# Misc +.DS_Store +Thumbs.db +brainstorm.md +nginx/ +scripts/ +Makefile diff --git a/.env b/.env deleted file mode 100644 index fc4bde7..0000000 --- a/.env +++ /dev/null @@ -1,34 +0,0 @@ -# Server Configuration -PORT=8080 -HOST=localhost - -# Database Configuration -DB_HOST=localhost -DB_PORT=5432 -DB_USER=postgres -DB_PASSWORD=123 -DB_NAME=booking_system -DB_SSLMODE=disable - -# JWT Configuration -JWT_SECRET=your-super-secret-jwt-key -JWT_EXPIRATION=24h - -# Stripe Configuration -STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key -STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret -STRIPE_PUBLISHABLE_KEY=pk_test_your_publishable_key - -# SMTP Configuration -SMTP_HOST=smtp.hostinger.com -SMTP_PORT=465 -SMTP_USERNAME=hello@attunehearttherapy.com -SMTP_PASSWORD="G&n2S;ffTc8f" -SMTP_FROM=hello@attunehearttherapy.com - -# Jitsi Configuration -# JITSI_BASE_URL=https://meet.jit.si -JITSI_BASE_URL=https://meet.attunehearttherapy.com -JITSI_API_KEY=your_jitsi_api_key -JITSI_APP_ID=attunehearttherapy_id -JITSI_PRIVATE_KEY=attunehearttherapy_jitsi_private_key \ No newline at end of file diff --git a/.env.example b/.env.example index fde6302..fc4bde7 100644 --- a/.env.example +++ b/.env.example @@ -6,7 +6,7 @@ HOST=localhost DB_HOST=localhost DB_PORT=5432 DB_USER=postgres -DB_PASSWORD=your_password +DB_PASSWORD=123 DB_NAME=booking_system DB_SSLMODE=disable @@ -20,21 +20,15 @@ STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret STRIPE_PUBLISHABLE_KEY=pk_test_your_publishable_key # SMTP Configuration -SMTP_HOST=smtp.gmail.com -SMTP_PORT=587 -SMTP_USERNAME=your_email@gmail.com -SMTP_PASSWORD=your_app_password -SMTP_FROM=your_email@gmail.com +SMTP_HOST=smtp.hostinger.com +SMTP_PORT=465 +SMTP_USERNAME=hello@attunehearttherapy.com +SMTP_PASSWORD="G&n2S;ffTc8f" +SMTP_FROM=hello@attunehearttherapy.com # Jitsi Configuration -# For public Jitsi (meet.jit.si) - JWT not required, leave API_KEY and APP_ID empty +# JITSI_BASE_URL=https://meet.jit.si JITSI_BASE_URL=https://meet.attunehearttherapy.com JITSI_API_KEY=your_jitsi_api_key JITSI_APP_ID=attunehearttherapy_id -JITSI_PRIVATE_KEY=attunehearttherapy_jitsi_private_key - -# For self-hosted Jitsi with JWT authentication - fill in these values -# JITSI_BASE_URL=https://meet.yourdomain.com -# JITSI_API_KEY=your_jwt_secret_key -# JITSI_APP_ID=your_jitsi_app_id -JITSI_PRIVATE_KEY=your_jitsi_private_key \ No newline at end of file +JITSI_PRIVATE_KEY=attunehearttherapy_jitsi_private_key \ No newline at end of file diff --git a/.gitignore b/.gitignore index e17b714..518679c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .kiro/ -bin/ \ No newline at end of file +bin/ +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..84eecc9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,48 @@ +# Build stage +FROM golang:1.25.1-alpine AS builder + +# Install build dependencies +RUN apk add --no-cache git make + +# Set working directory +WORKDIR /app + +# Copy go mod files +COPY go.mod go.sum ./ + +# Download dependencies +RUN go mod download + +# Copy source code +COPY . . + +# Build the server binary +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o server cmd/server/main.go + +# Build the CLI binary (optional, for migrations) +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o cli cmd/cli/main.go + +# Runtime stage +FROM alpine:latest + +# Install ca-certificates for HTTPS requests +RUN apk --no-cache add ca-certificates tzdata + +WORKDIR /root/ + +# Copy binaries from builder +COPY --from=builder /app/server . +COPY --from=builder /app/cli . + +# Copy templates if they exist +COPY --from=builder /app/internal/templates ./internal/templates + +# Expose port (adjust if needed) +EXPOSE 8080 + +# Health check +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ + CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1 + +# Run the server +CMD ["./server"] diff --git a/Makefile b/Makefile deleted file mode 100644 index b84ab8c..0000000 --- a/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -.PHONY: build run test clean deps server cli - -# Build the server binary -build: - go build -o bin/server cmd/server/main.go - -# Build the CLI binary -build-cli: - go build -o bin/cli cmd/cli/main.go - -# Run the server -run: - go run cmd/server/main.go - -# Run the CLI -cli: - go run cmd/cli/main.go - -# Install dependencies -deps: - go mod tidy - go mod download - -# Run tests -test: - go test ./... - -# Clean build artifacts -clean: - rm -rf bin/ - -# Format code -fmt: - go fmt ./... - -# Vet code -vet: - go vet ./... - -# Run linter (requires golangci-lint) -lint: - golangci-lint run - -# Database operations -db-migrate: build-cli - ./bin/cli migrate - -db-health: build-cli - ./bin/cli db health - -db-seed: build-cli - ./bin/cli db seed - -# Development setup -dev-setup: deps - cp .env.example .env - @echo "Please update .env file with your configuration" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..bcdf165 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,41 @@ +version: '3.8' + +services: + app: + build: + context: . + dockerfile: Dockerfile + ports: + - "8080:8080" + environment: + - DATABASE_URL=${DATABASE_URL} + - JWT_SECRET=${JWT_SECRET} + - STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY} + - SMTP_HOST=${SMTP_HOST} + - SMTP_PORT=${SMTP_PORT} + - SMTP_USERNAME=${SMTP_USERNAME} + - SMTP_PASSWORD=${SMTP_PASSWORD} + - JITSI_APP_ID=${JITSI_APP_ID} + - JITSI_SECRET=${JITSI_SECRET} + depends_on: + postgres: + condition: service_healthy + restart: unless-stopped + + postgres: + image: postgres:16-alpine + environment: + - POSTGRES_DB=${POSTGRES_DB:-videoconf} + - POSTGRES_USER=${POSTGRES_USER:-postgres} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + volumes: + - postgres_data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"] + interval: 10s + timeout: 5s + retries: 5 + restart: unless-stopped + +volumes: + postgres_data: