Skip to content

Commit

Permalink
deploy to fly
Browse files Browse the repository at this point in the history
  • Loading branch information
psykomal committed Jun 13, 2024
1 parent 3b403e9 commit f8332db
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .github/workflows/deploy-on-merge-to-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Deploy to Fly on push to main
on:
workflow_dispatch:
push:
branches:
- main


jobs:

deploy:
name: Deploy

runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
- uses: superfly/flyctl-actions/setup-flyctl@master
- name: Deploy a docker container to fly.io
run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.YRAL_GPU_COMPUTE_TASKS_GITHUB_ACTION_FLY_IO_DEPLOYMENT_TOKEN }}


3 changes: 3 additions & 0 deletions consts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ML_SERVER_JWT_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\
MCowBQYDK2VwAyEAoa9RNu5jVwjGT1NKIVfGyQltL0Nf94gLimPaK+jmpRk=\
-----END PUBLIC KEY-----"
4 changes: 3 additions & 1 deletion server.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import grpc
import ml_server_pb2
import ml_server_pb2_grpc
import consts

_LOGGER = logging.getLogger(__name__)

Expand All @@ -48,7 +49,7 @@

_AUTH_HEADER_KEY = "authorization"

_PUBLIC_KEY = str.encode(os.environ["ML_SERVER_JWT_PUBLIC_KEY"])
_PUBLIC_KEY = consts.ML_SERVER_JWT_PUBLIC_KEY
_JWT_PAYLOAD = {
"sub": "yral-ml-server",
"company": "gobazzinga",
Expand All @@ -74,6 +75,7 @@ def intercept_service(self, continuation, handler_call_details):
if payload == _JWT_PAYLOAD:
return continuation(handler_call_details)
else:
print(f"Received payload : {payload}")
return self._abort_handler


Expand Down

0 comments on commit f8332db

Please sign in to comment.