This directory contains all scripts for the Portfolio Website project, organized by functionality.
scripts/
├── backend/ # Backend-specific management scripts
├── database/ # Database management and migrations
├── deployment/ # Production deployment scripts
├── development/ # Development environment scripts
├── monitoring/ # Monitoring and metrics scripts
├── ssl/ # SSL certificate management
├── testing/ # Testing and validation scripts
└── utilities/ # General utility scripts
Main scripts are symlinked in the project root for convenience:
./start-dev.sh→ Development environment startup./start-prod.sh→ Production environment startup./stop-dev.sh→ Stop development services./stop-prod.sh→ Stop production services
- start-dev.sh - Start development environment with hot reload
- start-prod.sh - Start production-optimized environment locally
- stop-dev.sh - Stop development tmux sessions
- stop-prod.sh - Stop production tmux sessions
- lint.sh - Run linting checks on codebase
- optimize-images.sh - Optimize image assets
- seed.sh - Seed database with initial data
- backup_db.sh - Backup PostgreSQL database
- restore_db.sh - Restore database from backup
- check-db-status.sh - Check database connectivity
- update-database.sh - Apply database migrations
- deploy-local.sh - Deploy to local environment
- start-backend.sh - Start backend services only
- start-services.sh - Start all services in production
- INSTALL.sh - Initial server setup and installation
- check_system.sh - Verify system requirements
- install-systemd-service.sh - Install systemd services
- run.sh - Run backend services
- status.sh - Check backend service status
- stop.sh - Stop backend services
- autostart.sh - Configure auto-start on boot
- update_code_stats.sh - Update code statistics
- setup_code_stats_cron.sh - Setup cron job for stats
- setup-ssl-automation.sh - Configure SSL auto-renewal
- ssl-auto-renew.sh - Renew SSL certificates
- ssl-monitor.sh - Monitor SSL certificate status
- fix-ssl-now.sh - Quick SSL fix script
- test_db_connection.sh - Test database connectivity
- backend-lint.sh - Lint backend Go code
- backend-setup.sh - Setup backend dependencies
- initial-setup.sh - Initial project setup
- setup-admin.sh - Configure admin user
- setup-redis-security.sh - Configure Redis security
# Start development environment (automatic session cleanup included)
./start-dev.sh
# Start with fresh build and cache clear
./start-dev.sh --fresh
# Stop development environment
./stop-dev.sh# Start production environment locally
./start-prod.sh
# Deploy to production server
cd scripts/deployment
./INSTALL.sh # First-time setup
./start-services.sh # Start all services# Seed database
./scripts/database/seed.sh
# Backup database
./scripts/database/backup_db.sh
# Check database status
./scripts/database/check-db-status.sh# Update code statistics
./scripts/monitoring/update_code_stats.sh
# Setup automatic code stats updates
./scripts/monitoring/setup_code_stats_cron.sh- Naming: Use kebab-case for script names
- Extension: All scripts should have
.shextension - Shebang: Start with
#!/bin/bash - Error Handling: Use
set -efor error handling - Documentation: Include usage comments at the top
- Permissions: Ensure scripts are executable (
chmod +x)
Scripts may require these environment variables:
NODE_ENV- Node environment (development/production)ENVIRONMENT- Go environment (development/production)DB_HOST,DB_PORT,DB_NAME,DB_USER,DB_PASSWORD- Database configAPI_PORT,DEVPANEL_PORT,MESSAGING_PORT, etc. - Service ports
# Make script executable
chmod +x scripts/path/to/script.sh# The start scripts now automatically detect and clean up existing tmux sessions
./start-dev.sh# Test database connection
./scripts/testing/test_db_connection.sh- Place script in appropriate category directory
- Make it executable:
chmod +x script.sh - Update this README with description
- Create symlink in root if it's a primary script
- Test thoroughly before committing
Regular maintenance tasks:
- Review and remove unused scripts
- Update script documentation
- Ensure all scripts follow conventions
- Test scripts after major changes