fengling-activity/scripts/EXAMPLES.md
sam ab8d12527e refactor: major project restructuring and cleanup
Changes:

- Remove deprecated Fengling.Activity and YarpGateway.Admin projects

- Add points processing services with distributed lock support

- Update Vben frontend with gateway management pages

- Add gateway config controller and database listener

- Update routing to use header-mixed-nav layout

- Add comprehensive test suites for Member services

- Add YarpGateway integration tests

- Update package versions in Directory.Packages.props

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-15 10:34:07 +08:00

151 lines
3.0 KiB
Markdown

# Usage Examples
This document provides practical examples for using the infrastructure initialization scripts.
## Quick Start Examples
### Default Setup (MySQL + Redis + RabbitMQ)
```bash
# Using Docker Compose (Recommended)
docker compose up -d
# Using shell script (Linux/macOS)
./init-infrastructure.sh
# Using PowerShell (Windows)
.\init-infrastructure.ps1
```
### Different Database Options
```bash
# Use PostgreSQL instead of MySQL
docker compose --profile postgres up -d
# Use SQL Server instead of MySQL
docker compose --profile sqlserver up -d
# With PowerShell
.\init-infrastructure.ps1 -Postgres
.\init-infrastructure.ps1 -SqlServer
```
### Different Message Queue Options
```bash
# Use Kafka instead of RabbitMQ
docker compose --profile kafka up -d
# With PowerShell
.\init-infrastructure.ps1 -Kafka
```
### Cleanup Examples
```bash
# Stop services, keep data
docker compose down
./clean-infrastructure.sh
.\clean-infrastructure.ps1
# Stop services and remove all data
docker compose down -v
./clean-infrastructure.sh --volumes
.\clean-infrastructure.ps1 -Volumes
```
## Development Workflow
### Typical Development Session
```bash
# 1. Start infrastructure
cd scripts
docker compose up -d
# 2. Develop your application
cd ../src/Fengling.Activity.Web
dotnet run
# 3. Run tests
cd ../../
dotnet test
# 4. Stop infrastructure (keep data)
cd scripts
docker compose down
```
### Clean Development Environment
```bash
# Clean slate - remove everything including data
cd scripts
docker compose down -v
# Start fresh
docker compose up -d
```
## Troubleshooting
### Check Service Status
```bash
# List running containers
docker ps
# Check specific service logs
docker logs netcorepal-mysql
docker logs netcorepal-redis
docker logs netcorepal-rabbitmq
# Check service health
docker compose ps
```
### Common Issues
#### Port Already in Use
```bash
# Find what's using the port
netstat -tulpn | grep :3306 # Linux
netstat -ano | findstr :3306 # Windows
# Stop conflicting services
sudo systemctl stop mysql # Linux
net stop mysql80 # Windows
```
#### Container Won't Start
```bash
# Remove problematic container and restart
docker rm -f netcorepal-mysql
docker compose up -d mysql
```
#### Data Corruption
```bash
# Remove data volumes and start fresh
docker compose down -v
docker compose up -d
```
## Connection Strings for Development
Update your `appsettings.Development.json` with these connection strings:
```json
{
"ConnectionStrings": {
"Redis": "localhost:6379,defaultDatabase=0",
"MySql": "Server=localhost;Port=3306;Database=abctemplate;Uid=root;Pwd=123456;",
"SqlServer": "Server=localhost,1433;Database=abctemplate;User Id=sa;Password=Test123456!;TrustServerCertificate=true;",
"PostgreSQL": "Host=localhost;Port=15432;Database=abctemplate;Username=postgres;Password=123456;"
},
"RabbitMQ": {
"HostName": "localhost",
"Port": 5672,
"UserName": "guest",
"Password": "guest",
"VirtualHost": "/"
},
"Kafka": {
"BootstrapServers": "localhost:9092"
}
}
```