# 阿里云函数计算 FC 3.0 配置 # 使用 Serverless Devs 部署: cd deployment/serverless && s deploy edition: 3.0.0 name: functional-scaffold access: default vars: region: cn-beijing image: crpi-om2xd9y8cmaizszf-vpc.cn-beijing.personal.cr.aliyuncs.com/your-namespace/fc-test:test-v1 redis_host: 127.31.1.1 redis_port: "6379" redis_password: "your-password" resources: # API 服务函数 prime-checker-api: component: fc3 props: region: ${vars.region} functionName: prime-checker-api description: 质数判断算法服务(API) runtime: custom-container cpu: 0.35 memorySize: 512 diskSize: 512 timeout: 60 instanceConcurrency: 10 handler: not-used customContainerConfig: image: ${vars.image} port: 8000 command: - /app/entrypoint.sh healthCheckConfig: httpGetUrl: /healthz initialDelaySeconds: 3 periodSeconds: 5 timeoutSeconds: 3 failureThreshold: 3 successThreshold: 1 environmentVariables: APP_ENV: production LOG_LEVEL: INFO METRICS_ENABLED: "true" RUN_MODE: api REDIS_HOST: ${vars.redis_host} REDIS_PORT: ${vars.redis_port} REDIS_PASSWORD: ${vars.redis_password} vpcConfig: auto logConfig: auto triggers: - triggerName: http-trigger triggerType: http triggerConfig: authType: anonymous methods: - GET - POST - PUT - DELETE # 异步任务 Worker 函数 job-worker: component: fc3 props: region: ${vars.region} functionName: job-worker description: 异步任务 Worker runtime: custom-container cpu: 0.35 memorySize: 512 diskSize: 512 timeout: 900 instanceConcurrency: 1 handler: not-used customContainerConfig: image: ${vars.image} port: 8000 command: - /app/entrypoint.sh healthCheckConfig: httpGetUrl: /healthz initialDelaySeconds: 5 periodSeconds: 10 timeoutSeconds: 3 failureThreshold: 3 successThreshold: 1 environmentVariables: APP_ENV: production LOG_LEVEL: INFO METRICS_ENABLED: "true" RUN_MODE: worker REDIS_HOST: ${vars.redis_host} REDIS_PORT: ${vars.redis_port} REDIS_PASSWORD: ${vars.redis_password} WORKER_POLL_INTERVAL: "1.0" MAX_CONCURRENT_JOBS: "5" JOB_MAX_RETRIES: "3" JOB_EXECUTION_TIMEOUT: "300" vpcConfig: auto logConfig: auto triggers: - triggerName: timer-trigger triggerType: timer triggerConfig: cronExpression: "0 */1 * * * *" enable: true payload: "{}"