An open API service indexing awesome lists of open source software.

https://github.com/spydisec/spydi-n8n-automation

Various n8n automation
https://github.com/spydisec/spydi-n8n-automation

Last synced: about 2 months ago
JSON representation

Various n8n automation

Awesome Lists containing this project

README

          

# n8n Automation Workflows

> Production-ready n8n workflow automations for infrastructure management, monitoring, and operations

[![Validate Workflows](https://github.com/spydisec/spydi-n8n-automation/actions/workflows/validate-workflows.yml/badge.svg?branch=main)](https://github.com/spydisec/spydi-n8n-automation/actions/workflows/validate-workflows.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![n8n](https://img.shields.io/badge/n8n-2.0.3+-blueviolet)](https://n8n.io)

## 🎯 Overview

This repository contains automated workflows for n8n, covering:

- πŸ—οΈ **Infrastructure** - Server and container management (Portainer, Docker, system updates)
- πŸ“Š **Monitoring** - System health checks, alerts, and observability
- πŸ’Ύ **Backup** - Automated backup routines and verification
- πŸ“’ **Notifications** - Centralized alerting and reporting

All workflows are:
- βœ… Production-tested
- βœ… Fully documented with setup guides
- βœ… Versioned with semantic versioning
- βœ… Secure (no credentials in repository)
- βœ… CI/CD validated on every commit

## ⚠️ Security Notice

**This is a PUBLIC repository.**

- ❌ NO credentials or sensitive data are stored here
- βœ… All credentials must be configured via n8n GUI
- βœ… Example files use placeholder values only
- βœ… `.gitignore` prevents accidental credential commits
- βœ… GitHub Actions scans for sensitive data

See [Security Guidelines](#-security-guidelines) below.

## πŸš€ Quick Start

### Prerequisites

- n8n installed (>= 1.15.0) - [Installation Guide](https://docs.n8n.io/hosting/)
- Access to target systems (servers, APIs, etc.)
- Required credentials configured in n8n

### Installation

1. **Clone this repository:**
```bash
git clone https://github.com/spydi/spydi-n8n-automation.git
cd spydi-n8n-automation
```

2. **Configure server inventory:**
```bash
cp examples/configs/servers.example.json servers.json
nano servers.json # Update with your actual server details
```

3. **Set up credentials in n8n:**
- See [examples/credentials/](examples/credentials/) for templates
- Configure SSH, SMTP, Slack, etc. in n8n GUI
- Never store actual credentials in files!

4. **Import workflows:**
- Open n8n β†’ Workflows β†’ Import from File
- Select workflow JSON from `workflows/` directory
- Map credentials to your n8n credentials
- Test in development first!

See [docs/getting-started/](docs/getting-started/) for detailed setup instructions.

## πŸ“– Workflows

### Infrastructure Automation

| Workflow | Version | Description | Status |
|----------|---------|-------------|--------|
| [Portainer Upgrade](workflows/infrastructure/portainer-upgrade/) | 1.0.0 | Automated Portainer container upgrades with validation | βœ… Stable |

### Monitoring & Alerts

| Workflow | Version | Description | Status |
|----------|---------|-------------|--------|
| *Coming soon* | - | Server health monitoring | 🚧 Planned |

### Backup Automation

| Workflow | Version | Description | Status |
|----------|---------|-------------|--------|
| *Coming soon* | - | Database backup automation | 🚧 Planned |

### Notifications

| Workflow | Version | Description | Status |
|----------|---------|-------------|--------|
| *Coming soon* | - | Centralized notification router | 🚧 Planned |

[View full workflow catalog β†’](workflows/README.md)

## πŸ“ Repository Structure

```
spydi-n8n-automation/
β”œβ”€β”€ workflows/ # n8n workflow files organized by category
β”‚ β”œβ”€β”€ infrastructure/ # Infrastructure management workflows
β”‚ β”œβ”€β”€ monitoring/ # Monitoring and alerting
β”‚ β”œβ”€β”€ backup/ # Backup automation
β”‚ └── notifications/ # Notification workflows
β”œβ”€β”€ docs/ # Comprehensive documentation
β”‚ β”œβ”€β”€ getting-started/ # Setup and installation guides
β”‚ β”œβ”€β”€ guides/ # How-to guides and best practices
β”‚ β”œβ”€β”€ reference/ # Technical reference docs
β”‚ └── contributing/ # Contribution guidelines
β”œβ”€β”€ examples/ # Example configurations (NO sensitive data)
β”‚ β”œβ”€β”€ configs/ # Server inventory examples
β”‚ └── credentials/ # Credential setup templates
β”œβ”€β”€ templates/ # Workflow templates for new automations
β”œβ”€β”€ scripts/ # Validation and helper scripts
└── .github/workflows/ # CI/CD automation
```

## πŸ” Security Guidelines

### Never Commit:

❌ Credentials or API keys
❌ Server IPs/hostnames (use `servers.example.json` for templates)
❌ Environment-specific data
❌ Database connection strings
❌ SSH keys or certificates
❌ Real webhook URLs
❌ Email passwords

### Always:

βœ… Use `.example` suffix for template files
βœ… Configure credentials via n8n GUI
βœ… Use n8n variables (`$vars`) for environment-specific data
βœ… Review files before committing
βœ… Let CI/CD catch sensitive data before merge

### Credential Management

All sensitive credentials must be stored in **n8n's credential manager**:

1. n8n β†’ Credentials β†’ New Credential
2. Select type (SSH, SMTP, API, etc.)
3. Enter credentials
4. Reference by name in workflows

**Never hardcode credentials in workflow JSON files.**

See [examples/credentials/](examples/credentials/) for setup guides.

## πŸ› οΈ Development

### Development Workflow

This project uses a **branch-based development workflow** to ensure stability:

- **`main`** - Production-ready workflows (stable releases only)
- **`develop`** - Pre-release testing (beta features, integration testing)
- **`feature/*`** - Development branches for new workflows/features

**Testing Stages:**
1. **Local Testing** - Test on development servers first
2. **Staging Testing** - Integration testing in staging environment (24-48 hours)
3. **Production Release** - Phased rollout with monitoring

**Quick Start:**
```bash
# Create feature branch
git checkout -b feature/my-new-workflow

# Develop and test locally
# ... make changes ...

# Create PR to develop branch
git push origin feature/my-new-workflow
# Open PR: feature/my-new-workflow β†’ develop
```

**πŸ“– Complete Guides:**
- **[Development Workflow](DEVELOPMENT.md)** - Complete branching strategy, 16-step development lifecycle
- **[Testing Workflows](docs/guides/testing-workflows.md)** - 3-stage testing process with validation checklists
- **[Workflow Versioning](docs/guides/workflow-versioning.md)** - Semantic versioning and CHANGELOG management
- **[Using Workflows Safely](docs/guides/using-workflows-safely.md)** - End-user safety guidelines

### Adding a New Workflow

1. **Create workflow directory:**
```bash
git checkout develop
git checkout -b feature/new-workflow
mkdir -p workflows/[category]/[workflow-name]
cd workflows/[category]/[workflow-name]
```

2. **Use templates:**
```bash
cp ../../../templates/_workflow-template/*.template.md .
# Rename .template.md to .md and customize
```

3. **Required files:**
- `workflow-name.json` - n8n workflow export with metadata
- `README.md` - Usage documentation
- `prerequisites.md` - Setup requirements
- `troubleshooting.md` - Common issues
- `CHANGELOG.md` - Version history

4. **Add metadata to JSON:**
```json
{
"meta": {
"templateVersion": "1.0.0",
"author": "your-name",
"category": "infrastructure",
"description": "Brief description",
...
}
}
```

5. **Test locally (Stage 1):**
```bash
# Validate workflow
python scripts/check-version.py
bash scripts/check-sensitive-data.sh
# Test on development servers
```

6. **Submit PR to develop:**
```bash
git add workflows/[category]/[workflow-name]
git commit -m "feat: add [workflow-name] automation"
git push origin feature/new-workflow
```

7. **Staging testing (Stage 2):**
- PR merged to `develop`
- Test in staging environment for 24-48 hours
- Monitor execution logs

8. **Production release (Stage 3):**
- PR from `develop` β†’ `main`
- Tag release (e.g., `v1.1.0`)
- Phased rollout with monitoring

See **[CONTRIBUTING.md](CONTRIBUTING.md)** for complete contribution guidelines.

### Running Validation Locally

```bash
# Validate all workflows
./scripts/check-version.py # Check version metadata
./scripts/validate-changelogs.sh # Validate CHANGELOG format
./scripts/check-sensitive-data.sh # Scan for credentials
./scripts/check-workflow-consistency.py # Check file structure
```

## πŸ“š Documentation

### For End Users

- **[Getting Started](docs/getting-started/)** - Installation and setup guides
- **[Using Workflows Safely](docs/guides/using-workflows-safely.md)** - Safety guidelines for workflow usage
- **[Workflow Catalog](workflows/README.md)** - Complete workflow listing

### For Contributors & Developers

- **[Contributing Guide](CONTRIBUTING.md)** - How to contribute workflows
- **[Development Workflow](DEVELOPMENT.md)** - Branching strategy and development lifecycle
- **[Testing Workflows](docs/guides/testing-workflows.md)** - 3-stage testing process
- **[Workflow Versioning](docs/guides/workflow-versioning.md)** - Semantic versioning and CHANGELOG management
- **[Repository Structure](docs/reference/repository-structure.md)** - Complete repo organization guide

### Technical Reference

- **[Reference Documentation](docs/reference/)** - Technical reference and API docs
- **[Validation Scripts](scripts/)** - Script documentation

## πŸ§ͺ Testing

**Never test untested workflows on production servers!**

This project uses a **3-stage testing process**:

### Stage 1: Local Testing (Development)

- Test workflows on development/test servers only
- Validate JSON syntax and metadata
- Check for sensitive data exposure
- Verify expected outcomes

```bash
# Validation
python scripts/check-version.py
bash scripts/check-sensitive-data.sh

# Test execution on dev servers
```

### Stage 2: Staging Testing (Pre-Production)

- Deploy to staging environment
- Run workflows for 24-48 hours
- Monitor execution logs
- Verify integration with other systems
- Performance and error rate monitoring

### Stage 3: Production Deployment

- Phased rollout (1-5 servers β†’ 25% β†’ 50% β†’ 100%)
- Continuous monitoring
- Rollback plan ready
- Post-deployment verification

**πŸ“– Complete Testing Guide:** [docs/guides/testing-workflows.md](docs/guides/testing-workflows.md)

See individual workflow documentation for specific testing instructions.

## 🀝 Contributing

We welcome contributions! This project follows a structured development workflow to ensure quality and stability.

### Quick Start

1. Fork this repository
2. Create feature branch from `develop`: `git checkout -b feature/new-automation`
3. Add your workflow following [templates](templates/_workflow-template/)
4. Test locally (Stage 1 testing required)
5. Ensure all validations pass
6. Update documentation
7. Submit pull request to `develop` branch

### Branching Strategy

- **`main`** β†’ Production releases only (stable workflows)
- **`develop`** β†’ Integration and staging testing
- **`feature/*`** β†’ New workflow development
- **`bugfix/*`** β†’ Bug fixes
- **`hotfix/*`** β†’ Critical production fixes

### Required Before PR

βœ… Local testing complete (Stage 1)
βœ… All validation scripts pass
βœ… Documentation updated (README, prerequisites, troubleshooting, CHANGELOG)
βœ… No sensitive data in commits
βœ… Semantic versioning followed
βœ… CHANGELOG updated

**πŸ“– Complete Guides:**
- **[CONTRIBUTING.md](CONTRIBUTING.md)** - Full contribution guidelines
- **[DEVELOPMENT.md](DEVELOPMENT.md)** - Development workflow and lifecycle
- **[Testing Guide](docs/guides/testing-workflows.md)** - Testing process and checklists

## πŸ“œ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## πŸ†˜ Support

- **Documentation:** [docs/](docs/)
- **Issues:** [GitHub Issues](https://github.com/spydi/spydi-n8n-automation/issues)
- **Discussions:** [GitHub Discussions](https://github.com/spydi/spydi-n8n-automation/discussions)
- **n8n Community:** [community.n8n.io](https://community.n8n.io)

## πŸ—ΊοΈ Roadmap

### v1.0 (Current)
- βœ… Repository structure and documentation
- βœ… Portainer upgrade automation
- βœ… CI/CD validation pipeline
- βœ… Security scanning

### v1.1 (Next)
- πŸ”„ Docker cleanup automation
- πŸ”„ Server health monitoring
- πŸ”„ Slack notification integration
- πŸ”„ Batch server processing

### v2.0 (Future)
- πŸ“‹ Database backup automation
- πŸ“‹ SSL certificate renewal
- πŸ“‹ Log aggregation workflows
- πŸ“‹ Incident response automation

## πŸ“Š Project Stats

- **Workflows:** 1 (more coming soon!)
- **Categories:** 4
- **Documentation Pages:** 15+
- **Automated Validations:** 5

## πŸ’‘ Related Projects

- [n8n](https://github.com/n8n-io/n8n) - Workflow automation tool
- [n8n-nodes-base](https://github.com/n8n-io/n8n/tree/master/packages/nodes-base) - n8n core nodes
- [Awesome n8n](https://github.com/n8n-io/awesome-n8n) - Curated list of n8n resources

## πŸ™ Acknowledgments

- n8n team for the amazing workflow automation platform
- Community contributors
- Open source projects that inspired this repository

---

**Maintained by:** [spydi](https://github.com/spydisec)
**Last Updated:** 2025-12-21
**Repository Version:** 1.0.0

⭐ **Star this repo if you find it useful!**