Trim whitespaces from files. (#92)

* docker-composer.yml: Remove trailing whitespace.

Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>

* .env.example: Trim training whitespace.

Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>

* start_services.py: Trim training whitespace.

Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>

---------

Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>
This commit is contained in:
Elvis Dowson
2025-06-10 09:00:13 -04:00
committed by GitHub
parent 7e76a80bb8
commit 02f7b94a03
3 changed files with 40 additions and 40 deletions

View File

@@ -1,7 +1,7 @@
# Change the name of this file to .env after updating it!
############
# [required]
# [required]
# n8n credentials - you set this to whatever you want, just make it a long and secure string for both!
############
@@ -10,7 +10,7 @@ N8N_USER_MANAGEMENT_JWT_SECRET=even-more-secret
############
# [required]
# [required]
# Supabase Secrets
# YOU MUST CHANGE THESE BEFORE GOING INTO PRODUCTION
@@ -32,7 +32,7 @@ DASHBOARD_PASSWORD=this_password_is_insecure_and_should_be_updated
POOLER_TENANT_ID=your-tenant-id
############
# [required]
# [required]
# Neo4j username and password
# Replace "neo4j" with your chosen username and "password" with your chosen password.
# Keep the "/" as a separator between the two.
@@ -41,12 +41,12 @@ POOLER_TENANT_ID=your-tenant-id
NEO4J_AUTH=neo4j/password
############
# [required]
# [required]
# Langfuse credentials
# Each of the secret keys you can set to whatever you want, just make it secure!
# For the encryption key, use the command `openssl rand -hex 32`
# openssl is available by defualt on Linux/Mac
# For Windows, you can use the 'Git Bash' terminal installed with git
# For Windows, you can use the 'Git Bash' terminal installed with git
############
CLICKHOUSE_PASSWORD=super-secret-key-1
@@ -56,7 +56,7 @@ NEXTAUTH_SECRET=super-secret-key-4
ENCRYPTION_KEY=generate-with-openssl # generate via `openssl rand -hex 32`
############
# [required for prod]
# [required for prod]
# Caddy Config
# By default listen on https://localhost:[service port] and don't use an email for SSL

View File

@@ -64,9 +64,9 @@ services:
environment:
- PORT=3001
- FLOWISE_USERNAME=${FLOWISE_USERNAME}
- FLOWISE_PASSWORD=${FLOWISE_PASSWORD}
- FLOWISE_PASSWORD=${FLOWISE_PASSWORD}
extra_hosts:
- "host.docker.internal:host-gateway"
- "host.docker.internal:host-gateway"
volumes:
- ~/.flowise:/root/.flowise
entrypoint: /bin/sh -c "sleep 3; flowise start"
@@ -90,7 +90,7 @@ services:
- "-c"
- "n8n import:credentials --separate --input=/backup/credentials && n8n import:workflow --separate --input=/backup/workflows"
volumes:
- ./n8n/backup:/backup
- ./n8n/backup:/backup
n8n:
<<: *service-n8n
@@ -129,7 +129,7 @@ services:
- 7687/tcp
environment:
- NEO4J_AUTH=${NEO4J_AUTH:-"neo4j/your_password"}
restart: always
restart: always
caddy:
container_name: caddy
@@ -172,7 +172,7 @@ services:
restart: always
depends_on: &langfuse-depends-on
postgres:
condition: service_healthy
condition: service_healthy
minio:
condition: service_healthy
redis:
@@ -303,7 +303,7 @@ services:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: postgres
volumes:
- langfuse_postgres_data:/var/lib/postgresql/data
- langfuse_postgres_data:/var/lib/postgresql/data
redis:
container_name: redis
@@ -329,7 +329,7 @@ services:
test: ["CMD", "redis-cli", "ping"]
interval: 3s
timeout: 10s
retries: 10
retries: 10
searxng:
container_name: searxng
@@ -353,7 +353,7 @@ services:
driver: "json-file"
options:
max-size: "1m"
max-file: "1"
max-file: "1"
ollama-cpu:
profiles: ["cpu"]

View File

@@ -80,16 +80,16 @@ def start_local_ai(profile=None, environment=None):
def generate_searxng_secret_key():
"""Generate a secret key for SearXNG based on the current platform."""
print("Checking SearXNG settings...")
# Define paths for SearXNG settings files
settings_path = os.path.join("searxng", "settings.yml")
settings_base_path = os.path.join("searxng", "settings-base.yml")
# Check if settings-base.yml exists
if not os.path.exists(settings_base_path):
print(f"Warning: SearXNG base settings file not found at {settings_base_path}")
return
# Check if settings.yml exists, if not create it from settings-base.yml
if not os.path.exists(settings_path):
print(f"SearXNG settings.yml not found. Creating from {settings_base_path}...")
@@ -101,12 +101,12 @@ def generate_searxng_secret_key():
return
else:
print(f"SearXNG settings.yml already exists at {settings_path}")
print("Generating SearXNG secret key...")
# Detect the platform and run the appropriate command
system = platform.system()
try:
if system == "Windows":
print("Detected Windows platform, using PowerShell to generate secret key...")
@@ -119,7 +119,7 @@ def generate_searxng_secret_key():
"(Get-Content searxng/settings.yml) -replace 'ultrasecretkey', $secretKey | Set-Content searxng/settings.yml"
]
subprocess.run(ps_command, check=True)
elif system == "Darwin": # macOS
print("Detected macOS platform, using sed command with empty string parameter...")
# macOS sed command requires an empty string for the -i parameter
@@ -127,7 +127,7 @@ def generate_searxng_secret_key():
random_key = subprocess.check_output(openssl_cmd).decode('utf-8').strip()
sed_cmd = ["sed", "-i", "", f"s|ultrasecretkey|{random_key}|g", settings_path]
subprocess.run(sed_cmd, check=True)
else: # Linux and other Unix-like systems
print("Detected Linux/Unix platform, using standard sed command...")
# Standard sed command for Linux
@@ -135,9 +135,9 @@ def generate_searxng_secret_key():
random_key = subprocess.check_output(openssl_cmd).decode('utf-8').strip()
sed_cmd = ["sed", "-i", f"s|ultrasecretkey|{random_key}|g", settings_path]
subprocess.run(sed_cmd, check=True)
print("SearXNG secret key generated successfully.")
except Exception as e:
print(f"Error generating SearXNG secret key: {e}")
print("You may need to manually generate the secret key using the commands:")
@@ -155,15 +155,15 @@ def check_and_fix_docker_compose_for_searxng():
if not os.path.exists(docker_compose_path):
print(f"Warning: Docker Compose file not found at {docker_compose_path}")
return
try:
# Read the docker-compose.yml file
with open(docker_compose_path, 'r') as file:
content = file.read()
# Default to first run
is_first_run = True
# Check if Docker is running and if the SearXNG container exists
try:
# Check if the SearXNG container is running
@@ -172,18 +172,18 @@ def check_and_fix_docker_compose_for_searxng():
capture_output=True, text=True, check=True
)
searxng_containers = container_check.stdout.strip().split('\n')
# If SearXNG container is running, check inside for uwsgi.ini
if any(container for container in searxng_containers if container):
container_name = next(container for container in searxng_containers if container)
print(f"Found running SearXNG container: {container_name}")
# Check if uwsgi.ini exists inside the container
container_check = subprocess.run(
["docker", "exec", container_name, "sh", "-c", "[ -f /etc/searxng/uwsgi.ini ] && echo 'found' || echo 'not_found'"],
capture_output=True, text=True, check=False
)
if "found" in container_check.stdout:
print("Found uwsgi.ini inside the SearXNG container - not first run")
is_first_run = False
@@ -194,26 +194,26 @@ def check_and_fix_docker_compose_for_searxng():
print("No running SearXNG container found - assuming first run")
except Exception as e:
print(f"Error checking Docker container: {e} - assuming first run")
if is_first_run and "cap_drop: - ALL" in content:
print("First run detected for SearXNG. Temporarily removing 'cap_drop: - ALL' directive...")
# Temporarily comment out the cap_drop line
modified_content = content.replace("cap_drop: - ALL", "# cap_drop: - ALL # Temporarily commented out for first run")
# Write the modified content back
with open(docker_compose_path, 'w') as file:
file.write(modified_content)
print("Note: After the first run completes successfully, you should re-add 'cap_drop: - ALL' to docker-compose.yml for security reasons.")
elif not is_first_run and "# cap_drop: - ALL # Temporarily commented out for first run" in content:
print("SearXNG has been initialized. Re-enabling 'cap_drop: - ALL' directive for security...")
# Uncomment the cap_drop line
modified_content = content.replace("# cap_drop: - ALL # Temporarily commented out for first run", "cap_drop: - ALL")
# Write the modified content back
with open(docker_compose_path, 'w') as file:
file.write(modified_content)
except Exception as e:
print(f"Error checking/modifying docker-compose.yml for SearXNG: {e}")
@@ -227,20 +227,20 @@ def main():
clone_supabase_repo()
prepare_supabase_env()
# Generate SearXNG secret key and check docker-compose.yml
generate_searxng_secret_key()
check_and_fix_docker_compose_for_searxng()
stop_existing_containers(args.profile)
# Start Supabase first
start_supabase(args.environment)
# Give Supabase some time to initialize
print("Waiting for Supabase to initialize...")
time.sleep(10)
# Then start the local AI services
start_local_ai(args.profile, args.environment)