CRITICAL FIX: Move composer install after containers start

The previous setup scripts ran 'composer install' in a temporary container
before starting the actual containers. This caused vendor/ directory to be
created inside the temporary container and then deleted, leaving the host
filesystem without dependencies.

Changes:
- setup.bat: Move composer install to Step 4 (after containers start)
- setup.sh: Move composer install to Step 4 (after containers start)
- Use 'docker-compose exec' instead of 'docker-compose run --rm'
- This ensures vendor/ is written to the host filesystem via volume mount
- Added TEST_SETUP.md with comprehensive testing procedures

Now the vendor/ directory will persist correctly on Windows/WSL2 and the
app will load without 'vendor/autoload.php not found' errors.

This was the root cause of the setup not being truly '2-minute ready'.
This commit is contained in:
2026-03-09 18:35:56 +02:00
parent 7af4f1d14a
commit 97acc5e8ea
3 changed files with 454 additions and 23 deletions

View File

@@ -42,11 +42,10 @@ else
exit 1
fi
# Step 2: Install composer dependencies
echo -e "${YELLOW}Installing composer dependencies...${NC}"
# Step 2: Build containers
echo -e "${YELLOW}Building Docker containers...${NC}"
docker-compose build
docker-compose --profile ${DB} run --rm app composer install --no-interaction
echo -e "${GREEN}✓ Dependencies installed${NC}"
echo -e "${GREEN}✓ Containers built${NC}"
echo ""
# Step 3: Start containers
@@ -55,7 +54,13 @@ docker-compose --profile ${DB} up -d
echo -e "${GREEN}✓ Containers started${NC}"
echo ""
# Step 4: Wait for database
# Step 4: Install composer dependencies
echo -e "${YELLOW}→ Installing composer dependencies...${NC}"
docker-compose exec app composer install --no-interaction
echo -e "${GREEN}✓ Dependencies installed${NC}"
echo ""
# Step 5: Wait for database
if [ "$DB" = "mysql" ] || [ "$DB" = "pgsql" ]; then
echo -e "${YELLOW}→ Waiting for database...${NC}"
sleep 5
@@ -63,25 +68,25 @@ if [ "$DB" = "mysql" ] || [ "$DB" = "pgsql" ]; then
echo ""
fi
# Step 5: Generate app key if needed
# Step 6: Generate app key
echo -e "${YELLOW}→ Generating application key...${NC}"
docker-compose exec app php artisan key:generate --force
echo -e "${GREEN}✓ App key generated${NC}"
echo ""
# Step 6: Run migrations
# Step 7: Run migrations
echo -e "${YELLOW}→ Running database migrations...${NC}"
docker-compose exec app php artisan migrate --force
echo -e "${GREEN}✓ Migrations completed${NC}"
echo ""
# Step 7: Seed database (roles, permissions, admin user)
# Step 8: Seed database (roles, permissions, admin user)
echo -e "${YELLOW}→ Seeding database (roles, permissions, admin user)...${NC}"
docker-compose exec app php artisan db:seed --force
echo -e "${GREEN}✓ Database seeded${NC}"
echo ""
# Step 8: Create storage link
# Step 9: Create storage link
echo -e "${YELLOW}→ Creating storage symlink...${NC}"
docker-compose exec app php artisan storage:link
echo -e "${GREEN}✓ Storage linked${NC}"