Functions-as-a-Service (FaaS) has emerged as a new, scalable technology for implementing cloud-based web services. As an event-driven programming paradigm, FaaS systems are also gaining in popularity as a technology for implementing the ``back end'' of Internet of Things (IoT) applications. In this paper, we describe CSPOT -- a portable, multi-scale FaaS system for implementing IoT applications. CSPOT is designed to run at all scales employed by cloud-based IoT applications. The current implementation is available for micro-Linux devices, edge computing devices, moderately-sized private clouds, and public clouds. CSPOT features include a lightweight runtime system that automatically logs causal relationships between FaaS function invocations, and a portable, append-only storage abstraction which also serves as a communication substrate for functions.