-
Notifications
You must be signed in to change notification settings - Fork 858
feat: implement S3 integration for storing and retrieving digest files #427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/sh | ||
|
||
# Simple script to set up MinIO bucket and user | ||
# Based on example from MinIO issues | ||
|
||
# Format bucket name to ensure compatibility | ||
BUCKET_NAME=$(echo "${S3_BUCKET_NAME}" | tr '[:upper:]' '[:lower:]' | tr '_' '-') | ||
|
||
# Configure MinIO client | ||
mc alias set myminio http://minio:9000 ${MINIO_ROOT_USER} ${MINIO_ROOT_PASSWORD} | ||
|
||
# Remove bucket if it exists (for clean setup) | ||
mc rm -r --force myminio/${BUCKET_NAME} || true | ||
|
||
# Create bucket | ||
mc mb myminio/${BUCKET_NAME} | ||
|
||
# Set bucket policy to allow downloads | ||
mc anonymous set download myminio/${BUCKET_NAME} | ||
|
||
# Create user with access and secret keys | ||
mc admin user add myminio ${S3_ACCESS_KEY} ${S3_SECRET_KEY} || echo "User already exists" | ||
|
||
# Create policy for the bucket | ||
echo '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:*"],"Resource":["arn:aws:s3:::'${BUCKET_NAME}'/*","arn:aws:s3:::'${BUCKET_NAME}'"]}]}' > /tmp/policy.json | ||
|
||
# Apply policy | ||
mc admin policy create myminio gitingest-policy /tmp/policy.json || echo "Policy already exists" | ||
mc admin policy attach myminio gitingest-policy --user ${S3_ACCESS_KEY} | ||
|
||
echo "MinIO setup completed successfully" | ||
echo "Bucket: ${BUCKET_NAME}" | ||
echo "Access via console: http://localhost:9001" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# Common base configuration for all services | ||
x-app-base: &app-base | ||
ports: | ||
- "${APP_WEB_BIND:-8000}:8000" # Main application port | ||
- "${GITINGEST_METRICS_HOST:-127.0.0.1}:${GITINGEST_METRICS_PORT:-9090}:9090" # Metrics port | ||
environment: | ||
# Python Configuration | ||
- PYTHONUNBUFFERED=1 | ||
- PYTHONDONTWRITEBYTECODE=1 | ||
# Host Configuration | ||
- ALLOWED_HOSTS=${ALLOWED_HOSTS:-gitingest.com,*.gitingest.com,localhost,127.0.0.1} | ||
# Metrics Configuration | ||
- GITINGEST_METRICS_ENABLED=${GITINGEST_METRICS_ENABLED:-true} | ||
- GITINGEST_METRICS_HOST=${GITINGEST_METRICS_HOST:-127.0.0.1} | ||
- GITINGEST_METRICS_PORT=${GITINGEST_METRICS_PORT:-9090} | ||
# Sentry Configuration | ||
- GITINGEST_SENTRY_ENABLED=${GITINGEST_SENTRY_ENABLED:-false} | ||
- GITINGEST_SENTRY_DSN=${GITINGEST_SENTRY_DSN:-} | ||
- GITINGEST_SENTRY_TRACES_SAMPLE_RATE=${GITINGEST_SENTRY_TRACES_SAMPLE_RATE:-1.0} | ||
- GITINGEST_SENTRY_PROFILE_SESSION_SAMPLE_RATE=${GITINGEST_SENTRY_PROFILE_SESSION_SAMPLE_RATE:-1.0} | ||
- GITINGEST_SENTRY_PROFILE_LIFECYCLE=${GITINGEST_SENTRY_PROFILE_LIFECYCLE:-trace} | ||
- GITINGEST_SENTRY_SEND_DEFAULT_PII=${GITINGEST_SENTRY_SEND_DEFAULT_PII:-true} | ||
user: "1000:1000" | ||
command: ["python", "-m", "uvicorn", "server.main:app", "--host", "0.0.0.0", "--port", "8000"] | ||
|
||
services: | ||
# Production service configuration | ||
app: | ||
<<: *app-base | ||
image: ghcr.io/coderamp-labs/gitingest:latest | ||
profiles: | ||
- prod | ||
environment: | ||
- GITINGEST_SENTRY_ENVIRONMENT=${GITINGEST_SENTRY_ENVIRONMENT:-production} | ||
restart: unless-stopped | ||
|
||
# Development service configuration | ||
app-dev: | ||
<<: *app-base | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
profiles: | ||
- dev | ||
environment: | ||
- DEBUG=true | ||
- GITINGEST_SENTRY_ENVIRONMENT=${GITINGEST_SENTRY_ENVIRONMENT:-development} | ||
# S3 Configuration | ||
- S3_ENABLED=true | ||
- S3_ENDPOINT=http://minio:9000 | ||
- S3_ACCESS_KEY=${S3_ACCESS_KEY:-gitingest} | ||
- S3_SECRET_KEY=${S3_SECRET_KEY:-gitingest123} | ||
# Use lowercase bucket name to ensure compatibility with MinIO | ||
- S3_BUCKET_NAME=${S3_BUCKET_NAME:-gitingest-bucket} | ||
- S3_REGION=${S3_REGION:-us-east-1} | ||
# Public URL for S3 resources | ||
- S3_ALIAS_HOST=${S3_ALIAS_HOST:-http://127.0.0.1:9000/${S3_BUCKET_NAME:-gitingest-bucket}} | ||
volumes: | ||
# Mount source code for live development | ||
- ./src:/app:ro | ||
# Use --reload flag for hot reloading during development | ||
command: ["python", "-m", "uvicorn", "server.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"] | ||
depends_on: | ||
minio-setup: | ||
condition: service_completed_successfully | ||
|
||
# MinIO S3-compatible object storage for development | ||
minio: | ||
image: minio/minio:latest | ||
profiles: | ||
- dev | ||
ports: | ||
- "9000:9000" # API port | ||
- "9001:9001" # Console port | ||
environment: | ||
- MINIO_ROOT_USER=${MINIO_ROOT_USER:-minioadmin} | ||
- MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD:-minioadmin} | ||
volumes: | ||
- minio-data:/data | ||
command: server /data --console-address ":9001" | ||
restart: unless-stopped | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] | ||
interval: 30s | ||
timeout: 30s | ||
start_period: 30s | ||
start_interval: 1s | ||
|
||
# MinIO setup service to create bucket and user | ||
minio-setup: | ||
image: minio/mc | ||
profiles: | ||
- dev | ||
depends_on: | ||
minio: | ||
condition: service_healthy | ||
environment: | ||
- MINIO_ROOT_USER=${MINIO_ROOT_USER:-minioadmin} | ||
- MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD:-minioadmin} | ||
- S3_ACCESS_KEY=${S3_ACCESS_KEY:-gitingest} | ||
- S3_SECRET_KEY=${S3_SECRET_KEY:-gitingest123} | ||
- S3_BUCKET_NAME=${S3_BUCKET_NAME:-gitingest-bucket} | ||
volumes: | ||
- ./.docker/minio/setup.sh:/setup.sh:ro | ||
entrypoint: sh | ||
command: -c /setup.sh | ||
|
||
volumes: | ||
minio-data: | ||
driver: local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.