-
Notifications
You must be signed in to change notification settings - Fork 0
Hotfix: corrección en configuración o dependencias #36
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
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
50c435b
Hotfix: corrección en configuración o dependencias
Neiland85 5b4bbae
hotfix: excluir carpeta duplicada y añadir configs de deploy
Neiland85 0a82284
hotfix: limpiar node_modules y ajustes de deploy
Neiland85 c6e32e7
fix(auth): truncar bcrypt a 72 bytes y actualizar deps
Neiland85 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
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,69 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ "**" ] | ||
| push: | ||
| branches: [ "feature/**", "fix/**", "chore/**" ] | ||
|
|
||
| jobs: | ||
| test-and-lint: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: . | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
|
|
||
| - name: Cache pip | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.cache/pip | ||
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }} | ||
| restore-keys: ${{ runner.os }}-pip- | ||
|
|
||
| - name: Install deps (root + services) | ||
| run: | | ||
| pip install -U pip wheel | ||
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
| for svc in trading_ai_system/ingestion_service trading_ai_system/inference_service trading_ai_system/control_service; do | ||
| if [ -f "$svc/requirements.txt" ]; then pip install -r "$svc/requirements.txt"; fi | ||
| done | ||
| pip install pytest flake8 | ||
|
|
||
| - name: Lint | ||
| run: flake8 . | ||
|
|
||
| - name: Test | ||
| run: | | ||
| if [ -d tests ]; then pytest -q; else echo "No tests dir"; fi | ||
|
|
||
| build-check: | ||
| name: Docker build (no push) | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| service: | ||
| - { name: ingestion_service, path: trading_ai_system/ingestion_service } | ||
| - { name: inference_service, path: trading_ai_system/inference_service } | ||
| - { name: control_service, path: trading_ai_system/control_service } | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Check context exists | ||
| id: ctx | ||
| run: | | ||
| if [ -d "${{ matrix.service.path }}" ] && [ -f "${{ matrix.service.path }}/Dockerfile" ]; then | ||
| echo "exists=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "exists=false" >> $GITHUB_OUTPUT | ||
| fi | ||
| - name: Build ${{ matrix.service.name }} | ||
| if: steps.ctx.outputs.exists == 'true' | ||
| run: docker build -t neurobank/${{ matrix.service.name }}:ci ${{ matrix.service.path }} | ||
|
|
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,95 @@ | ||
| name: Deploy Prod (ECS) | ||
|
|
||
| on: | ||
| # Solo ejecutable manualmente | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: "Tag de release (prod-YYYY.MM.DD-XX)" | ||
| required: true | ||
| confirm: | ||
| description: "Confirmar deploy a PRODUCCIÓN (ECS)" | ||
| required: true | ||
| default: "no" | ||
| type: choice | ||
| options: ["no", "yes"] | ||
|
|
||
| env: | ||
| AWS_REGION: ${{ secrets.AWS_REGION }} | ||
| AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | ||
| ECR_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com | ||
|
|
||
| jobs: | ||
| build-and-push: | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'workflow_dispatch' && inputs.confirm == 'yes' && secrets.AWS_ACCOUNT_ID != '' && secrets.AWS_OIDC_ROLE_ARN != '' | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| service: | ||
| - { name: api-gateway, path: . } # Ajusta si API tiene Dockerfile propio en raíz/otra ruta | ||
| - { name: ingestion, path: trading_ai_system/ingestion_service } | ||
| - { name: inference, path: trading_ai_system/inference_service } | ||
| - { name: control, path: trading_ai_system/control_service } | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Configure AWS credentials (OIDC) | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| role-to-assume: ${{ secrets.AWS_OIDC_ROLE_ARN }} # IAM Role con trust para GitHub | ||
| aws-region: ${{ env.AWS_REGION }} | ||
|
|
||
| - name: Login to ECR | ||
| id: ecr | ||
| uses: aws-actions/amazon-ecr-login@v2 | ||
|
|
||
| - name: Build & Push ${{ matrix.service.name }} | ||
| run: | | ||
| IMAGE=${{ env.ECR_REGISTRY }}/neurobank/${{ matrix.service.name }}:${{ inputs.tag }} | ||
| docker build -t "$IMAGE" ${{ matrix.service.path }} | ||
| docker push "$IMAGE" | ||
|
|
||
| deploy-ecs: | ||
| needs: build-and-push | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'workflow_dispatch' && inputs.confirm == 'yes' | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| svc: | ||
| - { ecs_service: api-gateway-svc, taskdef: trading_ai_system/ecs/api-gateway-task.json, container: api-gateway, image_repo: neurobank/api-gateway } | ||
| - { ecs_service: ingestion-svc, taskdef: trading_ai_system/ecs/ingestion-service-task.json, container: ingestion, image_repo: neurobank/ingestion } | ||
| - { ecs_service: inference-svc, taskdef: trading_ai_system/ecs/inference-service-task.json, container: inference, image_repo: neurobank/inference } | ||
| - { ecs_service: control-svc, taskdef: trading_ai_system/ecs/control-service-task.json, container: control, image_repo: neurobank/control } | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Configure AWS credentials (OIDC) | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| role-to-assume: ${{ secrets.AWS_OIDC_ROLE_ARN }} | ||
| aws-region: ${{ env.AWS_REGION }} | ||
|
|
||
| - name: Render Task Definition | ||
| id: taskdef | ||
| uses: aws-actions/amazon-ecs-render-task-definition@v1 | ||
| with: | ||
| task-definition: ${{ matrix.svc.taskdef }} | ||
| container-name: ${{ matrix.svc.container }} | ||
| image: ${{ env.ECR_REGISTRY }}/${{ matrix.svc.image_repo }}:${{ inputs.tag }} | ||
|
|
||
| - name: Deploy to ECS | ||
| uses: aws-actions/amazon-ecs-deploy-task-definition@v2 | ||
| with: | ||
| task-definition: ${{ steps.taskdef.outputs.task-definition }} | ||
| service: ${{ matrix.svc.ecs_service }} | ||
| cluster: neurobank-prod | ||
| wait-for-service-stability: true | ||
|
|
||
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,51 @@ | ||
| name: Deploy Staging (Railway) | ||
|
|
||
| on: | ||
| # Solo ejecutable manualmente | ||
| workflow_dispatch: | ||
| inputs: | ||
| confirm: | ||
| description: "Confirmar deploy a Railway STAGING" | ||
| required: true | ||
| default: "no" | ||
| type: choice | ||
| options: ["no", "yes"] | ||
|
|
||
| concurrency: | ||
| group: staging-railway | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| # Ejecutar solo si se invoca manualmente y hay token | ||
| if: github.event_name == 'workflow_dispatch' && inputs.confirm == 'yes' && secrets.RAILWAY_TOKEN != '' | ||
| env: | ||
| RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node (Railway CLI) | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20" | ||
|
|
||
| - name: Install Railway CLI | ||
| run: npm i -g @railway/cli | ||
|
|
||
| - name: Auth | ||
| run: railway login --token "$RAILWAY_TOKEN" | ||
|
|
||
| # Si tienes railway.toml en la raíz con todos los servicios: | ||
| - name: Deploy API Gateway | ||
| run: railway up --service api-gateway --yes | ||
|
|
||
| - name: Deploy Ingestion | ||
| run: railway up --service ingestion-service --yes | ||
|
|
||
| - name: Deploy Inference | ||
| run: railway up --service inference-service --yes | ||
|
|
||
| - name: Deploy Control | ||
| run: railway up --service control-service --yes | ||
|
|
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,40 @@ | ||
| { | ||
| "family": "api-gateway-task", | ||
| "networkMode": "awsvpc", | ||
| "requiresCompatibilities": ["FARGATE"], | ||
| "cpu": "512", | ||
| "memory": "1024", | ||
| "executionRoleArn": "arn:aws:iam::<ACCOUNT_ID>:role/ecsTaskExecutionRole", | ||
| "taskRoleArn": "arn:aws:iam::<ACCOUNT_ID>:role/ecsTaskAppRole", | ||
| "containerDefinitions": [ | ||
| { | ||
| "name": "api-gateway", | ||
| "image": "<ACCOUNT_ID>.dkr.ecr.<AWS_REGION>.amazonaws.com/neurobank/api-gateway:latest", | ||
| "portMappings": [{ "containerPort": 8000, "protocol": "tcp" }], | ||
| "environment": [ | ||
| { "name": "ENVIRONMENT", "value": "production" }, | ||
| { "name": "LOG_LEVEL", "value": "INFO" }, | ||
| { "name": "OTEL_SERVICE_NAME", "value": "api_gateway" } | ||
| ], | ||
| "secrets": [ | ||
| { "name": "SECRET_KEY", "valueFrom": "arn:aws:ssm:<AWS_REGION>:<ACCOUNT_ID>:parameter/neurobank/secret_key" }, | ||
| { "name": "API_KEY", "valueFrom": "arn:aws:ssm:<AWS_REGION>:<ACCOUNT_ID>:parameter/neurobank/api_key" } | ||
| ], | ||
| "logConfiguration": { | ||
| "logDriver": "awslogs", | ||
| "options": { | ||
| "awslogs-group": "/ecs/api-gateway", | ||
| "awslogs-region": "<AWS_REGION>", | ||
| "awslogs-stream-prefix": "ecs" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "name": "otel-collector", | ||
| "image": "otel/opentelemetry-collector:latest", | ||
| "command": ["--config=/etc/otelcol-config.yaml"], | ||
| "essential": false | ||
| } | ||
| ] | ||
| } | ||
|
|
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,39 @@ | ||
| name: Infra (Terraform) | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| paths: | ||
| - "infra/**.tf" | ||
|
|
||
| jobs: | ||
| terraform: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| env: | ||
| AWS_REGION: ${{ secrets.AWS_REGION }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: hashicorp/setup-terraform@v3 | ||
| with: | ||
| terraform_version: 1.9.5 | ||
|
|
||
| - name: AWS Credentials (OIDC) | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| role-to-assume: ${{ secrets.AWS_OIDC_ROLE_ARN }} | ||
| aws-region: ${{ env.AWS_REGION }} | ||
|
|
||
| - name: Terraform Init/Plan | ||
| working-directory: infra | ||
| run: | | ||
| terraform init | ||
| terraform plan -out=tfplan | ||
|
|
||
| - name: Terraform Apply (manual gate) | ||
| if: github.event_name == 'workflow_dispatch' | ||
| working-directory: infra | ||
| run: terraform apply -auto-approve tfplan | ||
|
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent container naming between task definition files and deployment matrix. Task definitions use 'ingestion-service', 'inference-service', 'control-service' as container names, but the matrix specifies 'ingestion', 'inference', 'control'. This mismatch will cause deployment failures.