deploy-shinyproxy
About
This skill deploys ShinyProxy to host multiple containerized Shiny applications through a single entry point. It covers Docker deployment, configuration, authentication, access control, and usage tracking. Use it when you need to scale beyond single-app deployments with isolated containers, per-app security, and audit logging.
Quick Install
Claude Code
Recommendednpx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/deploy-shinyproxyCopy and paste this command in Claude Code to install this skill
Documentation
ShinyProxyのデプロイ
認証と利用追跡を備えた複数のコンテナ化Shinyアプリケーションをホスティングするため、ShinyProxyをデプロイする。
使用タイミング
- 単一エントリーポイントで複数のShinyアプリをホスティングする時
- アプリごとの認証とアクセス制御が必要な時
- 隔離されたDockerコンテナとしてShinyアプリをデプロイする時
- 単一アプリデプロイメント(shinyapps.ioやスタンドアロンDocker)を超えてスケーリングする時
- 利用分析と監査ログが必要な時
入力
- 必須: デプロイする1つ以上のShinyアプリ
- 必須: Dockerがインストールされたサーバー
- 任意: 認証プロバイダ(LDAP、OpenID、ソーシャル)
- 任意: ドメイン名とSSL証明書
- 任意: コンテナオーケストレーター(DockerまたはKubernetes)
手順
ステップ1: ShinyアプリのDockerイメージ作成
各Shinyアプリには独自のDockerイメージが必要。Shinyアプリ用のDockerfile例:
FROM rocker/shiny:4.5.0
RUN apt-get update && apt-get install -y \
libcurl4-openssl-dev \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
RUN R -e "install.packages(c('shiny', 'bslib', 'DT', 'dplyr'), \
repos='https://cloud.r-project.org/')"
COPY app/ /srv/shiny-server/app/
RUN chown -R shiny:shiny /srv/shiny-server/app
USER shiny
EXPOSE 3838
CMD ["R", "-e", "shiny::runApp('/srv/shiny-server/app', host='0.0.0.0', port=3838)"]
各アプリのビルドとテスト:
docker build -t myorg/dashboard:latest ./apps/dashboard/
docker run --rm -p 3838:3838 myorg/dashboard:latest
期待結果: 各Shinyアプリが独自のコンテナで独立して実行される。
ステップ2: ShinyProxyの設定
application.yml:
proxy:
title: "Shiny Applications"
port: 8080
container-backend: docker
docker:
internal-networking: true
authentication: simple
admin-groups: admins
users:
- name: admin
password: admin_password
groups: admins
- name: analyst
password: analyst_password
groups: users
specs:
- id: dashboard
display-name: "Analytics Dashboard"
description: "Interactive data analysis dashboard"
container-image: myorg/dashboard:latest
container-cmd: ["R", "-e", "shiny::runApp('/srv/shiny-server/app', host='0.0.0.0', port=3838)"]
container-network: shinyproxy-net
port: 3838
access-groups: [admins, users]
- id: report-builder
display-name: "Report Builder"
description: "Generate custom reports"
container-image: myorg/report-builder:latest
container-cmd: ["R", "-e", "shiny::runApp('/srv/shiny-server/app', host='0.0.0.0', port=3838)"]
container-network: shinyproxy-net
port: 3838
access-groups: [admins]
logging:
file:
name: /opt/shinyproxy/log/shinyproxy.log
server:
forward-headers-strategy: native
ステップ3: Docker ComposeによるShinyProxyのデプロイ
docker-compose.yml:
services:
shinyproxy:
image: openanalytics/shinyproxy:3.1.1
container_name: shinyproxy
ports:
- "8080:8080"
volumes:
- ./application.yml:/opt/shinyproxy/application.yml:ro
- /var/run/docker.sock:/var/run/docker.sock
- shinyproxy-logs:/opt/shinyproxy/log
networks:
- shinyproxy-net
restart: unless-stopped
networks:
shinyproxy-net:
name: shinyproxy-net
driver: bridge
volumes:
shinyproxy-logs:
# Create the network first (ShinyProxy spawns containers on this network)
docker network create shinyproxy-net
# Start ShinyProxy
docker compose up -d
# Check logs
docker compose logs -f shinyproxy
期待結果: ShinyProxyがポート8080で起動し、ログインページを表示し、設定済みアプリを一覧表示する。
失敗時: docker compose logs shinyproxyを確認する。アプリイメージがローカルで利用可能か確認する(docker images)。
ステップ4: 認証の設定
Simple(組み込み)
ステップ2で示したauthentication: simpleとインラインユーザー。
LDAP
proxy:
authentication: ldap
ldap:
url: ldap://ldap.example.com:389/dc=example,dc=com
manager-dn: cn=admin,dc=example,dc=com
manager-password: ldap_admin_password
user-search-base: ou=users
user-search-filter: (uid={0})
group-search-base: ou=groups
group-search-filter: (member={0})
OpenID Connect(Keycloak、Auth0など)
proxy:
authentication: openid
openid:
auth-url: https://auth.example.com/realms/myrealm/protocol/openid-connect/auth
token-url: https://auth.example.com/realms/myrealm/protocol/openid-connect/token
jwks-url: https://auth.example.com/realms/myrealm/protocol/openid-connect/certs
client-id: shinyproxy
client-secret: your_client_secret
roles-claim: realm_access.roles
ステップ5: Nginxによるリバースプロキシの追加
本番環境では、ShinyProxyの前にNginxを配置する:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 443 ssl;
server_name shiny.example.com;
ssl_certificate /etc/letsencrypt/live/shiny.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/shiny.example.com/privkey.pem;
location / {
proxy_pass http://shinyproxy:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 600s;
proxy_buffering off;
}
}
WebSocketサポートが重要 — ShinyProxyとShinyはWebSocketを多用する。
ステップ6: 利用追跡
ShinyProxyはログファイルに利用イベントを記録する。構造化された追跡にはInfluxDBを設定する:
proxy:
usage-stats-url: http://influxdb:8086/write?db=shinyproxy
usage-stats-username: shinyproxy
usage-stats-password: stats_password
ComposeスタックにInfluxDBを追加する:
services:
influxdb:
image: influxdb:1.8
environment:
INFLUXDB_DB: shinyproxy
INFLUXDB_ADMIN_USER: admin
INFLUXDB_ADMIN_PASSWORD: admin_password
volumes:
- influxdata:/var/lib/influxdb
networks:
- shinyproxy-net
volumes:
influxdata:
ステップ7: アプリリソース制限
specs:
- id: dashboard
container-image: myorg/dashboard:latest
container-memory-limit: 1g
container-cpu-limit: 1.0
max-instances: 5
container-env:
R_MAX_MEM_SIZE: 768m
ステップ8: デプロイメントの検証
# Check ShinyProxy health
curl -s http://localhost:8080/actuator/health
# Test login
curl -s -c cookies.txt -d "username=admin&password=admin_password" \
http://localhost:8080/login
# List apps via API
curl -s -b cookies.txt http://localhost:8080/api/proxyspec
期待結果: ヘルスエンドポイントがUPを返す。ログインが成功する。アプリが隔離されたコンテナで起動する。
バリデーション
- ShinyProxyが起動しログインページを表示する
- すべての設定済みユーザーで認証が機能する
- 各Shinyアプリが独自のコンテナで起動する
- WebSocket接続が機能する(Shinyのリアクティビティ機能)
- アクセスグループがアプリの表示を正しく制限する
- ユーザー切断時のコンテナクリーンアップが機能する
- ログが利用イベントをキャプチャする
よくある落とし穴
- Dockerソケットの権限: ShinyProxyはコンテナを起動するためにDockerソケットへのアクセスが必要。
dockerグループのユーザーとして実行するか、ソケットをマウントする - ネットワークの不一致: アプリコンテナはShinyProxyと同じDockerネットワーク上にある必要がある(specsの
container-networkが一致する必要がある) - WebSocketプロキシ: ShinyProxyの前のNginxやその他のプロキシはWebSocketアップグレードヘッダーを転送する必要がある
- イメージが見つからない: ShinyProxyが使用を試みる前にアプリイメージがDockerホスト上でプルまたはビルドされている必要がある
- コンテナクリーンアップ: ShinyProxyがクラッシュした場合、孤立したアプリコンテナが残る可能性がある。
docker psで確認しクリーンアップする - メモリ制限: Shinyアプリは大量のメモリを消費する可能性がある。単一アプリが他を飢えさせないよう
container-memory-limitを設定する
関連スキル
deploy-shiny-app-- shinyapps.io、Posit Connect、またはDockerへの単一アプリデプロイメントconfigure-reverse-proxy-- WebSocketプロキシを含むリバースプロキシパターンcreate-dockerfile-- アプリイメージ用の一般的なDockerfile作成create-r-dockerfile-- rockerイメージを使用するR固有のDockerfile
GitHub Repository
Frequently asked questions
What is the deploy-shinyproxy skill?
deploy-shinyproxy is a Claude Skill by pjt222. Skills package instructions and resources that Claude loads on demand, so Claude can perform deploy-shinyproxy-related tasks without extra prompting.
How do I install deploy-shinyproxy?
Use the install commands on this page: add deploy-shinyproxy to Claude Code as a plugin, or clone its repository into your skills directory, then restart Claude so it picks up the skill.
What category does deploy-shinyproxy belong to?
deploy-shinyproxy is in the Documentation category, tagged general.
Is deploy-shinyproxy free to use?
Yes. deploy-shinyproxy is listed on AIMCP and free to install. It runs inside Claude, so no separate service account is required to use the skill itself.
Related Skills
This skill fetches current Railway documentation to answer questions about features, functionality, or specific docs URLs. It ensures developers receive accurate, up-to-date information directly from Railway's official sources. Use it when users ask how Railway works or reference Railway documentation.
This Claude Skill provides expert guidance for writing Python code in n8n's Code nodes, specifically for using Python's standard library and working with n8n's special syntax like `_input`, `_json`, and `_node`. It helps developers understand Python's limitations within n8n and recommends using JavaScript for most workflows while offering Python solutions for specific data transformation needs.
The Archon skill provides RAG-powered semantic search and project management through a REST API. Use it for querying documentation, managing hierarchical projects/tasks, and performing knowledge retrieval with document upload capabilities. Always prioritize Archon first when searching external documentation before using other sources.
This Claude Skill provides expert guidance for writing JavaScript code in n8n's Code nodes. It covers essential n8n-specific syntax like `$input`/`$json` variables, HTTP helpers, and DateTime handling, while troubleshooting common errors. Use it when developing n8n workflows that require custom JavaScript processing in Code nodes.
