Welcome
License
Foreword
Preface
Motivation
Who Is This Book For?
What Will You Learn?
What Will You Not Learn?
Conventions
About the Authors
Acknowledgements
I Getting Started
1
Background
1.1
Data-intensive Apps
1.2
Enter Shiny
1.3
Application Development
1.4
Application Hosting
1.5
The DevOps Cycle
1.6
The Hosting Cycle
1.7
Summary
2
Hosting Concepts
2.1
Domains and Networking
2.2
Website Technologies
2.3
Servers
2.4
Hosting Environments
2.5
Summary
3
Local Setup
3.1
Installing Your Developer Tools
3.1.1
R
3.1.2
Python
3.1.3
Web Browser
3.1.4
Docker Desktop
3.2
The Command Line
3.2.1
Navigation
3.2.2
Editing Files
3.2.3
File and Directory Operations
3.2.4
Super User Access
3.3
Source Code Management with Git
3.3.1
Git Services
3.3.2
Git Commands
3.3.3
.gitignore
3.3.4
Branching
3.3.5
Git in Practice
3.4
Working with Servers
3.4.1
Secure Shell (SSH)
3.5
Readability and Other Useful Tools
3.6
Summary
4
Shiny Examples
4.1
Old Faithful
4.2
Bananas
4.3
Load Balancing Test
4.4
Summary
II Shiny Apps
5
Developing Shiny Apps
5.1
Creating a Shiny App
5.1.1
R
5.1.2
Python
5.2
The Shiny App Lifecycle
5.2.1
Connections
5.2.2
Sessions
5.2.3
Connections + Sessions
5.2.4
Shinylive
5.3
Organizing Shiny Apps
5.3.1
R
5.3.2
Python
5.4
Shinylive
5.4.1
Python Shinylive
5.4.2
R Shinylive
5.5
Dynamic Documents
5.5.1
R Markdown
5.5.2
Quarto with Python
5.6
Summary
6
Running Shiny Apps Locally
6.1
R
6.2
Python
6.3
Summary
7
Sharing Your Shiny App
7.1
Distributing Code
7.2
Deploying Shiny Apps
7.2.1
shinyapps.io
7.2.2
Sharing Shinylive
7.3
Summary
III Hosting Shiny Apps
8
A Review of Shiny Hosting Options
8.1
Hosting Patterns for Shiny Apps
8.2
The Decision Framework
8.2.1
Start with the Why
8.2.2
Requirements
8.2.3
Constraints
8.2.4
Picking an Option
8.3
Important Prerequisites
8.3.1
Custom Domain Names
8.3.2
HTTPS Access to Your App
8.4
Summary
9
Platforms for Shiny Hosting
9.1
shinyapps.io
9.2
shinyapps.io Alternatives
9.2.1
Posit Connect Cloud
9.2.2
Ploomber
9.3
Summary
10
Static Hosting for Shinylive
10.1
Building Shinylive
10.2
GitHub Pages
10.2.1
Enabling Pages
10.2.2
Accessing the Published Site
10.3
Other Static Site Hosting Providers
10.4
Summary
11
Embedding Shiny Apps
11.1
Understanding Iframes
11.2
Styling Iframes
11.3
Summary
12
Hosting on Virtual Machines
12.1
Custom Domain Names
12.2
Server Setup
12.3
Installing Software for Shiny Hosting
12.4
Reverse Proxies
12.5
Setting the Firewall
12.6
Monitoring Processes
12.7
Shutdown and Reboot
12.8
Summary
13
Shiny Server
13.1
Provisioning a Server
13.2
Using Systemd
13.3
Configuring Shiny Server
13.4
File Transfer Based Publishing
13.4.1
Editing Files on the Server
13.4.2
Secure Copy Files to the Server
13.5
Git-based Deployment
13.5.1
Apps with Multiple Linux Users
13.6
Licensing Considerations
13.7
Summary
14
Posit Connect
14.1
Summary
IV Containerized Shiny Apps
15
Introduction to Containers
15.1
Docker Concepts
15.1.1
Docker Engine
15.1.2
Container Registries
15.1.3
Images
15.1.4
The Dockerfile
15.1.5
Containers
15.1.6
The Docker Command Line
15.2
Summary
16
Container Images
16.1
Working with Existing Images
16.1.1
Image Names and Tags
16.1.2
Pulling an Image
16.1.3
Docker Login
16.1.4
Running a Container
16.2
Building a New Image
16.2.1
R for Shiny
16.2.2
Buildx and BuildKit
16.2.3
Inspecting the Image
16.2.4
Python for Shiny
16.3
Managing Images
16.4
Sharing Images
16.4.1
Pushing Images
16.4.2
Docker Registries
16.4.3
Log In to a Registry
16.4.4
Local Registry
16.5
Summary
17
Containerizing Shiny Apps
17.1
The Dockerfile
17.1.1
The Parent Image
17.1.2
Metadata
17.1.3
Dependencies
17.1.4
Directories and Files
17.1.5
Switching User
17.1.6
Expose a Port
17.1.7
Variables
17.1.8
Executable and Command
17.2
Parent Images
17.2.1
R Parent Images
17.2.2
Python Parent Images
17.3
Installing System Libraries
17.3.1
Manual Installation
17.3.2
Automated Dependency Resolution with r2u
17.3.3
Dependencies on Alpine Linux
17.4
Installing R Packages
17.4.1
Explicitly Stating Dependencies
17.4.2
Using the DESCRIPTION File
17.4.3
Using renv
17.4.4
Using deps
17.5
Python Requirements
17.6
Classic Shiny Apps
17.6.1
R
17.6.2
Python
17.6.3
R Markdown
17.6.4
Quarto with R
17.6.5
Quarto with Python
17.6.6
Shiny Server
17.7
Containerizing Shinylive
17.8
Summary
18
Working with Containers
18.1
Docker Run
18.2
Managing Containers
18.3
Summary
V Hosting Shiny with Containers
19
Hosting Platforms
19.1
Heroku
19.1.1
Deployment from the Command Line
19.1.2
Deployment using the Web Dashboard
19.1.3
Custom Domain and HTTPS
19.1.4
Scaling
19.1.5
Summary
19.2
DigitalOcean App Platform
19.2.1
Prerequisites
19.2.2
Docker Hub Deployment
19.2.3
GitHub Deployment
19.2.4
Programmatic Deployment
19.2.5
Logs
19.2.6
Custom Domains
19.2.7
Summary
19.3
Fly.io
19.3.1
Prerequisites
19.3.2
Creating a Fly.io App
19.3.3
Deploying to Fly.io
19.3.4
Metrics and Logs
19.3.5
Setting up a Custom Domain
19.3.6
Adding TLS/SSL certificate
19.3.7
Autoscaling in Multiple-Regions
19.3.8
Summary
19.4
Other Providers
19.5
Summary
20
Docker Compose
20.1
The Compose File
20.2
Compose Command Line
20.3
Docker Compose on a Virtual Machine
20.4
Docker Compose Up and Down
20.5
Scaling with Docker Compose
20.6
Server Maintenance
20.7
Summary
21
ShinyProxy
21.1
Setting up ShinyProxy Using Docker
21.1.1
Docker Compose for ShinyProxy
21.1.2
ShinyProxy Configuration
21.1.3
General
21.1.4
Authentication
21.1.5
Applications
21.2
Deploying TLS with ShinyProxy Operator
21.3
User Interface
21.4
Deploying Monitoring with ShinyProxy Operator
21.5
Benchmarking ShinyProxy Applications
21.5.1
Docker Stats
21.5.2
Grafana Dashboard
21.6
Adding and Removing Shiny Applications
21.7
Other Considerations
21.8
Summary
VI Production Shiny Apps
22
Considerations for Production
22.1
Security
22.1.1
SSL Certificates
22.1.2
Storing Secrets
22.1.3
Firewalls
22.1.4
Private Networking
22.2
Authentication
22.2.1
HTTP Basic Auth
22.2.2
Third Party Auth
22.2.3
Native Authentication
22.3
Reliability
22.3.1
Backups
22.3.2
Reserved IP Addresses
22.3.3
Monitoring
22.3.4
Benchmarking
22.4
Scaling
22.4.1
Options for Scaling
22.4.2
Container Orchestration
22.5
Operations and Maintenance
22.5.1
Continuous Integration and Deployment
22.5.2
Logging
22.6
Summary
23
What is Next
Appendices
References
Hosting Shiny Applications for R and Python
Foreword
This is a book that I can recommend.
John Doe, Affiliation