Migration to podman. Dev is OK, certificate problem with test

This commit is contained in:
Josako
2025-08-12 06:33:17 +02:00
parent 866cc2a60d
commit 7e35549262
5 changed files with 426 additions and 360 deletions

View File

@@ -3,19 +3,29 @@
# Exit on any error # Exit on any error
set -e set -e
source ./docker_env_switch.sh dev source ./podman_env_switch.sh dev
# Load environment variables # Load environment variables
source .env source .env
# Docker registry # Check if podman is available
REGISTRY="josakola" if ! command -v podman &> /dev/null; then
echo "Error: podman not found"
exit 1
fi
echo "Using container runtime: podman"
# Local registry
REGISTRY="registry.ask-eve-ai-local.com"
# Account prefix voor consistency met Docker Hub
ACCOUNT="josakola"
# Tag (you might want to use a version or git commit hash) # Tag (you might want to use a version or git commit hash)
TAG="latest" TAG="latest"
# Platforms to build for # Single platform - AMD64 only for simplicity
PLATFORMS="linux/amd64,linux/arm64" PLATFORM="linux/amd64"
# Default action # Default action
ACTION="both" ACTION="both"
@@ -28,13 +38,14 @@ DEBUG=""
# Function to display usage information # Function to display usage information
usage() { usage() {
echo "Usage: $0 [-b|-p] [--no-cache] [--progress=plain] [--debug] [service1 service2 ...]" echo "Usage: $0 [-b|-p] [--no-cache] [--progress=plain] [--debug] [service1 service2 ...]"
echo " -b: Build only (for current platform)" echo " -b: Build only"
echo " -p: Push only (multi-platform)" echo " -p: Push only"
echo " --no-cache: Perform a clean build without using cache" echo " --no-cache: Perform a clean build without using cache"
echo " --progress=plain: Show detailed progress of the build" echo " --progress=plain: Show detailed progress of the build"
echo " --debug: Enable debug mode for the build" echo " --debug: Enable debug mode for the build"
echo " If no option is provided, both build and push will be performed." echo " If no option is provided, both build and push will be performed."
echo " If no services are specified, all eveai_ services and nginx will be processed." echo " If no services are specified, all eveai_ services and nginx will be processed."
echo " All images are built for AMD64 platform (compatible with both x86_64 and Apple Silicon via emulation)."
} }
# Parse command-line options # Parse command-line options
@@ -92,47 +103,57 @@ process_service() {
return 1 return 1
fi fi
# Construct image names
LOCAL_IMAGE_NAME="$ACCOUNT/$SERVICE:$TAG"
REGISTRY_IMAGE_NAME="$REGISTRY/$ACCOUNT/$SERVICE:$TAG"
echo "Building for platform: $PLATFORM"
echo "Local tag: $LOCAL_IMAGE_NAME"
echo "Registry tag: $REGISTRY_IMAGE_NAME"
# Build and/or push based on ACTION # Build and/or push based on ACTION
if [ "$ACTION" = "build" ]; then if [ "$ACTION" = "build" ]; then
echo "Building $SERVICE for current platform..." echo "Building $SERVICE for $PLATFORM..."
docker build \ podman build \
--platform "$PLATFORM" \
$NO_CACHE \ $NO_CACHE \
$PROGRESS \ $PROGRESS \
$DEBUG \ $DEBUG \
-t "$REGISTRY/$SERVICE:$TAG" \ -t "$LOCAL_IMAGE_NAME" \
-f "$CONTEXT/$DOCKERFILE" \ -t "$REGISTRY_IMAGE_NAME" \
"$CONTEXT"
elif [ "$ACTION" = "push" ]; then
echo "Building and pushing $SERVICE for multiple platforms..."
docker buildx build \
$NO_CACHE \
$PROGRESS \
$DEBUG \
--platform "$PLATFORMS" \
-t "$REGISTRY/$SERVICE:$TAG" \
-f "$CONTEXT/$DOCKERFILE" \
"$CONTEXT" \
--push
else
echo "Building $SERVICE for current platform..."
docker build \
$NO_CACHE \
$PROGRESS \
$DEBUG \
-t "$REGISTRY/$SERVICE:$TAG" \
-f "$CONTEXT/$DOCKERFILE" \ -f "$CONTEXT/$DOCKERFILE" \
"$CONTEXT" "$CONTEXT"
echo "Building and pushing $SERVICE for multiple platforms..." elif [ "$ACTION" = "push" ]; then
docker buildx build \ echo "Building and pushing $SERVICE for $PLATFORM..."
podman build \
--platform "$PLATFORM" \
$NO_CACHE \ $NO_CACHE \
$PROGRESS \ $PROGRESS \
$DEBUG \ $DEBUG \
--platform "$PLATFORMS" \ -t "$LOCAL_IMAGE_NAME" \
-t "$REGISTRY/$SERVICE:$TAG" \ -t "$REGISTRY_IMAGE_NAME" \
-f "$CONTEXT/$DOCKERFILE" \ -f "$CONTEXT/$DOCKERFILE" \
"$CONTEXT" \ "$CONTEXT"
--push
echo "Pushing $SERVICE to registry..."
podman push "$REGISTRY_IMAGE_NAME"
else
# Both build and push
echo "Building $SERVICE for $PLATFORM..."
podman build \
--platform "$PLATFORM" \
$NO_CACHE \
$PROGRESS \
$DEBUG \
-t "$LOCAL_IMAGE_NAME" \
-t "$REGISTRY_IMAGE_NAME" \
-f "$CONTEXT/$DOCKERFILE" \
"$CONTEXT"
echo "Pushing $SERVICE to registry..."
podman push "$REGISTRY_IMAGE_NAME"
fi fi
} }
@@ -146,31 +167,25 @@ else
SERVICES=("$@") SERVICES=("$@")
fi fi
# Check if eveai_builder exists, if not create it echo "Using simplified AMD64-only approach for maximum compatibility..."
if ! docker buildx inspect eveai_builder > /dev/null 2>&1; then echo "Images will be tagged as: $REGISTRY/$ACCOUNT/[service]:$TAG"
echo "Creating eveai_builder..."
docker buildx create --name eveai_builder
fi
# Use eveai_builder
echo "Using eveai_builder..."
docker buildx use eveai_builder
# Loop through services # Loop through services
for SERVICE in "${SERVICES[@]}"; do for SERVICE in "${SERVICES[@]}"; do
if [[ "$SERVICE" == "nginx" ]]; then if [[ "$SERVICE" == "nginx" ]]; then
./copy_specialist_svgs.sh ../config ../nginx/static/assets ./copy_specialist_svgs.sh ../config ../nginx/static/assets 2>/dev/null || echo "Warning: copy_specialist_svgs.sh not found or failed"
fi fi
if [[ "$SERVICE" == "nginx" || "$SERVICE" == eveai_* || "$SERVICE" == "flower" || "$SERVICE" == "prometheus" || "$SERVICE" == "grafana" ]]; then if [[ "$SERVICE" == "nginx" || "$SERVICE" == eveai_* || "$SERVICE" == "flower" || "$SERVICE" == "prometheus" || "$SERVICE" == "grafana" ]]; then
if process_service "$SERVICE"; then if process_service "$SERVICE"; then
echo "Successfully processed $SERVICE" echo "Successfully processed $SERVICE"
else else
echo "Failed to process $SERVICE" echo "Failed to process $SERVICE"
fi fi
else else
echo "Skipping $SERVICE as it's not nginx, flower, prometheus, grafana or doesn't start with eveai_" echo "⏭️ Skipping $SERVICE as it's not nginx, flower, prometheus, grafana or doesn't start with eveai_"
fi fi
done done
echo -e "\033[35mAll specified services processed.\033[0m" echo -e "\033[32m✅ All specified services processed successfully!\033[0m"
echo -e "\033[35mFinished at $(date +"%d/%m/%Y %H:%M:%S")\033[0m" echo -e "\033[32m📦 Images are available locally and in registry\033[0m"
echo -e "\033[32m🕐 Finished at $(date +"%d/%m/%Y %H:%M:%S")\033[0m"

View File

@@ -1,13 +1,4 @@
# Comments are provided throughout this file to help you get started. # Podman Compose compatible versie met port schema compliance
# If you need more help, visit the Docker Compose reference guide at
# https://docs.docker.com/go/compose-spec-reference/
# Here the instructions define your application as a service called "server".
# This service is built from the Dockerfile in the current directory.
# You can add other services your application may depend on here, such as a
# database or a cache. For examples, see the Awesome Compose repository:
# https://github.com/docker/awesome-compose
x-common-variables: &common-variables x-common-variables: &common-variables
DB_HOST: db DB_HOST: db
DB_USER: luke DB_USER: luke
@@ -45,16 +36,13 @@ x-common-variables: &common-variables
services: services:
nginx: nginx:
container_name: nginx
image: josakola/nginx:latest image: josakola/nginx:latest
build: build:
context: .. context: ..
dockerfile: ./docker/nginx/Dockerfile dockerfile: ./docker/nginx/Dockerfile
platforms:
- linux/amd64
- linux/arm64
ports: ports:
- 80:80 - 3002:80 # Dev nginx proxy volgens port schema
- 8080:8080
environment: environment:
<<: *common-variables <<: *common-variables
volumes: volumes:
@@ -72,18 +60,16 @@ services:
- eveai_api - eveai_api
- eveai_chat_client - eveai_chat_client
networks: networks:
- eveai-network - eveai-dev-network
eveai_app: eveai_app:
container_name: eveai_app
image: josakola/eveai_app:latest image: josakola/eveai_app:latest
build: build:
context: .. context: ..
dockerfile: ./docker/eveai_app/Dockerfile dockerfile: ./docker/eveai_app/Dockerfile
platforms:
- linux/amd64
- linux/arm64
ports: ports:
- 5001:5001 - 3000:5001 # Dev app volgens port schema
expose: expose:
- 8000 - 8000
environment: environment:
@@ -108,20 +94,18 @@ services:
healthcheck: healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5001/healthz/ready"] test: ["CMD", "curl", "-f", "http://localhost:5001/healthz/ready"]
interval: 30s interval: 30s
timeout: 1s timeout: 10s
retries: 3 retries: 3
start_period: 30s start_period: 60s
networks: networks:
- eveai-network - eveai-dev-network
eveai_workers: eveai_workers:
container_name: eveai_workers
image: josakola/eveai_workers:latest image: josakola/eveai_workers:latest
build: build:
context: .. context: ..
dockerfile: ./docker/eveai_workers/Dockerfile dockerfile: ./docker/eveai_workers/Dockerfile
platforms:
- linux/amd64
- linux/arm64
expose: expose:
- 8000 - 8000
environment: environment:
@@ -142,18 +126,16 @@ services:
minio: minio:
condition: service_healthy condition: service_healthy
networks: networks:
- eveai-network - eveai-dev-network
eveai_chat_client: eveai_chat_client:
container_name: eveai_chat_client
image: josakola/eveai_chat_client:latest image: josakola/eveai_chat_client:latest
build: build:
context: .. context: ..
dockerfile: ./docker/eveai_chat_client/Dockerfile dockerfile: ./docker/eveai_chat_client/Dockerfile
platforms:
- linux/amd64
- linux/arm64
ports: ports:
- 5004:5004 - 3004:5004 # Dev chat client volgens port schema
expose: expose:
- 8000 - 8000
environment: environment:
@@ -176,20 +158,18 @@ services:
healthcheck: healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5004/healthz/ready"] test: ["CMD", "curl", "-f", "http://localhost:5004/healthz/ready"]
interval: 30s interval: 30s
timeout: 1s timeout: 10s
retries: 3 retries: 3
start_period: 30s start_period: 60s
networks: networks:
- eveai-network - eveai-dev-network
eveai_chat_workers: eveai_chat_workers:
container_name: eveai_chat_workers
image: josakola/eveai_chat_workers:latest image: josakola/eveai_chat_workers:latest
build: build:
context: .. context: ..
dockerfile: ./docker/eveai_chat_workers/Dockerfile dockerfile: ./docker/eveai_chat_workers/Dockerfile
platforms:
- linux/amd64
- linux/arm64
expose: expose:
- 8000 - 8000
environment: environment:
@@ -208,26 +188,21 @@ services:
redis: redis:
condition: service_healthy condition: service_healthy
networks: networks:
- eveai-network - eveai-dev-network
eveai_api: eveai_api:
container_name: eveai_api
image: josakola/eveai_api:latest image: josakola/eveai_api:latest
build: build:
context: .. context: ..
dockerfile: ./docker/eveai_api/Dockerfile dockerfile: ./docker/eveai_api/Dockerfile
platforms:
- linux/amd64
- linux/arm64
ports: ports:
- 5003:5003 - 3001:5003 # Dev API volgens port schema
expose: expose:
- 8000 - 8000
environment: environment:
<<: *common-variables <<: *common-variables
COMPONENT_NAME: eveai_api COMPONENT_NAME: eveai_api
WORDPRESS_HOST: host.docker.internal
WORDPRESS_PORT: 10003
WORDPRESS_PROTOCOL: http
volumes: volumes:
- ../eveai_api:/app/eveai_api - ../eveai_api:/app/eveai_api
- ../common:/app/common - ../common:/app/common
@@ -245,20 +220,18 @@ services:
healthcheck: healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:5003/healthz/ready" ] test: [ "CMD", "curl", "-f", "http://localhost:5003/healthz/ready" ]
interval: 30s interval: 30s
timeout: 1s timeout: 10s
retries: 3 retries: 3
start_period: 30s start_period: 60s
networks: networks:
- eveai-network - eveai-dev-network
eveai_beat: eveai_beat:
container_name: eveai_beat
image: josakola/eveai_beat:latest image: josakola/eveai_beat:latest
build: build:
context: .. context: ..
dockerfile: ./docker/eveai_beat/Dockerfile dockerfile: ./docker/eveai_beat/Dockerfile
platforms:
- linux/amd64
- linux/arm64
environment: environment:
<<: *common-variables <<: *common-variables
COMPONENT_NAME: eveai_beat COMPONENT_NAME: eveai_beat
@@ -273,16 +246,14 @@ services:
redis: redis:
condition: service_healthy condition: service_healthy
networks: networks:
- eveai-network - eveai-dev-network
eveai_entitlements: eveai_entitlements:
container_name: eveai_entitlements
image: josakola/eveai_entitlements:latest image: josakola/eveai_entitlements:latest
build: build:
context: .. context: ..
dockerfile: ./docker/eveai_entitlements/Dockerfile dockerfile: ./docker/eveai_entitlements/Dockerfile
platforms:
- linux/amd64
- linux/arm64
expose: expose:
- 8000 - 8000
environment: environment:
@@ -303,13 +274,14 @@ services:
minio: minio:
condition: service_healthy condition: service_healthy
networks: networks:
- eveai-network - eveai-dev-network
db: db:
container_name: db
hostname: db hostname: db
image: ankane/pgvector image: ankane/pgvector
ports: ports:
- 5432:5432 - 3005:5432 # Dev database volgens port schema (vermijd standaard 5432)
restart: always restart: always
environment: environment:
- POSTGRES_DB=eveai - POSTGRES_DB=eveai
@@ -324,13 +296,14 @@ services:
timeout: 5s timeout: 5s
retries: 5 retries: 5
networks: networks:
- eveai-network - eveai-dev-network
redis: redis:
container_name: redis
image: redis:7.2.5 image: redis:7.2.5
restart: always restart: always
ports: ports:
- "6379:6379" - "3006:6379" # Dev Redis volgens port schema (vermijd standaard 6379)
volumes: volumes:
- ./db/redis:/data - ./db/redis:/data
healthcheck: healthcheck:
@@ -339,9 +312,10 @@ services:
timeout: 5s timeout: 5s
retries: 5 retries: 5
networks: networks:
- eveai-network - eveai-dev-network
flower: flower:
container_name: flower
image: josakola/flower:latest image: josakola/flower:latest
build: build:
context: .. context: ..
@@ -351,17 +325,18 @@ services:
volumes: volumes:
- ../scripts:/app/scripts - ../scripts:/app/scripts
ports: ports:
- "5555:5555" - "3007:5555" # Dev Flower volgens port schema
depends_on: depends_on:
- redis - redis
networks: networks:
- eveai-network - eveai-dev-network
minio: minio:
container_name: minio
image: minio/minio image: minio/minio
ports: ports:
- "9000:9000" - "3008:9000" # Dev MinIO volgens port schema
- "9001:9001" - "3009:9001" # Dev MinIO console
expose: expose:
- 9000 - 9000
volumes: volumes:
@@ -376,18 +351,18 @@ services:
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
start_period: 30s start_period: 60s
networks: networks:
- eveai-network - eveai-dev-network
prometheus: prometheus:
image: prom/prometheus:latest container_name: prometheus
image: josakola/prometheus:latest
build: build:
context: ./prometheus context: ./prometheus
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: prometheus
ports: ports:
- "9090:9090" - "3010:9090" # Dev Prometheus volgens port schema
volumes: volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- ./prometheus/data:/prometheus - ./prometheus/data:/prometheus
@@ -399,24 +374,25 @@ services:
- '--web.enable-lifecycle' - '--web.enable-lifecycle'
restart: unless-stopped restart: unless-stopped
networks: networks:
- eveai-network - eveai-dev-network
pushgateway: pushgateway:
container_name: pushgateway
image: prom/pushgateway:latest image: prom/pushgateway:latest
restart: unless-stopped restart: unless-stopped
ports: ports:
- "9091:9091" - "3011:9091" # Dev Pushgateway volgens port schema
networks: networks:
- eveai-network - eveai-dev-network
grafana: grafana:
image: grafana/grafana:latest container_name: grafana
image: josakola/grafana:latest
build: build:
context: ./grafana context: ./grafana
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: grafana
ports: ports:
- "3000:3000" - "3012:3000" # Dev Grafana volgens port schema
volumes: volumes:
- ./grafana/provisioning:/etc/grafana/provisioning - ./grafana/provisioning:/etc/grafana/provisioning
- ./grafana/data:/var/lib/grafana - ./grafana/data:/var/lib/grafana
@@ -428,21 +404,12 @@ services:
depends_on: depends_on:
- prometheus - prometheus
networks: networks:
- eveai-network - eveai-dev-network
networks: networks:
eveai-network: eveai-dev-network:
driver: bridge driver: bridge
# This enables the containers to access the host network
driver_opts:
com.docker.network.bridge.host_ipc: "true"
volumes: volumes:
minio_data: minio_data:
eveai_logs: eveai_logs:
# db-data:
# redis-data:
# tenant-files:
#secrets:
# db-password:
# file: ./db/password.txt

View File

@@ -43,36 +43,36 @@ x-common-variables: &common-variables
SW_EMAIL_NAME: "Evie Admin (test)" SW_EMAIL_NAME: "Evie Admin (test)"
SW_PROJECT: "f282f55a-ea52-4538-a979-5bcb890717ab" SW_PROJECT: "f282f55a-ea52-4538-a979-5bcb890717ab"
name: eveai_test
services: services:
nginx: nginx:
image: josakola/nginx:${EVEAI_VERSION:-latest} image: josakola/nginx:latest
ports: ports:
- 80:80 - 4080:80
- 8080:8080
environment: environment:
<<: *common-variables <<: *common-variables
volumes: volumes:
- eveai_logs:/var/log/nginx - test_eveai_logs:/var/log/nginx
depends_on: depends_on:
- eveai_app - eveai_app
- eveai_api - eveai_api
- eveai_chat_client - eveai_chat_client
networks: networks:
- eveai-network - eveai-test-network
restart: "no" restart: "no"
eveai_app: eveai_app:
image: josakola/eveai_app:${EVEAI_VERSION:-latest} image: josakola/eveai_app:latest
ports: ports:
- 5001:5001 - 4001:5001
expose: expose:
- 8000 - 8000
environment: environment:
<<: *common-variables <<: *common-variables
COMPONENT_NAME: eveai_app COMPONENT_NAME: eveai_app
volumes: volumes:
- eveai_logs:/app/logs - test_eveai_logs:/app/logs
- crewai_storage:/app/crewai_storage
depends_on: depends_on:
redis: redis:
condition: service_healthy condition: service_healthy
@@ -85,40 +85,38 @@ services:
retries: 3 retries: 3
start_period: 30s start_period: 30s
networks: networks:
- eveai-network - eveai-test-network
restart: "no" restart: "no"
eveai_workers: eveai_workers:
image: josakola/eveai_workers:${EVEAI_VERSION:-latest} image: josakola/eveai_workers:latest
expose: expose:
- 8000 - 8000
environment: environment:
<<: *common-variables <<: *common-variables
COMPONENT_NAME: eveai_workers COMPONENT_NAME: eveai_workers
volumes: volumes:
- eveai_logs:/app/logs - test_eveai_logs:/app/logs
- crewai_storage:/app/crewai_storage
depends_on: depends_on:
redis: redis:
condition: service_healthy condition: service_healthy
minio: minio:
condition: service_healthy condition: service_healthy
networks: networks:
- eveai-network - eveai-test-network
restart: "no" restart: "no"
eveai_chat_client: eveai_chat_client:
image: josakola/eveai_chat_client:${EVEAI_VERSION:-latest} image: josakola/eveai_chat_client:latest
ports: ports:
- 5004:5004 - 4004:5004
expose: expose:
- 8000 - 8000
environment: environment:
<<: *common-variables <<: *common-variables
COMPONENT_NAME: eveai_chat_client COMPONENT_NAME: eveai_chat_client
volumes: volumes:
- eveai_logs:/app/logs - test_eveai_logs:/app/logs
- crewai_storage:/app/crewai_storage
depends_on: depends_on:
redis: redis:
condition: service_healthy condition: service_healthy
@@ -131,38 +129,36 @@ services:
retries: 3 retries: 3
start_period: 30s start_period: 30s
networks: networks:
- eveai-network - eveai-test-network
restart: "no" restart: "no"
eveai_chat_workers: eveai_chat_workers:
image: josakola/eveai_chat_workers:${EVEAI_VERSION:-latest} image: josakola/eveai_chat_workers:latest
expose: expose:
- 8000 - 8000
environment: environment:
<<: *common-variables <<: *common-variables
COMPONENT_NAME: eveai_chat_workers COMPONENT_NAME: eveai_chat_workers
volumes: volumes:
- eveai_logs:/app/logs - test_eveai_logs:/app/logs
- crewai_storage:/app/crewai_storage
depends_on: depends_on:
redis: redis:
condition: service_healthy condition: service_healthy
networks: networks:
- eveai-network - eveai-test-network
restart: "no" restart: "no"
eveai_api: eveai_api:
image: josakola/eveai_api:${EVEAI_VERSION:-latest} image: josakola/eveai_api:latest
ports: ports:
- 5003:5003 - 4003:5003
expose: expose:
- 8000 - 8000
environment: environment:
<<: *common-variables <<: *common-variables
COMPONENT_NAME: eveai_api COMPONENT_NAME: eveai_api
volumes: volumes:
- eveai_logs:/app/logs - test_eveai_logs:/app/logs
- crewai_storage:/app/crewai_storage
depends_on: depends_on:
redis: redis:
condition: service_healthy condition: service_healthy
@@ -175,80 +171,78 @@ services:
retries: 3 retries: 3
start_period: 30s start_period: 30s
networks: networks:
- eveai-network - eveai-test-network
restart: "no" restart: "no"
eveai_beat: eveai_beat:
image: josakola/eveai_beat:${EVEAI_VERSION:-latest} image: josakola/eveai_beat:latest
environment: environment:
<<: *common-variables <<: *common-variables
COMPONENT_NAME: eveai_beat COMPONENT_NAME: eveai_beat
volumes: volumes:
- eveai_logs:/app/logs - test_eveai_logs:/app/logs
- crewai_storage:/app/crewai_storage
depends_on: depends_on:
redis: redis:
condition: service_healthy condition: service_healthy
networks: networks:
- eveai-network - eveai-test-network
restart: "no" restart: "no"
eveai_entitlements: eveai_entitlements:
image: josakola/eveai_entitlements:${EVEAI_VERSION:-latest} image: josakola/eveai_entitlements:latest
expose: expose:
- 8000 - 8000
environment: environment:
<<: *common-variables <<: *common-variables
COMPONENT_NAME: eveai_entitlements COMPONENT_NAME: eveai_entitlements
volumes: volumes:
- eveai_logs:/app/logs - test_eveai_logs:/app/logs
- crewai_storage:/app/crewai_storage
depends_on: depends_on:
redis: redis:
condition: service_healthy condition: service_healthy
minio: minio:
condition: service_healthy condition: service_healthy
networks: networks:
- eveai-network - eveai-test-network
restart: "no" restart: "no"
redis: redis:
image: redis:7.2.5 image: redis:7.2.5
restart: no restart: no
ports: ports:
- "6379:6379" - "4006:6379"
volumes: volumes:
- redisdata:/data - test_redisdata:/data
healthcheck: healthcheck:
test: [ "CMD", "redis-cli", "ping" ] test: [ "CMD", "redis-cli", "ping" ]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
networks: networks:
- eveai-network - eveai-test-network
flower: flower:
image: josakola/flower:${EVEAI_VERSION:-latest} image: josakola/flower:latest
environment: environment:
<<: *common-variables <<: *common-variables
ports: ports:
- "5555:5555" - "4007:5555"
depends_on: depends_on:
- redis - redis
networks: networks:
- eveai-network - eveai-test-network
restart: "no" restart: "no"
minio: minio:
image: minio/minio image: minio/minio
ports: ports:
- "9000:9000" - "4008:9000"
- "9001:9001" - "4009:9001"
expose: expose:
- 9000 - 9000
volumes: volumes:
- miniodata:/data - test_miniodata:/data
- minioconfig:/root/.minio - test_minioconfig:/root/.minio
environment: environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin} MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin} MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin}
@@ -260,16 +254,16 @@ services:
retries: 3 retries: 3
start_period: 30s start_period: 30s
networks: networks:
- eveai-network - eveai-test-network
restart: "no" restart: "no"
prometheus: prometheus:
image: josakola/prometheus:${EVEAI_VERSION:-latest} image: josakola/prometheus:${EVEAI_VERSION:-latest}
container_name: prometheus container_name: prometheus
ports: ports:
- "9090:9090" - "4010:9090"
volumes: volumes:
- prometheusdata:/prometheus - test_prometheusdata:/prometheus
command: command:
- '--config.file=/etc/prometheus/prometheus.yml' - '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus' - '--storage.tsdb.path=/prometheus'
@@ -278,23 +272,23 @@ services:
- '--web.enable-lifecycle' - '--web.enable-lifecycle'
restart: no restart: no
networks: networks:
- eveai-network - eveai-test-network
pushgateway: pushgateway:
image: prom/pushgateway:latest image: prom/pushgateway:latest
restart: unless-stopped restart: unless-stopped
ports: ports:
- "9091:9091" - "4011:9091"
networks: networks:
- eveai-network - eveai-test-network
grafana: grafana:
image: josakola/grafana:${EVEAI_VERSION:-latest} image: josakola/grafana:${EVEAI_VERSION:-latest}
container_name: grafana container_name: grafana
ports: ports:
- "3000:3000" - "4012:3000"
volumes: volumes:
- grafanadata:/var/lib/grafana - test_grafanadata:/var/lib/grafana
environment: environment:
- GF_SECURITY_ADMIN_USER=admin - GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin - GF_SECURITY_ADMIN_PASSWORD=admin
@@ -303,21 +297,16 @@ services:
depends_on: depends_on:
- prometheus - prometheus
networks: networks:
- eveai-network - eveai-test-network
networks: networks:
eveai-network: eveai-test-network:
driver: bridge driver: bridge
# This enables the containers to access the host network
driver_opts:
com.docker.network.bridge.host_ipc: "true"
volumes: volumes:
eveai_logs: test_eveai_logs:
pgdata: test_redisdata:
redisdata: test_miniodata:
miniodata: test_minioconfig:
minioconfig: test_prometheusdata:
prometheusdata: test_grafanadata:
grafanadata:
crewai_storage:

View File

@@ -1,155 +0,0 @@
#!/bin/zsh
# or use #!/usr/bin/env zsh
# Function to display usage information
usage() {
echo "Usage: source $0 <environment> [version]"
echo " environment: The environment to use (dev, prod, test, integration, bugfix)"
echo " version : (Optional) Specific release version to deploy"
echo " If not specified, uses 'latest' (except for dev environment)"
}
# Replace the existing check at the beginning of docker_env_switch.sh
# Check if the script is sourced
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
# Script is being executed directly from terminal
echo "Error: This script must be sourced, not executed directly."
echo "Please run: source $0 <environment> [version]"
exit 1
fi
# If we reach here, script is being sourced (either by terminal or another script)
# Check if an environment is provided
if [ $# -eq 0 ]; then
usage
return 1
fi
ENVIRONMENT=$1
VERSION=${2:-latest} # Default to latest if not specified
# Set variables based on the environment
case $ENVIRONMENT in
dev)
DOCKER_CONTEXT="default"
COMPOSE_FILE="compose_dev.yaml"
VERSION="latest" # Always use latest for dev
;;
prod)
DOCKER_CONTEXT="mxz536.stackhero-network.com"
COMPOSE_FILE="compose_stackhero.yaml"
;;
test)
DOCKER_CONTEXT="test-environment" # Change to your actual test Docker context
COMPOSE_FILE="compose_test.yaml"
;;
integration)
DOCKER_CONTEXT="integration-environment" # Change to your actual integration Docker context
COMPOSE_FILE="compose_integration.yaml"
;;
bugfix)
DOCKER_CONTEXT="bugfix-environment" # Change to your actual bugfix Docker context
COMPOSE_FILE="compose_bugfix.yaml"
;;
*)
echo "Invalid environment: $ENVIRONMENT"
usage
return 1
;;
esac
# Set Docker account
DOCKER_ACCOUNT="josakola"
# Check if Docker context exists
if ! docker context ls --format '{{.Name}}' | grep -q "^$DOCKER_CONTEXT$"; then
echo "Warning: Docker context '$DOCKER_CONTEXT' does not exist."
# Prompt user if they want to create the context
if [[ "$DOCKER_CONTEXT" != "default" ]]; then
echo "Do you want to set up this context now? (y/n): "
read CREATE_CONTEXT
if [[ "$CREATE_CONTEXT" == "y" || "$CREATE_CONTEXT" == "Y" ]]; then
# You would add here the specific code to create each context type
# For example, for remote contexts you might need SSH settings
echo "Please specify the Docker host URL (e.g., ssh://user@remote_host or tcp://remote_host:2375):"
read DOCKER_HOST
docker context create "$DOCKER_CONTEXT" --docker "host=$DOCKER_HOST"
if [ $? -ne 0 ]; then
echo "Failed to create Docker context. Please create it manually."
return 1
fi
else
echo "Using default context instead."
DOCKER_CONTEXT="default"
fi
fi
fi
# Check if compose file exists
if [ ! -f "$COMPOSE_FILE" ]; then
echo "Warning: Compose file '$COMPOSE_FILE' does not exist."
echo "Do you want to create it based on compose_dev.yaml? (y/n): "
read CREATE_FILE
if [[ "$CREATE_FILE" == "y" || "$CREATE_FILE" == "Y" ]]; then
# Create new compose file based on compose_dev.yaml with version variables
sed 's/\(image: josakola\/[^:]*\):latest/\1:${EVEAI_VERSION:-latest}/g' compose_dev.yaml > "$COMPOSE_FILE"
echo "Created $COMPOSE_FILE with version placeholders."
else
echo "Cannot proceed without a valid compose file."
return 1
fi
fi
# Switch Docker context
echo "Switching to Docker context: $DOCKER_CONTEXT"
docker context use $DOCKER_CONTEXT
# Set environment variables
export COMPOSE_FILE=$COMPOSE_FILE
export EVEAI_VERSION=$VERSION
export DOCKER_ACCOUNT=$DOCKER_ACCOUNT
echo "Set COMPOSE_FILE to $COMPOSE_FILE"
echo "Set EVEAI_VERSION to $VERSION"
echo "Set DOCKER_ACCOUNT to $DOCKER_ACCOUNT"
docker-compose() {
docker compose -f $COMPOSE_FILE "$@"
}
dc() {
docker compose -f $COMPOSE_FILE "$@"
}
dcup() {
docker compose -f $COMPOSE_FILE up -d --remove-orphans "$@"
}
dcdown() {
docker compose -f $COMPOSE_FILE down "$@"
}
dcps() {
docker compose -f $COMPOSE_FILE ps "$@"
}
dclogs() {
docker compose -f $COMPOSE_FILE logs "$@"
}
dcpull() {
docker compose -f $COMPOSE_FILE pull "$@"
}
dcrefresh() {
docker compose -f $COMPOSE_FILE pull && docker compose -f $COMPOSE_FILE up -d --remove-orphans "$@"
}
# Exporteer de functies zodat ze beschikbaar zijn in andere scripts
export -f docker-compose dc dcup dcdown dcps dclogs dcpull dcrefresh
echo "Docker environment switched to $ENVIRONMENT with version $VERSION"
echo "You can now use 'docker-compose', 'dc', 'dcup', 'dcdown', 'dcps', 'dclogs', 'dcpull' or 'dcrefresh' commands"

250
docker/podman_env_switch.sh Normal file
View File

@@ -0,0 +1,250 @@
#!/usr/bin/env zsh
# Function to display usage information
usage() {
echo "Usage: source $0 <environment> [version]"
echo " environment: The environment to use (dev, prod, test, integration, bugfix)"
echo " version : (Optional) Specific release version to deploy"
echo " If not specified, uses 'latest' (except for dev environment)"
}
# Check if the script is sourced - improved for both bash and zsh
is_sourced() {
if [[ -n "$ZSH_VERSION" ]]; then
# In zsh, check if we're in a sourced context
[[ "$ZSH_EVAL_CONTEXT" =~ "(:file|:cmdsubst)" ]] || [[ "$0" != "$ZSH_ARGZERO" ]]
else
# In bash, compare BASH_SOURCE with $0
[[ "${BASH_SOURCE[0]}" != "${0}" ]]
fi
}
if ! is_sourced; then
echo "Error: This script must be sourced, not executed directly."
echo "Please run: source $0 <environment> [version]"
if [[ -n "$ZSH_VERSION" ]]; then
return 1 2>/dev/null || exit 1
else
exit 1
fi
fi
# Check if an environment is provided
if [ $# -eq 0 ]; then
usage
return 1
fi
ENVIRONMENT=$1
VERSION=${2:-latest} # Default to latest if not specified
# Check if podman and podman-compose are available
if ! command -v podman &> /dev/null; then
echo "Error: podman is not installed or not in PATH"
echo "Please install podman first"
return 1
fi
if ! command -v podman-compose &> /dev/null; then
echo "Error: podman-compose is not installed or not in PATH"
echo "Please install podman-compose first"
return 1
fi
CONTAINER_CMD="podman"
# Store the actual path to podman-compose to avoid recursion
COMPOSE_CMD_PATH=$(command -v podman-compose)
echo "Using container runtime: $CONTAINER_CMD"
echo "Using compose command: $COMPOSE_CMD_PATH"
# Set default platform to AMD64 for consistency
export BUILDAH_PLATFORM=linux/amd64
export PODMAN_PLATFORM=linux/amd64
# Set variables based on the environment
case $ENVIRONMENT in
dev)
PODMAN_CONNECTION="default"
COMPOSE_FILE="compose_dev.yaml"
VERSION="latest" # Always use latest for dev
;;
prod)
PODMAN_CONNECTION="mxz536.stackhero-network.com"
COMPOSE_FILE="compose_stackhero.yaml"
;;
test)
PODMAN_CONNECTION="test-environment"
COMPOSE_FILE="compose_test.yaml"
;;
integration)
PODMAN_CONNECTION="integration-environment"
COMPOSE_FILE="compose_integration.yaml"
;;
bugfix)
PODMAN_CONNECTION="bugfix-environment"
COMPOSE_FILE="compose_bugfix.yaml"
;;
*)
echo "Invalid environment: $ENVIRONMENT"
usage
return 1
;;
esac
# Set container registry account
CONTAINER_ACCOUNT="josakola"
# Handle remote connections for podman
if [[ "$PODMAN_CONNECTION" != "default" ]]; then
echo "Setting up remote podman connection: $PODMAN_CONNECTION"
# Check if podman connection exists
if ! podman system connection list --format '{{.Name}}' 2>/dev/null | grep -q "^$PODMAN_CONNECTION$"; then
echo "Warning: Podman connection '$PODMAN_CONNECTION' does not exist."
echo -n "Do you want to set up this connection now? (y/n): "
read -r CREATE_CONNECTION
if [[ "$CREATE_CONNECTION" == "y" || "$CREATE_CONNECTION" == "Y" ]]; then
echo -n "Please specify the SSH connection string (e.g., user@remote_host): "
read -r SSH_CONNECTION
if [[ -n "$SSH_CONNECTION" ]]; then
podman system connection add "$PODMAN_CONNECTION" --identity ~/.ssh/id_rsa "ssh://$SSH_CONNECTION/run/user/1000/podman/podman.sock"
if [[ $? -ne 0 ]]; then
echo "Failed to create podman connection. Please create it manually."
return 1
fi
else
echo "No SSH connection string provided."
return 1
fi
else
echo "Using local podman setup instead."
PODMAN_CONNECTION="default"
fi
fi
# Set the connection
if [[ "$PODMAN_CONNECTION" != "default" ]]; then
# Use podman context instead of manually setting CONTAINER_HOST
podman system connection default "$PODMAN_CONNECTION" 2>/dev/null
if [[ $? -eq 0 ]]; then
echo "Switched to remote podman connection: $PODMAN_CONNECTION"
else
echo "Warning: Failed to switch to connection $PODMAN_CONNECTION, using local setup"
PODMAN_CONNECTION="default"
fi
fi
else
echo "Using local podman setup with AMD64 platform"
# Ensure we're using the default local connection
podman system connection default "" 2>/dev/null || true
fi
# Check if compose file exists
if [[ ! -f "$COMPOSE_FILE" ]]; then
echo "Warning: Compose file '$COMPOSE_FILE' does not exist."
if [[ -f "compose_dev.yaml" ]]; then
echo -n "Do you want to create it based on compose_dev.yaml? (y/n): "
read -r CREATE_FILE
if [[ "$CREATE_FILE" == "y" || "$CREATE_FILE" == "Y" ]]; then
# Create new compose file based on compose_dev.yaml with version variables
if sed 's/\(image: josakola\/[^:]*\):latest/\1:${EVEAI_VERSION:-latest}/g' compose_dev.yaml > "$COMPOSE_FILE" 2>/dev/null; then
echo "Created $COMPOSE_FILE with version placeholders."
else
echo "Failed to create $COMPOSE_FILE"
return 1
fi
else
echo "Cannot proceed without a valid compose file."
return 1
fi
else
echo "Cannot create $COMPOSE_FILE: compose_dev.yaml not found."
return 1
fi
fi
# Set environment variables
export COMPOSE_FILE=$COMPOSE_FILE
export EVEAI_VERSION=$VERSION
export CONTAINER_ACCOUNT=$CONTAINER_ACCOUNT
export CONTAINER_CMD=$CONTAINER_CMD
export COMPOSE_CMD_PATH=$COMPOSE_CMD_PATH
echo "Set COMPOSE_FILE to $COMPOSE_FILE"
echo "Set EVEAI_VERSION to $VERSION"
echo "Set CONTAINER_ACCOUNT to $CONTAINER_ACCOUNT"
echo "Set platform to AMD64 (linux/amd64)"
# Define compose wrapper functions using the full path to avoid recursion
pc() {
$COMPOSE_CMD_PATH -f $COMPOSE_FILE "$@"
}
pcup() {
$COMPOSE_CMD_PATH -f $COMPOSE_FILE up -d --remove-orphans "$@"
}
pcdown() {
$COMPOSE_CMD_PATH -f $COMPOSE_FILE down "$@"
}
pcps() {
$COMPOSE_CMD_PATH -f $COMPOSE_FILE ps "$@"
}
pclogs() {
$COMPOSE_CMD_PATH -f $COMPOSE_FILE logs "$@"
}
# Simplified pull - no platform tricks needed
pcpull() {
echo "Pulling AMD64 images..."
$COMPOSE_CMD_PATH -f $COMPOSE_FILE pull "$@"
}
pcrefresh() {
$COMPOSE_CMD_PATH -f $COMPOSE_FILE pull && $COMPOSE_CMD_PATH -f $COMPOSE_FILE up -d --remove-orphans "$@"
}
pcbuild() {
$COMPOSE_CMD_PATH -f $COMPOSE_FILE build "$@"
}
pcrestart() {
$COMPOSE_CMD_PATH -f $COMPOSE_FILE restart "$@"
}
pcstop() {
$COMPOSE_CMD_PATH -f $COMPOSE_FILE stop "$@"
}
pcstart() {
$COMPOSE_CMD_PATH -f $COMPOSE_FILE start "$@"
}
# Export functions - handle both bash and zsh
if [[ -n "$ZSH_VERSION" ]]; then
# In zsh, functions are automatically available in subshells
# But we can make them available globally with typeset
typeset -f pc pcup pcdown pcps pclogs pcpull pcrefresh pcbuild pcrestart pcstop pcstart > /dev/null
else
# Bash style export
export -f pc pcup pcdown pcps pclogs pcpull pcrefresh pcbuild pcrestart pcstop pcstart
fi
echo "✅ Podman environment switched to $ENVIRONMENT with version $VERSION"
echo "🖥️ Platform: AMD64 (compatible with both Intel and Apple Silicon)"
echo "Available commands:"
echo " pc - podman-compose shorthand"
echo " pcup - start services in background"
echo " pcdown - stop and remove services"
echo " pcps - list running services"
echo " pclogs - view service logs"
echo " pcpull - pull latest images"
echo " pcrefresh - pull and restart services"
echo " pcbuild - build services"
echo " pcrestart - restart services"
echo " pcstop - stop services"
echo " pcstart - start stopped services"