-
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.
feat/price-pusher-infra: offchain/onchain buildspec (#154)
* feat: add infra folder for deployments * fix: use bash parameter substitution for entrypoint * feat: add offchain/onchain buildspec for infra deployment * fix: buildspecs path for each price-pusher * fix: config.yml inside Dockerfile, remove useless config.yml * fix: try with poetry run script * feat: API_BASE_URL variable envfor offchain price-pusher, fix script name for vrf-listener
- Loading branch information
Showing
7 changed files
with
155 additions
and
5 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,33 @@ | ||
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 \ | ||
POETRY_VERSION=1.8.3 \ | ||
POETRY_VIRTUALENVS_IN_PROJECT=true \ | ||
POETRY_NO_INTERACTION=1 | ||
|
||
ENV PATH="/root/.local/bin:${PATH}" | ||
|
||
FROM base as builder | ||
|
||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y \ | ||
gcc \ | ||
libgmp3-dev \ | ||
pipx | ||
|
||
RUN pipx install poetry | ||
COPY pragma-sdk/ /opt/pragma-sdk/ | ||
COPY pragma-utils/ /opt/pragma-utils/ | ||
COPY price-pusher/ /opt/price-pusher/ | ||
WORKDIR /opt/price-pusher | ||
RUN poetry env use 3.12 | ||
RUN poetry install | ||
|
||
FROM base as final | ||
COPY --from=builder /opt /opt | ||
WORKDIR /opt/price-pusher | ||
ENTRYPOINT /opt/price-pusher/.venv/bin/python3.12 price_pusher/main.py -c config/config.example.yaml -t ${TARGET} -n ${NETWORK} -p ${PRIVATE_KEY} --publisher-name ${PUBLISHER_NAME} --publisher-address ${PUBLISHER_ADDRESS} --rpc-url ${RPC_URL} --api-key ${API_KEY} --api-base-url ${API_BASE_URL} |
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,30 @@ | ||
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/price-pusher/offchain/Dockerfile -t $REPOSITORY_URI:latest . | ||
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG | ||
post_build: | ||
commands: | ||
- echo Build completed on `date` | ||
- 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/price-pusher/offchain/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,15 @@ | ||
path: "/" | ||
container_port: 8080 | ||
health_check_path: "/" | ||
container_environment: | ||
- region: "eu-west-3" | ||
- prefix: "/conf/{{ SERVICE_NAME }}/{{ RUN_ENV }}" | ||
- keys: | ||
- TARGET | ||
- NETWORK | ||
- PRIVATE_KEY | ||
- PUBLISHER_NAME | ||
- PUBLISHER_ADDRESS | ||
- RPC_URL | ||
- API_KEY | ||
- API_BASE_URL |
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,33 @@ | ||
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 \ | ||
POETRY_VERSION=1.8.3 \ | ||
POETRY_VIRTUALENVS_IN_PROJECT=true \ | ||
POETRY_NO_INTERACTION=1 | ||
|
||
ENV PATH="/root/.local/bin:${PATH}" | ||
|
||
FROM base as builder | ||
|
||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y \ | ||
gcc \ | ||
libgmp3-dev \ | ||
pipx | ||
|
||
RUN pipx install poetry | ||
COPY pragma-sdk/ /opt/pragma-sdk/ | ||
COPY pragma-utils/ /opt/pragma-utils/ | ||
COPY price-pusher/ /opt/price-pusher/ | ||
WORKDIR /opt/price-pusher | ||
RUN poetry env use 3.12 | ||
RUN poetry install | ||
|
||
FROM base as final | ||
COPY --from=builder /opt /opt | ||
WORKDIR /opt/price-pusher | ||
ENTRYPOINT /opt/price-pusher/.venv/bin/python3.12 price_pusher/main.py -c config/config.example.yaml -t ${TARGET} -n ${NETWORK} -p ${PRIVATE_KEY} --publisher-name ${PUBLISHER_NAME} --publisher-address ${PUBLISHER_ADDRESS} --rpc-url ${RPC_URL} |
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,30 @@ | ||
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/price-pusher/onchain/Dockerfile -t $REPOSITORY_URI:latest . | ||
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG | ||
post_build: | ||
commands: | ||
- echo Build completed on `date` | ||
- 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/price-pusher/onchain/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,13 @@ | ||
path: "/" | ||
container_port: 8080 | ||
health_check_path: "/" | ||
container_environment: | ||
- region: "eu-west-3" | ||
- prefix: "/conf/{{ SERVICE_NAME }}/{{ RUN_ENV }}" | ||
- keys: | ||
- TARGET | ||
- NETWORK | ||
- PRIVATE_KEY | ||
- PUBLISHER_NAME | ||
- PUBLISHER_ADDRESS | ||
- RPC_URL |
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