@alchemy.run/fly 0.0.0 → 2.0.0-beta.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +57 -4
- package/lib/App.d.ts +230 -0
- package/lib/App.d.ts.map +1 -0
- package/lib/App.js +340 -0
- package/lib/App.js.map +1 -0
- package/lib/AuthProvider.d.ts +22 -0
- package/lib/AuthProvider.d.ts.map +1 -0
- package/lib/AuthProvider.js +48 -0
- package/lib/AuthProvider.js.map +1 -0
- package/lib/BindService.d.ts +159 -0
- package/lib/BindService.d.ts.map +1 -0
- package/lib/BindService.js +222 -0
- package/lib/BindService.js.map +1 -0
- package/lib/Bootstrap.d.ts +8 -0
- package/lib/Bootstrap.d.ts.map +1 -0
- package/lib/Bootstrap.js +41 -0
- package/lib/Bootstrap.js.map +1 -0
- package/lib/Bucket.d.ts +278 -0
- package/lib/Bucket.d.ts.map +1 -0
- package/lib/Bucket.js +658 -0
- package/lib/Bucket.js.map +1 -0
- package/lib/BucketBinding.d.ts +33 -0
- package/lib/BucketBinding.d.ts.map +1 -0
- package/lib/BucketBinding.js +70 -0
- package/lib/BucketBinding.js.map +1 -0
- package/lib/Catalog.d.ts +28 -0
- package/lib/Catalog.d.ts.map +1 -0
- package/lib/Catalog.js +31 -0
- package/lib/Catalog.js.map +1 -0
- package/lib/Certificate.d.ts +189 -0
- package/lib/Certificate.d.ts.map +1 -0
- package/lib/Certificate.js +380 -0
- package/lib/Certificate.js.map +1 -0
- package/lib/Checkpoint.d.ts +55 -0
- package/lib/Checkpoint.d.ts.map +1 -0
- package/lib/Checkpoint.js +3 -0
- package/lib/Checkpoint.js.map +1 -0
- package/lib/CheckpointHttp.d.ts +22 -0
- package/lib/CheckpointHttp.d.ts.map +1 -0
- package/lib/CheckpointHttp.js +53 -0
- package/lib/CheckpointHttp.js.map +1 -0
- package/lib/ConnectPostgres.d.ts +58 -0
- package/lib/ConnectPostgres.d.ts.map +1 -0
- package/lib/ConnectPostgres.js +13 -0
- package/lib/ConnectPostgres.js.map +1 -0
- package/lib/ConnectPostgresHttp.d.ts +26 -0
- package/lib/ConnectPostgresHttp.d.ts.map +1 -0
- package/lib/ConnectPostgresHttp.js +57 -0
- package/lib/ConnectPostgresHttp.js.map +1 -0
- package/lib/Contributions.d.ts +7 -0
- package/lib/Contributions.d.ts.map +1 -0
- package/lib/Contributions.js +6 -0
- package/lib/Contributions.js.map +1 -0
- package/lib/Credentials.d.ts +33 -0
- package/lib/Credentials.d.ts.map +1 -0
- package/lib/Credentials.js +59 -0
- package/lib/Credentials.js.map +1 -0
- package/lib/Decrypt.d.ts +52 -0
- package/lib/Decrypt.d.ts.map +1 -0
- package/lib/Decrypt.js +3 -0
- package/lib/Decrypt.js.map +1 -0
- package/lib/DecryptHttp.d.ts +22 -0
- package/lib/DecryptHttp.d.ts.map +1 -0
- package/lib/DecryptHttp.js +43 -0
- package/lib/DecryptHttp.js.map +1 -0
- package/lib/DeleteObject.d.ts +29 -0
- package/lib/DeleteObject.d.ts.map +1 -0
- package/lib/DeleteObject.js +3 -0
- package/lib/DeleteObject.js.map +1 -0
- package/lib/DeleteObjectHttp.d.ts +12 -0
- package/lib/DeleteObjectHttp.d.ts.map +1 -0
- package/lib/DeleteObjectHttp.js +17 -0
- package/lib/DeleteObjectHttp.js.map +1 -0
- package/lib/Deployment.d.ts +51 -0
- package/lib/Deployment.d.ts.map +1 -0
- package/lib/Deployment.js +62 -0
- package/lib/Deployment.js.map +1 -0
- package/lib/DeploymentImages.d.ts +18 -0
- package/lib/DeploymentImages.d.ts.map +1 -0
- package/lib/DeploymentImages.js +61 -0
- package/lib/DeploymentImages.js.map +1 -0
- package/lib/DeploymentState.d.ts +17 -0
- package/lib/DeploymentState.d.ts.map +1 -0
- package/lib/DeploymentState.js +87 -0
- package/lib/DeploymentState.js.map +1 -0
- package/lib/Encrypt.d.ts +50 -0
- package/lib/Encrypt.d.ts.map +1 -0
- package/lib/Encrypt.js +3 -0
- package/lib/Encrypt.js.map +1 -0
- package/lib/EncryptHttp.d.ts +22 -0
- package/lib/EncryptHttp.d.ts.map +1 -0
- package/lib/EncryptHttp.js +39 -0
- package/lib/EncryptHttp.js.map +1 -0
- package/lib/Environment.d.ts +45 -0
- package/lib/Environment.d.ts.map +1 -0
- package/lib/Environment.js +43 -0
- package/lib/Environment.js.map +1 -0
- package/lib/Errors.d.ts +18 -0
- package/lib/Errors.d.ts.map +1 -0
- package/lib/Errors.js +13 -0
- package/lib/Errors.js.map +1 -0
- package/lib/Exec.d.ts +41 -0
- package/lib/Exec.d.ts.map +1 -0
- package/lib/Exec.js +3 -0
- package/lib/Exec.js.map +1 -0
- package/lib/ExecHttp.d.ts +22 -0
- package/lib/ExecHttp.d.ts.map +1 -0
- package/lib/ExecHttp.js +39 -0
- package/lib/ExecHttp.js.map +1 -0
- package/lib/GetObject.d.ts +34 -0
- package/lib/GetObject.d.ts.map +1 -0
- package/lib/GetObject.js +3 -0
- package/lib/GetObject.js.map +1 -0
- package/lib/GetObjectHttp.d.ts +12 -0
- package/lib/GetObjectHttp.d.ts.map +1 -0
- package/lib/GetObjectHttp.js +17 -0
- package/lib/GetObjectHttp.js.map +1 -0
- package/lib/GetSecret.d.ts +44 -0
- package/lib/GetSecret.d.ts.map +1 -0
- package/lib/GetSecret.js +3 -0
- package/lib/GetSecret.js.map +1 -0
- package/lib/GetSecretHttp.d.ts +22 -0
- package/lib/GetSecretHttp.d.ts.map +1 -0
- package/lib/GetSecretHttp.js +50 -0
- package/lib/GetSecretHttp.js.map +1 -0
- package/lib/HeadObject.d.ts +29 -0
- package/lib/HeadObject.d.ts.map +1 -0
- package/lib/HeadObject.js +3 -0
- package/lib/HeadObject.js.map +1 -0
- package/lib/HeadObjectHttp.d.ts +12 -0
- package/lib/HeadObjectHttp.d.ts.map +1 -0
- package/lib/HeadObjectHttp.js +17 -0
- package/lib/HeadObjectHttp.js.map +1 -0
- package/lib/IpAssignment.d.ts +258 -0
- package/lib/IpAssignment.d.ts.map +1 -0
- package/lib/IpAssignment.js +376 -0
- package/lib/IpAssignment.js.map +1 -0
- package/lib/ListObjectsV2.d.ts +29 -0
- package/lib/ListObjectsV2.d.ts.map +1 -0
- package/lib/ListObjectsV2.js +3 -0
- package/lib/ListObjectsV2.js.map +1 -0
- package/lib/ListObjectsV2Http.d.ts +12 -0
- package/lib/ListObjectsV2Http.d.ts.map +1 -0
- package/lib/ListObjectsV2Http.js +17 -0
- package/lib/ListObjectsV2Http.js.map +1 -0
- package/lib/ListSecrets.d.ts +53 -0
- package/lib/ListSecrets.d.ts.map +1 -0
- package/lib/ListSecrets.js +3 -0
- package/lib/ListSecrets.js.map +1 -0
- package/lib/ListSecretsHttp.d.ts +22 -0
- package/lib/ListSecretsHttp.d.ts.map +1 -0
- package/lib/ListSecretsHttp.js +35 -0
- package/lib/ListSecretsHttp.js.map +1 -0
- package/lib/Machine.d.ts +802 -0
- package/lib/Machine.d.ts.map +1 -0
- package/lib/Machine.js +773 -0
- package/lib/Machine.js.map +1 -0
- package/lib/MachineContainers.d.ts +44 -0
- package/lib/MachineContainers.d.ts.map +1 -0
- package/lib/MachineContainers.js +115 -0
- package/lib/MachineContainers.js.map +1 -0
- package/lib/Metadata.d.ts +109 -0
- package/lib/Metadata.d.ts.map +1 -0
- package/lib/Metadata.js +159 -0
- package/lib/Metadata.js.map +1 -0
- package/lib/MountVolume.d.ts +295 -0
- package/lib/MountVolume.d.ts.map +1 -0
- package/lib/MountVolume.js +20 -0
- package/lib/MountVolume.js.map +1 -0
- package/lib/Postgres.d.ts +298 -0
- package/lib/Postgres.d.ts.map +1 -0
- package/lib/Postgres.js +508 -0
- package/lib/Postgres.js.map +1 -0
- package/lib/PostgresMigrations.d.ts +35 -0
- package/lib/PostgresMigrations.d.ts.map +1 -0
- package/lib/PostgresMigrations.js +110 -0
- package/lib/PostgresMigrations.js.map +1 -0
- package/lib/Providers.d.ts +38 -0
- package/lib/Providers.d.ts.map +1 -0
- package/lib/Providers.js +95 -0
- package/lib/Providers.js.map +1 -0
- package/lib/PutObject.d.ts +35 -0
- package/lib/PutObject.d.ts.map +1 -0
- package/lib/PutObject.js +3 -0
- package/lib/PutObject.js.map +1 -0
- package/lib/PutObjectHttp.d.ts +12 -0
- package/lib/PutObjectHttp.d.ts.map +1 -0
- package/lib/PutObjectHttp.js +17 -0
- package/lib/PutObjectHttp.js.map +1 -0
- package/lib/ReadRedis.d.ts +26 -0
- package/lib/ReadRedis.d.ts.map +1 -0
- package/lib/ReadRedis.js +3 -0
- package/lib/ReadRedis.js.map +1 -0
- package/lib/ReadRedisHttp.d.ts +11 -0
- package/lib/ReadRedisHttp.d.ts.map +1 -0
- package/lib/ReadRedisHttp.js +15 -0
- package/lib/ReadRedisHttp.js.map +1 -0
- package/lib/ReadWriteRedis.d.ts +29 -0
- package/lib/ReadWriteRedis.d.ts.map +1 -0
- package/lib/ReadWriteRedis.js +3 -0
- package/lib/ReadWriteRedis.js.map +1 -0
- package/lib/ReadWriteRedisHttp.d.ts +11 -0
- package/lib/ReadWriteRedisHttp.d.ts.map +1 -0
- package/lib/ReadWriteRedisHttp.js +15 -0
- package/lib/ReadWriteRedisHttp.js.map +1 -0
- package/lib/Redis.d.ts +252 -0
- package/lib/Redis.d.ts.map +1 -0
- package/lib/Redis.js +608 -0
- package/lib/Redis.js.map +1 -0
- package/lib/RedisBinding.d.ts +7 -0
- package/lib/RedisBinding.d.ts.map +1 -0
- package/lib/RedisBinding.js +53 -0
- package/lib/RedisBinding.js.map +1 -0
- package/lib/RedisHttp.d.ts +8 -0
- package/lib/RedisHttp.d.ts.map +1 -0
- package/lib/RedisHttp.js +8 -0
- package/lib/RedisHttp.js.map +1 -0
- package/lib/Region.d.ts +16 -0
- package/lib/Region.d.ts.map +1 -0
- package/lib/Region.js +13 -0
- package/lib/Region.js.map +1 -0
- package/lib/Secret.d.ts +190 -0
- package/lib/Secret.d.ts.map +1 -0
- package/lib/Secret.js +310 -0
- package/lib/Secret.js.map +1 -0
- package/lib/SecretHttp.d.ts +54 -0
- package/lib/SecretHttp.d.ts.map +1 -0
- package/lib/SecretHttp.js +66 -0
- package/lib/SecretHttp.js.map +1 -0
- package/lib/SecretKey.d.ts +164 -0
- package/lib/SecretKey.d.ts.map +1 -0
- package/lib/SecretKey.js +277 -0
- package/lib/SecretKey.js.map +1 -0
- package/lib/SecretKeyHttp.d.ts +14 -0
- package/lib/SecretKeyHttp.d.ts.map +1 -0
- package/lib/SecretKeyHttp.js +5 -0
- package/lib/SecretKeyHttp.js.map +1 -0
- package/lib/Service.d.ts +1022 -0
- package/lib/Service.d.ts.map +1 -0
- package/lib/Service.js +1397 -0
- package/lib/Service.js.map +1 -0
- package/lib/Sign.d.ts +36 -0
- package/lib/Sign.d.ts.map +1 -0
- package/lib/Sign.js +3 -0
- package/lib/Sign.js.map +1 -0
- package/lib/SignHttp.d.ts +22 -0
- package/lib/SignHttp.d.ts.map +1 -0
- package/lib/SignHttp.js +36 -0
- package/lib/SignHttp.js.map +1 -0
- package/lib/Sprite.d.ts +283 -0
- package/lib/Sprite.d.ts.map +1 -0
- package/lib/Sprite.js +469 -0
- package/lib/Sprite.js.map +1 -0
- package/lib/SpriteHttp.d.ts +25 -0
- package/lib/SpriteHttp.d.ts.map +1 -0
- package/lib/SpriteHttp.js +33 -0
- package/lib/SpriteHttp.js.map +1 -0
- package/lib/Verify.d.ts +37 -0
- package/lib/Verify.d.ts.map +1 -0
- package/lib/Verify.js +3 -0
- package/lib/Verify.js.map +1 -0
- package/lib/VerifyHttp.d.ts +22 -0
- package/lib/VerifyHttp.d.ts.map +1 -0
- package/lib/VerifyHttp.js +38 -0
- package/lib/VerifyHttp.js.map +1 -0
- package/lib/Volume.d.ts +53 -0
- package/lib/Volume.d.ts.map +1 -0
- package/lib/Volume.js +188 -0
- package/lib/Volume.js.map +1 -0
- package/lib/VolumeSnapshot.d.ts +135 -0
- package/lib/VolumeSnapshot.d.ts.map +1 -0
- package/lib/VolumeSnapshot.js +213 -0
- package/lib/VolumeSnapshot.js.map +1 -0
- package/lib/Website/AssetDeployment.d.ts +43 -0
- package/lib/Website/AssetDeployment.d.ts.map +1 -0
- package/lib/Website/AssetDeployment.js +162 -0
- package/lib/Website/AssetDeployment.js.map +1 -0
- package/lib/Website/Astro.d.ts +87 -0
- package/lib/Website/Astro.d.ts.map +1 -0
- package/lib/Website/Astro.js +55 -0
- package/lib/Website/Astro.js.map +1 -0
- package/lib/Website/Foldkit.d.ts +52 -0
- package/lib/Website/Foldkit.d.ts.map +1 -0
- package/lib/Website/Foldkit.js +45 -0
- package/lib/Website/Foldkit.js.map +1 -0
- package/lib/Website/FrameworkSite.d.ts +175 -0
- package/lib/Website/FrameworkSite.d.ts.map +1 -0
- package/lib/Website/FrameworkSite.js +162 -0
- package/lib/Website/FrameworkSite.js.map +1 -0
- package/lib/Website/Nextjs.d.ts +54 -0
- package/lib/Website/Nextjs.d.ts.map +1 -0
- package/lib/Website/Nextjs.js +46 -0
- package/lib/Website/Nextjs.js.map +1 -0
- package/lib/Website/Nuxt.d.ts +51 -0
- package/lib/Website/Nuxt.d.ts.map +1 -0
- package/lib/Website/Nuxt.js +36 -0
- package/lib/Website/Nuxt.js.map +1 -0
- package/lib/Website/Octane.d.ts +49 -0
- package/lib/Website/Octane.d.ts.map +1 -0
- package/lib/Website/Octane.js +39 -0
- package/lib/Website/Octane.js.map +1 -0
- package/lib/Website/ReactRouter.d.ts +80 -0
- package/lib/Website/ReactRouter.d.ts.map +1 -0
- package/lib/Website/ReactRouter.js +70 -0
- package/lib/Website/ReactRouter.js.map +1 -0
- package/lib/Website/SolidStart.d.ts +93 -0
- package/lib/Website/SolidStart.d.ts.map +1 -0
- package/lib/Website/SolidStart.js +71 -0
- package/lib/Website/SolidStart.js.map +1 -0
- package/lib/Website/StaticSite.d.ts +155 -0
- package/lib/Website/StaticSite.d.ts.map +1 -0
- package/lib/Website/StaticSite.js +168 -0
- package/lib/Website/StaticSite.js.map +1 -0
- package/lib/Website/SvelteKit.d.ts +52 -0
- package/lib/Website/SvelteKit.d.ts.map +1 -0
- package/lib/Website/SvelteKit.js +37 -0
- package/lib/Website/SvelteKit.js.map +1 -0
- package/lib/Website/TanStackStart.d.ts +76 -0
- package/lib/Website/TanStackStart.d.ts.map +1 -0
- package/lib/Website/TanStackStart.js +66 -0
- package/lib/Website/TanStackStart.js.map +1 -0
- package/lib/Website/Vinext.d.ts +73 -0
- package/lib/Website/Vinext.d.ts.map +1 -0
- package/lib/Website/Vinext.js +67 -0
- package/lib/Website/Vinext.js.map +1 -0
- package/lib/Website/Vite.d.ts +103 -0
- package/lib/Website/Vite.d.ts.map +1 -0
- package/lib/Website/Vite.js +91 -0
- package/lib/Website/Vite.js.map +1 -0
- package/lib/Website/Vocs.d.ts +52 -0
- package/lib/Website/Vocs.d.ts.map +1 -0
- package/lib/Website/Vocs.js +38 -0
- package/lib/Website/Vocs.js.map +1 -0
- package/lib/Website/Waku.d.ts +64 -0
- package/lib/Website/Waku.d.ts.map +1 -0
- package/lib/Website/Waku.js +39 -0
- package/lib/Website/Waku.js.map +1 -0
- package/lib/Website/index.d.ts +17 -0
- package/lib/Website/index.d.ts.map +1 -0
- package/lib/Website/index.js +17 -0
- package/lib/Website/index.js.map +1 -0
- package/lib/WriteCertificates.d.ts +63 -0
- package/lib/WriteCertificates.d.ts.map +1 -0
- package/lib/WriteCertificates.js +3 -0
- package/lib/WriteCertificates.js.map +1 -0
- package/lib/WriteCertificatesHttp.d.ts +25 -0
- package/lib/WriteCertificatesHttp.d.ts.map +1 -0
- package/lib/WriteCertificatesHttp.js +67 -0
- package/lib/WriteCertificatesHttp.js.map +1 -0
- package/lib/WriteRedis.d.ts +26 -0
- package/lib/WriteRedis.d.ts.map +1 -0
- package/lib/WriteRedis.js +3 -0
- package/lib/WriteRedis.js.map +1 -0
- package/lib/WriteRedisHttp.d.ts +11 -0
- package/lib/WriteRedisHttp.d.ts.map +1 -0
- package/lib/WriteRedisHttp.js +15 -0
- package/lib/WriteRedisHttp.js.map +1 -0
- package/lib/WriteSecret.d.ts +68 -0
- package/lib/WriteSecret.d.ts.map +1 -0
- package/lib/WriteSecret.js +4 -0
- package/lib/WriteSecret.js.map +1 -0
- package/lib/WriteSecretHttp.d.ts +26 -0
- package/lib/WriteSecretHttp.d.ts.map +1 -0
- package/lib/WriteSecretHttp.js +54 -0
- package/lib/WriteSecretHttp.js.map +1 -0
- package/lib/bluegreen.d.ts +36 -0
- package/lib/bluegreen.d.ts.map +1 -0
- package/lib/bluegreen.js +458 -0
- package/lib/bluegreen.js.map +1 -0
- package/lib/hosted.d.ts +172 -0
- package/lib/hosted.d.ts.map +1 -0
- package/lib/hosted.js +458 -0
- package/lib/hosted.js.map +1 -0
- package/lib/index.d.ts +65 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +63 -0
- package/lib/index.js.map +1 -0
- package/lib/internal/RemoteBuilder.d.ts +28 -0
- package/lib/internal/RemoteBuilder.d.ts.map +1 -0
- package/lib/internal/RemoteBuilder.js +145 -0
- package/lib/internal/RemoteBuilder.js.map +1 -0
- package/lib/leases.d.ts +53 -0
- package/lib/leases.d.ts.map +1 -0
- package/lib/leases.js +279 -0
- package/lib/leases.js.map +1 -0
- package/lib/ports.d.ts +51 -0
- package/lib/ports.d.ts.map +1 -0
- package/lib/ports.js +123 -0
- package/lib/ports.js.map +1 -0
- package/lib/replicas.d.ts +270 -0
- package/lib/replicas.d.ts.map +1 -0
- package/lib/replicas.js +969 -0
- package/lib/replicas.js.map +1 -0
- package/lib/rpc.d.ts +35 -0
- package/lib/rpc.d.ts.map +1 -0
- package/lib/rpc.js +113 -0
- package/lib/rpc.js.map +1 -0
- package/package.json +83 -3
- package/src/App.ts +516 -0
- package/src/AuthProvider.ts +68 -0
- package/src/BindService.ts +304 -0
- package/src/Bootstrap.ts +66 -0
- package/src/Bucket.ts +916 -0
- package/src/BucketBinding.ts +128 -0
- package/src/Catalog.ts +43 -0
- package/src/Certificate.ts +548 -0
- package/src/Checkpoint.ts +69 -0
- package/src/CheckpointHttp.ts +66 -0
- package/src/ConnectPostgres.ts +68 -0
- package/src/ConnectPostgresHttp.ts +77 -0
- package/src/Contributions.ts +9 -0
- package/src/Credentials.ts +102 -0
- package/src/Decrypt.ts +62 -0
- package/src/DecryptHttp.ts +52 -0
- package/src/DeleteObject.ts +43 -0
- package/src/DeleteObjectHttp.ts +20 -0
- package/src/Deployment.ts +121 -0
- package/src/DeploymentImages.ts +84 -0
- package/src/DeploymentState.ts +104 -0
- package/src/Encrypt.ts +60 -0
- package/src/EncryptHttp.ts +48 -0
- package/src/Environment.ts +81 -0
- package/src/Errors.ts +14 -0
- package/src/Exec.ts +50 -0
- package/src/ExecHttp.ts +47 -0
- package/src/GetObject.ts +48 -0
- package/src/GetObjectHttp.ts +20 -0
- package/src/GetSecret.ts +48 -0
- package/src/GetSecretHttp.ts +60 -0
- package/src/HeadObject.ts +43 -0
- package/src/HeadObjectHttp.ts +20 -0
- package/src/IpAssignment.ts +522 -0
- package/src/ListObjectsV2.ts +43 -0
- package/src/ListObjectsV2Http.ts +20 -0
- package/src/ListSecrets.ts +57 -0
- package/src/ListSecretsHttp.ts +43 -0
- package/src/Machine.ts +1268 -0
- package/src/MachineContainers.ts +152 -0
- package/src/Metadata.ts +195 -0
- package/src/MountVolume.ts +315 -0
- package/src/Postgres.ts +777 -0
- package/src/PostgresMigrations.ts +153 -0
- package/src/Providers.ts +155 -0
- package/src/PutObject.ts +49 -0
- package/src/PutObjectHttp.ts +20 -0
- package/src/ReadRedis.ts +31 -0
- package/src/ReadRedisHttp.ts +18 -0
- package/src/ReadWriteRedis.ts +33 -0
- package/src/ReadWriteRedisHttp.ts +18 -0
- package/src/Redis.ts +820 -0
- package/src/RedisBinding.ts +64 -0
- package/src/RedisHttp.ts +11 -0
- package/src/Region.ts +44 -0
- package/src/Secret.ts +405 -0
- package/src/SecretHttp.ts +149 -0
- package/src/SecretKey.ts +389 -0
- package/src/SecretKeyHttp.ts +23 -0
- package/src/Service.ts +1934 -0
- package/src/Sign.ts +46 -0
- package/src/SignHttp.ts +44 -0
- package/src/Sprite.ts +671 -0
- package/src/SpriteHttp.ts +50 -0
- package/src/Verify.ts +47 -0
- package/src/VerifyHttp.ts +46 -0
- package/src/Volume.ts +264 -0
- package/src/VolumeSnapshot.ts +321 -0
- package/src/Website/AssetDeployment.ts +294 -0
- package/src/Website/Astro.ts +87 -0
- package/src/Website/Foldkit.ts +54 -0
- package/src/Website/FrameworkSite.ts +363 -0
- package/src/Website/Nextjs.ts +50 -0
- package/src/Website/Nuxt.ts +48 -0
- package/src/Website/Octane.ts +44 -0
- package/src/Website/ReactRouter.ts +76 -0
- package/src/Website/SolidStart.ts +90 -0
- package/src/Website/StaticSite.ts +275 -0
- package/src/Website/SvelteKit.ts +49 -0
- package/src/Website/TanStackStart.ts +72 -0
- package/src/Website/Vinext.ts +79 -0
- package/src/Website/Vite.ts +112 -0
- package/src/Website/Vocs.ts +50 -0
- package/src/Website/Waku.ts +65 -0
- package/src/Website/index.ts +16 -0
- package/src/WriteCertificates.ts +90 -0
- package/src/WriteCertificatesHttp.ts +93 -0
- package/src/WriteRedis.ts +31 -0
- package/src/WriteRedisHttp.ts +18 -0
- package/src/WriteSecret.ts +86 -0
- package/src/WriteSecretHttp.ts +71 -0
- package/src/bluegreen.ts +708 -0
- package/src/globals.d.ts +2 -0
- package/src/hosted.ts +668 -0
- package/src/index.ts +64 -0
- package/src/internal/RemoteBuilder.ts +224 -0
- package/src/leases.ts +437 -0
- package/src/ports.ts +177 -0
- package/src/replicas.ts +1480 -0
- package/src/rpc.ts +136 -0
package/lib/Service.d.ts
ADDED
|
@@ -0,0 +1,1022 @@
|
|
|
1
|
+
import * as machines from "@distilled.cloud/fly-io/machines";
|
|
2
|
+
import { AlchemyContext } from "alchemy/AlchemyContext";
|
|
3
|
+
import { Platform, type Main, type MainRpc, type PlatformProps } from "alchemy/Platform";
|
|
4
|
+
import * as Provider from "alchemy/Provider";
|
|
5
|
+
import type { Resource } from "alchemy/Resource";
|
|
6
|
+
import type { ServerHost } from "alchemy/Runtime/Process";
|
|
7
|
+
import { Stack } from "alchemy/Stack";
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
9
|
+
import * as Layer from "effect/Layer";
|
|
10
|
+
import * as Redacted from "effect/Redacted";
|
|
11
|
+
import { App } from "./App.ts";
|
|
12
|
+
import { type MachineDeploy, type MachineShutdown, type MachineCheck } from "./Deployment.ts";
|
|
13
|
+
import { type FlyBuildOptions, type FlyHostRuntimeContext } from "./hosted.ts";
|
|
14
|
+
import type { MachineGuest, MachineImageRef, MachineService } from "./Machine.ts";
|
|
15
|
+
import type { MountedDisk, ServiceBinding } from "./MountVolume.ts";
|
|
16
|
+
import type { Providers } from "./Providers.ts";
|
|
17
|
+
import { type Region } from "./Region.ts";
|
|
18
|
+
import { type Replica } from "./replicas.ts";
|
|
19
|
+
/**
|
|
20
|
+
* A resource-valued prop: the resource itself, or an Effect that produces
|
|
21
|
+
* it (so `yield* App(...)` and `App(...)` both type-check).
|
|
22
|
+
*/
|
|
23
|
+
type Ref<T> = T | Effect.Effect<T, never, Providers>;
|
|
24
|
+
export interface ServiceProps extends PlatformProps {
|
|
25
|
+
/** Deployment strategy and readiness deadline. Defaults to in-place rolling updates. */
|
|
26
|
+
deploy?: MachineDeploy;
|
|
27
|
+
/** Graceful process shutdown. Defaults to SIGTERM / 30 seconds when blue/green is enabled. */
|
|
28
|
+
shutdown?: MachineShutdown;
|
|
29
|
+
/** Named readiness checks for workers without public services. */
|
|
30
|
+
checks?: Record<string, MachineCheck>;
|
|
31
|
+
/**
|
|
32
|
+
* Run inside an existing {@link App} instead of the Service's own App.
|
|
33
|
+
* The Service then shares that App's hostname, addresses, and secrets,
|
|
34
|
+
* and Alchemy does not manage addresses for it. Accepts a `Fly.App` or
|
|
35
|
+
* an Effect that produces one. Changing it, or adding or removing it,
|
|
36
|
+
* replaces the Service.
|
|
37
|
+
*
|
|
38
|
+
* By default each Service owns its App, so it gets its own
|
|
39
|
+
* `{name}.fly.dev` hostname, addresses, logs, and metrics.
|
|
40
|
+
*/
|
|
41
|
+
app?: Ref<App>;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the Service is reachable from the internet. A public Service
|
|
44
|
+
* gets a shared IPv4 and an IPv6 and serves `https://{name}.fly.dev`. A
|
|
45
|
+
* private Service is reachable only from other Apps in the organization,
|
|
46
|
+
* at `http://{name}.flycast`. Every address is free. Only applies when
|
|
47
|
+
* the Service owns its App (no `app`).
|
|
48
|
+
*
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
|
+
public?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Private network the Service's App joins. Only Apps on the same
|
|
54
|
+
* network can reach it, over `privateUrl` or `.internal`; every other
|
|
55
|
+
* App in the organization, including those on the default network,
|
|
56
|
+
* cannot resolve it. Services on one network reach each other freely.
|
|
57
|
+
* Use {@link stackNetwork} for a network unique to the stack and stage.
|
|
58
|
+
* Fly creates the network with the first App that names it. Changing
|
|
59
|
+
* it replaces the Service. Only applies when the Service owns its App
|
|
60
|
+
* (no `app`).
|
|
61
|
+
*
|
|
62
|
+
* @default the organization's default network, shared by every App
|
|
63
|
+
*/
|
|
64
|
+
network?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Plain-HTTP port Alchemy publishes for callers that bind this Service
|
|
67
|
+
* with {@link bindService}, when the Service publishes no plain-HTTP port
|
|
68
|
+
* of its own (a public Service's defaults are an HTTPS redirect on 80 and
|
|
69
|
+
* HTTPS on 443). Fly issues no certificate for `.flycast`, so bound
|
|
70
|
+
* callers use plain HTTP inside Fly's WireGuard-encrypted private network.
|
|
71
|
+
* Requests on this port must come from Fly's private network. Change it
|
|
72
|
+
* when the port collides with another Service in the same App.
|
|
73
|
+
*
|
|
74
|
+
* @default 7780
|
|
75
|
+
*/
|
|
76
|
+
bindingPort?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Caller token for bound callers. Set automatically from an
|
|
79
|
+
* `Alchemy.Random` child resource; do not pass it.
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
rpcToken?: Redacted.Redacted<string>;
|
|
83
|
+
/**
|
|
84
|
+
* Module entrypoint bundled with rolldown and baked into a Docker
|
|
85
|
+
* image pushed to `registry.fly.io`. Typically `import.meta.url`.
|
|
86
|
+
* A content-hash change updates the workload using the selected deployment strategy.
|
|
87
|
+
*/
|
|
88
|
+
main: string;
|
|
89
|
+
/**
|
|
90
|
+
* Region or regions to run in (`"iad"`, `["iad", "lhr"]`). The
|
|
91
|
+
* Service runs `count` Machines in each region behind one hostname;
|
|
92
|
+
* Fly's proxy sends each request to the nearest healthy Machine.
|
|
93
|
+
* Adding or removing a region updates the Service in place: Machines
|
|
94
|
+
* in a removed region are deleted, new regions get new Machines.
|
|
95
|
+
*
|
|
96
|
+
* @default "iad"
|
|
97
|
+
*/
|
|
98
|
+
region?: Region | Region[];
|
|
99
|
+
/**
|
|
100
|
+
* Number of Machines to provision in each region, including
|
|
101
|
+
* stopped/suspended idle capacity. Fly's proxy load-balances
|
|
102
|
+
* `{app}.fly.dev` across available replicas.
|
|
103
|
+
* Blue/green checks a representative and the required running floor while
|
|
104
|
+
* preserving idle nonrepresentatives. Each replica gets its own Volume
|
|
105
|
+
* from every `MountVolume` binding; attached volumes require rolling updates.
|
|
106
|
+
*
|
|
107
|
+
* @default 1
|
|
108
|
+
*/
|
|
109
|
+
count?: number;
|
|
110
|
+
/**
|
|
111
|
+
* Guest size. Defaults to shared-cpu-1x 256 MB.
|
|
112
|
+
*/
|
|
113
|
+
guest?: MachineGuest;
|
|
114
|
+
/**
|
|
115
|
+
* Port the hosted HTTP server listens on. Written to `PORT` and used
|
|
116
|
+
* as the Fly proxy `internal_port`.
|
|
117
|
+
*
|
|
118
|
+
* @default 3000
|
|
119
|
+
*/
|
|
120
|
+
port?: number;
|
|
121
|
+
/**
|
|
122
|
+
* Named export to load from `main`.
|
|
123
|
+
*
|
|
124
|
+
* @default "default"
|
|
125
|
+
*/
|
|
126
|
+
handler?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Additional environment variables for the hosted process. Merged
|
|
129
|
+
* after binding-injected `env`.
|
|
130
|
+
*/
|
|
131
|
+
env?: Record<string, any>;
|
|
132
|
+
/**
|
|
133
|
+
* Bundler configuration for `main`: rolldown `input`/`output`
|
|
134
|
+
* overrides, pure-annotation options (`pure`), and `install` for
|
|
135
|
+
* packages that must ship as real `node_modules` (see {@link FlyBuildOptions}).
|
|
136
|
+
*/
|
|
137
|
+
build?: FlyBuildOptions;
|
|
138
|
+
/**
|
|
139
|
+
* Environment image used as the generated Dockerfile's `FROM`. Must
|
|
140
|
+
* be able to run Node (websites and Effect-native Services use Node
|
|
141
|
+
* in production).
|
|
142
|
+
*
|
|
143
|
+
* @default "node:26-slim"
|
|
144
|
+
*/
|
|
145
|
+
image?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Fly proxy services. Defaults to HTTP 80 + HTTPS 443 → {@link port}.
|
|
148
|
+
*/
|
|
149
|
+
services?: MachineService[];
|
|
150
|
+
/**
|
|
151
|
+
* Name of the Service's App, which is its `{name}.fly.dev` and
|
|
152
|
+
* `{name}.flycast` hostname. Globally unique across Fly. If omitted, a
|
|
153
|
+
* unique name is generated from the stack, stage and logical ID.
|
|
154
|
+
* Changing it replaces the Service.
|
|
155
|
+
*
|
|
156
|
+
* When `app` is set, this is instead the Machine name (unique per App;
|
|
157
|
+
* in blue/green mode a base for generation-qualified physical names).
|
|
158
|
+
*/
|
|
159
|
+
name?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Extra host directories copied into the Machine image next to the
|
|
162
|
+
* bundled entry (e.g. a website `clientDirectory` at `/app/dist`).
|
|
163
|
+
* Hashed into `code.hash` so asset changes update the image.
|
|
164
|
+
* Destination is relative to `/app`.
|
|
165
|
+
*/
|
|
166
|
+
extraFiles?: ReadonlyArray<{
|
|
167
|
+
source: string;
|
|
168
|
+
dest: string;
|
|
169
|
+
}>;
|
|
170
|
+
/**
|
|
171
|
+
* Fly proxy static-file maps. Matching GET paths skip the process and
|
|
172
|
+
* are served from the image (`guestPath`) or a Tigris bucket
|
|
173
|
+
* (`tigrisBucket`). Website composites publish hashed client assets
|
|
174
|
+
* this way.
|
|
175
|
+
*/
|
|
176
|
+
statics?: ReadonlyArray<{
|
|
177
|
+
/** Path inside the image, or key prefix in {@link tigrisBucket}. */
|
|
178
|
+
guestPath: string;
|
|
179
|
+
/** URL prefix, e.g. `"/"`. */
|
|
180
|
+
urlPrefix: string;
|
|
181
|
+
/** Tigris bucket name. When set, files come from the bucket. */
|
|
182
|
+
tigrisBucket?: string;
|
|
183
|
+
/** Directory index file (`index.html`) for Tigris statics. */
|
|
184
|
+
indexDocument?: string;
|
|
185
|
+
}>;
|
|
186
|
+
}
|
|
187
|
+
/** A port the Service publishes on Fly's proxy. */
|
|
188
|
+
export interface ServiceEndpoint {
|
|
189
|
+
/**
|
|
190
|
+
* Hostname the port is published on: `{appName}.fly.dev`, or
|
|
191
|
+
* `{appName}.flycast` for a private Service.
|
|
192
|
+
*/
|
|
193
|
+
host: string;
|
|
194
|
+
/** Port on Fly's proxy. */
|
|
195
|
+
port: number;
|
|
196
|
+
/** Port the process listens on inside the Machine. */
|
|
197
|
+
internalPort: number | undefined;
|
|
198
|
+
/** `tcp` or `udp`. */
|
|
199
|
+
protocol: string;
|
|
200
|
+
/** Fly proxy handlers (`tls`, `http`, `pg_tls`, …). Empty for raw TCP or UDP. */
|
|
201
|
+
handlers: string[];
|
|
202
|
+
/**
|
|
203
|
+
* URL when the port speaks HTTP: `https://` for `tls` + `http`, `http://`
|
|
204
|
+
* for plain `http`, with `:{port}` unless it is 443 or 80. `undefined`
|
|
205
|
+
* for other protocols, and for TLS ports on `.flycast` (Fly issues no
|
|
206
|
+
* certificate there).
|
|
207
|
+
*/
|
|
208
|
+
url: string | undefined;
|
|
209
|
+
}
|
|
210
|
+
export type Service = Resource<"Fly.Service", ServiceProps, {
|
|
211
|
+
/** Whether recovery must finish an interrupted deployment. */
|
|
212
|
+
rolloutPending?: boolean;
|
|
213
|
+
/** Fly App name the Machines run in. */
|
|
214
|
+
appName: string;
|
|
215
|
+
/** Whether the Service created and manages {@link appName}. */
|
|
216
|
+
ownsApp?: boolean;
|
|
217
|
+
/**
|
|
218
|
+
* Private network the Service's Machines are on: `network`, or the
|
|
219
|
+
* shared App's network. `undefined` for the organization's default.
|
|
220
|
+
*/
|
|
221
|
+
network?: string;
|
|
222
|
+
/** Token bound callers send with RPC calls. */
|
|
223
|
+
rpcToken?: Redacted.Redacted<string>;
|
|
224
|
+
/** Fly Machine id of replica 0. */
|
|
225
|
+
machineId: string;
|
|
226
|
+
/** Fly Machine ids of every replica. */
|
|
227
|
+
machineIds: string[];
|
|
228
|
+
/** Logical base for generation-qualified Machine names. */
|
|
229
|
+
baseName?: string;
|
|
230
|
+
/** Machine name of replica 0 (unique per App). Changes during blue/green deployment. */
|
|
231
|
+
name: string;
|
|
232
|
+
/** Region of the first Machine. */
|
|
233
|
+
region: string;
|
|
234
|
+
/** Every region the Service's Machines run in. */
|
|
235
|
+
regions: string[];
|
|
236
|
+
/** Observed state of replica 0 (`created`, `started`, `stopped`, …). */
|
|
237
|
+
state: string;
|
|
238
|
+
/**
|
|
239
|
+
* Main public HTTP endpoint: the first published `tls` + `http` port
|
|
240
|
+
* as `https://{appName}.fly.dev[:port]`, else the first plain `http`
|
|
241
|
+
* port as `http://{appName}.fly.dev[:port]`. `https://{appName}.fly.dev`
|
|
242
|
+
* for the default services. `undefined` for a private Service or when
|
|
243
|
+
* no port speaks HTTP. When `app` is set, the App's addresses are
|
|
244
|
+
* managed elsewhere, so this is where the Service answers once the App
|
|
245
|
+
* is reachable. See {@link endpoints} for every published port.
|
|
246
|
+
*/
|
|
247
|
+
url: string | undefined;
|
|
248
|
+
/**
|
|
249
|
+
* Every port the Service publishes, in declaration order. Ports that
|
|
250
|
+
* only redirect HTTP to HTTPS (`forceHttps`) and port ranges are
|
|
251
|
+
* omitted. Empty when nothing is published.
|
|
252
|
+
*/
|
|
253
|
+
endpoints: ServiceEndpoint[];
|
|
254
|
+
/**
|
|
255
|
+
* Address bound callers use over Fly's private network:
|
|
256
|
+
* `http://{appName}.flycast`, with the port when it is not 80. It is
|
|
257
|
+
* the Service's first plain-HTTP port, or {@link ServiceProps.bindingPort}
|
|
258
|
+
* when it has none. Reachable only from Apps on the Service's network.
|
|
259
|
+
* `undefined` when nothing is published.
|
|
260
|
+
*/
|
|
261
|
+
privateUrl: string | undefined;
|
|
262
|
+
/** Parsed image reference from Fly. */
|
|
263
|
+
imageRef: MachineImageRef | undefined;
|
|
264
|
+
/** Number of Machines in each region. */
|
|
265
|
+
count: number;
|
|
266
|
+
/** Disks mounted on replica 0. */
|
|
267
|
+
mounts: MountedDisk[];
|
|
268
|
+
/** Every replica in the set. */
|
|
269
|
+
replicas: Replica[];
|
|
270
|
+
/** Content hash of the bundled program's image. */
|
|
271
|
+
code: {
|
|
272
|
+
hash: string;
|
|
273
|
+
};
|
|
274
|
+
}, ServiceBinding, Providers>;
|
|
275
|
+
export declare const isService: (value: unknown) => value is Service;
|
|
276
|
+
export type ServiceServices = ServerHost;
|
|
277
|
+
/**
|
|
278
|
+
* What a Service's program returns: `fetch` for HTTP, `run` for a
|
|
279
|
+
* background loop, and any other methods, which bound callers invoke
|
|
280
|
+
* with {@link bindService}.
|
|
281
|
+
*/
|
|
282
|
+
export type ServiceShape = Main<ServiceServices> | (Exclude<Main<ServiceServices>, void> & MainRpc<ServiceServices>);
|
|
283
|
+
export type ServiceRuntimeContext = FlyHostRuntimeContext;
|
|
284
|
+
/**
|
|
285
|
+
* A Service is an Effect program running on Fly.io Machines in its own
|
|
286
|
+
* Fly App. It gets its own `{name}.fly.dev` hostname, addresses, logs,
|
|
287
|
+
* and metrics, the way each Cloudflare Worker is its own endpoint. Set
|
|
288
|
+
* `count` to scale it up or down.
|
|
289
|
+
*
|
|
290
|
+
* @see https://fly.io/docs/machines/api/machines-resource/
|
|
291
|
+
*
|
|
292
|
+
* ### Declare a Service
|
|
293
|
+
* A Service is a class. Props describe the Machine. The Effect is the
|
|
294
|
+
* program that runs on it.
|
|
295
|
+
*
|
|
296
|
+
* The Service creates its Fly App, and deleting the Service deletes it.
|
|
297
|
+
* `main: import.meta.url` is the bundle entrypoint. Alchemy bundles this
|
|
298
|
+
* file with Rolldown, builds a Docker image (default `node:26-slim`), and
|
|
299
|
+
* pushes it to `registry.fly.io/{app}:{id}-{hash}`.
|
|
300
|
+
*
|
|
301
|
+
* **Example:** Class + main
|
|
302
|
+
* ```typescript
|
|
303
|
+
* // src/api.ts
|
|
304
|
+
* import * as Fly from "@alchemy.run/fly";
|
|
305
|
+
* import * as Effect from "effect/Effect";
|
|
306
|
+
*
|
|
307
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
308
|
+
* "Api",
|
|
309
|
+
* { main: import.meta.url },
|
|
310
|
+
* Effect.gen(function* () {
|
|
311
|
+
* return {};
|
|
312
|
+
* }),
|
|
313
|
+
* ) {}
|
|
314
|
+
* ```
|
|
315
|
+
*
|
|
316
|
+
* ### Serve HTTP with fetch
|
|
317
|
+
* Return `fetch` from the init Effect to boot an HTTP server. Omit
|
|
318
|
+
* `fetch` for a background service.
|
|
319
|
+
*
|
|
320
|
+
* **Example:** Hello
|
|
321
|
+
* ```typescript
|
|
322
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
323
|
+
* "Api",
|
|
324
|
+
* { main: import.meta.url },
|
|
325
|
+
* Effect.gen(function* () {
|
|
326
|
+
* return {
|
|
327
|
+
* fetch: Effect.succeed(HttpServerResponse.text("hello")),
|
|
328
|
+
* };
|
|
329
|
+
* }),
|
|
330
|
+
* ) {}
|
|
331
|
+
* ```
|
|
332
|
+
*
|
|
333
|
+
* ### Pin a region
|
|
334
|
+
* Fly Machines live in a region. Default is `iad`. See
|
|
335
|
+
* [Regions](/fly/compute/regions) for the list of codes.
|
|
336
|
+
*
|
|
337
|
+
* **Example:** Region
|
|
338
|
+
* ```typescript
|
|
339
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
340
|
+
* "Api",
|
|
341
|
+
* { main: import.meta.url, region: "iad" },
|
|
342
|
+
* Effect.gen(function* () {
|
|
343
|
+
* return {
|
|
344
|
+
* fetch: Effect.succeed(HttpServerResponse.text("hello")),
|
|
345
|
+
* };
|
|
346
|
+
* }),
|
|
347
|
+
* ) {}
|
|
348
|
+
* ```
|
|
349
|
+
*
|
|
350
|
+
* ### Run in several regions
|
|
351
|
+
* Pass a list to run the same program in several regions behind one
|
|
352
|
+
* hostname. `count` Machines run in each region, and Fly's proxy sends
|
|
353
|
+
* each request to the nearest healthy one. `regions` on the Service
|
|
354
|
+
* lists where it runs.
|
|
355
|
+
*
|
|
356
|
+
* **Example:** Two regions, two Machines each
|
|
357
|
+
* ```typescript
|
|
358
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
359
|
+
* "Api",
|
|
360
|
+
* { main: import.meta.url, region: ["iad", "lhr"], count: 2 },
|
|
361
|
+
* Effect.gen(function* () {
|
|
362
|
+
* return {
|
|
363
|
+
* fetch: Effect.succeed(HttpServerResponse.text("hello")),
|
|
364
|
+
* };
|
|
365
|
+
* }),
|
|
366
|
+
* ) {}
|
|
367
|
+
* ```
|
|
368
|
+
*
|
|
369
|
+
* Adding or removing a region updates the Service in place and keeps
|
|
370
|
+
* its App and hostname. Machines already in a kept region stay; a
|
|
371
|
+
* removed region's Machines are deleted. Each Machine's Volume from
|
|
372
|
+
* `MountVolume` is created in that Machine's region.
|
|
373
|
+
*
|
|
374
|
+
* ### Set the port
|
|
375
|
+
* `port` is the port the process listens on inside the Machine.
|
|
376
|
+
* Alchemy writes it to `PORT`. Default is `3000`.
|
|
377
|
+
*
|
|
378
|
+
* **Example:** Port 3000
|
|
379
|
+
* ```typescript
|
|
380
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
381
|
+
* "Api",
|
|
382
|
+
* { main: import.meta.url, region: "iad", port: 3000 },
|
|
383
|
+
* Effect.gen(function* () {
|
|
384
|
+
* return {
|
|
385
|
+
* fetch: Effect.succeed(HttpServerResponse.text("hello")),
|
|
386
|
+
* };
|
|
387
|
+
* }),
|
|
388
|
+
* ) {}
|
|
389
|
+
* ```
|
|
390
|
+
*
|
|
391
|
+
* ### The public URL
|
|
392
|
+
* A Service is public by default. Alchemy allocates a shared IPv4 and
|
|
393
|
+
* an IPv6 on its App (both free) and `api.url` is
|
|
394
|
+
* `https://{appName}.fly.dev`.
|
|
395
|
+
*
|
|
396
|
+
* **Example:** Stack output
|
|
397
|
+
* ```typescript
|
|
398
|
+
* export default Alchemy.Stack(
|
|
399
|
+
* "MyApp",
|
|
400
|
+
* { providers: Fly.providers(), state: Alchemy.localState() },
|
|
401
|
+
* Effect.gen(function* () {
|
|
402
|
+
* const api = yield* Api;
|
|
403
|
+
* return { url: api.url };
|
|
404
|
+
* }),
|
|
405
|
+
* );
|
|
406
|
+
* ```
|
|
407
|
+
*
|
|
408
|
+
* `url` is `undefined` when you pass `services: []` (nothing is
|
|
409
|
+
* published).
|
|
410
|
+
*
|
|
411
|
+
* ### Every published port
|
|
412
|
+
* `url` is one endpoint. A Service that publishes several ports has one
|
|
413
|
+
* endpoint per port at the same hostname, listed in `endpoints` with
|
|
414
|
+
* its port, handlers, and a URL when the port speaks HTTP. Ports that
|
|
415
|
+
* only redirect to HTTPS are left out.
|
|
416
|
+
*
|
|
417
|
+
* **Example:** An admin UI on 8443 and raw TCP on 7000
|
|
418
|
+
* ```typescript
|
|
419
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
420
|
+
* "Api",
|
|
421
|
+
* {
|
|
422
|
+
* main: import.meta.url,
|
|
423
|
+
* services: [
|
|
424
|
+
* {
|
|
425
|
+
* internalPort: 3000,
|
|
426
|
+
* ports: [
|
|
427
|
+
* { port: 80, handlers: ["http"], forceHttps: true },
|
|
428
|
+
* { port: 443, handlers: ["tls", "http"] },
|
|
429
|
+
* ],
|
|
430
|
+
* },
|
|
431
|
+
* { internalPort: 9000, ports: [{ port: 8443, handlers: ["tls", "http"] }] },
|
|
432
|
+
* { internalPort: 7000, ports: [{ port: 7000 }] },
|
|
433
|
+
* ],
|
|
434
|
+
* },
|
|
435
|
+
* Effect.gen(function* () {
|
|
436
|
+
* return {};
|
|
437
|
+
* }),
|
|
438
|
+
* ) {}
|
|
439
|
+
*
|
|
440
|
+
* api.url; // "https://{appName}.fly.dev"
|
|
441
|
+
* api.endpoints.map((endpoint) => endpoint.url);
|
|
442
|
+
* // ["https://{appName}.fly.dev", "https://{appName}.fly.dev:8443", undefined]
|
|
443
|
+
* ```
|
|
444
|
+
*
|
|
445
|
+
* :::note[Plain HTTP on other ports needs IPv6]
|
|
446
|
+
* The free shared IPv4 serves TLS on any port but plain HTTP only on
|
|
447
|
+
* port 80. A plain-HTTP port such as 8080 answers over IPv6 only.
|
|
448
|
+
* :::
|
|
449
|
+
*
|
|
450
|
+
* ### Private Services
|
|
451
|
+
* `public: false` keeps a Service off the internet. It gets only a
|
|
452
|
+
* Flycast address and publishes plain HTTP on port 80 (Fly issues no
|
|
453
|
+
* certificate for `.flycast`). `url` is `undefined`, and `privateUrl` is
|
|
454
|
+
* `http://{appName}.flycast`. Calls go through Fly's proxy, so service
|
|
455
|
+
* checks, `autostart`, and blue/green cutover still apply.
|
|
456
|
+
*
|
|
457
|
+
* Turning `public` on or off updates the Service in place. Its App and
|
|
458
|
+
* hostname stay the same.
|
|
459
|
+
*
|
|
460
|
+
* ### Call another Service
|
|
461
|
+
* A Service can return methods next to `fetch`. Another Service calls
|
|
462
|
+
* them by binding it with {@link bindService}, which returns a typed
|
|
463
|
+
* client. Binding makes the caller deploy after the Service, and only
|
|
464
|
+
* callers that bind a Service receive its caller token, so only they
|
|
465
|
+
* can call its methods.
|
|
466
|
+
*
|
|
467
|
+
* **Example:** A private Service with methods
|
|
468
|
+
* ```typescript
|
|
469
|
+
* export default class Users extends Fly.Service<Users>()(
|
|
470
|
+
* "Users",
|
|
471
|
+
* { main: import.meta.url, public: false },
|
|
472
|
+
* Effect.gen(function* () {
|
|
473
|
+
* return {
|
|
474
|
+
* list: () => Effect.succeed(USERS),
|
|
475
|
+
* get: (id: string) =>
|
|
476
|
+
* Effect.succeed(USERS.find((user) => user.id === id)),
|
|
477
|
+
* };
|
|
478
|
+
* }),
|
|
479
|
+
* ) {}
|
|
480
|
+
* ```
|
|
481
|
+
*
|
|
482
|
+
* **Example:** Bind it from another Service
|
|
483
|
+
* ```typescript
|
|
484
|
+
* export default class Gateway extends Fly.Service<Gateway>()(
|
|
485
|
+
* "Gateway",
|
|
486
|
+
* { main: import.meta.url },
|
|
487
|
+
* Effect.gen(function* () {
|
|
488
|
+
* const users = yield* Fly.bindService(Users);
|
|
489
|
+
* return {
|
|
490
|
+
* fetch: Effect.gen(function* () {
|
|
491
|
+
* return yield* HttpServerResponse.json(yield* users.list());
|
|
492
|
+
* }).pipe(Effect.orDie),
|
|
493
|
+
* };
|
|
494
|
+
* }),
|
|
495
|
+
* ) {}
|
|
496
|
+
* ```
|
|
497
|
+
*
|
|
498
|
+
* Calls use plain HTTP to `privateUrl` inside Fly's WireGuard-encrypted
|
|
499
|
+
* private network. The Service accepts a method call only with its
|
|
500
|
+
* caller token and a `Fly-Src` signature from Fly's proxy for the same
|
|
501
|
+
* organization, so the public internet can never call it. A public
|
|
502
|
+
* Service publishes an extra plain-HTTP port for bound callers,
|
|
503
|
+
* `bindingPort` (default 7780), since its own ports are an HTTPS
|
|
504
|
+
* redirect and HTTPS. `client.fetch` sends a request to the Service's
|
|
505
|
+
* `fetch` routes, and {@link bindEndpoint} targets one published port.
|
|
506
|
+
* Two Services can bind each other; declare them as tag classes and
|
|
507
|
+
* provide their `.make` layers (see the
|
|
508
|
+
* [Connect Services guide](/fly/compute/connecting-services)).
|
|
509
|
+
*
|
|
510
|
+
* ### Isolate Services on a private network
|
|
511
|
+
* Fly's default private network spans the whole organization, so any
|
|
512
|
+
* App in it can reach a private Service's address. Put a stack's
|
|
513
|
+
* Services on their own network with `network`. {@link stackNetwork}
|
|
514
|
+
* names one per stack and stage. Apps on other networks, including the
|
|
515
|
+
* default one, cannot resolve them, and binding a Service on another
|
|
516
|
+
* network fails the caller's deploy with `Fly.ServiceUnreachable`
|
|
517
|
+
* before anything is created. A public Service on the network still
|
|
518
|
+
* serves `url`, which makes it the stack's single entry point.
|
|
519
|
+
*
|
|
520
|
+
* **Example:** Private backend behind a public gateway
|
|
521
|
+
* ```typescript
|
|
522
|
+
* export class Users extends Fly.Service<Users>()(
|
|
523
|
+
* "Users",
|
|
524
|
+
* Effect.gen(function* () {
|
|
525
|
+
* return {
|
|
526
|
+
* main: import.meta.url,
|
|
527
|
+
* public: false,
|
|
528
|
+
* network: yield* Fly.stackNetwork,
|
|
529
|
+
* };
|
|
530
|
+
* }),
|
|
531
|
+
* Effect.gen(function* () {
|
|
532
|
+
* return { list: () => Effect.succeed(USERS) };
|
|
533
|
+
* }),
|
|
534
|
+
* ) {}
|
|
535
|
+
*
|
|
536
|
+
* export class Gateway extends Fly.Service<Gateway>()(
|
|
537
|
+
* "Gateway",
|
|
538
|
+
* Effect.gen(function* () {
|
|
539
|
+
* return { main: import.meta.url, network: yield* Fly.stackNetwork };
|
|
540
|
+
* }),
|
|
541
|
+
* Effect.gen(function* () {
|
|
542
|
+
* const users = yield* Fly.bindService(Users);
|
|
543
|
+
* return {
|
|
544
|
+
* fetch: Effect.gen(function* () {
|
|
545
|
+
* return yield* HttpServerResponse.json(yield* users.list());
|
|
546
|
+
* }).pipe(Effect.orDie),
|
|
547
|
+
* };
|
|
548
|
+
* }),
|
|
549
|
+
* ) {}
|
|
550
|
+
* ```
|
|
551
|
+
*
|
|
552
|
+
* :::caution[Changing `network` replaces the Service]
|
|
553
|
+
* Fly cannot move an App between networks. Alchemy creates the Service
|
|
554
|
+
* on the new network, then deletes the old App.
|
|
555
|
+
* :::
|
|
556
|
+
*
|
|
557
|
+
* ### Fly's proxy is the load balancer
|
|
558
|
+
* There is no LoadBalancer resource. Fly runs an Anycast proxy at
|
|
559
|
+
* the edge.
|
|
560
|
+
*
|
|
561
|
+
* **Example:** Published ports
|
|
562
|
+
* ```typescript
|
|
563
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
564
|
+
* "Api",
|
|
565
|
+
* { main: import.meta.url, region: "iad", port: 3000 },
|
|
566
|
+
* Effect.gen(function* () {
|
|
567
|
+
* return {
|
|
568
|
+
* fetch: Effect.succeed(HttpServerResponse.text("hello")),
|
|
569
|
+
* };
|
|
570
|
+
* }),
|
|
571
|
+
* ) {}
|
|
572
|
+
* ```
|
|
573
|
+
*
|
|
574
|
+
* Unless you override `services`, Alchemy publishes HTTP 80 and
|
|
575
|
+
* HTTPS 443 on that proxy and points them at `port` inside each
|
|
576
|
+
* Machine (`internal_port`). A request to
|
|
577
|
+
* `https://{appName}.fly.dev` lands on Fly's edge. Fly terminates
|
|
578
|
+
* TLS on 443, picks one started Machine that published this service,
|
|
579
|
+
* and forwards to `port` where `fetch` runs.
|
|
580
|
+
*
|
|
581
|
+
* ### Configure routing health checks
|
|
582
|
+
* The generated service includes a TCP check on `port`. To customize
|
|
583
|
+
* it, provide `services` and configure each service's `checks` property.
|
|
584
|
+
* With rolling updates, reconcile waits for each started replica's checks
|
|
585
|
+
* before updating the next replica. Missing or non-passing results are
|
|
586
|
+
* polled within `deploy.healthTimeout` (60 seconds by default), then fail
|
|
587
|
+
* deployment with `Fly.ReplicaChecksNotPassing`. Later replicas remain
|
|
588
|
+
* unchanged; earlier updates are not rolled back. A single rolling replica
|
|
589
|
+
* can be unavailable. Blue/green checks replacements before retiring the
|
|
590
|
+
* old set, with representative/floor readiness for idle capacity.
|
|
591
|
+
*
|
|
592
|
+
* **Example:** HTTP readiness check
|
|
593
|
+
* ```typescript
|
|
594
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
595
|
+
* "Api",
|
|
596
|
+
* {
|
|
597
|
+
* main: import.meta.url,
|
|
598
|
+
* port: 3000,
|
|
599
|
+
* services: [
|
|
600
|
+
* {
|
|
601
|
+
* protocol: "tcp",
|
|
602
|
+
* internalPort: 3000,
|
|
603
|
+
* ports: [
|
|
604
|
+
* { port: 80, handlers: ["http"], forceHttps: true },
|
|
605
|
+
* { port: 443, handlers: ["tls", "http"] },
|
|
606
|
+
* ],
|
|
607
|
+
* checks: [
|
|
608
|
+
* {
|
|
609
|
+
* type: "http",
|
|
610
|
+
* port: 3000,
|
|
611
|
+
* method: "GET",
|
|
612
|
+
* path: "/health",
|
|
613
|
+
* protocol: "http",
|
|
614
|
+
* interval: "15s",
|
|
615
|
+
* timeout: "2s",
|
|
616
|
+
* gracePeriod: "30s",
|
|
617
|
+
* },
|
|
618
|
+
* ],
|
|
619
|
+
* },
|
|
620
|
+
* ],
|
|
621
|
+
* },
|
|
622
|
+
* Effect.gen(function* () {
|
|
623
|
+
* return {
|
|
624
|
+
* fetch: Effect.succeed(HttpServerResponse.text("hello")),
|
|
625
|
+
* };
|
|
626
|
+
* }),
|
|
627
|
+
* ) {}
|
|
628
|
+
* ```
|
|
629
|
+
*
|
|
630
|
+
* ### Scale with count
|
|
631
|
+
* `count` is how many Machines to provision, including idle capacity.
|
|
632
|
+
* Default is `1`. Replicas publish the same proxy service behind
|
|
633
|
+
* `{appName}.fly.dev`; Fly's proxy picks an available Machine per request.
|
|
634
|
+
* Each replica gets its own Volume from every {@link MountVolume} binding;
|
|
635
|
+
* attached volumes require rolling updates.
|
|
636
|
+
*
|
|
637
|
+
* **Example:** Three replicas
|
|
638
|
+
* ```typescript
|
|
639
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
640
|
+
* "Api",
|
|
641
|
+
* { main: import.meta.url, region: "iad", count: 3, port: 3000 },
|
|
642
|
+
* Effect.gen(function* () {
|
|
643
|
+
* return {
|
|
644
|
+
* fetch: Effect.succeed(HttpServerResponse.text("hello")),
|
|
645
|
+
* };
|
|
646
|
+
* }),
|
|
647
|
+
* ) {}
|
|
648
|
+
* ```
|
|
649
|
+
*
|
|
650
|
+
* ### Config
|
|
651
|
+
* Yield `Config` in init. Alchemy reads the value from the env of
|
|
652
|
+
* whoever deploys and writes it onto the Machine, so there is no need
|
|
653
|
+
* to copy it into `env`.
|
|
654
|
+
*
|
|
655
|
+
* `Config.Redacted("API_KEY")` is `Redacted<string>`. Unwrap with
|
|
656
|
+
* `Redacted.value` only where you need the raw string.
|
|
657
|
+
*
|
|
658
|
+
* Alchemy also injects `PORT` (when `port` is set) and stack metadata.
|
|
659
|
+
* For a secret Fly should own and inject into every Machine on an App,
|
|
660
|
+
* run the Service in an {@link App} (`app`) and use {@link Secret}.
|
|
661
|
+
*
|
|
662
|
+
* **Example:** Config.Redacted
|
|
663
|
+
* ```typescript
|
|
664
|
+
* import * as Config from "effect/Config";
|
|
665
|
+
* import * as Redacted from "effect/Redacted";
|
|
666
|
+
*
|
|
667
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
668
|
+
* "Api",
|
|
669
|
+
* { main: import.meta.url, port: 3000 },
|
|
670
|
+
* Effect.gen(function* () {
|
|
671
|
+
* const apiKey = yield* Config.Redacted("API_KEY");
|
|
672
|
+
*
|
|
673
|
+
* return {
|
|
674
|
+
* fetch: Effect.gen(function* () {
|
|
675
|
+
* const token = Redacted.value(apiKey);
|
|
676
|
+
* return HttpServerResponse.text("ok");
|
|
677
|
+
* }),
|
|
678
|
+
* };
|
|
679
|
+
* }),
|
|
680
|
+
* ) {}
|
|
681
|
+
* ```
|
|
682
|
+
*
|
|
683
|
+
* ### Mount a disk
|
|
684
|
+
* Bind {@link MountVolume} inside init. App and region come from the
|
|
685
|
+
* Service. `count: 3` creates three Volumes, one per replica. Provide
|
|
686
|
+
* {@link MountVolumeLive}.
|
|
687
|
+
*
|
|
688
|
+
* **Example:** Per-replica disk
|
|
689
|
+
* ```typescript
|
|
690
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
691
|
+
* "Api",
|
|
692
|
+
* { main: import.meta.url, region: "iad", count: 3, port: 3000 },
|
|
693
|
+
* Effect.gen(function* () {
|
|
694
|
+
* const disk = yield* Fly.MountVolume({ path: "/data", sizeGb: 1 });
|
|
695
|
+
* const fs = yield* FileSystem.FileSystem;
|
|
696
|
+
* return {
|
|
697
|
+
* fetch: Effect.gen(function* () {
|
|
698
|
+
* const text = yield* fs.readFileString(`${disk.path}/hello.txt`);
|
|
699
|
+
* return HttpServerResponse.text(text);
|
|
700
|
+
* }),
|
|
701
|
+
* };
|
|
702
|
+
* }).pipe(Effect.provide(Fly.MountVolumeLive)),
|
|
703
|
+
* ) {}
|
|
704
|
+
* ```
|
|
705
|
+
*
|
|
706
|
+
* ### Guest size
|
|
707
|
+
* `guest` is CPU kind, CPU count, and memory. Default is shared-cpu,
|
|
708
|
+
* 1 CPU, 256 MB. Set `gpuKind` and `gpus` for a GPU. Guest updates in
|
|
709
|
+
* place.
|
|
710
|
+
*
|
|
711
|
+
* **Example:** Bigger guest
|
|
712
|
+
* ```typescript
|
|
713
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
714
|
+
* "Api",
|
|
715
|
+
* {
|
|
716
|
+
* main: import.meta.url,
|
|
717
|
+
* region: "iad",
|
|
718
|
+
* port: 3000,
|
|
719
|
+
* guest: { cpuKind: "shared", cpus: 2, memoryMb: 512 },
|
|
720
|
+
* },
|
|
721
|
+
* Effect.gen(function* () {
|
|
722
|
+
* return {
|
|
723
|
+
* fetch: Effect.succeed(HttpServerResponse.text("hello")),
|
|
724
|
+
* };
|
|
725
|
+
* }),
|
|
726
|
+
* ) {}
|
|
727
|
+
* ```
|
|
728
|
+
*
|
|
729
|
+
* ### A stable hostname
|
|
730
|
+
* `name` names the Service's App, so it is the `{name}.fly.dev`
|
|
731
|
+
* hostname. App names are globally unique across Fly. Omit `name` and
|
|
732
|
+
* Alchemy generates one from the stack, stage, and logical ID.
|
|
733
|
+
*
|
|
734
|
+
* **Example:** Explicit name
|
|
735
|
+
* ```typescript
|
|
736
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
737
|
+
* "Api",
|
|
738
|
+
* { main: import.meta.url, name: "api", port: 3000 },
|
|
739
|
+
* Effect.gen(function* () {
|
|
740
|
+
* return {
|
|
741
|
+
* fetch: Effect.succeed(HttpServerResponse.text("hello")),
|
|
742
|
+
* };
|
|
743
|
+
* }),
|
|
744
|
+
* ) {}
|
|
745
|
+
* ```
|
|
746
|
+
*
|
|
747
|
+
* :::caution[Changing `name` replaces the Service]
|
|
748
|
+
* Fly cannot rename an App. Alchemy creates the Service under the new
|
|
749
|
+
* name, then deletes the old App.
|
|
750
|
+
* :::
|
|
751
|
+
*
|
|
752
|
+
* ### Named export
|
|
753
|
+
* `handler` is the named export to load from `main`. Default is
|
|
754
|
+
* `"default"`.
|
|
755
|
+
*
|
|
756
|
+
* **Example:** Custom handler
|
|
757
|
+
* ```typescript
|
|
758
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
759
|
+
* "Api",
|
|
760
|
+
* { main: import.meta.url, handler: "api", port: 3000 },
|
|
761
|
+
* Effect.gen(function* () {
|
|
762
|
+
* return {
|
|
763
|
+
* fetch: Effect.succeed(HttpServerResponse.text("hello")),
|
|
764
|
+
* };
|
|
765
|
+
* }),
|
|
766
|
+
* ) {}
|
|
767
|
+
* ```
|
|
768
|
+
*
|
|
769
|
+
* ### Base image
|
|
770
|
+
* `image` is the generated Dockerfile's `FROM`. Default is
|
|
771
|
+
* `node:26-slim`. A content-hash change of `main` updates the
|
|
772
|
+
* Machine in place.
|
|
773
|
+
*
|
|
774
|
+
* **Example:** Override FROM
|
|
775
|
+
* ```typescript
|
|
776
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
777
|
+
* "Api",
|
|
778
|
+
* {
|
|
779
|
+
* main: import.meta.url,
|
|
780
|
+
* image: "node:26",
|
|
781
|
+
* port: 3000,
|
|
782
|
+
* },
|
|
783
|
+
* Effect.gen(function* () {
|
|
784
|
+
* return {
|
|
785
|
+
* fetch: Effect.succeed(HttpServerResponse.text("hello")),
|
|
786
|
+
* };
|
|
787
|
+
* }),
|
|
788
|
+
* ) {}
|
|
789
|
+
* ```
|
|
790
|
+
*
|
|
791
|
+
* ### Custom proxy services
|
|
792
|
+
* `services` defaults to HTTP 80 (redirecting to HTTPS) + HTTPS 443
|
|
793
|
+
* toward `port`, or plain HTTP 80 for a private Service. Pass a custom
|
|
794
|
+
* list to change handlers or autostop. Pass `[]` so Fly does not
|
|
795
|
+
* publish a proxy.
|
|
796
|
+
*
|
|
797
|
+
* **Example:** Unpublished process
|
|
798
|
+
* ```typescript
|
|
799
|
+
* export default class Worker extends Fly.Service<Worker>()(
|
|
800
|
+
* "Worker",
|
|
801
|
+
* { main: import.meta.url, region: "iad", services: [] },
|
|
802
|
+
* Effect.gen(function* () {
|
|
803
|
+
* return {};
|
|
804
|
+
* }),
|
|
805
|
+
* ) {}
|
|
806
|
+
* ```
|
|
807
|
+
*
|
|
808
|
+
* ### Background services
|
|
809
|
+
* Omit `port` and `fetch`. Pass `services: []`. Use `ServerHost.run`
|
|
810
|
+
* for a long-running loop. If the process exits, Fly restarts it.
|
|
811
|
+
*
|
|
812
|
+
* **Example:** ServerHost.run
|
|
813
|
+
* ```typescript
|
|
814
|
+
* import { ServerHost } from "alchemy/Runtime/Process";
|
|
815
|
+
*
|
|
816
|
+
* export default class Worker extends Fly.Service<Worker>()(
|
|
817
|
+
* "Worker",
|
|
818
|
+
* { main: import.meta.url, region: "iad", services: [] },
|
|
819
|
+
* Effect.gen(function* () {
|
|
820
|
+
* const host = yield* ServerHost;
|
|
821
|
+
*
|
|
822
|
+
* yield* host.run(
|
|
823
|
+
* Effect.gen(function* () {
|
|
824
|
+
* return yield* Effect.never;
|
|
825
|
+
* }).pipe(Effect.orDie),
|
|
826
|
+
* );
|
|
827
|
+
* }),
|
|
828
|
+
* ) {}
|
|
829
|
+
* ```
|
|
830
|
+
*
|
|
831
|
+
* ### Bundle config
|
|
832
|
+
* `build` is Rolldown `input` / `output` overrides plus
|
|
833
|
+
* pure-annotation options. Use it when `main` needs extra entry
|
|
834
|
+
* points or externals.
|
|
835
|
+
*
|
|
836
|
+
* **Example:** Externals
|
|
837
|
+
* ```typescript
|
|
838
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
839
|
+
* "Api",
|
|
840
|
+
* {
|
|
841
|
+
* main: import.meta.url,
|
|
842
|
+
* port: 3000,
|
|
843
|
+
* build: { input: { external: ["sharp"] } },
|
|
844
|
+
* },
|
|
845
|
+
* Effect.gen(function* () {
|
|
846
|
+
* return {
|
|
847
|
+
* fetch: Effect.succeed(HttpServerResponse.text("hello")),
|
|
848
|
+
* };
|
|
849
|
+
* }),
|
|
850
|
+
* ) {}
|
|
851
|
+
* ```
|
|
852
|
+
*
|
|
853
|
+
* **Example:** Install `pg` unbundled
|
|
854
|
+
* `pg` is CommonJS. Rolldown's interop turns `Client` into a namespace.
|
|
855
|
+
* Install it into the image so `@effect/sql-pg` / `Drizzle.Postgres` load
|
|
856
|
+
* it with Node's CJS semantics — same `build.install` as Lambda.
|
|
857
|
+
* ```typescript
|
|
858
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
859
|
+
* "Api",
|
|
860
|
+
* {
|
|
861
|
+
* main: import.meta.url,
|
|
862
|
+
* port: 3000,
|
|
863
|
+
* build: { install: ["pg"] },
|
|
864
|
+
* },
|
|
865
|
+
* Effect.gen(function* () {
|
|
866
|
+
* const conn = yield* Fly.ConnectPostgres(Db);
|
|
867
|
+
* const db = yield* Drizzle.Postgres(conn.connectionString);
|
|
868
|
+
* return {
|
|
869
|
+
* fetch: Effect.gen(function* () {
|
|
870
|
+
* const rows = yield* db.execute("select 1 as ok");
|
|
871
|
+
* return HttpServerResponse.json({ rows });
|
|
872
|
+
* }),
|
|
873
|
+
* };
|
|
874
|
+
* }).pipe(Effect.provide(Fly.ConnectPostgresHttp)),
|
|
875
|
+
* ) {}
|
|
876
|
+
* ```
|
|
877
|
+
*
|
|
878
|
+
* ### Group Services in one App
|
|
879
|
+
* Pass `app` to run a Service inside an existing {@link App} instead of
|
|
880
|
+
* its own. The Services share the App's hostname, addresses, and
|
|
881
|
+
* {@link Secret}s, and a {@link Certificate} on the App covers them.
|
|
882
|
+
* Alchemy manages no addresses for a Service in a shared App: allocate
|
|
883
|
+
* an {@link IpAssignment} on the App. `url` and `endpoints` follow the
|
|
884
|
+
* Service's own ports, so Services in one App tell themselves apart by
|
|
885
|
+
* port (`https://{appName}.fly.dev` and `https://{appName}.fly.dev:8443`).
|
|
886
|
+
* `public` does not apply.
|
|
887
|
+
*
|
|
888
|
+
* **Example:** API and worker sharing a secret
|
|
889
|
+
* ```typescript
|
|
890
|
+
* export const Site = Fly.App("Site");
|
|
891
|
+
*
|
|
892
|
+
* class Api extends Fly.Service<Api>()(
|
|
893
|
+
* "Api",
|
|
894
|
+
* { app: Site, main: import.meta.url, port: 3000 },
|
|
895
|
+
* Effect.gen(function* () {
|
|
896
|
+
* return {
|
|
897
|
+
* fetch: Effect.succeed(HttpServerResponse.text("hello")),
|
|
898
|
+
* };
|
|
899
|
+
* }),
|
|
900
|
+
* ) {}
|
|
901
|
+
*
|
|
902
|
+
* class Worker extends Fly.Service<Worker>()(
|
|
903
|
+
* "Worker",
|
|
904
|
+
* { app: Site, main: import.meta.url, services: [] },
|
|
905
|
+
* Effect.gen(function* () {
|
|
906
|
+
* return {};
|
|
907
|
+
* }),
|
|
908
|
+
* ) {}
|
|
909
|
+
* ```
|
|
910
|
+
*
|
|
911
|
+
* Fly's proxy routes an App's traffic by port only, so each Service in
|
|
912
|
+
* the App needs its own ports, including its own `bindingPort` when
|
|
913
|
+
* Alchemy adds one. Two Services on the same port and protocol fail with
|
|
914
|
+
* `Fly.ServicePortConflict` before any Machine is created: at plan time
|
|
915
|
+
* when the App already exists, otherwise when the App deploys. Grouped
|
|
916
|
+
* Services can be bound like any other; they cannot bind each other in
|
|
917
|
+
* a cycle.
|
|
918
|
+
*
|
|
919
|
+
* ### Blue/green deployments
|
|
920
|
+
* Opt into healthy replacement Machines instead of in-place updates.
|
|
921
|
+
* The default TCP service check proves the server is listening; supply
|
|
922
|
+
* service HTTP checks when readiness also depends on application state.
|
|
923
|
+
*
|
|
924
|
+
* **Example:** Single-replica HTTP replacement
|
|
925
|
+
* ```typescript
|
|
926
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
927
|
+
* "Api",
|
|
928
|
+
* {
|
|
929
|
+
* main: import.meta.url,
|
|
930
|
+
* deploy: { strategy: "bluegreen" },
|
|
931
|
+
* shutdown: { timeout: "30 seconds" },
|
|
932
|
+
* },
|
|
933
|
+
* Effect.succeed({ fetch: Effect.succeed(HttpServerResponse.text("ready")) }),
|
|
934
|
+
* ) {}
|
|
935
|
+
* ```
|
|
936
|
+
*
|
|
937
|
+
* Keep one Service declaration. The old process retains its own shutdown
|
|
938
|
+
* signal and deadline when the replacement's policy changes. Managed
|
|
939
|
+
* SIGTERM/SIGINT shutdown drains HTTP while runtime resource finalizers run;
|
|
940
|
+
* shared dependencies remain alive until both settle or the deadline expires.
|
|
941
|
+
* Applications own stop-acquisition barriers, separately scoped jobs, and
|
|
942
|
+
* bounded drain or checkpoint logic using ordinary finalizers, not a new
|
|
943
|
+
* shutdown hook. External servers own their signal handling. An old bootstrap
|
|
944
|
+
* cannot gain handlers retroactively. Volumes are incompatible with blue/green;
|
|
945
|
+
* physical IDs and names change. Service-bound secret versions are floors,
|
|
946
|
+
* not vault snapshots, and native Machine leases are not deployment-wide locks.
|
|
947
|
+
* Leases do not serialize vault writers or every simultaneous first deployment;
|
|
948
|
+
* serialize CI invocations for the same resource.
|
|
949
|
+
*
|
|
950
|
+
* Stop and suspend autostop policies preserve idle nonrepresentatives while
|
|
951
|
+
* a representative and the required running floor pass readiness. Requested
|
|
952
|
+
* idle policy is restored before old retirement; a new instance needs fresh
|
|
953
|
+
* checks. Suspension is not SIGTERM shutdown and does not run ordinary
|
|
954
|
+
* shutdown finalizers. Replacements do not inherit suspended process memory.
|
|
955
|
+
* See the [deployment guide](/fly/compute/deployments) for recovery,
|
|
956
|
+
* idle capacity, application responsibilities, and verification limits.
|
|
957
|
+
*
|
|
958
|
+
* @resource
|
|
959
|
+
* @product Service
|
|
960
|
+
*/
|
|
961
|
+
export declare const Service: Platform<Service, ServiceServices, ServiceShape, ServiceRuntimeContext>;
|
|
962
|
+
declare const ServiceNotCreated_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
963
|
+
readonly _tag: "Fly.ServiceNotCreated";
|
|
964
|
+
} & Readonly<A>;
|
|
965
|
+
export declare class ServiceNotCreated extends ServiceNotCreated_base<{
|
|
966
|
+
name: string;
|
|
967
|
+
appName: string;
|
|
968
|
+
}> {
|
|
969
|
+
}
|
|
970
|
+
declare const InvalidServiceProps_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
971
|
+
readonly _tag: "Fly.InvalidServiceProps";
|
|
972
|
+
} & Readonly<A>;
|
|
973
|
+
export declare class InvalidServiceProps extends InvalidServiceProps_base<{
|
|
974
|
+
message: string;
|
|
975
|
+
}> {
|
|
976
|
+
}
|
|
977
|
+
declare const ServiceAppNotResolved_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
978
|
+
readonly _tag: "Fly.ServiceAppNotResolved";
|
|
979
|
+
} & Readonly<A>;
|
|
980
|
+
export declare class ServiceAppNotResolved extends ServiceAppNotResolved_base<{
|
|
981
|
+
message: string;
|
|
982
|
+
}> {
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* A private network name unique to the current stack and stage, for the
|
|
986
|
+
* Service `network` prop. Services in one stage reach each other; other
|
|
987
|
+
* stages and every other App in the organization cannot.
|
|
988
|
+
*/
|
|
989
|
+
export declare const stackNetwork: Effect.Effect<string, never, Stack>;
|
|
990
|
+
declare const ServiceUnreachable_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
991
|
+
readonly _tag: "Fly.ServiceUnreachable";
|
|
992
|
+
} & Readonly<A>;
|
|
993
|
+
export declare class ServiceUnreachable extends ServiceUnreachable_base<{
|
|
994
|
+
service: string;
|
|
995
|
+
target: string;
|
|
996
|
+
network: string | undefined;
|
|
997
|
+
targetNetwork: string | undefined;
|
|
998
|
+
}> {
|
|
999
|
+
get message(): string;
|
|
1000
|
+
}
|
|
1001
|
+
declare const ServiceNotBindable_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
1002
|
+
readonly _tag: "Fly.ServiceNotBindable";
|
|
1003
|
+
} & Readonly<A>;
|
|
1004
|
+
export declare class ServiceNotBindable extends ServiceNotBindable_base<{
|
|
1005
|
+
service: string;
|
|
1006
|
+
target: string;
|
|
1007
|
+
}> {
|
|
1008
|
+
get message(): string;
|
|
1009
|
+
}
|
|
1010
|
+
declare const EndpointNotPublished_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
1011
|
+
readonly _tag: "Fly.EndpointNotPublished";
|
|
1012
|
+
} & Readonly<A>;
|
|
1013
|
+
export declare class EndpointNotPublished extends EndpointNotPublished_base<{
|
|
1014
|
+
service: string;
|
|
1015
|
+
target: string;
|
|
1016
|
+
port: number;
|
|
1017
|
+
}> {
|
|
1018
|
+
get message(): string;
|
|
1019
|
+
}
|
|
1020
|
+
export declare const ServiceProvider: () => Layer.Layer<Provider.Provider<Service>, never, AlchemyContext | import("effect/process/ChildProcessSpawner").ChildProcessSpawner | import("effect/FileSystem").FileSystem | import("effect/Path").Path | Stack | import("alchemy/Stage").Stage | machines.FlyIoOpContext>;
|
|
1021
|
+
export {};
|
|
1022
|
+
//# sourceMappingURL=Service.d.ts.map
|