-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ add Infra configuration for lmax-connector
- Loading branch information
Showing
4 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 @@ | ||
FROM python:3.12-slim AS base | ||
|
||
ENV PYTHONUNBUFFERED=1 \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
PIP_NO_CACHE_DIR=off \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
PIP_DEFAULT_TIMEOUT=100 | ||
|
||
ENV PATH="/root/.local/bin:${PATH}" | ||
|
||
FROM base as builder | ||
|
||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y \ | ||
gcc \ | ||
g++ \ | ||
libssl-dev \ | ||
swig \ | ||
libgmp3-dev \ | ||
pkg-config \ | ||
pipx \ | ||
stunnel4 | ||
|
||
RUN apt-get update && apt-get install -y bash curl && curl -1sLf \ | ||
'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.deb.sh' | bash \ | ||
&& apt-get update && apt-get install -y infisical | ||
|
||
RUN pipx install uv | ||
COPY pragma-sdk/ /opt/pragma-sdk/ | ||
COPY lmax-connector/ /opt/lmax-connector/ | ||
WORKDIR /opt/lmax-connector | ||
RUN uv sync | ||
|
||
FROM base as final | ||
COPY --from=builder /usr/bin/infisical /usr/bin/infisical | ||
COPY --from=builder /opt /opt | ||
COPY infra/lmax-connector/entrypoint.sh /opt/lmax-connector/ | ||
WORKDIR /opt/lmax-connector | ||
ENTRYPOINT ["bash","/opt/lmax-connector/entrypoint.sh"] |
This file contains 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,29 @@ | ||
version: 0.2 | ||
phases: | ||
pre_build: | ||
commands: | ||
- echo Logging in to Amazon ECR... | ||
- aws --version | ||
- aws ecr get-login-password --region $ECR_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$ECR_REGION.amazonaws.com | ||
- REPOSITORY_URI=$AWS_ACCOUNT_ID.dkr.ecr.$ECR_REGION.amazonaws.com/$ECR_REPOSITORY_NAME | ||
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7) | ||
- IMAGE_TAG=${COMMIT_HASH:=latest} | ||
build: | ||
commands: | ||
- echo Build started on `date` | ||
- echo Building the Docker image... | ||
- ls -ltr | ||
- docker build -f infra/lmax-connector/Dockerfile -t $REPOSITORY_URI:latest . | ||
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG | ||
post_build: | ||
commands: | ||
- echo Pushing the Docker images... | ||
- docker push $REPOSITORY_URI:latest | ||
- docker push $REPOSITORY_URI:$IMAGE_TAG | ||
- echo Writing image definitions file... | ||
- printf '[{"name":"%s","imageUri":"%s"}]' $ECS_CONTAINER_NAME $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json | ||
artifacts: | ||
files: | ||
- imagedefinitions.json | ||
- infra/lmax-connector/config.yml | ||
discard-paths: yes |
This file contains 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,9 @@ | ||
path: "/" | ||
container_port: 8080 | ||
health_check_path: "/" | ||
container_environment: | ||
- region: "eu-west-3" | ||
- prefix: "/conf/{{ SERVICE_NAME }}/{{ RUN_ENV }}" | ||
- keys: | ||
- INFISICAL_ENV | ||
- INFISICAL_APP_PATH |
This file contains 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,14 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
export INFISICAL_TOKEN=$(infisical login --method=universal-auth --client-id=${INFISICAL_CLIENT_ID} --client-secret=${INFISICAL_CLIENT_SECRET} --silent --plain) | ||
infisical export --projectId=${INFISICAL_PROJECT_ID} --env=${INFISICAL_ENV} --path=${INFISICAL_APP_PATH} > .env | ||
source .env | ||
|
||
# Execute Stunnel | ||
stunnel stunnel.conf & | ||
sleep 5 | ||
|
||
# Execute LMAX Connector | ||
exec /opt/lmax-connector/.venv/bin/python3.12 -m lmax_connector |