Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions examples-copier/QUICK-REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,25 +410,31 @@ gcloud secrets list
```
examples-copier/
├── README.md # Main documentation
├── MIGRATION-GUIDE.md # Migration from legacy
├── QUICK-REFERENCE.md # This file
├── REFACTORING-SUMMARY.md # Feature details
├── docs/
│ ├── ARCHITECTURE.md # Architecture overview
│ ├── CONFIGURATION-GUIDE.md # Complete config reference
│ ├── DEPLOYMENT.md # Deployment guide
│ └── DEPLOYMENT-CHECKLIST.md # Deployment checklist
├── TESTING-SUMMARY.md # Test documentation
│ ├── DEPLOYMENT-CHECKLIST.md # Deployment checklist
│ ├── FAQ.md # Frequently asked questions
│ ├── LOCAL-TESTING.md # Local testing guide
│ ├── PATTERN-MATCHING-GUIDE.md # Pattern matching guide
│ ├── PATTERN-MATCHING-CHEATSHEET.md # Quick pattern reference
│ ├── TROUBLESHOOTING.md # Troubleshooting guide
│ └── WEBHOOK-TESTING.md # Webhook testing guide
├── configs/
│ ├── .env # Environment config
│ ├── .env.example.new # Environment template
│ └── config.example.yaml # Config template
│ ├── env.yaml.example # Environment template
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I was just looking in the config folder from what got merged recently and it looks like we've also got some other files in here, including a env.yaml.production: https://github.com/mongodb/code-example-tooling/blob/main/examples-copier/configs/env.yaml.production

Wasn't sure if that was intentional, and/or if we should update this README to exhaustively list what was intended to be here or if it's not exhaustive because this is only a "QUICK-REFERENCE.md" - not the proper "README.md"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll update

│ └── copier-config.example.yaml # Config template
└── cmd/
└── config-validator/ # CLI tool
├── config-validator/ # CLI validation tool
└── test-webhook/ # Webhook testing tool
```

## Quick Start Checklist

- [ ] Clone repository
- [ ] Copy `.env.example.new` to `.env`
- [ ] Copy `configs/.env.local.example` to `configs/.env`
- [ ] Set required environment variables
- [ ] Create `copier-config.yaml` in source repo
- [ ] Validate config: `./config-validator validate -config copier-config.yaml`
Expand All @@ -440,6 +446,8 @@ examples-copier/
## Support

- **Documentation**: [README.md](README.md)
- **Migration**: [MIGRATION-GUIDE.md](./docs/MIGRATION-GUIDE.md)
- **Deployment**: [DEPLOYMENT-GUIDE.md](./docs/DEPLOYMENT-GUIDE.md)
- **Configuration**: [Configuration Guide](./docs/CONFIGURATION-GUIDE.md)
- **Deployment**: [Deployment Guide](./docs/DEPLOYMENT.md)
- **Troubleshooting**: [Troubleshooting Guide](./docs/TROUBLESHOOTING.md)
- **FAQ**: [Frequently Asked Questions](./docs/FAQ.md)

37 changes: 27 additions & 10 deletions examples-copier/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,14 @@ go build -o config-validator ./cmd/config-validator

### Configuration

1. **Copy .env example file**
1. **Copy environment example file**

```bash
cp configs/.env.example.new configs/.env
# For local development
cp configs/.env.local.example configs/.env

# Or for YAML-based configuration
cp configs/env.yaml.example env.yaml
```

2. **Set required environment variables**
Expand Down Expand Up @@ -387,22 +391,34 @@ COPIER_DEBUG=true ./examples-copier
examples-copier/
├── app.go # Main application entry point
├── cmd/
│ └── config-validator/ # CLI validation tool
│ ├── config-validator/ # CLI validation tool
│ └── test-webhook/ # Webhook testing tool
├── configs/
│ ├── environment.go # Environment configuration
│ ├── .env.example.new # Environment template
│ └── config.example.yaml # Config template
│ ├── .env.local.example # Local environment template
│ ├── env.yaml.example # YAML environment template
│ └── copier-config.example.yaml # Config template
├── services/
│ ├── pattern_matcher.go # Pattern matching engine
│ ├── config_loader.go # Config loading & validation
│ ├── audit_logger.go # MongoDB audit logging
│ ├── health_metrics.go # Health & metrics endpoints
│ ├── file_state_service.go # Thread-safe state management
│ ├── service_container.go # Dependency injection
│ └── webhook_handler_new.go # New webhook handler
└── types/
├── config.go # Configuration types
└── types.go # Core types
│ ├── webhook_handler_new.go # Webhook handler
│ ├── github_auth.go # GitHub authentication
│ ├── github_read.go # GitHub read operations
│ ├── github_write_to_target.go # GitHub write operations
│ └── slack_notifier.go # Slack notifications
├── types/
│ ├── config.go # Configuration types
│ └── types.go # Core types
└── docs/
├── ARCHITECTURE.md # Architecture overview
├── CONFIGURATION-GUIDE.md # Complete config reference
├── DEPLOYMENT.md # Deployment guide
├── FAQ.md # Frequently asked questions
└── ... # Additional documentation
```

### Service Container
Expand Down Expand Up @@ -452,9 +468,10 @@ docker run -p 8080:8080 --env-file .env examples-copier

- **[Pattern Matching Cheat Sheet](docs/PATTERN-MATCHING-CHEATSHEET.md)** - Quick pattern syntax reference
- **[Architecture](docs/ARCHITECTURE.md)** - System design and components
- **[Migration Guide](docs/MIGRATION-GUIDE.md)** - Migrate from legacy JSON config
- **[Troubleshooting](docs/TROUBLESHOOTING.md)** - Common issues and solutions
- **[FAQ](docs/FAQ.md)** - Frequently asked questions
- **[Debug Logging](docs/DEBUG-LOGGING.md)** - Debug logging configuration
- **[Deprecation Tracking](docs/DEPRECATION-TRACKING-EXPLAINED.md)** - How deprecation tracking works

### Features

Expand Down
36 changes: 36 additions & 0 deletions examples-copier/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,39 @@ env: flex

includes:
- env.yaml

# Automatic scaling configuration
# Keeps at least 1 instance running to avoid cold starts
automatic_scaling:
min_num_instances: 1
max_num_instances: 10
cool_down_period_sec: 120
cpu_utilization:
target_utilization: 0.6

# Network configuration
network:
session_affinity: true

# Health check configuration
# These ensure the app is ready before receiving traffic
liveness_check:
path: "/health"
check_interval_sec: 30
timeout_sec: 4
failure_threshold: 2
success_threshold: 2

readiness_check:
path: "/health"
check_interval_sec: 5
timeout_sec: 4
failure_threshold: 2
success_threshold: 2
app_start_timeout_sec: 300

# Resources configuration
resources:
cpu: 1
memory_gb: 2
disk_size_gb: 10
6 changes: 3 additions & 3 deletions examples-copier/cmd/config-validator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ EOF

## See Also

- [Configuration Setup](../../docs/CONFIG-SETUP.md) - Configuration guide
- [Configuration Guide](../../docs/CONFIGURATION-GUIDE.md) - Complete configuration reference
- [Pattern Matching Guide](../../docs/PATTERN-MATCHING-GUIDE.md) - Pattern matching help
- [Migration Guide](../../docs/MIGRATION-GUIDE.md) - Migrating from JSON
- [Quick Reference](../../docs/QUICK-REFERENCE.md) - All commands
- [FAQ](../../docs/FAQ.md) - Frequently asked questions (includes JSON to YAML conversion)
- [Quick Reference](../../QUICK-REFERENCE.md) - All commands

16 changes: 8 additions & 8 deletions examples-copier/configs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Overview of the different environment configuration files and when to use each.
|-----------------------|---------------------------------------|---------------------------------|
| `env.yaml.example` | Complete reference with all variables | First-time setup, documentation |
| `env.yaml.production` | Production-ready template | Quick deployment to production |
| `.env.example` | Local development template | Local testing and development |
| `.env.local.example` | Local development template | Local testing and development |

---

Expand Down Expand Up @@ -61,9 +61,9 @@ Overview of the different environment configuration files and when to use each.

---

## .env.example.new
## .env.local.example

**Location:** `configs/.env.example.new`
**Location:** `configs/.env.local.example`

**Purpose:** Local development template (traditional .env format)

Expand Down Expand Up @@ -136,11 +136,11 @@ nano env.yaml # Enable features you need

### Scenario 3: Local Development

**Recommended:** `.env.example.new`
**Recommended:** `.env.local.example`

```bash
# Local development
cp configs/.env.example.new configs/.env
cp configs/.env.local.example configs/.env
nano configs/.env # Add your values

# Run locally
Expand Down Expand Up @@ -215,7 +215,7 @@ diff configs/env.yaml.production configs/env.yaml.example

- **Use `env.yaml.production` for quick production deployment**
- **Use `env.yaml.example` as reference documentation**
- **Use `.env.example.new` for local development**
- **Use `.env.local.example` for local development**
- **Add `env.yaml` and `.env` to `.gitignore`**
- **Use Secret Manager for production secrets**
- **Keep comments in your env.yaml for team documentation**
Expand All @@ -237,7 +237,7 @@ examples-copier/
├── configs/
│ ├── env.yaml.example # ← Complete reference (all variables)
│ ├── env.yaml.production # ← Production template (essential only)
│ └── .env.example # ← Local development template
│ └── .env.local.example # ← Local development template
├── env.yaml # ← Your actual config (gitignored)
└── .env # ← Your local config (gitignored)
```
Expand All @@ -253,7 +253,7 @@ examples-copier/
→ Read `env.yaml.example`

**Need to develop locally?**
→ Use `.env.example.new`
→ Use `.env.local.example`

**Need advanced features?**
→ Start with `env.yaml.example`, customize
Expand Down
4 changes: 2 additions & 2 deletions examples-copier/docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ path_transform: "source/code-examples/${lang}/${category}/${file}"
**Files Created:**
- `types/config.go` - New configuration types
- `services/config_loader.go` - Configuration loader with YAML/JSON support
- `configs/config.example.yaml` - Example YAML configuration
- `configs/copier-config.example.yaml` - Example YAML configuration

**Capabilities:**
- Native YAML support with `gopkg.in/yaml.v3`
Expand Down Expand Up @@ -190,7 +190,7 @@ Returns detailed metrics:

```bash
# Validate configuration
config-validator validate -config copier-copier-config.yaml -v
config-validator validate -config copier-config.yaml -v

# Test pattern matching
config-validator test-pattern \
Expand Down
3 changes: 2 additions & 1 deletion examples-copier/docs/CONFIGURATION-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -883,9 +883,10 @@ Error: copy_rules[0]: name is required

- [Pattern Matching Guide](PATTERN-MATCHING-GUIDE.md) - Detailed pattern matching documentation
- [Pattern Matching Cheat Sheet](PATTERN-MATCHING-CHEATSHEET.md) - Quick reference
- [Migration Guide](MIGRATION-GUIDE.md) - Migrating from legacy JSON config
- [FAQ](FAQ.md) - Frequently asked questions (includes JSON to YAML conversion)
- [Quick Reference](../QUICK-REFERENCE.md) - Command reference
- [Deployment Guide](DEPLOYMENT.md) - Deploying the application
- [Architecture](ARCHITECTURE.md) - System architecture overview

---

Expand Down
2 changes: 1 addition & 1 deletion examples-copier/docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Use the config-validator tool:
./config-validator convert -input config.json -output copier-config.yaml
```

See [Migration Guide](MIGRATION-GUIDE.md) for details.
The tool will automatically convert your legacy JSON configuration to the new YAML format while preserving all settings.

## Pattern Matching

Expand Down
2 changes: 1 addition & 1 deletion examples-copier/docs/LOCAL-TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ make run-local-quick

```bash
# Copy the local template
cp configs/.env.local configs/.env
cp configs/.env.local.example configs/.env

# Edit with your values (optional)
nano configs/.env
Expand Down
Loading