Skip to content

Commit

Permalink
fix depoyment
Browse files Browse the repository at this point in the history
  • Loading branch information
giulioco committed Nov 16, 2024
1 parent 2c723c2 commit 3034bd8
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 22 deletions.
24 changes: 24 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
node_modules
dist
.git
.env
__pycache__
*.pyc
*.pyo
*.pyd
.Python
env
pip-log.txt
pip-delete-this-directory.txt
.tox
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.log
.pytest_cache
.env
.venv
.DS_Store
18 changes: 18 additions & 0 deletions .github/workflows/fly-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/

name: Fly Deploy
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
concurrency: deploy-group
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ dist-ssr
*.sw?
data/*
*.env
static/*
tsconfig.app.tsbuildinfo
tsconfig.node.tsbuildinfo
44 changes: 44 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Use Python 3.11 slim image
FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*

# Install Node.js and npm
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g bun

# Copy package files
COPY package.json bun.lockb ./

# Install frontend dependencies
RUN bun install

# Copy Python requirements
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application
COPY . .

# Build frontend
RUN bun run build

# Create static directory and copy build files
RUN mkdir -p static && \
cp -r dist/* static/

# Expose port
EXPOSE 8080

# Start the application
CMD ["python", "app.py"]
8 changes: 6 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,5 +276,9 @@ def serve_audio(filename):
return send_file(os.path.join(TEMP_DIR, filename))

if __name__ == '__main__':
port = int(os.getenv('PORT', 5000))
socketio.run(app, host='0.0.0.0', port=port, debug=True, allow_unsafe_werkzeug=True)
port = int(os.getenv('PORT', 8080))
socketio.run(app,
host='0.0.0.0',
port=port,
debug=False, # Set to False in production
allow_unsafe_werkzeug=True)
22 changes: 11 additions & 11 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# fly.toml app configuration file
app = "ai-podcast-generator"
primary_region = "iad"
# fly.toml app configuration file generated for openpod on 2024-11-16T12:01:28-05:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

[build]
builder = "paketobuildpacks/builder:base"
app = 'openpod'
primary_region = 'ewr'

[env]
PORT = "8080"
[build]

[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = true
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 0
processes = ["app"]
processes = ['app']

[[vm]]
cpu_kind = "shared"
memory = '1gb'
cpu_kind = 'shared'
cpus = 1
memory_mb = 1024
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ fastjsonschema==2.20.0
ffmpeg==1.4
filelock==3.16.1
Flask==3.0.0
Flask-Cors==5.0.0
Flask-SocketIO==5.4.1
frozenlist==1.5.0
fsspec==2024.10.0
Expand Down
2 changes: 0 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { CustomPodcast } from "@/components/CustomPodcast";
import { APIKeys } from "@/components/APIKeys";
import { NewsPodcast } from "@/components/NewsPodcast";
import { Toaster } from "@/components/ui/toaster";
import { Github } from "lucide-react";
import { Button } from "@/components/ui/button";

export default function App() {
const [activeTab, setActiveTab] = useState("custom");
Expand Down
3 changes: 0 additions & 3 deletions src/components/APIKeys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,8 @@ const API_KEY_INSTRUCTIONS = {
};

function InstructionsDialog({
type,
instructions,
}: {
type: string;
instructions: (typeof API_KEY_INSTRUCTIONS)[keyof typeof API_KEY_INSTRUCTIONS];
}) {
return (
Expand Down Expand Up @@ -190,7 +188,6 @@ export function APIKeys() {
API Key
</Label>
<InstructionsDialog
type={type}
instructions={
API_KEY_INSTRUCTIONS[
type as keyof typeof API_KEY_INSTRUCTIONS
Expand Down
6 changes: 3 additions & 3 deletions src/components/CustomPodcast.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useState, useEffect } from "react";
import { useEffect, useState } from "react";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import * as z from "zod";
import { Loader2, X, Upload, Play, Download } from "lucide-react";
import { Loader2, Play, Download, X } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Textarea } from "@/components/ui/textarea";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Progress } from "@/components/ui/progress";
import { Card, CardContent } from "@/components/ui/card";
import { Card } from "@/components/ui/card";
import { io } from "socket.io-client";
import {
Accordion,
Expand Down
2 changes: 1 addition & 1 deletion src/components/NewsPodcast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function NewsPodcast() {
const [progress, setProgress] = useState(0);
const [statusMessage, setStatusMessage] = useState("");
const [audioUrl, setAudioUrl] = useState("");
const [transcript, setTranscript] = useState("");
const [, setTranscript] = useState("");
const [topics, setTopics] = useState("");
const { toast } = useToast();

Expand Down

0 comments on commit 3034bd8

Please sign in to comment.