Multi Platform Auto Deploy - bpmbox/AUTOCREATE GitHub Wiki
「あなたと私の会社」の世界展開 - マルチプラットフォーム自動デプロイ
-
🚀 AWS(本格運用)
- AWS Lambda + SAM でサーバーレス
- CloudFront + S3 で高速配信
- RDS for PostgreSQL でデータベース
-
🤗 HuggingFace Spaces(AI特化)
- Gradio標準対応
- AI・ML コミュニティ向け
- 無料でGPUアクセス可能
-
📊 Google Apps Script(軽量版)
- CLASP で自動デプロイ
- Google Workspace 統合
- 簡易API・スクリプト実行
-
📄 GitHub Pages(ドキュメント)
- Wiki・ドキュメント公開
- 静的サイト・デモページ
- 完全無料・高速
# template.yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
Timeout: 300
MemorySize: 512
Runtime: python3.11
Resources:
AutocreateFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: autocreate/
Handler: app.lambda_handler
Environment:
Variables:
GRADIO_SERVER_NAME: "0.0.0.0"
GRADIO_SERVER_PORT: 7860
Events:
AutocreateApi:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY
AutocreateDatabase:
Type: AWS::RDS::DBInstance
Properties:
DBInstanceIdentifier: autocreate-db
DBInstanceClass: db.t3.micro
Engine: postgres
MasterUsername: autocreate
AllocatedStorage: 20
Outputs:
AutocreateApi:
Description: "API Gateway endpoint URL"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/"
# app.py (HuggingFace Spaces版)
import gradio as gr
import os
# AUTOCREATE コンポーネントをインポート
from mysite.asgi import create_gradio_interface
def create_huggingface_app():
"""HuggingFace Spaces用のGradioアプリ作成"""
# 環境変数設定
os.environ['SPACE_ID'] = os.environ.get('SPACE_ID', 'autocreate-demo')
# Gradioインターフェース作成
demo = create_gradio_interface()
# HuggingFace Spaces用設定
demo.queue(max_size=20)
return demo
if __name__ == "__main__":
app = create_huggingface_app()
app.launch(
server_name="0.0.0.0",
server_port=7860,
share=False,
show_error=True
)
// Code.gs
function doGet(e) {
return HtmlService.createTemplateFromFile('index').evaluate()
.setTitle('AUTOCREATE - AI協働開発システム')
.addMetaTag('viewport', 'width=device-width, initial-scale=1')
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
}
function include(filename) {
return HtmlService.createHtmlOutputFromFile(filename).getContent();
}
// API エンドポイント
function doPost(e) {
const action = e.parameter.action;
switch(action) {
case 'health':
return ContentService.createTextOutput(JSON.stringify({
status: 'healthy',
timestamp: new Date().toISOString(),
platform: 'Google Apps Script'
})).setMimeType(ContentService.MimeType.JSON);
case 'gradio-proxy':
// Gradio機能のプロキシ(簡易版)
return handleGradioProxy(e.parameter);
default:
return ContentService.createTextOutput(JSON.stringify({
error: 'Unknown action'
})).setMimeType(ContentService.MimeType.JSON);
}
}
# .github/workflows/deploy-docs.yml
name: 📄 Deploy Documentation to GitHub Pages
on:
push:
branches: [ main ]
paths:
- 'wikigit/**'
- 'docs/**'
- 'README.md'
jobs:
deploy-docs:
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
steps:
- name: 📥 Checkout
uses: actions/checkout@v4
- name: 🔧 Setup Pages
uses: actions/configure-pages@v3
- name: 📝 Generate documentation site
run: |
mkdir -p docs-site
# README.mdをindex.htmlに変換
echo '<!DOCTYPE html><html><head><title>AUTOCREATE</title><meta charset="utf-8"></head><body>' > docs-site/index.html
markdown README.md >> docs-site/index.html
echo '</body></html>' >> docs-site/index.html
# Wiki ファイルを HTML に変換
mkdir -p docs-site/wiki
for file in wikigit/*.md; do
filename=$(basename "$file" .md)
echo '<!DOCTYPE html><html><head><title>'$filename'</title><meta charset="utf-8"></head><body>' > docs-site/wiki/$filename.html
markdown "$file" >> docs-site/wiki/$filename.html
echo '</body></html>' >> docs-site/wiki/$filename.html
done
- name: 📤 Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: docs-site
- name: 🚀 Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
# .github/workflows/multi-platform-deploy.yml
name: 🌍 Multi-Platform Auto Deploy
on:
push:
branches: [ main ]
release:
types: [published]
env:
AWS_REGION: us-east-1
HUGGINGFACE_SPACE: "autocreate/ai-collaboration-system"
jobs:
# 品質チェック(既存のCI)
quality-check:
uses: ./.github/workflows/ai-human-collaboration-ci.yml
# AWS デプロイ
deploy-aws:
needs: quality-check
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: 📥 Checkout
uses: actions/checkout@v4
- name: 🔧 Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: 🏗️ Build SAM application
run: |
sam build --use-container
- name: 🚀 Deploy to AWS
run: |
sam deploy --no-confirm-changeset --no-fail-on-empty-changeset \
--stack-name autocreate-prod \
--capabilities CAPABILITY_IAM \
--parameter-overrides \
Environment=production \
DomainName=${{ secrets.DOMAIN_NAME }}
- name: 📊 Update API Gateway
run: |
aws apigateway create-deployment \
--rest-api-id $(aws cloudformation describe-stacks \
--stack-name autocreate-prod \
--query 'Stacks[0].Outputs[?OutputKey==`RestApiId`].OutputValue' \
--output text) \
--stage-name Prod
# HuggingFace Spaces デプロイ
deploy-huggingface:
needs: quality-check
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout
uses: actions/checkout@v4
- name: 🤗 Setup HuggingFace CLI
run: |
pip install huggingface-hub
- name: 🚀 Deploy to HuggingFace Spaces
env:
HF_TOKEN: ${{ secrets.HUGGINGFACE_TOKEN }}
run: |
# HuggingFace Spaces用のファイル準備
cp app.py spaces_app.py
echo "title: AUTOCREATE AI Collaboration System" > README_spaces.md
echo "emoji: 🤖" >> README_spaces.md
echo "colorFrom: blue" >> README_spaces.md
echo "colorTo: purple" >> README_spaces.md
echo "sdk: gradio" >> README_spaces.md
echo "sdk_version: 5.0.1" >> README_spaces.md
echo "app_file: spaces_app.py" >> README_spaces.md
echo "pinned: false" >> README_spaces.md
cat README.md >> README_spaces.md
# HuggingFace Spaces にアップロード
huggingface-cli upload ${{ env.HUGGINGFACE_SPACE }} . \
--token $HF_TOKEN \
--repo-type space
# Google Apps Script デプロイ
deploy-gas:
needs: quality-check
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout
uses: actions/checkout@v4
- name: 📊 Setup CLASP
run: |
npm install -g @google/clasp
- name: 🔧 Configure CLASP
env:
CLASP_TOKEN: ${{ secrets.CLASP_TOKEN }}
run: |
echo "$CLASP_TOKEN" > ~/.clasprc.json
- name: 🚀 Deploy to Google Apps Script
run: |
# GAS用ファイル準備
mkdir -p gas-deploy
cp gas/* gas-deploy/
cd gas-deploy
# デプロイ実行
clasp push
clasp deploy --description "Auto deploy from GitHub Actions"
# GitHub Pages デプロイ(ドキュメント)
deploy-docs:
needs: quality-check
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
steps:
- name: 📥 Checkout
uses: actions/checkout@v4
- name: 📝 Build documentation site
run: |
# ドキュメントサイト生成
python scripts/generate-docs-site.py
- name: 🚀 Deploy to GitHub Pages
uses: actions/deploy-pages@v2
with:
path: docs-site
# デプロイ完了通知
deployment-notification:
needs: [deploy-aws, deploy-huggingface, deploy-gas, deploy-docs]
runs-on: ubuntu-latest
if: always()
steps:
- name: 🎉 Success notification
if: needs.deploy-aws.result == 'success' && needs.deploy-huggingface.result == 'success'
run: |
echo "🎉 Multi-platform deployment completed successfully!"
echo "🚀 AWS: Production environment updated"
echo "🤗 HuggingFace Spaces: AI community version updated"
echo "📊 Google Apps Script: Lightweight version updated"
echo "📄 GitHub Pages: Documentation updated"
- name: ⚠️ Failure notification
if: failure()
run: |
echo "❌ Some deployments failed. Check the logs for details."
# scripts/multi-platform-monitor.py
import requests
import json
from datetime import datetime
class MultiPlatformMonitor:
def __init__(self):
self.platforms = {
'aws': 'https://your-aws-api.execute-api.us-east-1.amazonaws.com/Prod/',
'huggingface': 'https://huggingface.co/spaces/autocreate/ai-collaboration-system',
'gas': 'https://script.google.com/macros/s/YOUR_SCRIPT_ID/exec',
'github_pages': 'https://your-username.github.io/AUTOCREATE/'
}
def check_platform_health(self, platform, url):
try:
response = requests.get(f"{url}/api/health", timeout=10)
return {
'platform': platform,
'status': 'healthy' if response.status_code == 200 else 'unhealthy',
'response_time': response.elapsed.total_seconds(),
'timestamp': datetime.now().isoformat()
}
except Exception as e:
return {
'platform': platform,
'status': 'error',
'error': str(e),
'timestamp': datetime.now().isoformat()
}
def monitor_all_platforms(self):
results = []
for platform, url in self.platforms.items():
result = self.check_platform_health(platform, url)
results.append(result)
return {
'overall_status': 'healthy' if all(r['status'] == 'healthy' for r in results) else 'degraded',
'platforms': results,
'check_time': datetime.now().isoformat()
}
if __name__ == "__main__":
monitor = MultiPlatformMonitor()
status = monitor.monitor_all_platforms()
print(json.dumps(status, indent=2))
- 対象: 企業・本格利用者
- 特徴: 高性能・高可用性・カスタマイズ性
- 機能: 全Gradioコンポーネント・API・データベース
- 対象: AI・ML研究者・開発者
- 特徴: GPU無料利用・AI コミュニティ
- 機能: Gradio メイン機能・デモ・研究用途
- 対象: Google Workspace ユーザー
- 特徴: 軽量・シンプル・統合性
- 機能: 基本API・シンプルUI・スクリプト実行
- 対象: 開発者・ドキュメント閲覧者
- 特徴: 高速・SEO対応・無料
- 機能: Wiki・ガイド・デモページ・ランディング
- 🌍 グローバル展開: 複数プラットフォームで最大リーチ
- 👥 ターゲット分散: プラットフォームごとの特化対応
- 🔄 相互補完: プラットフォーム障害時のバックアップ
- ⚡ 自動デプロイ: Git push で全プラットフォーム更新
- 📊 一元監視: 全プラットフォームの統合監視
- 🔧 品質保証: CI/CD での自動品質チェック
- 🏢 企業向け: AWS での本格運用・カスタマイズ対応
- 🎓 研究向け: HuggingFace での AI研究・教育利用
- 📊 軽量版: GAS での簡易利用・統合連携
- 📚 情報発信: GitHub Pages での情報発信・SEO
🌍 「あなたと私の会社」を世界中のあらゆるプラットフォームで展開し、最大限のインパクトを創出しましょう!
🚀 Multi-Platform Auto Deploy System
📅 設計完了: 2025年6月15日
🎯 目標: 世界最大リーチの AI協働開発システム