Floci:本地模拟任何云服务
Floci: Locally emulating any cloud service

原始链接: https://floci.io

Floci 是一款开源工具,提供各大云服务商的本地模拟功能,让开发者无需支付费用即可离线运行云服务。Floci 通过 Docker 容器模拟 AWS(支持 S3、Lambda 和 DynamoDB 等 119 项服务)、Azure(Blob、Queue、Table、Functions)、GCP(Cloud Storage)以及 OCI 的环境。 用户可以通过安装 Floci CLI 实现快速配置,或直接通过 Docker 部署特定的模拟器。运行后,开发者只需将现有的命令行工具(如 `aws`、`az`、`gcloud` 或 `oci`)指向 Floci 暴露的本地端口即可。这使得开发者能够像往常一样进行创建存储桶、上传文件和管理资源等操作,而无需有效的云订阅或网络连接。它是进行测试和开发的理想解决方案,不仅消除了账单顾虑,还简化了本地云集成流程。

关于 Floci(一款用于本地模拟云服务的工具)的 Hacker News 讨论,凸显了它作为 Localstack 等现有方案的一种轻量级替代品而崭露头角。 用户称赞 Floci 在构建自定义云兼容测试套件时易于使用。许多贡献者正在利用 Claude 等人工智能工具快速实现功能,这被一些人视为开源开发的“Folding at Home”模式——即通过集体努力和人工智能辅助,实现复杂模拟器的快速构建。 尽管一些开发者为了更高的保真度更倾向于针对真实的云 API 进行测试,但另一些人认为 Floci 及类似的模拟器(如 `fakecloud` 或 `Testcontainers`)对于个人项目、本地开发以及避免集成成本至关重要。 讨论还涉及了“数字孪生”带来的挑战,即模拟器与真实生产环境之间可能存在的偏差风险;此外还有一个关于产品名称的趣闻,该名称在罗马尼亚语、希腊语和意大利语中有着不太雅观的俚语含义。尽管存在语言上的争议,社区对 Floci 作为现代人工智能辅助编程工作流中一款轻量级、对开发者友好的工具所展现出的潜力持乐观态度。
相关文章

原文
# Install floci-cli
curl -fsSL https://floci.io/install.sh | sh

# Start the AWS emulator & export env vars
floci start && eval $(floci env)

# Create a bucket
aws s3 mb s3://my-bucket

# Upload a file
echo "Why pay for S3 when floci is free? 🎉" > hello-floci.txt
aws s3 cp hello-floci.txt s3://my-bucket/

# Download it back
aws s3 cp s3://my-bucket/hello-floci.txt hello-back.txt
cat hello-back.txt

# Install floci-cli (PowerShell)
irm https://floci.io/install.ps1 | iex

# Start the AWS emulator & export env vars
floci start; floci env | Invoke-Expression

# Create a bucket
aws s3 mb s3://my-bucket

# Upload a file
"Why pay for S3 when floci is free? 🎉" | Out-File hello-floci.txt
aws s3 cp hello-floci.txt s3://my-bucket/

# Download it back
aws s3 cp s3://my-bucket/hello-floci.txt hello-back.txt; Get-Content hello-back.txt

# Run all 119 AWS services on port 4566
docker run --rm -p 4566:4566 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  floci/floci:latest

# Point the AWS CLI at floci
export AWS_ENDPOINT_URL=http://localhost:4566
export AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test

# Create a bucket
aws s3 mb s3://my-bucket

# Upload a file
echo "Why pay for S3 when floci is free? 🎉" > hello-floci.txt
aws s3 cp hello-floci.txt s3://my-bucket/

# Download it back
aws s3 cp s3://my-bucket/hello-floci.txt hello-back.txt
cat hello-back.txt

# Run Blob, Queue, Table & Functions on port 4577
docker run --rm -p 4577:4577 \
  floci/floci-az:latest

# Configure the Azure CLI
export AZURE_STORAGE_CONNECTION_STRING="DefaultEndpointsProtocol=http;\
AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;\
BlobEndpoint=http://localhost:4577/devstoreaccount1;"

# Create a container & upload a file
az storage container create -n my-container
echo "Azure locally, no bill, no drama. 🚀" > hello-floci.txt
az storage blob upload -c my-container -f hello-floci.txt -n hello-floci.txt

# Download it back
az storage blob download -c my-container -n hello-floci.txt -f hello-back.txt
cat hello-back.txt

# Run Cloud Storage on port 4588
docker run --rm -p 4588:4588 \
  floci/floci-gcp:latest

# Point the gcloud CLI at floci-gcp
export CLOUDSDK_API_ENDPOINT_OVERRIDES_STORAGE=http://localhost:4588/
export CLOUDSDK_CORE_PROJECT=floci-local

# Create a bucket & upload a file
gcloud storage buckets create gs://my-bucket
echo "No billing alert? Must be floci. ☁️" > hello-floci.txt
gcloud storage cp hello-floci.txt gs://my-bucket/

# Download it back
gcloud storage cp gs://my-bucket/hello-floci.txt hello-back.txt
cat hello-back.txt

# Run all 8 OCI services on port 4599
docker run --rm -p 4599:4599 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  floci/floci-oci:latest

# One-time OCI CLI setup (throwaway API key + profile) & env vars
floci oci setup && eval $(floci oci env)
export TENANCY_OCID=ocid1.tenancy.oc1..flocilocaltenancy0000000000000000000000000000000000000000

# Create a bucket & upload a file
oci os bucket create \
  --namespace-name floci-local --name my-bucket --compartment-id $TENANCY_OCID

echo "Oracle Cloud locally — no bill, no drama. 🚀" > hello-floci.txt
oci os object put \
  --namespace-name floci-local --bucket-name my-bucket --file hello-floci.txt

# Download it back
oci os object get \
  --namespace-name floci-local --bucket-name my-bucket --name hello-floci.txt --file hello-back.txt

cat hello-back.txt

119 AWS services ready on :4566. S3 · SQS · DynamoDB · Lambda · RDS · +114 more

联系我们 contact @ memedata.com