ininventer/DEPLOYMENT.md

3.7 KiB

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:
chmod +x deploy.sh start-production.sh backup.sh
  1. Create a deployment package:
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:
scp ininventer-deploy.tar.gz root@172.104.242.160:/tmp/
  1. Copy the deployment script:
scp deploy.sh root@172.104.242.160:/tmp/

Step 3: Connect to Server and Deploy

  1. SSH into your server:
ssh root@172.104.242.160
  1. Run the deployment script:
cd /tmp
chmod +x deploy.sh
./deploy.sh
  1. 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:

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:

./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:
docker-compose -f docker-compose.production.yml ps
  1. Check logs:
docker-compose -f docker-compose.production.yml logs -f
  1. Visit your domain in a web browser:

Step 7: First Login

Default credentials:

  • Email: admin@ininventer.com
  • Password: admin123

IMPORTANT: Change the default password immediately after first login!

Maintenance

View Logs

cd /opt/ininventer
docker-compose -f docker-compose.production.yml logs -f [service_name]

Restart Services

systemctl restart ininventer

Manual Backup

cd /opt/ininventer
./backup.sh

Update Application

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:
    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

# Renew certificates manually
docker-compose -f docker-compose.production.yml run --rm certbot renew

Container Won't Start

# 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

# 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