- Getting containers ready for the cloud
This commit is contained in:
1
.idea/sqldialects.xml
generated
1
.idea/sqldialects.xml
generated
@@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="SqlDialectMappings">
|
<component name="SqlDialectMappings">
|
||||||
<file url="file://$PROJECT_DIR$/common/utils/database.py" dialect="GenericSQL" />
|
|
||||||
<file url="PROJECT" dialect="PostgreSQL" />
|
<file url="PROJECT" dialect="PostgreSQL" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
78
docker/build_and_push_eveai.sh
Executable file
78
docker/build_and_push_eveai.sh
Executable file
@@ -0,0 +1,78 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Exit on any error
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Load environment variables
|
||||||
|
source .env
|
||||||
|
|
||||||
|
# Docker registry
|
||||||
|
REGISTRY="josakola"
|
||||||
|
|
||||||
|
# Tag (you might want to use a version or git commit hash)
|
||||||
|
TAG="latest"
|
||||||
|
|
||||||
|
# Platforms to build for
|
||||||
|
PLATFORMS="linux/amd64,linux/arm64"
|
||||||
|
|
||||||
|
# Function to build and push a service
|
||||||
|
build_and_push_service() {
|
||||||
|
local SERVICE="$1"
|
||||||
|
echo "Building and pushing $SERVICE..."
|
||||||
|
|
||||||
|
# Extract the build context and dockerfile from the compose file
|
||||||
|
CONTEXT=$(yq e ".services.$SERVICE.build.context" compose_dev.yaml)
|
||||||
|
DOCKERFILE=$(yq e ".services.$SERVICE.build.dockerfile" compose_dev.yaml)
|
||||||
|
|
||||||
|
# Check if context directory exists
|
||||||
|
if [ ! -d "$CONTEXT" ]; then
|
||||||
|
echo "Error: Build context directory '$CONTEXT' for service '$SERVICE' does not exist."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if Dockerfile exists
|
||||||
|
if [ ! -f "$CONTEXT/$DOCKERFILE" ]; then
|
||||||
|
echo "Error: Dockerfile '$DOCKERFILE' for service '$SERVICE' does not exist in context '$CONTEXT'."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build and push
|
||||||
|
docker buildx build \
|
||||||
|
--platform "$PLATFORMS" \
|
||||||
|
-t "$REGISTRY/$SERVICE:$TAG" \
|
||||||
|
-f "$CONTEXT/$DOCKERFILE" \
|
||||||
|
"$CONTEXT" \
|
||||||
|
--push
|
||||||
|
}
|
||||||
|
|
||||||
|
# If no arguments are provided, build all services
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
mapfile -t SERVICES < <(yq e '.services | keys | .[]' compose_dev.yaml | grep -E '^(nginx|eveai_)')
|
||||||
|
else
|
||||||
|
SERVICES=("$@")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if eveai_builder exists, if not create it
|
||||||
|
if ! docker buildx inspect eveai_builder > /dev/null 2>&1; then
|
||||||
|
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
|
||||||
|
for SERVICE in "${SERVICES[@]}"; do
|
||||||
|
if [[ "$SERVICE" == "nginx" || "$SERVICE" == eveai_* ]]; then
|
||||||
|
if build_and_push_service "$SERVICE"; then
|
||||||
|
echo "Successfully built and pushed $SERVICE"
|
||||||
|
else
|
||||||
|
echo "Failed to build and push $SERVICE"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Skipping $SERVICE as it's not nginx or doesn't start with eveai_"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "All specified services processed."
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Source the environment setup script
|
|
||||||
if [ -f "./docker_env_switch.sh" ]; then
|
|
||||||
source ./docker_env_switch.sh dev
|
|
||||||
else
|
|
||||||
echo "Error: set_environment.sh not found in the current directory."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Docker Hub username
|
|
||||||
USERNAME="josakola"
|
|
||||||
|
|
||||||
# List of all your services
|
|
||||||
ALL_SERVICES=("eveai_app" "eveai_workers" "eveai_chat" "eveai_chat_workers" "nginx")
|
|
||||||
|
|
||||||
# Function to build, tag and push an image
|
|
||||||
build_tag_and_push() {
|
|
||||||
local service=$1
|
|
||||||
echo "Building, tagging, and pushing ${service}..."
|
|
||||||
|
|
||||||
# Extract dockerfile and context paths from Docker Compose configuration
|
|
||||||
local dockerfile_path
|
|
||||||
local context_path
|
|
||||||
|
|
||||||
dockerfile_path=$(docker compose -f "$COMPOSE_FILE" config | grep "${service}" -A 10 | grep "dockerfile" | awk '{print $2}')
|
|
||||||
context_path=$(docker compose -f "$COMPOSE_FILE" config | grep "${service}" -A 10 | grep "context" | awk '{print $2}')
|
|
||||||
|
|
||||||
# Verify the paths
|
|
||||||
echo "Dockerfile path: ${dockerfile_path}"
|
|
||||||
echo "Context path: ${context_path}"
|
|
||||||
|
|
||||||
# Use docker buildx to build the image
|
|
||||||
docker buildx build \
|
|
||||||
--platform linux/amd64,linux/arm64 \
|
|
||||||
-t "${USERNAME}/${service}:latest" \
|
|
||||||
--push \
|
|
||||||
--file "${dockerfile_path}" \
|
|
||||||
"${context_path}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to check if a service is in the ALL_SERVICES array
|
|
||||||
service_exists() {
|
|
||||||
local service=$1
|
|
||||||
for s in "${ALL_SERVICES[@]}"; do
|
|
||||||
if [[ "$s" == "$service" ]]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ensure we're using buildx
|
|
||||||
docker buildx create --use
|
|
||||||
|
|
||||||
# If COMPOSE_FILE is not set, use a default value
|
|
||||||
if [ -z "$COMPOSE_FILE" ]; then
|
|
||||||
COMPOSE_FILE="compose_dev.yaml"
|
|
||||||
echo "COMPOSE_FILE not set, using default: $COMPOSE_FILE"
|
|
||||||
else
|
|
||||||
echo "Using COMPOSE_FILE: $COMPOSE_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If no arguments are provided, process all services
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
echo "No specific services provided. Processing all services..."
|
|
||||||
for service in "${ALL_SERVICES[@]}"; do
|
|
||||||
build_tag_and_push "$service"
|
|
||||||
done
|
|
||||||
else
|
|
||||||
# Process only the specified services
|
|
||||||
for service in "$@"; do
|
|
||||||
if service_exists "$service"; then
|
|
||||||
build_tag_and_push "$service"
|
|
||||||
else
|
|
||||||
echo "Warning: ${service} is not a recognized service name. Skipping."
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Done!"
|
|
||||||
@@ -33,8 +33,8 @@ x-common-variables: &common-variables
|
|||||||
services:
|
services:
|
||||||
nginx:
|
nginx:
|
||||||
build:
|
build:
|
||||||
context: ../nginx
|
context: ..
|
||||||
dockerfile: Dockerfile
|
dockerfile: ./docker/nginx/Dockerfile
|
||||||
platforms:
|
platforms:
|
||||||
- linux/amd64
|
- linux/amd64
|
||||||
- linux/arm64
|
- linux/arm64
|
||||||
|
|||||||
@@ -33,16 +33,17 @@ x-common-variables: &common-variables
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
nginx:
|
nginx:
|
||||||
image: nginx:latest
|
platform: linux/amd64
|
||||||
|
image: josakola/nginx:latest
|
||||||
ports:
|
ports:
|
||||||
- 80:80
|
- 80:80
|
||||||
- 8080:8080
|
- 8080:8080
|
||||||
volumes:
|
volumes:
|
||||||
- ../nginx:/etc/nginx
|
# - ../nginx:/etc/nginx
|
||||||
- ../nginx/sites-enabled:/etc/nginx/sites-enabled
|
# - ../nginx/sites-enabled:/etc/nginx/sites-enabled
|
||||||
- ../nginx/static:/etc/nginx/static
|
# - ../nginx/static:/etc/nginx/static
|
||||||
- ../nginx/public:/etc/nginx/public
|
# - ../nginx/public:/etc/nginx/public
|
||||||
- ./logs/nginx:/var/log/nginx
|
- logs:/var/log/nginx
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.api.rule=Host(`evie.askeveai.com`)"
|
- "traefik.http.routers.api.rule=Host(`evie.askeveai.com`)"
|
||||||
@@ -52,13 +53,14 @@ services:
|
|||||||
- eveai_chat
|
- eveai_chat
|
||||||
|
|
||||||
eveai_app:
|
eveai_app:
|
||||||
|
platform: linux/amd64
|
||||||
image: josakola/eveai_app:latest
|
image: josakola/eveai_app:latest
|
||||||
ports:
|
ports:
|
||||||
- 5001:5001
|
- 5001:5001
|
||||||
environment:
|
environment:
|
||||||
<<: *common-variables
|
<<: *common-variables
|
||||||
volumes:
|
volumes:
|
||||||
- ./logs:/app/logs
|
- logs:/app/logs
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:5001/health"]
|
test: ["CMD", "curl", "-f", "http://localhost:5001/health"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
@@ -67,13 +69,14 @@ services:
|
|||||||
command: ["sh", "-c", "scripts/start_eveai_app.sh"]
|
command: ["sh", "-c", "scripts/start_eveai_app.sh"]
|
||||||
|
|
||||||
eveai_workers:
|
eveai_workers:
|
||||||
|
platform: linux/amd64
|
||||||
image: josakola/eveai_workers:latest
|
image: josakola/eveai_workers:latest
|
||||||
# ports:
|
# ports:
|
||||||
# - 5001:5001
|
# - 5001:5001
|
||||||
environment:
|
environment:
|
||||||
<<: *common-variables
|
<<: *common-variables
|
||||||
volumes:
|
volumes:
|
||||||
- ./logs:/app/logs
|
- logs:/app/logs
|
||||||
# healthcheck:
|
# healthcheck:
|
||||||
# test: [ "CMD", "curl", "-f", "http://localhost:5001/health" ]
|
# test: [ "CMD", "curl", "-f", "http://localhost:5001/health" ]
|
||||||
# interval: 10s
|
# interval: 10s
|
||||||
@@ -82,13 +85,14 @@ services:
|
|||||||
command: [ "sh", "-c", "scripts/start_eveai_workers.sh" ]
|
command: [ "sh", "-c", "scripts/start_eveai_workers.sh" ]
|
||||||
|
|
||||||
eveai_chat:
|
eveai_chat:
|
||||||
|
platform: linux/amd64
|
||||||
image: josakola/eveai_chat:latest
|
image: josakola/eveai_chat:latest
|
||||||
ports:
|
ports:
|
||||||
- 5002:5002
|
- 5002:5002
|
||||||
environment:
|
environment:
|
||||||
<<: *common-variables
|
<<: *common-variables
|
||||||
volumes:
|
volumes:
|
||||||
- ./logs:/app/logs
|
- logs:/app/logs
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: [ "CMD", "curl", "-f", "http://localhost:5002/health" ] # Adjust based on your health endpoint
|
test: [ "CMD", "curl", "-f", "http://localhost:5002/health" ] # Adjust based on your health endpoint
|
||||||
interval: 10s
|
interval: 10s
|
||||||
@@ -97,13 +101,14 @@ services:
|
|||||||
command: ["sh", "-c", "scripts/start_eveai_chat.sh"]
|
command: ["sh", "-c", "scripts/start_eveai_chat.sh"]
|
||||||
|
|
||||||
eveai_chat_workers:
|
eveai_chat_workers:
|
||||||
|
platform: linux/amd64
|
||||||
image: josakola/eveai_chat_workers:latest
|
image: josakola/eveai_chat_workers:latest
|
||||||
# ports:
|
# ports:
|
||||||
# - 5001:5001
|
# - 5001:5001
|
||||||
environment:
|
environment:
|
||||||
<<: *common-variables
|
<<: *common-variables
|
||||||
volumes:
|
volumes:
|
||||||
- ./logs:/app/logs
|
- logs:/app/logs
|
||||||
# healthcheck:
|
# healthcheck:
|
||||||
# test: [ "CMD", "curl", "-f", "http://localhost:5001/health" ]
|
# test: [ "CMD", "curl", "-f", "http://localhost:5001/health" ]
|
||||||
# interval: 10s
|
# interval: 10s
|
||||||
@@ -112,8 +117,9 @@ services:
|
|||||||
command: [ "sh", "-c", "scripts/start_eveai_chat_workers.sh" ]
|
command: [ "sh", "-c", "scripts/start_eveai_chat_workers.sh" ]
|
||||||
|
|
||||||
|
|
||||||
#volumes:
|
volumes:
|
||||||
# minio_data:
|
logs:
|
||||||
|
# miniAre theo_data:
|
||||||
# db-data:
|
# db-data:
|
||||||
# redis-data:
|
# redis-data:
|
||||||
# tenant-files:
|
# tenant-files:
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ SQLAlchemy~=2.0.31
|
|||||||
tiktoken~=0.7.0
|
tiktoken~=0.7.0
|
||||||
tzdata~=2024.1
|
tzdata~=2024.1
|
||||||
urllib3~=2.2.2
|
urllib3~=2.2.2
|
||||||
uWSGI~=2.0.26
|
|
||||||
WTForms~=3.1.2
|
WTForms~=3.1.2
|
||||||
wtforms-html5~=0.6.1
|
wtforms-html5~=0.6.1
|
||||||
zxcvbn~=4.4.28
|
zxcvbn~=4.4.28
|
||||||
|
|||||||
Reference in New Issue
Block a user