diff --git a/templates/openfaas/0/README.md b/templates/openfaas/0/README.md new file mode 100644 index 0000000..de94650 --- /dev/null +++ b/templates/openfaas/0/README.md @@ -0,0 +1,3 @@ +This is a catalog that spins up an OpenFaaS(https://github.com/alexellis/faas) stack with Rancher as the backend. The `faas-rancher` container is the proxy that connects OpenFaas and Rancher. + +`faas-rancher` is in an extremely early stage and is meant only to be used in development. \ No newline at end of file diff --git a/templates/openfaas/0/docker-compose.yml b/templates/openfaas/0/docker-compose.yml new file mode 100644 index 0000000..4c891e2 --- /dev/null +++ b/templates/openfaas/0/docker-compose.yml @@ -0,0 +1,56 @@ +version: '2' +services: + lb: + image: rancher/lb-service-haproxy:v0.7.9 + ports: + - 8080:8080/tcp + - 9090:9090/tcp + - 9093:9093/tcp + labels: + io.rancher.container.agent.role: environmentAdmin + io.rancher.container.create_agent: 'true' + prometheus: + image: kenfdev/prometheus:latest-cattle + environment: + no_proxy: gateway + stdin_open: true + tty: true + command: + - -config.file=/etc/prometheus/prometheus.yml + - -storage.local.path=/prometheus + - -storage.local.memory-chunks=10000 + - --alertmanager.url=http://alertmanager:9093 + labels: + io.rancher.container.pull_image: always + faas-rancher: + image: kenfdev/faas-rancher + environment: + FUNCTION_STACK_NAME: ${FUNCTION_STACK_NAME} + CATTLE_URL: ${CATTLE_URL} + CATTLE_ACCESS_KEY: ${CATTLE_ACCESS_KEY} + CATTLE_SECRET_KEY: ${CATTLE_SECRET_KEY} + stdin_open: true + tty: true + labels: + io.rancher.container.pull_image: always + gateway: + image: functions/gateway:0.6.2 + environment: + dnsrr: 'true' + functions_provider_url: http://faas-rancher:8080/ + stdin_open: true + volumes: + - /var/run/docker.sock:/var/run/docker.sock + tty: true + labels: + io.rancher.container.pull_image: always + alertmanager: + image: functions/alertmanager:latest + environment: + no_proxy: gateway + stdin_open: true + tty: true + command: + - -config.file=/alertmanager.yml + labels: + io.rancher.container.pull_image: always diff --git a/templates/openfaas/0/rancher-compose.yml b/templates/openfaas/0/rancher-compose.yml new file mode 100644 index 0000000..667cc8f --- /dev/null +++ b/templates/openfaas/0/rancher-compose.yml @@ -0,0 +1,71 @@ +.catalog: + name: "OpenFaaS" + version: "v0.0.1" + description: "Enable Rancher as a backend for Functions as a Service (OpenFaaS)" + uuid: "openfaas-0" + minimum_rancher_version: v1.5.0 + questions: + - variable: "CATTLE_URL" + description: "The v2-beta Rancher Server Endpoint" + label: "Rancher Server Endpoint URL" + required: true + type: "string" + - variable: "CATTLE_ACCESS_KEY" + description: "The Rancher API Access Key" + label: "API Access Key" + required: true + type: "string" + - variable: "CATTLE_SECRET_KEY" + description: "The Rancher API Secret Key" + label: "API Secret Key" + required: true + type: "string" + - variable: "FUNCTION_STACK_NAME" + description: "The stack name faas functions will be deployed to. Don't forget to create it!" + label: "Functions Stack Name" + required: true + type: "string" + +version: '2' +services: + lb: + scale: 1 + start_on_create: true + lb_config: + certs: [] + port_rules: + - priority: 1 + protocol: http + service: gateway + source_port: 8080 + target_port: 8080 + - priority: 2 + protocol: http + service: prometheus + source_port: 9090 + target_port: 9090 + - priority: 3 + protocol: http + service: alertmanager + source_port: 9093 + target_port: 9093 + health_check: + healthy_threshold: 2 + response_timeout: 2000 + port: 42 + unhealthy_threshold: 3 + initializing_timeout: 60000 + interval: 2000 + reinitializing_timeout: 60000 + prometheus: + scale: 1 + start_on_create: true + faas-rancher: + scale: 1 + start_on_create: true + gateway: + scale: 1 + start_on_create: true + alertmanager: + scale: 1 + start_on_create: true diff --git a/templates/openfaas/catalogIcon-openfaas.png b/templates/openfaas/catalogIcon-openfaas.png new file mode 100644 index 0000000..91467b6 Binary files /dev/null and b/templates/openfaas/catalogIcon-openfaas.png differ diff --git a/templates/openfaas/config.yml b/templates/openfaas/config.yml new file mode 100644 index 0000000..8afc950 --- /dev/null +++ b/templates/openfaas/config.yml @@ -0,0 +1,7 @@ +name: OpenFaaS +description: | + Functions as a Service - a serverless framework for Docker +version: v0.0.1 +category: Platform +license: MIT +projectURL: https://github.com/kenfdev/rancher-cattle-openfaas \ No newline at end of file