From dca252827caa95a1cf3fd2b0ebc95766b0ef2d20 Mon Sep 17 00:00:00 2001 From: Daniel Luiz Alves Date: Wed, 16 Apr 2025 15:24:20 -0300 Subject: [PATCH] refactor: remove deprecated Makefile and generate-docker-compose.sh The Makefile and generate-docker-compose.sh script were removed as they are no longer needed. The docker-compose.yaml file was updated to include inline comments and use the latest image tag for the palmr-app service. This cleanup simplifies the project structure and ensures clarity in the docker-compose configuration. --- Makefile | 3 - composes/docker-compose-base.yaml | 103 ----------------------------- docker-compose.yaml | 6 +- scripts/generate-docker-compose.sh | 48 -------------- 4 files changed, 3 insertions(+), 157 deletions(-) delete mode 100644 Makefile delete mode 100644 composes/docker-compose-base.yaml delete mode 100755 scripts/generate-docker-compose.sh diff --git a/Makefile b/Makefile deleted file mode 100644 index 7aa4fc6..0000000 --- a/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -gen-compose: - chmod +x ./scripts/generate-docker-compose.sh - ./scripts/generate-docker-compose.sh diff --git a/composes/docker-compose-base.yaml b/composes/docker-compose-base.yaml deleted file mode 100644 index ec6b4dd..0000000 --- a/composes/docker-compose-base.yaml +++ /dev/null @@ -1,103 +0,0 @@ -services: - palmr-api: - image: kyantech/palmr-api:latest - container_name: palmr-api - depends_on: - postgres: - condition: "service_healthy" - minio: - condition: "service_healthy" - environment: - - PORT=3333 - - DATABASE_URL=postgresql://postgres:{{DB_PASSWORD}}@postgres:5432/palmr_db?schema=public - - MINIO_ENDPOINT=minio - - MINIO_PORT=9000 - - MINIO_USE_SSL=false - - MINIO_ROOT_USER={{MINIO_ROOT_USER}} - - MINIO_ROOT_PASSWORD={{MINIO_ROOT_PASSWORD}} - - MINIO_REGION=sa-east-1 - - MINIO_BUCKET_NAME=files - - FRONTEND_URL=http://localhost:4173 - - BASE_URL=http://localhost:3333 - ports: - - "3333:3333" - restart: unless-stopped - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:3333/health"] - interval: 10s - timeout: 5s - retries: 5 - start_period: 30s - - palmr-app: - image: kyantech/palmr-app:latest - container_name: palmr-web - ports: - - "4173:4173" - depends_on: - palmr-api: - condition: "service_healthy" - restart: unless-stopped - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:4173"] - interval: 10s - timeout: 5s - retries: 5 - start_period: 10s - - minio: - image: minio/minio:RELEASE.2025-03-12T18-04-18Z - container_name: minio - environment: - - MINIO_ROOT_USER={{MINIO_ROOT_USER}} - - MINIO_ROOT_PASSWORD={{MINIO_ROOT_PASSWORD}} - - MINIO_SITE_REGION=sa-east-1 - command: server /data --console-address ":9001" - volumes: - - minio_data:/data - ports: - - "9000:9000" - - "9001:9001" - restart: unless-stopped - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/ready"] - interval: 10s - timeout: 5s - retries: 5 - - minio-init: - image: minio/mc:RELEASE.2025-03-12T17-29-24Z - container_name: minio-init - depends_on: - minio: - condition: "service_healthy" - restart: "no" - entrypoint: > - sh -c " - sleep 5 && - mc alias set myminio http://minio:9000 {{MINIO_ROOT_USER}} {{MINIO_ROOT_PASSWORD}} && - mc mb myminio/files --ignore-existing && - mc anonymous set download myminio/files - " - - postgres: - image: bitnami/postgresql:17.2.0 - container_name: palmr-postgres - environment: - - POSTGRESQL_USERNAME=postgres - - POSTGRESQL_PASSWORD={{DB_PASSWORD}} - - POSTGRESQL_DATABASE=palmr_db - volumes: - - postgres_data:/bitnami/postgresql - ports: - - "5432:5432" - restart: unless-stopped - healthcheck: - test: ["CMD", "pg_isready", "-U", "palmr"] - interval: 10s - timeout: 5s - retries: 5 - -volumes: - minio_data: - postgres_data: diff --git a/docker-compose.yaml b/docker-compose.yaml index 4058286..82cdb51 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,7 +8,7 @@ services: minio: condition: "service_healthy" environment: - - PORT=3333 + - PORT=3333 # Port for the backend service - DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD:-postgresRootPassword}@postgres:5432/palmr_db?schema=public # Database URL with configurable password through POSTGRES_PASSWORD env var - MINIO_ENDPOINT=minio # This can change if your MinIO is at a different address - MINIO_PORT=9000 # Default MinIO port (Change if yours is not the default) @@ -20,7 +20,7 @@ services: - FRONTEND_URL=http://localhost:3000 # Frontend URL - Make sure to use the correct frontend URL, depends on where the frontend is running - BASE_URL=http://localhost:3333 ports: - - "3333:3333" + - "3333:3333" # Backend port mapping restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost:3333/health"] @@ -30,7 +30,7 @@ services: start_period: 30s palmr-app: - image: kyantech/palmr-app:v2.0.0-beta # Make sure to use the correct version (latest) of the image + image: kyantech/palmr-app:latest # Make sure to use the correct version (latest) of the image container_name: palmr-web depends_on: palmr-api: diff --git a/scripts/generate-docker-compose.sh b/scripts/generate-docker-compose.sh deleted file mode 100755 index afd7dd0..0000000 --- a/scripts/generate-docker-compose.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -export LC_ALL=C - -generate_password() { - cat /dev/urandom | LC_ALL=C tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1 -} - -generate_minio_user() { - local words=("alpha" "beta" "gamma" "delta" "omega" "light" "dark" "space" "star" "fire" "sky" "moon" "earth" "storm" "wave" "sun" "cloud" "wind" "rain" "shadow" "flame") - local word1="${words[$RANDOM % ${#words[@]}]}" - local word2="${words[$RANDOM % ${#words[@]}]}" - printf "%s_%s" "$word1" "$word2" -} - -MINIO_ROOT_USER=$(generate_minio_user) -MINIO_ROOT_PASSWORD=$(generate_password) -DB_PASSWORD=$(generate_password) - -input_file="composes/docker-compose-base.yaml" -output_file="docker-compose.yaml" - -# Check if docker-compose.yaml already exists -if [ -f "$output_file" ]; then - read -p $'\033[1;33mThe file docker-compose.yaml already exists. Do you want to replace it? (y/N) \033[0m' response - if [[ ! "$response" =~ ^[yY]$ ]]; then - echo -e "\033[1;31mOperation cancelled.\033[0m" - exit 1 - fi -fi - -sed "s/{{MINIO_ROOT_USER}}/$MINIO_ROOT_USER/g; s/{{MINIO_ROOT_PASSWORD}}/$MINIO_ROOT_PASSWORD/g; s/{{DB_PASSWORD}}/$DB_PASSWORD/g" "$input_file" > "$output_file" - - -# Print a styled header -echo -e "\n\033[1;34m┌────────────────────────────────────────────┐" -echo -e "│ Generated Credentials │" -echo -e "└────────────────────────────────────────────┘\033[0m\n" - -# Print variables in a table format with colors -echo -e "\033[1;36m Variable Name │ Value\033[0m" -echo -e "\033[1;36m────────────────────┼───────────────────────\033[0m" -echo -e " MINIO_ROOT_USER │ \033[1;33m$MINIO_ROOT_USER\033[0m" -echo -e " MINIO_ROOT_PASSWORD│ \033[1;33m$MINIO_ROOT_PASSWORD\033[0m" -echo -e " DB_PASSWORD │ \033[1;33m$DB_PASSWORD\033[0m" -echo - -echo -e "\033[1;32m✔ docker-compose.yaml file generated successfully.\033[0m\n"