Skip to content

arjun-keyvalue/neptune-22h-backend

Repository files navigation

n8n Workflow Project

This project contains n8n workflow automation setup for the neptune22h project with MongoDB support via Docker Compose.

Prerequisites

Option 1: Docker Development (Recommended)

  • Docker
  • Docker Compose

Option 2: Local Development

  • Node.js (version 16 or later)
  • npm (comes with Node.js)

Quick Start with Docker

  1. Start the services:

    npm run docker:up

    This starts both n8n and MongoDB in Docker containers.

  2. Access n8n:

  3. Access MongoDB (optional):

    • Host: localhost
    • Port: 27017
    • Username: admin
    • Password: password123

Installation & Setup

Docker Setup (Recommended)

  1. Build and start services:

    npm run docker:build
    npm run docker:up
  2. View logs:

    npm run docker:logs
  3. Stop services:

    npm run docker:down

Local Development

  1. Install dependencies:

    npm install
  2. Start n8n locally:

    npm start

Docker Commands

  • Start services: npm run docker:up
  • Stop services: npm run docker:down
  • View logs: npm run docker:logs
  • Restart services: npm run docker:restart
  • Build images: npm run docker:build

Accessing n8n

Once started, n8n will be available at:

Security Note: Change the default credentials in the docker-compose.yml file before deploying to production.

Configuration

Docker Setup

The Docker setup includes:

  • Database: MongoDB 7.0 with persistent storage
  • Authentication: Basic auth enabled
  • Execution: Regular mode with 1-hour timeout
  • Logging: Console logging
  • Networking: Isolated Docker network

Local Development

The local setup includes:

  • Database: SQLite (stored in ./n8n.db)
  • Authentication: Basic auth enabled
  • Execution: Regular mode with 1-hour timeout
  • Logging: Console and file logging (stored in ./logs/)

Project Structure

neptune22h/
├── .dockerignore         # Docker ignore rules
├── .gitignore           # Git ignore rules
├── .n8nrc              # n8n configuration file
├── docker-compose.yml   # Docker Compose configuration
├── Dockerfile          # n8n Docker image
├── logs/               # Log files directory
├── mongo-init/         # MongoDB initialization scripts
│   └── init-n8n-db.js  # Database setup script
├── node_modules/       # Dependencies (local only)
├── package.json        # Node.js project configuration
└── README.md          # This file

Creating Your First Workflow

  1. Start n8n:

    • Docker: npm run docker:up
    • Local: npm start
  2. Open the interface: http://localhost:5678

  3. Login with the credentials above

  4. Create workflow:

    • Click "Add workflow"
    • Add a trigger node (e.g., "Manual Trigger")
    • Add action nodes for your automation tasks
    • Connect nodes to define the workflow flow
    • Test using "Execute Workflow" button

MongoDB Integration

The Docker setup includes a fully configured MongoDB instance:

  • Database: n8n
  • User: n8n (with read/write permissions)
  • Admin User: admin (root access)
  • Persistent Storage: Data survives container restarts
  • Initialization: Automatic database and user creation

Useful n8n Resources

Troubleshooting

Docker Issues

Port conflicts:

# Check what's using port 5678
lsof -i :5678

# Stop conflicting services or change ports in docker-compose.yml

Container won't start:

# Check logs
npm run docker:logs

# Rebuild containers
npm run docker:build
npm run docker:up

MongoDB connection issues:

# Check MongoDB logs
docker-compose logs mongodb

# Restart MongoDB
docker-compose restart mongodb

Local Development Issues

Port already in use:

N8N_PORT=5679 npm start

Database issues:

# Reset SQLite database
rm n8n.db
npm start

Security Considerations

  • Change default credentials before production use
  • Use environment variables for sensitive configuration
  • Enable HTTPS in production environments
  • Consider using MongoDB authentication in production
  • Regularly update Docker images for security patches

Production Deployment

For production deployment:

  1. Update credentials in docker-compose.yml
  2. Set up proper networking and reverse proxy
  3. Enable HTTPS with SSL certificates
  4. Configure MongoDB authentication properly
  5. Set up monitoring and logging
  6. Use Docker secrets for sensitive data

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published