MCP HubMCP Hub
스킬 목록으로 돌아가기

deploy-shiny-app

pjt222
업데이트됨 2 days ago
5 조회
17
2
17
GitHub에서 보기
메타aiautomation

정보

이 Claude Skill은 개발자가 Shiny 애플리케이션을 shinyapps.io, Posit Connect 또는 Docker 컨테이너에 배포할 수 있도록 지원합니다. 구성 설정, 매니페스트 생성, Dockerfile 작성 및 배포 검증을 처리합니다. 로컬 개발 환경에서 호스팅 환경으로 전환하거나 자동화된 배포 파이프라인을 설정할 때 사용하세요.

빠른 설치

Claude Code

추천
기본
npx skills add pjt222/agent-almanac -a claude-code
플러그인 명령대체
/plugin add https://github.com/pjt222/agent-almanac
Git 클론대체
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/deploy-shiny-app

Claude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요

문서

Deploy Shiny App

Deploy Shiny application to shinyapps.io, Posit Connect, or Docker container.

When Use

  • Publish Shiny app for external or internal users
  • Move from local development to hosted environment
  • Containerize Shiny app for Kubernetes or Docker deployment
  • Set up automated deployment pipelines

Inputs

  • Required: Path to Shiny application
  • Required: Deployment target (shinyapps.io, Posit Connect, or Docker)
  • Optional: Account name and token (for shinyapps.io/Connect)
  • Optional: Instance size preference
  • Optional: Custom domain or URL path

Steps

Step 1: Prep Application

Ensure app is self-contained and deployable:

# Check for missing dependencies
rsconnect::appDependencies("path/to/app")

# For golem apps, ensure DESCRIPTION lists all Imports
devtools::check()

# Verify app runs cleanly
shiny::runApp("path/to/app")

Verify these files exist:

  • app.R (or ui.R + server.R)
  • renv.lock (recommended for reproducible deployments)
  • .Rprofile does NOT call mcptools::mcp_session() in production

Got: App runs locally without errors. All dependencies captured.

If fail: If appDependencies() reports missing packages, install them and update renv.lock. If app uses system libraries (e.g., gdal, curl), note them for Docker path.

Step 2a: Deploy to shinyapps.io

# One-time account setup
rsconnect::setAccountInfo(
  name = "your-account",
  token = Sys.getenv("SHINYAPPS_TOKEN"),
  secret = Sys.getenv("SHINYAPPS_SECRET")
)

# Deploy
rsconnect::deployApp(
  appDir = "path/to/app",
  appName = "my-app",
  appTitle = "My Application",
  account = "your-account",
  forceUpdate = TRUE
)

Store credentials in .Renviron (never in code):

# .Renviron
SHINYAPPS_TOKEN=your_token_here
SHINYAPPS_SECRET=your_secret_here

Got: App deployed and accessible at https://your-account.shinyapps.io/my-app/.

If fail: If authentication fails, regenerate tokens at shinyapps.io dashboard > Account > Tokens. If package installation fails on server, check all packages available on CRAN — shinyapps.io cannot install from GitHub by default.

Step 2b: Deploy to Posit Connect

# Register server (one-time)
rsconnect::addServer(
  url = "https://connect.example.com",
  name = "production"
)

# Authenticate (one-time)
rsconnect::connectApiUser(
  account = "your-username",
  server = "production",
  apiKey = Sys.getenv("CONNECT_API_KEY")
)

# Deploy
rsconnect::deployApp(
  appDir = "path/to/app",
  appName = "my-app",
  server = "production",
  account = "your-username"
)

Got: App deployed and accessible on Posit Connect instance.

If fail: If server rejects connection, verify API key and server URL. If packages fail to install, check Connect has access to required repositories (CRAN, internal CRAN-like repos).

Step 2c: Deploy with Docker

Create Dockerfile:

FROM rocker/shiny-verse:4.4.0

# Install system dependencies
RUN apt-get update && apt-get install -y \
    libcurl4-openssl-dev \
    libssl-dev \
    libxml2-dev \
    && rm -rf /var/lib/apt/lists/*

# Install R packages
RUN R -e "install.packages(c('shiny', 'bslib', 'DT', 'plotly'))"

# Copy app
COPY . /srv/shiny-server/myapp/

# Configure Shiny Server
COPY shiny-server.conf /etc/shiny-server/shiny-server.conf

# Expose port
EXPOSE 3838

# Run
CMD ["/usr/bin/shiny-server"]

Create shiny-server.conf:

run_as shiny;

server {
  listen 3838;

  location / {
    site_dir /srv/shiny-server/myapp;
    log_dir /var/log/shiny-server;
    directory_index on;
  }
}

Build and run:

docker build -t myapp:latest .
docker run -p 3838:3838 myapp:latest

Got: App accessible at http://localhost:3838.

If fail: If build fails on package installation, add missing system libraries to apt-get install line. If app doesn't load, check Shiny Server logs: docker exec <container> cat /var/log/shiny-server/*.log.

Step 3: Verify Deployment

# Check deployed URL responds
response <- httr::GET("https://your-app-url/")
httr::status_code(response)  # Should be 200

# For Docker
response <- httr::GET("http://localhost:3838/")
httr::status_code(response)

Manual verification checklist:

  1. App loads without errors
  2. All interactive elements respond
  3. Data connections work in deployed environment
  4. Authentication/authorization works (if applicable)

Got: App responds with HTTP 200. All features work.

If fail: Check server logs for specific deployment platform. Common issues: environment variables not set in production, database connections using localhost instead of production URLs, or file paths only existing locally.

Step 4: Configure Monitoring (Optional)

shinyapps.io

Monitor via dashboard at https://www.shinyapps.io/admin/#/applications.

Posit Connect

# Check deployment status via API
connectapi::connect(
  server = "https://connect.example.com",
  api_key = Sys.getenv("CONNECT_API_KEY")
)

Docker

Add health check to Dockerfile:

HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
  CMD curl -f http://localhost:3838/ || exit 1

Got: Monitoring configured for deployment target.

If fail: If health checks fail intermittently, increase timeout values. Shiny apps can be slow to respond during initial load.

Checks

  • App deploys without errors
  • Deployed URL responds with HTTP 200
  • All interactive features work in production
  • Environment variables/secrets configured (not hardcoded)
  • Credentials stored in .Renviron or CI secrets, not in code
  • renv.lock committed for reproducible dependency resolution

Pitfalls

  • Hardcoded file paths: Replace absolute paths with system.file() (for package data) or environment variables (for external resources).
  • Development-only dependencies: Don't deploy .Rprofile that loads mcptools::mcp_session() or devtools. Use conditional loading or separate profiles.
  • Missing system libraries in Docker: R packages like sf, curl, and xml2 need system libraries. Add them to Dockerfile's apt-get install.
  • CRAN-only packages on shinyapps.io: shinyapps.io only installs from CRAN by default. GitHub-only packages need remotes package and explicit installation in deployment.
  • Forgotten environment variables: Database credentials, API keys, other secrets must be configured in deployment environment separately from code.

See Also

  • scaffold-shiny-app — create app structure before deployment
  • create-r-dockerfile — detailed Docker configuration for R projects
  • setup-docker-compose — multi-container setups for Shiny with databases
  • setup-github-actions-ci — CI/CD including automated deployment
  • optimize-shiny-performance — performance tuning before deploying to production

GitHub 저장소

pjt222/agent-almanac
경로: i18n/caveman/skills/deploy-shiny-app
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

연관 스킬

content-collections

메타

이 스킬은 콘텐츠 콜렉션(Content Collections)을 위한 프로덕션 검증된 설정을 제공합니다. 콘텐츠 콜렉션은 Markdown/MDX 파일을 Zod 검증이 포함된 타입 안전한 데이터 콜렉션으로 변환해주는 TypeScript 최우선 도구입니다. 블로그, 문서 사이트 또는 콘텐츠 중심의 Vite + React 애플리케이션을 구축할 때 타입 안전성과 자동 콘텐츠 검증을 보장하기 위해 사용하세요. Vite 플러그인 구성과 MDX 컴파일부터 배포 최적화 및 스키마 검증에 이르기까지 모든 것을 다룹니다.

스킬 보기

polymarket

메타

이 스킬은 개발자들이 Polymarket 예측 시장 플랫폼을 활용한 애플리케이션을 구축할 수 있도록 지원하며, 거래 및 시장 데이터를 위한 API 통합 기능을 포함합니다. 또한 WebSocket을 통한 실시간 데이터 스트리밍을 제공하여 실시간 거래와 시장 활동을 모니터링할 수 있습니다. 이를 통해 거래 전략을 구현하거나 실시간 시장 업데이트를 처리하는 도구를 생성하는 데 활용할 수 있습니다.

스킬 보기

creating-opencode-plugins

메타

이 스킬은 개발자들이 명령어, 파일, LSP 작업 등 25개 이상의 이벤트 유형에 연결되는 OpenCode 플러그인을 만들 수 있도록 돕습니다. JavaScript/TypeScript 모듈을 위한 플러그인 구조, 이벤트 API 명세, 구현 패턴을 제공합니다. OpenCode AI 어시스턴트의 라이프사이클을 사용자 정의 이벤트 기반 로직으로 가로채거나, 모니터링하거나, 확장해야 할 때 사용하세요.

스킬 보기

sglang

메타

SGLang은 RadixAttention 프리픽스 캐싱을 활용하여 JSON, 정규식, 에이전트 워크플로우를 위한 고속 구조화 생성에 특화된 고성능 LLM 서빙 프레임워크입니다. 특히 반복되는 프리픽스가 있는 작업에서 상당히 빠른 추론 속도를 제공하여 복잡한 구조화 출력 및 다중 턴 대화에 이상적입니다. 제약 디코딩이 필요하거나 광범위한 프리픽스 공유가 있는 애플리케이션을 구축할 때는 vLLM과 같은 대안보다 SGLang을 선택하십시오.

스킬 보기