Merge branch 'main' into refactor-xml-tools

This commit is contained in:
Soumyadas15 2025-05-29 01:21:33 +05:30
commit 1b075658ba
7 changed files with 38 additions and 104 deletions

View File

@ -1,17 +0,0 @@
name: Fly Deploy Production
on:
push:
branches:
- PRODUCTION
workflow_dispatch:
jobs:
deploy:
name: Deploy production app
runs-on: ubuntu-latest
concurrency: deploy-group # optional: ensure only one action runs at a time
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: cd backend && flyctl deploy --remote-only --config fly.production.toml
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

View File

@ -1,17 +0,0 @@
name: Fly Deploy Staging
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
name: Deploy staging app
runs-on: ubuntu-latest
concurrency: deploy-group # optional: ensure only one action runs at a time
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: cd backend && flyctl deploy --remote-only --config fly.staging.toml
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

View File

@ -2,6 +2,9 @@ name: Update PRODUCTION Branch
on:
workflow_dispatch:
permissions:
contents: write
jobs:
update-production:
name: Rebase PRODUCTION to main

View File

@ -1,26 +0,0 @@
# fly.toml app configuration file generated for backend-production-ogog on 2025-04-21T00:36:09+01:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = 'backend-production-ogog'
primary_region = 'bos'
[build]
dockerfile = 'Dockerfile'
[http_service]
internal_port = 8000
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
max_machines_count = 1
processes = ['app']
[[vm]]
memory = '16gb'
cpu_kind = 'performance'
cpus = 8
[env]
ENV_MODE = "production"

View File

@ -1,26 +0,0 @@
# fly.toml app configuration file generated for backend-staging-icy-mountain-363 on 2025-04-21T00:32:15+01:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = 'backend-staging-icy-mountain-363'
primary_region = 'cdg'
[build]
dockerfile = 'Dockerfile'
[http_service]
internal_port = 8000
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
max_machines_count = 1
processes = ['app']
[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1
[env]
ENV_MODE = "staging"

View File

@ -7,6 +7,8 @@ import subprocess
from getpass import getpass
import re
IS_WINDOWS = platform.system() == 'Windows'
# ANSI colors for pretty output
class Colors:
HEADER = '\033[95m'
@ -81,7 +83,8 @@ def check_requirements():
[cmd_to_check, '--version'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
check=True
check=True,
shell=IS_WINDOWS
)
print_success(f"{cmd} is installed")
except (subprocess.SubprocessError, FileNotFoundError):
@ -103,7 +106,8 @@ def check_docker_running():
['docker', 'info'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
check=True
check=True,
shell=IS_WINDOWS
)
print_success("Docker is running")
return True
@ -550,7 +554,8 @@ def setup_supabase():
['supabase', '--version'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
check=True
check=True,
shell=IS_WINDOWS
)
except (subprocess.SubprocessError, FileNotFoundError):
print_error("Supabase CLI is not installed.")
@ -592,19 +597,25 @@ def setup_supabase():
try:
# Login to Supabase CLI (interactive)
print_info("Logging into Supabase CLI...")
subprocess.run(['supabase', 'login'], check=True)
subprocess.run(['supabase', 'login'], check=True, shell=IS_WINDOWS)
# Link to project
print_info(f"Linking to Supabase project {project_ref}...")
subprocess.run(
['supabase', 'link', '--project-ref', project_ref],
cwd=backend_dir,
check=True
check=True,
shell=IS_WINDOWS
)
# Push database migrations
print_info("Pushing database migrations...")
subprocess.run(['supabase', 'db', 'push'], cwd=backend_dir, check=True)
subprocess.run(
['supabase', 'db', 'push'],
cwd=backend_dir,
check=True,
shell=IS_WINDOWS
)
print_success("Supabase database setup completed")
@ -628,7 +639,8 @@ def install_dependencies():
subprocess.run(
['npm', 'install'],
cwd='frontend',
check=True
check=True,
shell=IS_WINDOWS
)
print_success("Frontend dependencies installed successfully")
@ -637,14 +649,16 @@ def install_dependencies():
subprocess.run(
['poetry', 'lock'],
cwd='backend',
check=True
check=True,
shell=IS_WINDOWS
)
# Install backend dependencies
print_info("Installing backend dependencies...")
subprocess.run(
['poetry', 'install'],
cwd='backend',
check=True
check=True,
shell=IS_WINDOWS
)
print_success("Backend dependencies installed successfully")
@ -715,7 +729,7 @@ def start_suna():
# subprocess.run(['docker', 'compose', 'up', '-d'], check=True)
print_info("Building images locally...")
subprocess.run(['docker', 'compose', 'up', '-d'], check=True)
subprocess.run(['docker', 'compose', 'up', '-d', '--build'], check=True, shell=IS_WINDOWS)
# Wait for services to be ready
print_info("Waiting for services to start...")
@ -723,11 +737,10 @@ def start_suna():
# Check if services are running
result = subprocess.run(
['docker', 'compose', 'ps'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
check=True,
text=True
['docker', 'compose', 'ps', '-q'],
capture_output=True,
text=True,
shell=IS_WINDOWS
)
if "backend" in result.stdout and "frontend" in result.stdout:

View File

@ -2,12 +2,16 @@
import subprocess
import sys
import platform
IS_WINDOWS = platform.system() == 'Windows'
def check_docker_compose_up():
result = subprocess.run(
["docker", "compose", "ps", "-q"],
capture_output=True,
text=True
text=True,
shell=IS_WINDOWS
)
return len(result.stdout.strip()) > 0
@ -47,9 +51,9 @@ def main():
return
if action == "stop":
subprocess.run(["docker", "compose", "down"])
subprocess.run(["docker", "compose", "down"], shell=IS_WINDOWS)
else:
subprocess.run(["docker", "compose", "up", "-d"])
subprocess.run(["docker", "compose", "up", "-d"], shell=IS_WINDOWS)
if __name__ == "__main__":
main()