feat(01-01): process-compose config and setup script
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
cc5a25ed59
commit
b20e61efdc
2 changed files with 99 additions and 0 deletions
23
dev/process-compose.yaml
Normal file
23
dev/process-compose.yaml
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
version: "0.5"
|
||||||
|
processes:
|
||||||
|
mariadb:
|
||||||
|
command: >
|
||||||
|
mysqld --datadir=$PWD/dev/.mariadb-data
|
||||||
|
--socket=$PWD/dev/.mariadb.sock
|
||||||
|
--port=3307
|
||||||
|
--skip-grant-tables
|
||||||
|
--skip-networking=false
|
||||||
|
--bind-address=127.0.0.1
|
||||||
|
readiness_probe:
|
||||||
|
exec:
|
||||||
|
command: mysqladmin --socket=$PWD/dev/.mariadb.sock ping
|
||||||
|
initial_delay_seconds: 2
|
||||||
|
period_seconds: 1
|
||||||
|
shutdown:
|
||||||
|
command: mysqladmin --socket=$PWD/dev/.mariadb.sock shutdown
|
||||||
|
|
||||||
|
kimai:
|
||||||
|
command: symfony server:start --no-tls --dir=$PWD/dev/kimai --port=8010
|
||||||
|
depends_on:
|
||||||
|
mariadb:
|
||||||
|
condition: process_healthy
|
||||||
76
dev/setup.sh
Executable file
76
dev/setup.sh
Executable file
|
|
@ -0,0 +1,76 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
KIMAI_DIR="$SCRIPT_DIR/kimai"
|
||||||
|
DATA_DIR="$SCRIPT_DIR/.mariadb-data"
|
||||||
|
|
||||||
|
# Step 1: Initialize MariaDB data directory
|
||||||
|
if [ ! -d "$DATA_DIR" ]; then
|
||||||
|
echo "==> Initializing MariaDB data directory..."
|
||||||
|
mysql_install_db --datadir="$DATA_DIR" --auth-root-authentication-method=normal
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 2: Start MariaDB temporarily for setup
|
||||||
|
echo "==> Starting MariaDB for setup..."
|
||||||
|
mysqld --datadir="$DATA_DIR" --socket="$SCRIPT_DIR/.mariadb.sock" --port=3307 --skip-grant-tables --skip-networking=false --bind-address=127.0.0.1 &
|
||||||
|
MARIADB_PID=$!
|
||||||
|
trap "kill $MARIADB_PID 2>/dev/null || true; wait $MARIADB_PID 2>/dev/null || true" EXIT
|
||||||
|
|
||||||
|
# Wait for MariaDB to be ready
|
||||||
|
for i in $(seq 1 30); do
|
||||||
|
if mysqladmin --socket="$SCRIPT_DIR/.mariadb.sock" ping 2>/dev/null; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
# Create database
|
||||||
|
mysql --socket="$SCRIPT_DIR/.mariadb.sock" -e "CREATE DATABASE IF NOT EXISTS kimai;"
|
||||||
|
|
||||||
|
# Step 3: Clone Kimai
|
||||||
|
if [ ! -d "$KIMAI_DIR" ]; then
|
||||||
|
echo "==> Cloning Kimai 2.52.0..."
|
||||||
|
git clone -b 2.52.0 --depth 1 https://github.com/kimai/kimai.git "$KIMAI_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 4: Configure Kimai
|
||||||
|
cat > "$KIMAI_DIR/.env.local" <<EOF
|
||||||
|
DATABASE_URL=mysql://root@127.0.0.1:3307/kimai?charset=utf8mb4&serverVersion=11.4.9-MariaDB
|
||||||
|
APP_SECRET=$(openssl rand -hex 16)
|
||||||
|
APP_ENV=dev
|
||||||
|
MAILER_URL=null://null
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Step 5: Install Composer dependencies
|
||||||
|
echo "==> Installing Composer dependencies..."
|
||||||
|
cd "$KIMAI_DIR"
|
||||||
|
composer install --no-interaction
|
||||||
|
|
||||||
|
# Step 6: Install Kimai (creates schema, runs migrations)
|
||||||
|
echo "==> Installing Kimai..."
|
||||||
|
bin/console kimai:install -n
|
||||||
|
|
||||||
|
# Step 7: Load test fixtures
|
||||||
|
echo "==> Loading test fixtures..."
|
||||||
|
bin/console kimai:reset:dev -n
|
||||||
|
|
||||||
|
# Step 8: Symlink plugin
|
||||||
|
echo "==> Symlinking plugin..."
|
||||||
|
mkdir -p var/plugins
|
||||||
|
ln -sfn "$PROJECT_DIR" var/plugins/KimaiHeatmapBundle
|
||||||
|
|
||||||
|
# Step 9: Clear cache
|
||||||
|
bin/console cache:clear
|
||||||
|
|
||||||
|
# Stop MariaDB
|
||||||
|
kill $MARIADB_PID 2>/dev/null || true
|
||||||
|
wait $MARIADB_PID 2>/dev/null || true
|
||||||
|
trap - EXIT
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "==> Setup complete!"
|
||||||
|
echo " Run: process-compose -f dev/process-compose.yaml up"
|
||||||
|
echo " Then open: http://127.0.0.1:8010"
|
||||||
|
echo " Login: susan_super / password"
|
||||||
Loading…
Add table
Reference in a new issue