this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Switch from localstack to minio

+102 -25
+17 -10
docker-compose.yaml
··· 23 23 ports: 24 24 - "6380:6379" 25 25 26 - localstack: 27 - image: localstack/localstack:latest 26 + minio: 27 + image: minio/minio:latest 28 28 restart: unless-stopped 29 29 environment: 30 - - AWS_DEFAULT_REGION=ap-south-1 31 - - EDGE_PORT=4566 32 - - SERVICES=s3 33 - - EXTRA_CORS_ALLOWED_ORIGINS=* 34 - - EXTRA_CORS_ALLOWED_HEADERS=* 30 + MINIO_ROOT_USER: minioadmin 31 + MINIO_ROOT_PASSWORD: minioadmin 32 + AWS_DEFAULT_REGION: ap-south-1 # To maintain compatibility with existing apps 35 33 volumes: 36 - - "${TEMPDIR:-./care/media/localstack}:/var/lib/localstack" 37 - - "./docker/awslocal:/etc/localstack/init/ready.d/" 34 + - "./care/media/minio:/data" 35 + - "./docker/minio/init-script.sh:/init-script.sh:ro" # Mount the init script 36 + - "./docker/minio/entrypoint.sh:/entrypoint.sh:ro" # Mount the entrypoint script 38 37 ports: 39 - - "4566:4566" 38 + - "9100:9000" # S3 API 39 + - "9001:9001" # Web Console 40 + entrypoint: ["/entrypoint.sh"] 41 + healthcheck: 42 + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/ready"] 43 + interval: 10s 44 + retries: 5 45 + start_period: 10s 46 + timeout: 10s 40 47 41 48 volumes: 42 49 postgres-data:
+4 -4
docker/.local.env
··· 10 10 DJANGO_DEBUG=False 11 11 12 12 BUCKET_REGION=ap-south-1 13 - BUCKET_KEY=key 14 - BUCKET_SECRET=secret 15 - BUCKET_ENDPOINT=http://localstack:4566 16 - BUCKET_EXTERNAL_ENDPOINT=http://localhost:4566 13 + BUCKET_KEY=minioadmin 14 + BUCKET_SECRET=minioadmin 15 + BUCKET_ENDPOINT=http://minio:9000 16 + BUCKET_EXTERNAL_ENDPOINT=http://localhost:9100 17 17 FILE_UPLOAD_BUCKET=patient-bucket 18 18 FACILITY_S3_BUCKET=facility-bucket 19 19
+4 -4
docker/.prebuilt.env
··· 10 10 DJANGO_DEBUG=False 11 11 12 12 BUCKET_REGION=ap-south-1 13 - BUCKET_KEY=key 14 - BUCKET_SECRET=secret 15 - BUCKET_ENDPOINT=http://localstack:4566 16 - BUCKET_EXTERNAL_ENDPOINT=http://localhost:4566 13 + BUCKET_KEY=minioadmin 14 + BUCKET_SECRET=minioadmin 15 + BUCKET_ENDPOINT=http://minio:9000 16 + BUCKET_EXTERNAL_ENDPOINT=http://localhost:9100 17 17 FILE_UPLOAD_BUCKET=patient-bucket 18 18 FACILITY_S3_BUCKET=facility-bucket 19 19
-6
docker/awslocal/bucket-setup.sh
··· 1 - #!/usr/bin/sh 2 - 3 - set -x 4 - awslocal s3 mb s3://patient-bucket 5 - awslocal s3 mb s3://facility-bucket 6 - set +x
+16
docker/minio/entrypoint.sh
··· 1 + #!/bin/sh 2 + 3 + # Start MinIO in the background 4 + minio server /data --console-address ":9001" & 5 + 6 + # Wait for MinIO to be ready before running the initialization script 7 + until curl -s http://localhost:9000/minio/health/ready; do 8 + echo "Waiting for MinIO to be ready..." 9 + sleep 5 10 + done 11 + 12 + # Run the bucket setup script 13 + sh /init-script.sh 14 + 15 + # Keep the container running 16 + wait $!
+60
docker/minio/init-script.sh
··· 1 + #!/bin/sh 2 + 3 + set -e 4 + 5 + # MinIO configuration 6 + MINIO_HOST=${MINIO_HOST:-"http://localhost:9000"} 7 + MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY:-"minioadmin"} 8 + MINIO_SECRET_KEY=${MINIO_SECRET_KEY:-"minioadmin"} 9 + 10 + # Max retries and delay 11 + MAX_RETRIES=10 12 + RETRY_COUNT=0 13 + RETRY_DELAY=5 # 5 seconds delay between retries 14 + 15 + # Function to retry a command 16 + retry_command() { 17 + local cmd=$1 18 + until $cmd; do 19 + RETRY_COUNT=$((RETRY_COUNT + 1)) 20 + if [ $RETRY_COUNT -ge $MAX_RETRIES ]; then 21 + echo "Command failed after $MAX_RETRIES attempts. Exiting..." 22 + exit 1 23 + fi 24 + echo "Command failed. Retrying ($RETRY_COUNT/$MAX_RETRIES)..." 25 + sleep $RETRY_DELAY 26 + done 27 + } 28 + 29 + # Function to create a bucket if it doesn't exist 30 + create_bucket_if_not_exists() { 31 + BUCKET_NAME=$1 32 + echo "Checking if bucket $BUCKET_NAME exists..." 33 + if mc ls local/$BUCKET_NAME > /dev/null 2>&1; then 34 + echo "Bucket $BUCKET_NAME already exists. Skipping creation." 35 + else 36 + echo "Creating bucket $BUCKET_NAME..." 37 + mc mb local/$BUCKET_NAME 38 + fi 39 + } 40 + 41 + # Function to set a bucket public 42 + set_bucket_public() { 43 + BUCKET_NAME=$1 44 + echo "Setting bucket $BUCKET_NAME as public..." 45 + mc anonymous set public local/$BUCKET_NAME 46 + } 47 + 48 + # Retry MinIO Client alias setup 49 + retry_command "mc alias set local $MINIO_HOST $MINIO_ACCESS_KEY $MINIO_SECRET_KEY" 50 + 51 + # Create the necessary buckets 52 + create_bucket_if_not_exists "patient-bucket" 53 + create_bucket_if_not_exists "facility-bucket" 54 + 55 + # Set only facility-bucket as public 56 + set_bucket_public "facility-bucket" 57 + 58 + # Graceful exit 59 + echo "Bucket setup completed successfully." 60 + exit 0
+1 -1
docs/local-setup/configuration.rst
··· 16 16 - care (main repo) 17 17 - redis (in-memory cache) 18 18 - celery (task queue) 19 - - localstack (to mimic AWS services locally) 19 + - minio (to mimic AWS services locally) 20 20 21 21 This is the most recommended way of setting up care locally, 22 22 as it installs appropriate dependencies in containers so there