# InInventer Deployment Guide This guide will walk you through deploying InInventer to a Debian 12 server on Linode. ## Prerequisites - A Linode server running Debian 12 - A domain name pointing to your server's IP address - Root access to the server - Basic knowledge of Linux command line ## Step 1: Prepare Your Local Environment 1. Make scripts executable: ```bash chmod +x deploy.sh start-production.sh backup.sh ``` 2. Create a deployment package: ```bash tar -czf ininventer-deploy.tar.gz \ --exclude='node_modules' \ --exclude='.git' \ --exclude='*.log' \ --exclude='.env' \ backend/ frontend/ nginx/ \ docker-compose.yml deploy.sh \ start-production.sh backup.sh ``` ## Step 2: Upload Files to Server 1. Copy the deployment package to your server: ```bash scp ininventer-deploy.tar.gz root@172.104.242.160:/tmp/ ``` 2. Copy the deployment script: ```bash scp deploy.sh root@172.104.242.160:/tmp/ ``` ## Step 3: Connect to Server and Deploy 1. SSH into your server: ```bash ssh root@172.104.242.160 ``` 2. Run the deployment script: ```bash cd /tmp chmod +x deploy.sh ./deploy.sh ``` 3. When prompted, enter: - Your domain name (e.g., inventory.yourdomain.com) - Email address for SSL certificates ## Step 4: Extract Application Files After the deployment script completes: ```bash cd /opt/ininventer tar -xzf /tmp/ininventer-deploy.tar.gz chmod +x start-production.sh backup.sh ``` ## Step 5: Start the Application Run the production start script: ```bash ./start-production.sh ``` This script will: - Obtain SSL certificates from Let's Encrypt - Start all Docker containers - Configure automatic SSL renewal - Set up systemd service for auto-start ## Step 6: Verify Deployment 1. Check if all containers are running: ```bash docker-compose -f docker-compose.production.yml ps ``` 2. Check logs: ```bash docker-compose -f docker-compose.production.yml logs -f ``` 3. Visit your domain in a web browser: - https://your-domain.com ## Step 7: First Login Default credentials: - Email: `admin@ininventer.com` - Password: `admin123` **IMPORTANT: Change the default password immediately after first login!** ## Maintenance ### View Logs ```bash cd /opt/ininventer docker-compose -f docker-compose.production.yml logs -f [service_name] ``` ### Restart Services ```bash systemctl restart ininventer ``` ### Manual Backup ```bash cd /opt/ininventer ./backup.sh ``` ### Update Application ```bash cd /opt/ininventer docker-compose -f docker-compose.production.yml down # Upload new files docker-compose -f docker-compose.production.yml build docker-compose -f docker-compose.production.yml up -d ``` ## Security Recommendations 1. **Change Default Passwords** - Change the superadmin password immediately - Update MongoDB passwords in production 2. **Firewall Configuration** - Only ports 22, 80, and 443 should be open - Consider changing SSH port 3. **Regular Backups** - Set up automated backups using cron: ```bash crontab -e # Add: 0 2 * * * /opt/ininventer/backup.sh ``` 4. **Monitor Resources** - Check disk space regularly - Monitor CPU and memory usage ## Troubleshooting ### SSL Certificate Issues ```bash # Renew certificates manually docker-compose -f docker-compose.production.yml run --rm certbot renew ``` ### Container Won't Start ```bash # Check logs docker-compose -f docker-compose.production.yml logs [service_name] # Rebuild containers docker-compose -f docker-compose.production.yml build --no-cache ``` ### Database Connection Issues ```bash # Check MongoDB is running docker exec -it ininventer-mongodb-prod mongo --eval "db.adminCommand('ping')" ``` ## Support For issues or questions: 1. Check container logs 2. Verify domain DNS settings 3. Ensure firewall rules are correct 4. Check disk space and resources