### Install and Run ConstructPro (Bash) Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/README.md This snippet provides the bash commands to install dependencies, set up the database, start the development server, build for production, and start the production server for the ConstructPro application. ```bash # Install dependencies npm install # Set up the database npm run db:push npm run db:generate # Start development server npm run dev # Build for production npm run build # Start production server npm start Open http://localhost:3000 to access ConstructPro. ``` -------------------------------- ### Execute Server Setup Script Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/SERVER_SETUP_GUIDE.md Instructions on how to upload and execute the server-setup.sh script on an Ubuntu server. This includes making the script executable and running it with sudo privileges. ```bash # Option 1: Using SCP (from your local machine) scp server-setup.sh user@your-server-ip:/tmp/ # Option 2: Create directly on server nano server-setup.sh # Copy and paste the script content ``` ```bash chmod +x server-setup.sh ``` ```bash sudo ./server-setup.sh ``` -------------------------------- ### Check System Resources Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/SERVER_SETUP_GUIDE.md Commands to monitor system resources such as CPU usage, memory, and disk space after server setup. ```bash htop ``` ```bash df -h ``` ```bash free -h ``` -------------------------------- ### Make Scripts Executable and Run Setup Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/ADIM_ADIM_BULUT_SUNUCU_REHBERI.md Changes the permissions of the transferred setup scripts to make them executable and then runs the main server setup script. This process includes package updates, security configurations, and system optimizations. ```Bash chmod +x server-setup.sh chmod +x verify-setup.sh ``` ```Bash ./server-setup.sh ``` ```Bash ./verify-setup.sh ``` ```Bash # Dosya var mı kontrol et: ls -la server-setup.sh ``` -------------------------------- ### Execute Server Setup Scripts Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TASK1_QUICK_REFERENCE.md Commands to make the server setup and verification scripts executable and then run them. This is the primary method for setting up the server environment. ```bash chmod +x server-setup.sh sudo ./server-setup.sh chmod +x verify-setup.sh ./verify-setup.sh ``` -------------------------------- ### Install WSL2 Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/WSL2_SETUP.md Installs the Windows Subsystem for Linux 2. This command needs to be run with administrator privileges. A system restart is required after execution. ```powershell # Run as Administrator wsl --install # Restart your computer ``` -------------------------------- ### Transfer Setup Scripts to Server Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/ADIM_ADIM_BULUT_SUNUCU_REHBERI.md Copies setup scripts (server-setup.sh, verify-setup.sh) from a local Windows machine to the server's root directory using SCP. Requires the server's IP address and root password. ```PowerShell # ConstructPro klasörüne git cd "C:\Users\mrbcr\OneDrive\Desktop\ConstructPro" # Scriptleri sunucuya gönder (IP adresini değiştir!) scp server-setup.sh root@68.183.216.65:/root/ scp verify-setup.sh root@68.183.216.65:/root/ ``` -------------------------------- ### Check and Restart Service Logs Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/SERVER_SETUP_GUIDE.md View logs for a specific service to diagnose startup failures and restart the service. This is essential for troubleshooting any service-related issues. ```bash sudo journalctl -u service-name -f sudo systemctl restart service-name ``` -------------------------------- ### Verify Service Status Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/SERVER_SETUP_GUIDE.md Commands to check the running status of essential services like SSH, Fail2Ban, and unattended-upgrades. ```bash sudo systemctl status sshd ``` ```bash sudo systemctl status fail2ban ``` ```bash sudo systemctl status unattended-upgrades ``` -------------------------------- ### Test SSH Connection Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/SERVER_SETUP_GUIDE.md Command to test the SSH connection to the server from your local machine after the setup script has been executed. ```bash # From your local machine ssh your-username@your-server-ip ``` -------------------------------- ### Check Firewall Status Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/SERVER_SETUP_GUIDE.md Command to verify the status of the UFW firewall after it has been configured by the setup script. ```bash sudo ufw status verbose ``` -------------------------------- ### Manage System Services Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TASK1_QUICK_REFERENCE.md Commands to check the status of a service, view its logs, and restart it. These are general-purpose commands for managing system services. ```bash sudo systemctl status service-name sudo journalctl -u service-name -f sudo systemctl restart service-name ``` -------------------------------- ### Install Ubuntu 22.04 on WSL2 Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/WSL2_SETUP.md Installs the Ubuntu 22.04 distribution within WSL2. This command specifies the exact version of Ubuntu to be installed. ```powershell wsl --install -d Ubuntu-22.04 ``` -------------------------------- ### ConstructPro Start Komutu Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/COOLIFY_GITHUB_ENTEGRASYON_REHBERI.md ConstructPro uygulamasının başlatılması için kullanılan npm komutu. ```bash npm start ``` -------------------------------- ### Check Coolify Installation Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/DURUM_KONTROL_REHBERI.md Verifies if Coolify is installed by checking for running Coolify containers. If not installed, it provides the command to install Coolify. ```bash # Coolify container'larını kontrol et: docker ps | grep coolify ``` ```bash # Coolify kurulumu: curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash ``` -------------------------------- ### Check Docker Installation Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/DURUM_KONTROL_REHBERI.md Verifies if Docker and Docker Compose are installed by checking their versions. If not installed, it provides commands to install Docker. ```bash docker --version # Docker version göstermeli docker-compose --version # Docker Compose version göstermeli ``` ```bash # Docker kurulumu: curl -fsSL https://get.docker.com -o get-docker.sh sh get-docker.sh systemctl start docker systemctl enable docker ``` -------------------------------- ### Transfer and Run Setup Scripts in WSL2 Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/WSL2_SETUP.md Copies setup scripts from the Windows file system to the WSL2 Ubuntu environment, makes them executable, and then runs them. This is crucial for configuring the server environment. ```bash # Inside WSL2 Ubuntu cd ~ # Copy the scripts from Windows to WSL2 cp /mnt/c/Users/mrbcr/OneDrive/Desktop/ConstructPro/server-setup.sh . cp /mnt/c/Users/mrbcr/OneDrive/Desktop/ConstructPro/verify-setup.sh . # Make executable and run chmod +x server-setup.sh verify-setup.sh sudo ./server-setup.sh ./verify-setup.sh ``` -------------------------------- ### Setup Ubuntu User and Update System Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/WSL2_SETUP.md Configures the user account within the Ubuntu WSL2 environment by setting a username and password. It also updates the system's package lists and installed packages. ```bash # Create username and password when prompted # Update system: sudo apt update && sudo apt upgrade -y ``` -------------------------------- ### Transfer and Execute Setup Scripts Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/CLOUD_SERVER_SETUP.md Securely copy setup scripts to your server using SCP and then execute them after logging in via SSH. This involves making the scripts executable and running them. ```bash scp server-setup.sh root@your-server-ip:/root/ scp verify-setup.sh root@your-server-ip:/root/ ``` ```bash ssh root@your-server-ip chmod +x server-setup.sh verify-setup.sh ./server-setup.sh ./verify-setup.sh ``` -------------------------------- ### UptimeRobot External Monitoring Setup Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/DEPLOYMENT-RUNBOOK.md Example bash command to set up uptime monitoring using the UptimeRobot API. This involves sending a POST request with API key, format, type, URL, and a friendly name for the monitor. ```bash # Example with UptimeRobot API curl -X POST "https://api.uptimerobot.com/v2/newMonitor" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "api_key=YOUR_API_KEY&format=json&type=1&url=https://constructpro.vovelet-tech.com&friendly_name=ConstructPro" ``` -------------------------------- ### Test SSH Configuration Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/SERVER_SETUP_GUIDE.md Validate the SSH server configuration file for syntax errors before restarting the SSH service. This prevents potential connection failures due to misconfigurations. ```bash sudo nano /etc/ssh/sshd_config sudo sshd -t ``` -------------------------------- ### Manage Firewall Rules with UFW Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/SERVER_SETUP_GUIDE.md Check current firewall status and allow SSH traffic (port 22) if it's blocked. This helps resolve lockout issues caused by firewall misconfigurations. ```bash sudo ufw status sudo ufw allow 22/tcp ``` -------------------------------- ### Manage UFW Firewall Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TASK1_QUICK_REFERENCE.md Commands to view the current UFW firewall status, reset all rules, allow SSH traffic, and enable the firewall. Useful for troubleshooting firewall-related issues. ```bash sudo ufw status verbose sudo ufw --force reset sudo ufw allow 22/tcp sudo ufw enable ``` -------------------------------- ### Perform Emergency Rollback and Data Recovery Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Instructions for performing a quick rollback in Coolify, a Git-based rollback, and database backup and restore operations using pg_dump and psql. ```bash # Quick rollback in Coolify # 1. Go to Deployments tab # 2. Select previous successful deployment # 3. Click "Redeploy" # Git-based rollback git revert HEAD git push origin main ``` ```bash # Database backup pg_dump $DATABASE_URL > emergency_backup_$(date +%Y%m%d_%H%M%S).sql # Restore from backup psql $DATABASE_URL < backup_file.sql ``` -------------------------------- ### Diagnose Firewall Issues Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Commands to check firewall status, test port connectivity, and open necessary ports for services like SSH, HTTP, HTTPS, and Coolify. ```bash # Check firewall status sudo ufw status verbose # Test port connectivity telnet constructpro.vovelet-tech.com 443 nc -zv constructpro.vovelet-tech.com 443 ``` ```bash # Open required ports sudo ufw allow 22/tcp # SSH sudo ufw allow 80/tcp # HTTP sudo ufw allow 443/tcp # HTTPS sudo ufw allow 8000/tcp # Coolify # Reload firewall sudo ufw reload ``` -------------------------------- ### Check SSH Configuration Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TASK1_QUICK_REFERENCE.md Commands to check the status of the SSH service, view firewall status, and test the SSH daemon configuration. These are used for emergency access and troubleshooting. ```bash sudo systemctl status sshd sudo ufw status sudo nano /etc/ssh/sshd_config sudo sshd -t ``` -------------------------------- ### Check and Restart SSH Service Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/SERVER_SETUP_GUIDE.md Diagnose SSH service status and restart it if necessary. This is crucial for regaining SSH access after script execution. ```bash sudo systemctl status sshd sudo systemctl restart sshd ``` -------------------------------- ### Next.js 15 Project Setup with TypeScript and App Router Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/CONSTRUCTION_THEME_IMPLEMENTATION.md This snippet outlines the core setup for a Next.js 15 project utilizing TypeScript and the App Router. It includes configurations for strict TypeScript settings, the App Router, and a custom server with Socket.IO integration. ```bash npx create-next-app@latest constructpro --typescript --eslint --app --src-dir --tailwind --import-alias "@/*" # Add Socket.IO to server.ts (example) # server.ts # import { Server } from 'socket.io' # const io = new Server(httpServer) ``` -------------------------------- ### Temporarily Disable and Reconfigure UFW Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/SERVER_SETUP_GUIDE.md Temporarily disable the Uncomplicated Firewall (UFW) to regain access, then reconfigure it to allow SSH traffic and re-enable it. This is a recovery step for firewall-induced lockouts. ```bash sudo ufw disable sudo ufw allow 22/tcp sudo ufw enable ``` -------------------------------- ### Verify DNS Records and Clear Cache Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Commands to verify A records, check TTL, clear local DNS cache, and test DNS resolution using a specific DNS server. ```bash # Verify A record points to server IP # Check TTL settings # Wait for propagation (up to 48 hours) ``` ```bash # Clear local DNS cache sudo systemctl flush-dns # Use different DNS servers for testing nslookup constructpro.vovelet-tech.com 8.8.8.8 ``` -------------------------------- ### Generate Prisma Client Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Generate the Prisma client based on the current Prisma schema. This is necessary after schema changes or to ensure the client is up-to-date. ```bash npx prisma generate ``` -------------------------------- ### Restart Services and Verify System Status Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Commands to restart Docker containers, perform a full system reboot, and verify service availability via API health checks. ```bash # Restart all services docker restart # Full system restart (if needed) sudo reboot # Verify services after restart curl https://constructpro.vovelet-tech.com/api/health ``` -------------------------------- ### Configure Prisma Schema for Security Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/security-config.md Defines security considerations for the Prisma schema, recommending PostgreSQL for production environments and enabling query logging only in development for performance and security. ```typescript // prisma/schema.prisma security considerations generator client { provider = "prisma-client-js" // Enable query logging in development only log = ["query", "info", "warn", "error"] } datasource db { provider = "postgresql" // More secure than SQLite for production url = env("DATABASE_URL") } ``` -------------------------------- ### Secure Prisma Client Initialization Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/security-config.md Ensures secure initialization of the PrismaClient by conditionally enabling query logging based on the environment (development only) to prevent sensitive data exposure in production. ```typescript // src/lib/db.ts import { PrismaClient } from '@prisma/client'; const globalForPrisma = globalThis as unknown as { prisma: PrismaClient | undefined; }; export const prisma = globalForPrisma.prisma ?? new PrismaClient({ log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'], }); if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma; ``` -------------------------------- ### Manage Production Environment Variables Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/security-config.md Demonstrates secure management of sensitive production environment variables, such as database credentials and authentication secrets, recommending storage in Coolify secrets for enhanced security. ```env # Production environment variables (store in Coolify secrets) DATABASE_URL=postgresql://... NEXTAUTH_SECRET=your-secret-key NEXTAUTH_URL=https://your-domain.com # Non-sensitive configuration NODE_ENV=production NEXT_TELEMETRY_DISABLED=1 ``` -------------------------------- ### Check Database Connectivity with Prisma Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Use Prisma to attempt a database pull, which implicitly tests the database connection. This is a way to verify if the application can connect to its database. ```bash docker exec -it npx prisma db pull ``` -------------------------------- ### Test Docker Build Locally Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Build a Docker image for ConstructPro locally with a specific tag. This is useful for testing build processes and diagnosing build failures outside of the deployment environment. ```bash docker build -t constructpro-test . ``` -------------------------------- ### Connect to Server via SSH Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/DURUM_KONTROL_REHBERI.md Establishes an SSH connection to the server. Requires the server's IP address and root credentials. Ensure the server is running and accessible. ```powershell # Windows PowerShell'de: ssh root@SUNUCU-IP-ADRESİNİZ ``` -------------------------------- ### Analyze Docker Logs for Errors and Performance Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Bash commands to filter Docker container logs for specific patterns like errors, exceptions, timeouts, memory issues, and security-related events. ```bash # Error patterns to look for docker logs | grep -i "error\|exception\|failed" ``` ```bash # Performance issues docker logs | grep -i "timeout\|slow\|memory" ``` ```bash # Security issues docker logs | grep -i "blocked\|rate limit\|unauthorized" ``` -------------------------------- ### Restart SSH Service and Configure Firewall Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TASK1_QUICK_REFERENCE.md Troubleshooting commands to restart the SSH daemon, allow SSH traffic through the firewall, and reload firewall rules. This is useful if SSH connections are lost. ```bash sudo systemctl restart sshd sudo ufw allow 22/tcp sudo ufw reload ``` -------------------------------- ### Dry Run npm ci for Package-lock.json Integrity Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Perform a dry run of `npm ci` to check the integrity of the `package-lock.json` file without actually installing dependencies. This helps in identifying potential issues before a full installation. ```bash npm ci --dry-run ``` -------------------------------- ### Database Migration with Prisma Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/DEPLOYMENT-RUNBOOK.md Steps to connect to the application container and run database migrations using Prisma. This includes deploying migrations, generating types, and pulling the database schema. ```bash # Connect to application container docker exec -it sh # Run Prisma migrations npx prisma migrate deploy npx prisma generate # Verify database connection npx prisma db pull ``` -------------------------------- ### Get Database URL Environment Variable Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Echo the value of the DATABASE_URL environment variable. This is useful for verifying the database connection string format and credentials. ```bash echo $DATABASE_URL ``` -------------------------------- ### Remove and Reinstall npm Dependencies Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Remove the existing `package-lock.json` file and then run `npm install` to generate a fresh one. This is a common solution for dependency conflicts. ```bash rm package-lock.json npm install ``` -------------------------------- ### Test Docker Functionality Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/DURUM_KONTROL_REHBERI.md Runs a test container ('hello-world') to confirm Docker is functioning correctly and lists all running containers. Ensures Docker can execute images and manage containers. ```bash docker run hello-world # "Hello from Docker!" mesajı görmeli docker ps -a # Çalışan container'ları göster ``` -------------------------------- ### Troubleshooting Application Startup Issues Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/DEPLOYMENT-RUNBOOK.md Bash commands to diagnose and resolve application startup failures. This involves checking container logs, environment variables, and database connection status. ```bash # Check container logs docker logs # Check environment variables docker exec -it env # Verify database connection docker exec -it npx prisma db pull ``` -------------------------------- ### ConstructPro Build Komutu Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/COOLIFY_GITHUB_ENTEGRASYON_REHBERI.md ConstructPro projesinin build edilmesi için kullanılan npm komutu. ```bash npm run build ``` -------------------------------- ### Test SSL Configuration Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/security-config.md Provides commands to test SSL/TLS configuration by checking HTTP headers and performing an SSL handshake, as well as a command to retrieve an SSL rating from Qualys SSL Labs. ```bash # Test SSL configuration curl -I https://your-domain.com openssl s_client -connect your-domain.com:443 -servername your-domain.com # Check SSL rating curl -s "https://api.ssllabs.com/api/v3/analyze?host=your-domain.com" ``` -------------------------------- ### Dockerfile.alternative: Fallback Dependency Installation Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/docker-build-test.md This alternative Dockerfile provides a fallback mechanism for dependency installation, using `npm install --frozen-lockfile` with a fallback to `npm install`. This approach is more forgiving in environments experiencing dependency conflicts. ```Dockerfile # Alternative Dockerfile (Fallback) FROM node:18-alpine AS deps WORKDIR /app COPY package.json package-lock.json ./ # Fallback strategy for dependency installation RUN npm install --frozen-lockfile || npm install # ... (rest of the Dockerfile would follow similar stages as the primary one) ``` -------------------------------- ### Clear npm Cache Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Forcefully clean the npm cache. This can resolve issues caused by corrupted or outdated cached packages. ```bash npm cache clean --force ``` -------------------------------- ### Resolve ConstructPro Database Migration Failures Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Commands to fix database migration issues and synchronize the schema. This includes resetting migrations (with caution), deploying pending migrations, generating the Prisma client, and pulling the latest schema. ```bash # Reset migrations (CAUTION: Data loss) npx prisma migrate reset ``` ```bash # Deploy pending migrations npx prisma migrate deploy ``` ```bash # Generate Prisma client npx prisma generate ``` ```bash # Verify schema npx prisma db pull ``` -------------------------------- ### Prepare ConstructPro Repository for Deployment Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/DEPLOYMENT-RUNBOOK.md Commands to ensure the local repository is up-to-date with the remote 'main' branch and to create and push a Git tag for the production release. This step is crucial for version control and tracking deployments. ```bash # Ensure main branch is up to date git checkout main git pull origin main # Tag the release git tag -a v1.0.0 -m "Production release v1.0.0" git push origin v1.0.0 ``` -------------------------------- ### Check if Port is Available Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Check if a specific port (e.g., 3000) is currently being used by any process on the system. This helps diagnose port binding errors. ```bash netstat -tulpn | grep :3000 ``` -------------------------------- ### Check System Memory Usage Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Display information about total, used, and free memory and swap space. This helps in identifying memory-related performance issues. ```bash free -h ``` -------------------------------- ### Configure PostgreSQL Database Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/DEPLOYMENT-RUNBOOK.md Provides SQL commands to set up the PostgreSQL database for ConstructPro, including creating the database, a dedicated user, and granting necessary privileges for schema and table access. This ensures the application has a properly configured data store. ```sql -- Create database and user CREATE DATABASE constructpro_production; CREATE USER constructpro_user WITH PASSWORD 'secure_password'; GRANT ALL PRIVILEGES ON DATABASE constructpro_production TO constructpro_user; -- Grant schema permissions \c constructpro_production GRANT ALL ON SCHEMA public TO constructpro_user; GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO constructpro_user; GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO constructpro_user; ``` -------------------------------- ### Check for Processes Using a Specific Port Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md List processes that are listening on a specific network port (e.g., 3000). This command helps identify port conflicts. ```bash sudo lsof -i :3000 ``` -------------------------------- ### Monitor Node.js Heap Usage Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Fetch memory metrics from a Node.js application endpoint, specifically looking for heap usage. This requires a custom metrics endpoint in the application. ```javascript curl https://constructpro.vovelet-tech.com/api/monitoring/metrics | jq '.memory' ``` -------------------------------- ### Verify Server Status and Resources Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/ADIM_ADIM_BULUT_SUNUCU_REHBERI.md Checks the status of essential services like the firewall (ufw), SSH daemon (sshd), and Fail2ban, and displays system resource usage including CPU, disk space, and RAM. ```Bash # Bu komutlar çalışmalı: ufw status # Firewall aktif olmalı systemctl status sshd # SSH çalışıyor olmalı fail2ban-client status # Fail2ban aktif olmalı ``` ```Bash # Sunucu bilgilerini gör: htop # Sistem kaynaklarını göster (q ile çık) df -h # Disk alanını göster free -h # RAM kullanımını göster ``` ```Bash # Sunucuda: curl -I http://google.com # İnternet bağlantısı test ``` -------------------------------- ### Measure Health Check Response Time Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Measure the time taken for the health check endpoint to respond. This helps in identifying performance issues related to the health check itself. ```bash time curl https://constructpro.vovelet-tech.com/api/health ``` -------------------------------- ### Kill a Process by PID Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Forcefully terminate a process using its Process ID (PID). Use this command cautiously to stop processes that are causing port conflicts or are unresponsive. ```bash sudo kill -9 ``` -------------------------------- ### Troubleshooting npm ci Failures Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/DEPLOYMENT-RUNBOOK.md Instructions to handle npm ci failures related to package-lock.json errors by using an alternative Dockerfile for the build process. ```bash # Solution: Use alternative Dockerfile cp Dockerfile.alternative Dockerfile # Redeploy in Coolify ``` -------------------------------- ### Pull Database Schema into Prisma Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Pull the latest schema from the database and update the Prisma schema file. This is useful for synchronizing the Prisma schema with the actual database structure. ```bash npx prisma db pull ``` -------------------------------- ### Diagnostic Commands for Application and System Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/DEPLOYMENT-RUNBOOK.md A collection of bash commands for diagnosing application health, system metrics, container status, network connectivity, and SSL certificate validity. ```bash # Application health curl -s https://constructpro.vovelet-tech.com/api/health | jq # System metrics curl -s https://constructpro.vovelet-tech.com/api/monitoring/metrics | jq # Container status docker ps | grep constructpro docker stats # Network connectivity ping constructpro.vovelet-tech.com nslookup constructpro.vovelet-tech.com # SSL certificate openssl s_client -connect constructpro.vovelet-tech.com:443 -servername constructpro.vovelet-tech.com ``` -------------------------------- ### Validate Prisma Schema Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Check the syntax and validity of the Prisma schema file. This command helps catch errors in the database schema definition before generating the Prisma client. ```bash npx prisma validate ``` -------------------------------- ### Troubleshoot ConstructPro Database Connection Failures Source: https://github.com/ozcanbicervv-create/constructpro-/blob/main/TROUBLESHOOTING.md Steps to diagnose and resolve database connection errors, including Prisma client issues. This involves checking the connection string, testing network connectivity, and verifying authentication credentials. ```bash # Test database connection docker exec -it npx prisma db pull ``` ```bash # Check connection string echo $DATABASE_URL ``` ```bash # Test direct connection psql $DATABASE_URL -c "SELECT 1;" ``` ```bash # Verify format: postgresql://user:pass@host:port/db # Check for special characters in password # Ensure database exists ``` ```bash # Test network connectivity telnet db-host 5432 # Check firewall rules # Verify database server is running ``` ```bash # Verify credentials # Check user permissions # Reset password if needed ```