Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 19 additions & 23 deletions .mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,41 +40,30 @@ docker compose --file tests.yaml run --rm --no-TTY tests
docker compose --file tests.yaml down --volumes --remove-orphans
"""

[tasks."application:service:run:production"]
description = "Run the application service"
run = """
docker run \
--env-file .env \
--publish 8080:8080 \
pocketsizefund/{{arg(name="application_name")}}:latest \
"""

[tasks."application:service:run:development"]
[tasks."application:service:run"]
description = "Run the application service locally with hot reloading"
run = """
cd application/{{arg(name="service_name")}}
uv run uvicorn src.{{arg(name="service_name")}}.main:application --reload
cd application/{{option(name="service")}}
uv run uvicorn src.{{option(name="service")}}.main:application --reload
"""

[tasks."application:service:test:integration"]
description = "Run integration tests"
run = """
cd application/{{arg(name="service_name")}}
cd application/{{option(name="service")}}
docker compose up --build --abort-on-container-exit --remove-orphans
"""

[tasks."application:service:test:behavioral"]
description = "Run behavioral tests"
run = """
cd application/{{arg(name="service_name")}}
docker compose up --build --abort-on-container-exit
"""

[tasks."application:service:cleanup:behavioral"]
description = "Clean up behavioral tests"
run = """
cd application/{{arg(name="service_name")}}
docker compose down -v
cd application/{{option(name="service")}}
if [ {{flag(name="cleanup")}} == true ]
then
docker compose down -v
else
docker compose up --build --abort-on-container-exit
fi
"""

[tasks."lint"]
Expand Down Expand Up @@ -108,5 +97,12 @@ uv run pulumi down --yes --stack pocketsizefund/pocketsizefund/production
[tasks."cli:datamanager:authorize"]
description = "Authorize the CLI with AWS credentials"
run = """
aws iam attach-user-policy --user-name {{arg(user-name="user-name")}} --policy-arn ${{pulumi stack output DATAMANAGER_API_ACCESS_POLICY_ARN}}
aws iam attach-user-policy --user-name {{option(user-name="user-name")}} --policy-arn ${{pulumi stack output DATAMANAGER_API_ACCESS_POLICY_ARN}}
"""

[tasks."dashboard:upload"]
description = "Upload Grafana dashboard"
run = """
cd infrastructure
nu upload_grafana_dashboard.nu
"""
6 changes: 1 addition & 5 deletions application/datamanager/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ services:
- 8080:8080
environment:
- POLYGON_API_KEY=${POLYGON_API_KEY}
- DATA_BUCKET_NAME=${DATA_BUCKET_NAME}
- GOOGLE_APPLICATION_CREDENTIALS=/root/.config/gcloud/application_default_credentials.json
- DUCKDB_ACCESS_KEY=${DUCKDB_ACCESS_KEY}
- DUCKDB_SECRET=${DUCKDB_SECRET}
- AWS_S3_DATA_BUCKET_NAME=${AWS_S3_DATA_BUCKET_NAME}
volumes:
- ./:/app/datamanager
- ~/.config/gcloud/application_default_credentials.json:/root/.config/gcloud/application_default_credentials.json:ro
healthcheck:
test: ["CMD", "curl", "-f", "http://0.0.0.0:8080/health"]
interval: 10s
Expand Down
8 changes: 5 additions & 3 deletions application/datamanager/src/datamanager/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
polygon_api_key=os.getenv("POLYGON_API_KEY", ""),
)

app.state.s3_client = S3Client(data_bucket_name=os.getenv("DATA_BUCKET_NAME", ""))
app.state.s3_client = S3Client(
data_bucket_name=os.getenv("AWS_S3_DATA_BUCKET_NAME", "")
)

duckdb_user_access_key_id = os.getenv("DUCKDB_USER_ACCESS_KEY_ID")
duckdb_user_access_key_secret = os.getenv("DUCKDB_USER_ACCESS_KEY_SECRET")
duckdb_user_access_key_id = os.getenv("AWS_IAM_DUCKDB_USER_ACCESS_KEY_ID")
duckdb_user_access_key_secret = os.getenv("AWS_IAM_DUCKDB_USER_ACCESS_KEY_SECRET")
aws_region = os.getenv("AWS_REGION", "us-east-1")

app.state.connection = duckdb.connect()
Expand Down
Loading