Skip to main content

Installation Guide

System Requirements

Hardware Requirements

  • CPU: 4+ cores
  • RAM: 8GB minimum, 16GB recommended
  • Storage: 50GB minimum

Software Requirements

  • Node.js v18 or higher
  • MongoDB v6 or higher
  • Docker (optional)
  • Nginx (for production)

Installation Methods

  1. Pull Docker Images
docker pull eyenet/backend:latest
docker pull eyenet/frontend:latest
docker pull mongo:latest
  1. Create Docker Network
docker network create eyenet-network
  1. Start MongoDB
docker run -d \
--name mongodb \
--network eyenet-network \
-v mongodb_data:/data/db \
-e MONGO_INITDB_ROOT_USERNAME=admin \
-e MONGO_INITDB_ROOT_PASSWORD=secret \
mongo:latest
  1. Start Backend
docker run -d \
--name eyenet-backend \
--network eyenet-network \
-p 3000:3000 \
-e MONGODB_URI=mongodb://admin:secret@mongodb:27017/eyenet \
-e JWT_SECRET=your_jwt_secret \
eyenet/backend:latest
  1. Start Frontend
docker run -d \
--name eyenet-frontend \
--network eyenet-network \
-p 3001:3000 \
-e NEXT_PUBLIC_API_URL=http://localhost:3000/api \
eyenet/frontend:latest

2. Manual Installation

  1. Install MongoDB
# Ubuntu
sudo apt-get update
sudo apt-get install -y mongodb

# Start MongoDB
sudo systemctl start mongodb
sudo systemctl enable mongodb
  1. Clone Repository
git clone https://github.com/TadashiJei/EyeNetProject.git
cd EyeNetProject
  1. Install Backend
cd eyenet/backend
npm install
npm run build

# Create systemd service
sudo nano /etc/systemd/system/eyenet-backend.service
[Unit]
Description=EyeNet Backend Service
After=network.target

[Service]
Type=simple
User=eyenet
WorkingDirectory=/path/to/eyenet/backend
ExecStart=/usr/bin/npm start
Restart=always
Environment=NODE_ENV=production
Environment=PORT=3000
Environment=MONGODB_URI=mongodb://localhost:27017/eyenet
Environment=JWT_SECRET=your_jwt_secret

[Install]
WantedBy=multi-user.target
  1. Install Frontend
cd ../frontend
npm install
npm run build

# Create systemd service
sudo nano /etc/systemd/system/eyenet-frontend.service
[Unit]
Description=EyeNet Frontend Service
After=network.target

[Service]
Type=simple
User=eyenet
WorkingDirectory=/path/to/eyenet/frontend
ExecStart=/usr/bin/npm start
Restart=always
Environment=NODE_ENV=production
Environment=NEXT_PUBLIC_API_URL=http://localhost:3000/api

[Install]
WantedBy=multi-user.target
  1. Start Services
sudo systemctl start eyenet-backend
sudo systemctl enable eyenet-backend
sudo systemctl start eyenet-frontend
sudo systemctl enable eyenet-frontend

Production Setup

1. Nginx Configuration

# /etc/nginx/sites-available/eyenet
server {
listen 80;
server_name eyenet.example.com;

location / {
proxy_pass http://localhost:3001;
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;
}

location /api {
proxy_pass http://localhost:3000;
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;
}
}

2. SSL Configuration

# Install Certbot
sudo apt-get install certbot python3-certbot-nginx

# Get SSL certificate
sudo certbot --nginx -d eyenet.example.com

3. MongoDB Security

  1. Enable Authentication
# Create admin user
mongo
use admin
db.createUser({
user: "admin",
pwd: "secure_password",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
})
  1. Update MongoDB Configuration
# /etc/mongodb.conf
security:
authorization: enabled

4. Firewall Configuration

# Allow necessary ports
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 27017/tcp

Post-Installation

1. Verify Installation

# Check services
sudo systemctl status eyenet-backend
sudo systemctl status eyenet-frontend
sudo systemctl status mongodb
sudo systemctl status nginx

# Check logs
sudo journalctl -u eyenet-backend
sudo journalctl -u eyenet-frontend

2. Initial Setup

  1. Create admin user
  2. Configure network devices
  3. Set up monitoring
  4. Configure backup system

3. Backup Configuration

  1. Set up MongoDB backups
  2. Configure log rotation
  3. Set up system backups
  4. Test restore procedures