From fc04a78b7ddda80d79e66e2443e02aac6e314bff Mon Sep 17 00:00:00 2001 From: Josh Faigan Date: Thu, 8 Feb 2024 15:21:52 -0500 Subject: [PATCH 1/6] here we go again --- .buildkite/pipeline.yml | 6 ++++++ docker-compose.yml | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 .buildkite/pipeline.yml create mode 100644 docker-compose.yml diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml new file mode 100644 index 0000000..2fe6c51 --- /dev/null +++ b/.buildkite/pipeline.yml @@ -0,0 +1,6 @@ +steps: + - name: ":python:" + command: "py.test" + plugins: + - docker-compose#v3.7.0: + run: app \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e7daba8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,5 @@ +version: '3' + +services: + app: + build: . \ No newline at end of file From 708fb9a51d2756c7d7e7362bc7598943d8d11e9c Mon Sep 17 00:00:00 2001 From: Josh Faigan Date: Thu, 8 Feb 2024 15:36:23 -0500 Subject: [PATCH 2/6] changing build --- .buildkite/pipeline.yml | 7 ++----- scripts/build-and-push.sh | 11 +++++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100755 scripts/build-and-push.sh diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 2fe6c51..f293c8f 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,6 +1,3 @@ steps: - - name: ":python:" - command: "py.test" - plugins: - - docker-compose#v3.7.0: - run: app \ No newline at end of file + - name: ":docker: Build and Push Docker Image" + command: "scripts/build-and-push.sh" diff --git a/scripts/build-and-push.sh b/scripts/build-and-push.sh new file mode 100755 index 0000000..16ceb97 --- /dev/null +++ b/scripts/build-and-push.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Build the Docker image using docker-compose +docker-compose build app + +# Tag the image +# Note: Ensure you've logged into your Docker registry beforehand or include login commands in this script +docker tag app:latest evilgenius13/starfire:latest + +# Push the image to the registry +docker push evilgenius13/starfire:latest From 133f47c8386e3868a9be8f80538c0b2b8e1d9545 Mon Sep 17 00:00:00 2001 From: Josh Faigan Date: Thu, 8 Feb 2024 15:41:08 -0500 Subject: [PATCH 3/6] ? --- scripts/build-and-push.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/build-and-push.sh b/scripts/build-and-push.sh index 16ceb97..fb634de 100755 --- a/scripts/build-and-push.sh +++ b/scripts/build-and-push.sh @@ -1,11 +1,15 @@ #!/bin/bash +# Ensure we're in the directory containing the docker-compose.yml file +cd "$(dirname "$0")/.." + # Build the Docker image using docker-compose docker-compose build app -# Tag the image -# Note: Ensure you've logged into your Docker registry beforehand or include login commands in this script -docker tag app:latest evilgenius13/starfire:latest +# After building, tag the built image appropriately. +# The image name typically follows the format "_service_name" +# but since we want to tag it for pushing to a Docker registry, we specify the tag directly. +docker tag "dev-build_app" "evilgenius13/starfire:latest" -# Push the image to the registry -docker push evilgenius13/starfire:latest +# Push the tagged image to the Docker registry +docker push "evilgenius13/starfire:latest" From 2e52ddd61b6bca31c4588e9675ddcae651f157d8 Mon Sep 17 00:00:00 2001 From: Josh Faigan Date: Thu, 8 Feb 2024 15:47:40 -0500 Subject: [PATCH 4/6] again --- scripts/build-and-push.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/scripts/build-and-push.sh b/scripts/build-and-push.sh index fb634de..3ae380b 100755 --- a/scripts/build-and-push.sh +++ b/scripts/build-and-push.sh @@ -1,15 +1,11 @@ #!/bin/bash -# Ensure we're in the directory containing the docker-compose.yml file +# Root directory of the project cd "$(dirname "$0")/.." -# Build the Docker image using docker-compose +# Build the Docker image using docker-compose and tag it with the latest tag and push it to the registry docker-compose build app -# After building, tag the built image appropriately. -# The image name typically follows the format "_service_name" -# but since we want to tag it for pushing to a Docker registry, we specify the tag directly. docker tag "dev-build_app" "evilgenius13/starfire:latest" -# Push the tagged image to the Docker registry docker push "evilgenius13/starfire:latest" From 5521c148d246f077f9d3f569a054f7bef006ec44 Mon Sep 17 00:00:00 2001 From: Josh Faigan Date: Thu, 8 Feb 2024 15:53:30 -0500 Subject: [PATCH 5/6] changed readme --- README.MD | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.MD b/README.MD index 52ca61a..8321b28 100644 --- a/README.MD +++ b/README.MD @@ -8,13 +8,20 @@ A lightweight, fast way to send data from your server to axiom for logging. pip3 install -r requirements.txt ``` +## Environment Variables +You need the following variables to run the app. +```bash +AXIOM_API_KEY=your_api_key +AXIOM_DATASET=your_dataset +``` + ## Usage -Local Code +*Locally* ```python uvicorn app:app --reload ``` -Docker +*Docker* ```bash docker run -d -p 8000:8000 evilgenius13/axiomstarfire ``` From 3d620ed2532e1d42effc69b2a61e0283d7942254 Mon Sep 17 00:00:00 2001 From: Josh Faigan Date: Thu, 8 Feb 2024 16:01:27 -0500 Subject: [PATCH 6/6] finalizing --- initializers/axiom_helper.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/initializers/axiom_helper.py b/initializers/axiom_helper.py index c8df1f5..69a5cfb 100644 --- a/initializers/axiom_helper.py +++ b/initializers/axiom_helper.py @@ -16,5 +16,3 @@ def __init__(self): async def send_event(self, event_data): await asyncio.to_thread(self.client.ingest_events, AXIOM_DATASET, event_data) - -# TODO: Build container via buildkite \ No newline at end of file