Initial commit: Open sourcing all of the Maple Open Technologies code.
This commit is contained in:
commit
755d54a99d
2010 changed files with 448675 additions and 0 deletions
168
cloud/infrastructure/development/Taskfile.yml
Normal file
168
cloud/infrastructure/development/Taskfile.yml
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
version: '3'
|
||||
|
||||
# Variables for Docker Compose command detection
|
||||
vars:
|
||||
DOCKER_COMPOSE_CMD:
|
||||
sh: |
|
||||
if command -v docker-compose >/dev/null 2>&1; then
|
||||
echo "docker-compose"
|
||||
elif docker compose version >/dev/null 2>&1; then
|
||||
echo "docker compose"
|
||||
else
|
||||
echo "docker-compose"
|
||||
fi
|
||||
|
||||
tasks:
|
||||
dev:start:
|
||||
desc: Start all infrastructure services for development
|
||||
cmds:
|
||||
- "{{.DOCKER_COMPOSE_CMD}} -f docker-compose.dev.yml up -d"
|
||||
- echo "⏳ Waiting for services to be healthy..."
|
||||
- task: dev:wait
|
||||
- task: dev:init
|
||||
- echo ""
|
||||
- echo "✅ Infrastructure ready!"
|
||||
- echo ""
|
||||
- echo "📊 Running Services:"
|
||||
- docker ps --filter "name=maple-"
|
||||
|
||||
dev:wait:
|
||||
desc: Wait for all services to be healthy
|
||||
silent: true
|
||||
cmds:
|
||||
- |
|
||||
echo "Waiting for Cassandra Node 1..."
|
||||
for i in {1..30}; do
|
||||
if docker exec maple-cassandra-1-dev cqlsh -e "describe cluster" >/dev/null 2>&1; then
|
||||
echo "✅ Cassandra Node 1 is ready"
|
||||
break
|
||||
fi
|
||||
echo " ... ($i/30)"
|
||||
sleep 2
|
||||
done
|
||||
- |
|
||||
echo "Waiting for Cassandra Node 2..."
|
||||
for i in {1..30}; do
|
||||
if docker exec maple-cassandra-2-dev cqlsh -e "describe cluster" >/dev/null 2>&1; then
|
||||
echo "✅ Cassandra Node 2 is ready"
|
||||
break
|
||||
fi
|
||||
echo " ... ($i/30)"
|
||||
sleep 2
|
||||
done
|
||||
- |
|
||||
echo "Waiting for Cassandra Node 3..."
|
||||
for i in {1..30}; do
|
||||
if docker exec maple-cassandra-3-dev cqlsh -e "describe cluster" >/dev/null 2>&1; then
|
||||
echo "✅ Cassandra Node 3 is ready"
|
||||
break
|
||||
fi
|
||||
echo " ... ($i/30)"
|
||||
sleep 2
|
||||
done
|
||||
- |
|
||||
echo "Waiting for Redis..."
|
||||
for i in {1..10}; do
|
||||
if docker exec maple-redis-dev redis-cli ping >/dev/null 2>&1; then
|
||||
echo "✅ Redis is ready"
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
- |
|
||||
echo "Waiting for SeaweedFS..."
|
||||
for i in {1..10}; do
|
||||
if docker exec maple-seaweedfs-dev /usr/bin/wget -q --spider http://127.0.0.1:9333/cluster/status 2>/dev/null; then
|
||||
echo "✅ SeaweedFS is ready"
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
dev:init:
|
||||
desc: Initialize keyspaces and databases
|
||||
cmds:
|
||||
- |
|
||||
echo "📦 Initializing Cassandra keyspaces..."
|
||||
docker exec -i maple-cassandra-1-dev cqlsh < cassandra/init-scripts/01-create-keyspaces.cql
|
||||
echo "✅ Keyspaces initialized with replication_factor=3"
|
||||
|
||||
dev:status:
|
||||
desc: Show status of all infrastructure services
|
||||
cmds:
|
||||
- |
|
||||
echo "📊 Infrastructure Status:"
|
||||
docker ps --filter "name=maple-" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
|
||||
|
||||
dev:stop:
|
||||
desc: Stop all infrastructure services (keeps data)
|
||||
cmds:
|
||||
- "{{.DOCKER_COMPOSE_CMD}} -f docker-compose.dev.yml down"
|
||||
- echo "✅ Infrastructure stopped (data preserved)"
|
||||
|
||||
dev:restart:
|
||||
desc: Restart all infrastructure services
|
||||
cmds:
|
||||
- task: dev:stop
|
||||
- task: dev:start
|
||||
|
||||
dev:logs:
|
||||
desc: View infrastructure logs (usage task dev:logs -- cassandra)
|
||||
cmds:
|
||||
- "{{.DOCKER_COMPOSE_CMD}} -f docker-compose.dev.yml logs -f {{.CLI_ARGS}}"
|
||||
|
||||
dev:clean:
|
||||
desc: Stop services and remove all data (DESTRUCTIVE!)
|
||||
prompt: This will DELETE ALL DATA in Cassandra, Redis, Meilisearch, and SeaweedFS. Continue?
|
||||
cmds:
|
||||
- "{{.DOCKER_COMPOSE_CMD}} -f docker-compose.dev.yml down -v"
|
||||
- echo "✅ Infrastructure cleaned (all data removed)"
|
||||
|
||||
dev:clean:keyspace:
|
||||
desc: Drop and recreate a specific Cassandra keyspace (usage task dev:clean:keyspace -- maplefile)
|
||||
prompt: This will DELETE ALL DATA in the {{.CLI_ARGS}} keyspace. Continue?
|
||||
cmds:
|
||||
- |
|
||||
KEYSPACE={{.CLI_ARGS}}
|
||||
if [ -z "$KEYSPACE" ]; then
|
||||
echo "❌ Error: Please specify a keyspace name"
|
||||
echo "Usage: task dev:clean:keyspace -- maplefile"
|
||||
exit 1
|
||||
fi
|
||||
echo "🗑️ Dropping keyspace: $KEYSPACE"
|
||||
docker exec maple-cassandra-1-dev cqlsh -e "DROP KEYSPACE IF EXISTS $KEYSPACE;"
|
||||
echo "📦 Recreating keyspace: $KEYSPACE"
|
||||
docker exec maple-cassandra-1-dev cqlsh -e "CREATE KEYSPACE IF NOT EXISTS $KEYSPACE WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 3} AND DURABLE_WRITES = true;"
|
||||
echo "✅ Keyspace $KEYSPACE cleaned and recreated"
|
||||
|
||||
# Cassandra-specific tasks
|
||||
cql:
|
||||
desc: Open Cassandra CQL shell (connects to node 1)
|
||||
cmds:
|
||||
- docker exec -it maple-cassandra-1-dev cqlsh
|
||||
|
||||
cql:keyspaces:
|
||||
desc: List all keyspaces
|
||||
cmds:
|
||||
- docker exec maple-cassandra-1-dev cqlsh -e "DESCRIBE KEYSPACES;"
|
||||
|
||||
cql:tables:
|
||||
desc: List tables in a keyspace (usage task cql:tables -- maplepress)
|
||||
cmds:
|
||||
- docker exec maple-cassandra-1-dev cqlsh -e "USE {{.CLI_ARGS}}; DESCRIBE TABLES;"
|
||||
|
||||
cql:status:
|
||||
desc: Show Cassandra cluster status
|
||||
cmds:
|
||||
- docker exec maple-cassandra-1-dev nodetool status
|
||||
|
||||
# Redis-specific tasks
|
||||
redis:
|
||||
desc: Open Redis CLI
|
||||
cmds:
|
||||
- docker exec -it maple-redis-dev redis-cli
|
||||
|
||||
redis:info:
|
||||
desc: Show Redis info
|
||||
cmds:
|
||||
- docker exec maple-redis-dev redis-cli INFO
|
||||
Loading…
Add table
Add a link
Reference in a new issue