1. It is a Native Aot Scale to Zero Application Shell for Web Hosting of Static Content in fly.io
1. Pay for Hosting based on Actual Usage of Resources rather than for subscription of Resources
2. Protect Web Hosting from Over Usage
1. Fly Log showing Scale to Performance on start of less than 50 Millisecond
- Github Repository Link of the AotWeb Open Source MIT Licensed Repository
- Fly Hosted App Link of the Hosted Scale To Zero App Shell to show the Published Astro Blog Template copied to wwwroot
- Github Repository Link of the StaticWeb Repository for Self Hosting with Additional Features
- Fly Hosted App Link of the Hosted Scale To Zero App Static Web with Additional Features
-
Auto Shutdown MicroVM fly.io Machines
Can auto shutdown after a idle time of configurable 10 seconds if have no requests -
View Server Instance Information
Can view information about the web instance on querying using /Echo -
Access Other Region Instance (If Hosted in Multiple Regions)
Can use ?region=sin querystring to replay to the instance in the specified region -
View Server Performance on Cold Start/Warm Start
Can view the performance log metrics of the instance in fly.io logs
Install flyctl from https://fly.io for your respective environment
Clone the repo and run the appropriate **Arshu.ScaleToZeroAotWeb** asp.net core project for the respective platform
1. Run the Docker Image **arshucs/ScaleToZeroAotWeb** as below
2. docker run --publish 8080:8080 arshucs/ScaleToZeroAotWeb:latest
Fly.io provides free/paid options which should be more than sufficient to host any web app at low cost since the machine will auto shutdown after a idle time configured using Environment Flag
Prerequisite is Install the Fly Command Line Program from fly site and login using the fly command line program using fly auth login
Replace [appname] and [orgname] with your own app name and org name eg. personal
Initial Step 1 : Create a Fly App for Machines [NOT A FLY APP] flyctl apps create --machines --name [appname] --org [orgname] Initial Step 2 : Allocation IPv4 and IPv6 for the App flyctl ips allocate-v6 --app [appname] flyctl ips allocate-v4 --shared --app [appname] flyctl ips list --app [appname] Initial Step 3 : Modify AppName in fly.toml Modify the appname and checks.appname in fly.toml Initila Step 4 : Upload the Docker Image to Fly Docker Registry flyctl deploy --dockerfile Dockerfile --build-only --remote-only --push --image-label latest -a [appname] Initial Step 5 : Deploy the Machine to Fly flyctl machine run registry.fly.io/[appname]:latest --name [appname]-sin-1 --region sin --port 443:8080/tcp:tls --port 80:8080/tcp:http --env INITIAL_TIME_IN_SEC="10" --env IDLE_TIME_IN_SEC="10" --config fly.toml --app [appname] Repeat Step 5 for each region you want to deploy the app Update Step 6 After every change in the src deploy the docker image to Fly Docker Registry and Update the Machine flyctl deploy --dockerfile Dockerfile --build-only --remote-only --push --image-label latest -a [appname] Update the Machine flyctl machine update [machineID] --image registry.fly.io/[appname]:latest --port 443:8080/tcp:tls --port 80:8080/tcp:http --env INITIAL_TIME_IN_SEC="15" --env IDLE_TIME_IN_SEC="15" --config fly.toml --app [appname] Optional Steps Show Log of the App flyctl logs -a [appname] -r sin Retrive the Machine ID flyctl machine list --app [appname] Stop the Machine flyctl machine stop [machineID] Destroy the Machine flyctl machine destroy [machineID] --force Delete the [appname] after testing flyctl apps destroy [appname] --yes
eg. For Compatible Astro Projects, copy the content of dist folder to wwwroot created using npm run build