Skip to content

Commit 6e9ea09

Browse files
Inject secrets
1 parent c0fdf1a commit 6e9ea09

File tree

7 files changed

+21
-37
lines changed

7 files changed

+21
-37
lines changed

.github/actions/cdk-synth/action.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ inputs:
1717
required: false
1818
description: An optional working directory where the CDK code is located
1919
default: ./
20+
deploy-parameters:
21+
required: false
22+
description: Optional additional parameters for 'cdk-deploy'
23+
default: ""
2024
python-version:
2125
description: The Python version to use
2226
required: false
@@ -53,4 +57,4 @@ runs:
5357
env:
5458
CDK_DEPLOY_ACCOUNT: ${{ inputs.account }}
5559
CDK_DEPLOY_REGION: ${{ inputs.region }}
56-
run: cdk synth --exclusively ${{ inputs.stacks }}
60+
run: cdk synth --exclusively ${{ inputs.stacks }} --require-approval never ${{ inputs.deploy-parameters }}

.github/workflows/deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ on:
44
workflow_call:
55
inputs:
66
account:
7-
required: true
7+
required: false
88
type: string
99
default: "730335381248"
1010
region:
11-
required: true
11+
required: false
1212
type: string
1313
default: "ap-northeast-1"
1414

.github/workflows/test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ on:
44
workflow_call:
55
inputs:
66
account:
7-
required: true
7+
required: false
88
type: string
99
default: "730335381248"
1010
region:
11-
required: true
11+
required: false
1212
type: string
1313
default: "ap-northeast-1"
1414

Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ ENV GIT_REPO_URL=${GIT_REPO_URL}
88
ARG GIT_BRANCH
99
ENV GIT_BRANCH=${GIT_BRANCH}
1010

11-
RUN echo "GIT_REPO_URL: ${GIT_REPO_URL}"
12-
RUN echo "GIT_BRANCH: ${GIT_BRANCH}"
11+
RUN echo "Cache bust: ${RAILWAY_GIT_COMMIT_SHA}"
1312

1413
# Copy the project files
1514
RUN apt-get update && apt-get install -y curl git bash
@@ -34,7 +33,9 @@ RUN /root/.foundry/bin/forge build
3433

3534
FROM --platform=${PLATFORM} debian:trixie-slim AS runtime
3635

37-
RUN apt-get update && apt-get install -y adduser python3-full virtualenv && rm -rf /var/lib/apt/lists/*
36+
RUN apt-get update && apt-get install -y gnupg adduser python3-full virtualenv && rm -rf /var/lib/apt/lists/*
37+
RUN curl -Ls https://cli.doppler.com/install.sh | sh
38+
3839

3940
COPY --from=build /mewler-liquidation-bot /app
4041

@@ -72,4 +73,4 @@ EXPOSE 8080
7273

7374
# CMD ["python", "python/liquidation_bot.py"]
7475
# Run the application
75-
CMD [".venv/bin/gunicorn", "--bind", "0.0.0.0:8080", "application:application"]
76+
CMD ["doppler", "run", "--", ".venv/bin/gunicorn", "--bind", "0.0.0.0:8080", "application:application"]

Dockerfile.aws

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ RUN /root/.foundry/bin/forge build
2020

2121
FROM --platform=${PLATFORM} debian:trixie-slim AS runtime
2222

23-
RUN apt-get update && apt-get install -y adduser python3-full virtualenv && rm -rf /var/lib/apt/lists/*
23+
RUN apt-get update && apt-get install -y gnupg adduser python3-full virtualenv && rm -rf /var/lib/apt/lists/*
24+
RUN curl -Ls https://cli.doppler.com/install.sh | sh
2425

2526
COPY --from=build /app /app
2627

@@ -60,4 +61,4 @@ EXPOSE 8080
6061

6162
# CMD ["python", "python/liquidation_bot.py"]
6263
# Run the application
63-
CMD [".venv/bin/gunicorn", "--bind", "0.0.0.0:8080", "application:application"]
64+
CMD ["doppler", "run", "--", ".venv/bin/gunicorn", "--bind", "0.0.0.0:8080", "application:application"]

cdk/app.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,6 @@
2525
vpc_id="vpc-01e44f96507b5ea1b",
2626
cluster_name="hypurr-liquidator-cluster",
2727
secret_name=os.getenv("SECRET_NAME", "mewler-liquidation-bot/config"),
28-
container_environment={
29-
# Non-sensitive configuration values
30-
# RPC URLs (can be overridden by secrets)
31-
"MAINNET_RPC_URL": "https://eth-mainnet.g.alchemy.com/v2/FDD0XfX77DTxUk3qykJ3U",
32-
"HYPEREVM_MAINNET_RPC_URL": "https://eth-mainnet.g.alchemy.com/v2/FDD0XfX77DTxUk3qykJ3U",
33-
"BASE_RPC_URL": "https://eth-mainnet.g.alchemy.com/v2/FDD0XfX77DTxUk3qykJ3U",
34-
"ARBITRUM_RPC_URL": "https://eth-mainnet.g.alchemy.com/v2/FDD0XfX77DTxUk3qykJ3U",
35-
# GlueX API Configuration (can be overridden by secrets)
36-
"GLUEX_API_URL": "https://router.gluex.xyz/v1/quote",
37-
"GLUEX_UNIQUE_PID": "657a8d5a95d73a70a4b49319544a42ad61d689c83679fcfe6b80e8e9b51cfe2c",
38-
"GLUEX_API_KEY": "SVQkMIOLo9O2NpA0xI0pQGPV1FYIYXmk",
39-
### OPTIONAL ###
40-
# Slack webhook URL for sending notifications
41-
"SLACK_WEBHOOK_URL": "https://hooks.slack.com/services/SLACK_KEY",
42-
# URL for the liquidation UI, if including in the slack notification
43-
"RISK_DASHBOARD_URL": "http://127.0.0.1:8080",
44-
# Note: LIQUIDATOR_EOA and LIQUIDATOR_PRIVATE_KEY must be in Secrets Manager
45-
},
4628
)
4729

4830
app.synth()

cdk/mewler_liquidation_bot_stack.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,17 @@ def __init__(
9898

9999
env_vars = container_environment.copy() if container_environment else {}
100100

101-
secrets = {}
102-
required_secret_keys = [
103-
"LIQUIDATOR_EOA",
104-
"LIQUIDATOR_PRIVATE_KEY",
105-
]
106101

107-
for key in required_secret_keys:
108-
secrets[key] = ecs.Secret.from_secrets_manager(secret, key)
102+
doppler_token = ecs.Secret.from_secrets_manager(secret, "DOPPLER_TOKEN")
109103

110104
container = task_definition.add_container(
111105
"mewler-liquidation-bot",
112106
image=image,
113107
memory_limit_mib=2048,
114108
environment=env_vars if env_vars else None,
115-
secrets=secrets if secrets else None,
109+
secrets={
110+
"DOPPLER_TOKEN": doppler_token,
111+
},
116112
logging=ecs.LogDriver.aws_logs(
117113
stream_prefix="mewler-liquidation-bot",
118114
log_retention=logs.RetentionDays.THREE_DAYS,

0 commit comments

Comments
 (0)