Add scripts and port mapping env vars
This commit is contained in:
17
cleanup.sh
Executable file
17
cleanup.sh
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Cleanup script for HarborForge Test
|
||||||
|
# Removes containers and networks, but keeps images
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
COMPOSE_FILE="docker-compose-frontend.yml"
|
||||||
|
|
||||||
|
echo "🧹 Cleaning up HarborForge Test containers..."
|
||||||
|
|
||||||
|
# Stop and remove containers, networks (keep images)
|
||||||
|
docker compose -f "$COMPOSE_FILE" down
|
||||||
|
|
||||||
|
# Also remove the wizard config volume
|
||||||
|
docker volume rm harborforgetest_wizard_config 2>/dev/null || true
|
||||||
|
|
||||||
|
echo "✅ Cleanup complete!"
|
||||||
@@ -2,7 +2,9 @@ services:
|
|||||||
mysql:
|
mysql:
|
||||||
image: mysql:8.0
|
image: mysql:8.0
|
||||||
container_name: harborforge-test-mysql
|
container_name: harborforge-test-mysql
|
||||||
restart: unless-stopped
|
restart: "no"
|
||||||
|
tmpfs:
|
||||||
|
- /var/lib/mysql
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-harborforge_root}
|
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-harborforge_root}
|
||||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-harborforge}
|
MYSQL_DATABASE: ${MYSQL_DATABASE:-harborforge}
|
||||||
@@ -13,11 +15,6 @@ services:
|
|||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpus: '0.5'
|
|
||||||
memory: 512M
|
|
||||||
networks:
|
networks:
|
||||||
- test-network
|
- test-network
|
||||||
|
|
||||||
@@ -28,7 +25,7 @@ services:
|
|||||||
image: harborforge-test-wizard:dev
|
image: harborforge-test-wizard:dev
|
||||||
container_name: harborforge-test-wizard
|
container_name: harborforge-test-wizard
|
||||||
user: 0:0
|
user: 0:0
|
||||||
restart: unless-stopped
|
restart: "no"
|
||||||
volumes:
|
volumes:
|
||||||
- wizard_config:/config
|
- wizard_config:/config
|
||||||
environment:
|
environment:
|
||||||
@@ -37,12 +34,7 @@ services:
|
|||||||
MAX_BACKUPS: "5"
|
MAX_BACKUPS: "5"
|
||||||
CORS_ORIGINS: http://frontend:3000
|
CORS_ORIGINS: http://frontend:3000
|
||||||
ports:
|
ports:
|
||||||
- "${WIZARD_PORT:-18080}:8080"
|
- "18080:8080"
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpus: '0.1'
|
|
||||||
memory: 64M
|
|
||||||
networks:
|
networks:
|
||||||
- test-network
|
- test-network
|
||||||
|
|
||||||
@@ -52,29 +44,20 @@ services:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
image: harborforge-test-backend:dev
|
image: harborforge-test-backend:dev
|
||||||
container_name: harborforge-test-backend
|
container_name: harborforge-test-backend
|
||||||
restart: unless-stopped
|
restart: "no"
|
||||||
|
volumes:
|
||||||
|
- wizard_config:/config:ro
|
||||||
environment:
|
environment:
|
||||||
CONFIG_DIR: /config
|
CONFIG_DIR: /config
|
||||||
CONFIG_FILE: harborforge.json
|
CONFIG_FILE: harborforge.json
|
||||||
SECRET_KEY: ${SECRET_KEY:-change_me_in_production}
|
SECRET_KEY: ${SECRET_KEY:-change_me_in_production}
|
||||||
LOG_LEVEL: ${LOG_LEVEL:-INFO}
|
LOG_LEVEL: ${LOG_LEVEL:-INFO}
|
||||||
DATABASE_URL: mysql+pymysql://harborforge:harborforge_pass@mysql:3306/harborforge
|
DATABASE_URL: mysql+pymysql://harborforge:harborforge_pass@mysql:3306/harborforge
|
||||||
volumes:
|
ports:
|
||||||
- wizard_config:/config:ro
|
- "${MAP_BACKEND_PORT:- }:8000"
|
||||||
depends_on:
|
depends_on:
|
||||||
mysql:
|
mysql:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpus: '0.5'
|
|
||||||
memory: 512M
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
start_period: 10s
|
|
||||||
networks:
|
networks:
|
||||||
- test-network
|
- test-network
|
||||||
|
|
||||||
@@ -84,24 +67,17 @@ services:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
args:
|
args:
|
||||||
VITE_WIZARD_PORT: 8080
|
VITE_WIZARD_PORT: 8080
|
||||||
|
VITE_WIZARD_HOST: wizard
|
||||||
image: harborforge-test-frontend:dev
|
image: harborforge-test-frontend:dev
|
||||||
container_name: harborforge-test-frontend
|
container_name: harborforge-test-frontend
|
||||||
restart: unless-stopped
|
restart: "no"
|
||||||
environment:
|
environment:
|
||||||
VITE_API_BASE_URL: http://backend:8000
|
VITE_API_BASE_URL: http://backend:8000
|
||||||
|
ports:
|
||||||
|
- "${MAP_FRONTEND_PORT:- }:3000"
|
||||||
depends_on:
|
depends_on:
|
||||||
- wizard
|
- wizard
|
||||||
- backend
|
- backend
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpus: '0.25'
|
|
||||||
memory: 128M
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
networks:
|
networks:
|
||||||
- test-network
|
- test-network
|
||||||
|
|
||||||
@@ -115,18 +91,14 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
BASE_URL: http://frontend:3000
|
BASE_URL: http://frontend:3000
|
||||||
WEB_SERVER_URL: http://frontend:3000
|
WEB_SERVER_URL: http://frontend:3000
|
||||||
|
WIZARD_URL: http://wizard:8080/wizard
|
||||||
|
WIZARD_API_URL: http://wizard:8080
|
||||||
CHROME_DEBUGGING_PORT: 9222
|
CHROME_DEBUGGING_PORT: 9222
|
||||||
depends_on:
|
|
||||||
frontend:
|
|
||||||
condition: service_healthy
|
|
||||||
backend:
|
|
||||||
condition: service_healthy
|
|
||||||
networks:
|
networks:
|
||||||
- test-network
|
- test-network
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
wizard_config:
|
wizard_config:
|
||||||
driver: local
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
test-network:
|
test-network:
|
||||||
|
|||||||
26
run-test.sh
Executable file
26
run-test.sh
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Run test and cleanup afterwards
|
||||||
|
set -e
|
||||||
|
|
||||||
|
COMPOSE_FILE="docker-compose-frontend.yml"
|
||||||
|
|
||||||
|
echo "🚀 Running HarborForge Test..."
|
||||||
|
|
||||||
|
# Clean any previous containers first
|
||||||
|
docker compose -f "$COMPOSE_FILE" down 2>/dev/null || true
|
||||||
|
|
||||||
|
# Run test
|
||||||
|
docker compose -f "$COMPOSE_FILE" run --rm test
|
||||||
|
TEST_EXIT_CODE=$?
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "🧹 Cleaning up containers and volumes..."
|
||||||
|
docker compose -f "$COMPOSE_FILE" down -v
|
||||||
|
|
||||||
|
if [ $TEST_EXIT_CODE -eq 0 ]; then
|
||||||
|
echo "✅ Test passed!"
|
||||||
|
else
|
||||||
|
echo "❌ Test failed with exit code: $TEST_EXIT_CODE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit $TEST_EXIT_CODE
|
||||||
Reference in New Issue
Block a user