docs: Add comprehensive documentation and helper scripts
Add: - QUICKSTART.md: 5-minute quick start guide with examples - scripts/incus_setup.sh: Automated PostgreSQL container setup - scripts/validate_migration.sql: SQL validation queries - scripts/setup_cron.sh: Cron job setup for incremental migrations - tests/test_setup.py: Unit tests for configuration and transformation - install.sh: Quick installation script Documentation includes: - Step-by-step setup instructions - Example queries for RAWDATACOR and ELABDATADISP - Troubleshooting guide - Performance optimization tips 🤖 Generated with Claude Code Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
52
scripts/incus_setup.sh
Executable file
52
scripts/incus_setup.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
# Script per setup PostgreSQL in container Incus
|
||||
|
||||
set -e
|
||||
|
||||
CONTAINER_NAME=${1:-pg-server}
|
||||
POSTGRES_PASSWORD=${2:-postgres}
|
||||
|
||||
echo "Creating Incus container: $CONTAINER_NAME"
|
||||
|
||||
# Creare container
|
||||
incus launch images:ubuntu/22.04 "$CONTAINER_NAME" --wait
|
||||
|
||||
echo "Installing PostgreSQL..."
|
||||
|
||||
# Installare PostgreSQL
|
||||
incus exec "$CONTAINER_NAME" -- apt update
|
||||
incus exec "$CONTAINER_NAME" -- apt install -y postgresql postgresql-contrib
|
||||
|
||||
echo "Starting PostgreSQL..."
|
||||
|
||||
# Avviare PostgreSQL
|
||||
incus exec "$CONTAINER_NAME" -- systemctl start postgresql
|
||||
incus exec "$CONTAINER_NAME" -- systemctl enable postgresql
|
||||
|
||||
# Impostare password postgres
|
||||
incus exec "$CONTAINER_NAME" -- sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD '$POSTGRES_PASSWORD';"
|
||||
|
||||
# Permettere connessioni TCP
|
||||
incus exec "$CONTAINER_NAME" -- bash -c "
|
||||
echo \"host all all 0.0.0.0/0 md5\" >> /etc/postgresql/14/main/pg_hba.conf
|
||||
sed -i \"s/#listen_addresses = 'localhost'/listen_addresses = '*'/\" /etc/postgresql/14/main/postgresql.conf
|
||||
"
|
||||
|
||||
# Riavviare PostgreSQL
|
||||
incus exec "$CONTAINER_NAME" -- systemctl restart postgresql
|
||||
|
||||
# Ottenere IP
|
||||
IP=$(incus list "$CONTAINER_NAME" -c4 | tail -n1 | awk '{print $1}')
|
||||
|
||||
echo ""
|
||||
echo "✓ PostgreSQL is running!"
|
||||
echo ""
|
||||
echo "Connection details:"
|
||||
echo " Host: $IP"
|
||||
echo " Port: 5432"
|
||||
echo " User: postgres"
|
||||
echo " Password: $POSTGRES_PASSWORD"
|
||||
echo ""
|
||||
echo "Update .env file with:"
|
||||
echo " POSTGRES_HOST=$IP"
|
||||
echo " POSTGRES_PASSWORD=$POSTGRES_PASSWORD"
|
||||
Reference in New Issue
Block a user