diff --git a/docs/DEPLOYMENT.md b/docs/DEPLOYMENT.md index 4c824fb..c386f4c 100644 --- a/docs/DEPLOYMENT.md +++ b/docs/DEPLOYMENT.md @@ -2,78 +2,91 @@ ## Deployment Options -### 1. Replit (Recommended) -The easiest way to deploy this portfolio website is through Replit: +### 1. General Internet Deployment (Recommended) -1. Fork the template on Replit -2. Set up environment variables in Secrets tab: - ```env - # Required environment variables - DATABASE_URL=postgresql://user:password@host:port/dbname - GITHUB_TOKEN=your_github_token - JWT_SECRET=your_secure_jwt_secret - COOKIE_SECRET=your_secure_cookie_secret - - # Optional variables - GOOGLE_ANALYTICS_ID=your_ga_id # If using Google Analytics - ``` - -3. Install dependencies: - - The system will automatically install required packages - - Database dependencies will be set up automatically - - Node.js modules will be installed - -4. Initialize the database: - - The database will be automatically created on first run - - Initial schema will be applied - - Default admin user will be created (username: admin, password: admin123) - - IMPORTANT: Change default admin credentials after first login - -5. Click "Run" and verify: - - Frontend loads at the provided URL - - Admin dashboard is accessible at `/admin` - - Database connections are working - - GitHub integration is functioning - -6. Post-deployment checklist: - - Login to admin dashboard with default credentials - - Change admin password immediately - - Add your first project - - Configure GitHub integration - - Test contact form - - Verify analytics tracking - -### 2. Traditional Hosting +Deploying this portfolio website on the internet involves setting up a server, configuring dependencies, and ensuring the environment is properly set up. Here's a step-by-step guide: #### Prerequisites +- A web hosting service or VPS with Linux (e.g., DigitalOcean, AWS, Linode) +- A domain name (optional, for custom URL) - Node.js v18+ - PostgreSQL database - GitHub account (for project sync) #### Steps -1. Clone the repository -2. Install dependencies: + +1. **Clone the Repository** + On your server, use Git to clone the repository: + ```bash + git clone https://github.com/Xza85hrf/Modern-portfolio-dashboard.git + cd Modern-portfolio-dashboard + ``` + +2. **Install Dependencies** + Ensure Node.js and npm are installed. Then, install the project's dependencies: ```bash npm install ``` -3. Set up environment variables (copy from .env.template) -4. Initialize database: + +3. **Set Up Environment Variables** + Copy the `.env.template` file to `.env` and fill in the required values: + ```env + DATABASE_URL=postgresql://user:password@host:port/dbname + GITHUB_TOKEN=your_github_token + JWT_SECRET=your_secure_jwt_secret + COOKIE_SECRET=your_secure_cookie_secret + ``` + +4. **Initialize the Database** + Run the database migrations to set up the schema: ```bash npm run db:push ``` -5. Build and start: + +5. **Build and Start the Project** + Build the project and start the server: ```bash npm run build npm start ``` + By default, the application runs on port 5000. You can change this by setting the `PORT` environment variable. + +6. **Configure Reverse Proxy (Optional)** + Use a web server like Nginx or Apache as a reverse proxy to serve your application on port 80 or 443 (for HTTPS). Example for Nginx: + ```nginx + server { + listen 80; + server_name yourdomain.com; + + location / { + proxy_pass http://localhost:5000; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + } + } + ``` -### 3. Railway/Heroku Deployment +7. **Secure Your Deployment** + - Use HTTPS by setting up an SSL certificate (e.g., with Let's Encrypt). + - Change default admin credentials immediately. -1. Connect your GitHub repository -2. Configure environment variables -3. Set build command: `npm run build` -4. Set start command: `npm start` -5. Add PostgreSQL add-on +### 2. Alternative Hosting Platforms (Railway, Heroku) + +#### Steps +1. Connect your GitHub repository to the hosting platform. +2. Configure environment variables. +3. Set build command: + ```bash + npm run build + ``` +4. Set start command: + ```bash + npm start + ``` +5. Add a PostgreSQL add-on (if using these platforms' integrated databases). ## Environment Setup @@ -97,71 +110,59 @@ COOKIE_SECRET=your_cookie_secret ## Post-Deployment Steps -1. Change default admin credentials -2. Verify all features are working: - - Admin login - - Project management - - Blog posts - - Analytics -3. Set up regular backups -4. Configure monitoring (optional) +1. **Verify Functionality** + - Check admin login, project management, blog posts, and analytics. + - Ensure database connections are stable. + +2. **Set Up Monitoring** + Configure monitoring for your server and application using tools like PM2 or New Relic. + +3. **Schedule Backups** + Regularly back up your PostgreSQL database to prevent data loss. ## Updating ### Minor Updates ```bash -npm update +git pull +npm install npm run build ``` ### Major Updates -1. Backup database -2. Review changelog -3. Update dependencies -4. Run database migrations -5. Test thoroughly +1. Backup your database. +2. Review the changelog. +3. Update dependencies. +4. Run database migrations. +5. Test thoroughly before going live. ## Troubleshooting -### Troubleshooting Guide - -1. Database Connection Issues - - Verify DATABASE_URL format is correct - - Check PostgreSQL service is running - - Confirm database credentials in environment variables - - Try running `npm run db:push` to update schema - - Common error: "Connection refused" - check if database is running - - Common error: "Authentication failed" - verify credentials - -2. Build Failures - - Clear build cache in Replit - - Check for TypeScript errors in console - - Verify all dependencies are installed - - Common error: "Module not found" - run `npm install` - - Common error: "Type errors" - check recent code changes - -3. Runtime Errors - - Check browser console for frontend errors - - Review server logs for backend issues - - Verify all environment variables are set - - Check port conflicts (default: 5000) - - Monitor memory usage in Replit - -4. GitHub Integration Issues - - Verify GITHUB_TOKEN is valid - - Check repository permissions - - Confirm repository URL format - - Test sync functionality in admin dashboard - -5. Authentication Problems - - Clear browser cookies and cache - - Verify JWT_SECRET is set - - Check if admin user exists in database - - Try default credentials if needed +### Common Issues + +1. **Database Connection Issues** + - Ensure `DATABASE_URL` is correct. + - Confirm PostgreSQL service is running. + - Verify credentials in the `.env` file. + +2. **Build Failures** + - Check for dependency issues with `npm install`. + - Resolve any TypeScript errors. + +3. **Runtime Errors** + - Review server logs for backend issues. + - Confirm all required environment variables are set. + +4. **GitHub Integration Problems** + - Ensure the `GITHUB_TOKEN` is valid. + - Verify repository permissions. + +5. **Authentication Issues** + - Confirm `JWT_SECRET` is set. + - Verify the admin user exists in the database. ### Getting Help -- Review the complete documentation in `/docs` -- Check troubleshooting guides -- Open GitHub issues for bugs -- Join our community discussions -- Contact support team with error logs +- Review documentation in `/docs`. +- Open GitHub issues for bugs. +- Contact the support team with detailed logs. +