SimpleCDN 0.8.0-pre8

This is a prerelease version of SimpleCDN.
There is a newer version of this package available.
See the version list below for details.
dotnet add package SimpleCDN --version 0.8.0-pre8
                    
NuGet\Install-Package SimpleCDN -Version 0.8.0-pre8
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SimpleCDN" Version="0.8.0-pre8" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SimpleCDN" Version="0.8.0-pre8" />
                    
Directory.Packages.props
<PackageReference Include="SimpleCDN" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SimpleCDN --version 0.8.0-pre8
                    
#r "nuget: SimpleCDN, 0.8.0-pre8"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SimpleCDN@0.8.0-pre8
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SimpleCDN&version=0.8.0-pre8&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=SimpleCDN&version=0.8.0-pre8&prerelease
                    
Install as a Cake Tool

SimpleCDN

GitHub Actions Workflow Status

SimpleCDN is, well, a simple CDN server. Currently it is only tested for single-instance use, but I don't see any reasons why a load balancer wouldn't work. With Redis you can make sure they have one single shared cache.

How to use this in an existing project?

NuGet Packages

SimpleCDN is available on NuGet:

  • SimpleCDN on NuGet
  • SimpleCDN.Extensions.Redis on NuGet

How to use SimpleCDN as a standalone application?

Using Docker

Tags:

  • latest: the latest stable release
  • main: the latest build of the main branch, usually on the last commit. Not recommended for production as it may contain bugs or break.
  • vX.X.X: pin to a specific version. Recommended for production scenarios. Supported versions can be found in the tags listing.
with docker run
docker run -p "<your_port>:8080" -v "<your_cdn_data>:/data:ro" ghcr.io/jonathanbout/simplecdn

This will pull and run the latest stable build of SimpleCDN.

with docker compose
services:
  server:
    image: ghcr.io/jonathanbout/simplecdn
    volumes:
    - <your_cdn_data>:/data:ro # :ro to make the bind mount read-only
    ports:
    - <your_port>:8080
    environment:
    - ASPNETCORE_URLS=http://+:8080

# === use below only if you want to use redis ===
    - Cache__Redis__ConnectionString=redis:6379
  redis:
    image: redis

Redis support is available, but it ocasionally fails, especially in high-load scenario's. By implementing a custom connection manager, it's brought down to a minimum but failures still happen. The application will simply load the data from disk instead of using the cache.

Using dotnet

dotnet run
# PublishAOT is not supported with dotnet run so we need to disable it
dotnet run --property:PublishAot=false -- --data-root <your_cdn_data>

Variables:

Command line arguments have precedence over appsettings.json and appsettings.json has precedence environment variables.

command line argument environment variable appsettings.json allowed values default value description
--data-root CDN_DATA_ROOT CDN:DataRoot a local path /data The data root, where the files to be served are stored.
--max-cache CDN_CACHE_LIMIT CDN:MaxMemoryCacheSize any number within the size of your devices memory 500 The maximum size of the cache, in kB
--CDN:Footer CDN__Footer CDN:Footer Any HTML Powered by SimpleCDN (with a link to this GitHub repo) The text to place at the bottom of generated index files
--CDN:PageTitle CDN__PageTitle CDN:PageTitle Any <title> compatible string SimpleCDN The text to display in the browser's title bar

more options are available, for a full overview look at the models in the SimpleCDN/Configuration folder.

  • For command line arguments, use --<section name>:<property name> "<property value>" (section separator is :)
  • For environment variables, use <section name>__<property name>=<property value> (section separator is __, double underscore)
  • In appsettings.json, use the following structure:
    {
      "<section name>": {
        "<property name>": "<property value>"
      }
    }
    

Where section name is one of the following:

  • CDN - common CDN options corresponding to CDNConfiguration.cs
  • Cache - caching options corresponding to CacheConfiguration.cs
    • Cache > Redis - Redis-specific options, corresponding to RedisCacheConfiguration.cs
    • Cache > InMemory - Redis-specific options, corresponding to InMemoryCacheConfiguration.cs When any options in the Redis section are defined, SimpleCDN will assume you want to use Redis. To overwrite this, use the Cache > Type property to use InMemory or no (Disabled) cache.

Development

Contributions are always welcome! Feel free to create an issue if you encounter problems. If you know a fix, a Pull Request is even better!

Building the docker image

Building a docker image can be done easily with docker build:

docker build . -f SimpleCDN/Dockerfile -t simplecdn:local

Be aware the build context has to be the root of the repo, whilst the dockerfile is in the SimpleCDN folder.

Running tests

Executing the Unit tests can be done with just a single command:

dotnet test SimpleCDN.sln

This will run the NUnit tests in the SimpleCDN.Tests project.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SimpleCDN:

Package Downloads
SimpleCDN.Extensions.Redis

An extension for using Redis with SimpleCDN, the static file server.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5 192 8/26/2025
1.0.4 164 6/3/2025
1.0.3 142 5/2/2025
1.0.2 130 2/21/2025
1.0.1 125 2/11/2025
1.0.0 132 2/11/2025
0.9.0-pre1 101 1/29/2025
0.8.0 123 1/23/2025
0.8.0-rc7 112 1/23/2025
0.8.0-rc6 112 1/21/2025
0.8.0-rc5 96 1/17/2025
0.8.0-rc4 92 1/16/2025
0.8.0-rc3 91 1/15/2025
0.8.0-pre9 87 1/15/2025
0.8.0-pre8 90 1/15/2025
0.8.0-pre7 94 1/15/2025
0.8.0-pre6 88 1/14/2025
0.8.0-pre5 85 1/14/2025
0.8.0-pre4 102 1/11/2025
0.8.0-pre3 104 1/11/2025
0.8.0-pre11 99 1/17/2025
0.8.0-pre10 102 1/17/2025