Skip to content

Commit

Permalink
refactor: setup and deploy to FLY gpu
Browse files Browse the repository at this point in the history
  • Loading branch information
cs50victor committed Feb 21, 2024
1 parent 9ffc2c1 commit 6434352
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/fly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Deploy NEW_MEDIA to Fly

on:
push:
branches:
- main
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Get source code
uses: actions/checkout@v3

- name: Deploy to Fly.io
uses: superfly/[email protected]
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
with:
args: "deploy --remote-only --dockerfile ./Dockerfile.prod --config ./fly.toml"


3 changes: 2 additions & 1 deletion demo/components/WebSocketExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ export interface ServerWSResponse {
}

export default function WebSocketExample({port = 8080}:{port?:number}){
const server_ws_url = process.env.NODE_ENV === "production" ? `ws://localhost:${port}` : "ws://new-media.fly.dev"
const [imgMetadata, setImageMetadata] = useState<ServerWSResponse>();
const [socket, setSocket] = useState<WebSocket>()

useEffect(() => {
const socket = new WebSocket(`ws://localhost:${port}`)
const socket = new WebSocket(server_ws_url)

socket.onopen = () => {
setSocket(socket)
Expand Down
6 changes: 3 additions & 3 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app = 'new-media-still-surf-1038'
primary_region = 'sjc'
app = 'new-media'
primary_region = 'ord'

[build]
dockerfile = 'Dockerfile.prod'
Expand All @@ -16,4 +16,4 @@ primary_region = 'sjc'
cpu_kind = 'performance'
memory = '64gb'
cpus = 16
size = "a100-40gb"
size = "a100-40gb"

0 comments on commit 6434352

Please sign in to comment.