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 暴露的本地端口即可。这使得开发者能够像往常一样进行创建存储桶、上传文件和管理资源等操作,而无需有效的云订阅或网络连接。它是进行测试和开发的理想解决方案,不仅消除了账单顾虑,还简化了本地云集成流程。

最近的一篇 Hacker News 帖子介绍了 **Floci**,这是一个旨在本地模拟各种云服务的工具。该项目收到的反馈褒贬不一,既有对其技术实用性的关注,也有对其名称在语言层面上的调侃。 用户强调了 Floci 在对象存储方面的潜在用途,一些开发者表示有兴趣将类似的模拟技术用于生产环境,并指出他们已经成功在本地运行了模拟的云堆栈。 然而,在一名罗马尼亚用户指出“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