All Projects → rgee0 → Openfaas On Digitalocean

rgee0 / Openfaas On Digitalocean

Licence: mit
Ansible playbook to create a Digital Ocean droplet and deploy OpenFaaS onto it.

Projects that are alternatives of or similar to Openfaas On Digitalocean

Ansible Role K3s
Ansible role for installing k3s as either a standalone server or HA cluster.
Stars: ✭ 132 (+131.58%)
Mutual labels:  ansible, playbook, k8s
Debops
DebOps - Your Debian-based data center in a box
Stars: ✭ 734 (+1187.72%)
Mutual labels:  ansible, playbook
Op Note
当我有服务器时我做了什么 · 个人服务器运维指南
Stars: ✭ 733 (+1185.96%)
Mutual labels:  ansible, k8s
Ansible Role Mysql
Ansible Role - MySQL
Stars: ✭ 826 (+1349.12%)
Mutual labels:  ansible, playbook
Ansible Role Php
Ansible Role - PHP
Stars: ✭ 396 (+594.74%)
Mutual labels:  ansible, playbook
Ansible For Devops
Ansible for DevOps examples.
Stars: ✭ 5,265 (+9136.84%)
Mutual labels:  ansible, playbook
Kubeasz
使用Ansible脚本安装K8S集群,介绍组件交互原理,方便直接,不受国内网络环境影响
Stars: ✭ 7,629 (+13284.21%)
Mutual labels:  ansible, k8s
Kubeoperator
KubeOperator 是一个开源的轻量级 Kubernetes 发行版,专注于帮助企业规划、部署和运营生产级别的 K8s 集群。
Stars: ✭ 4,147 (+7175.44%)
Mutual labels:  ansible, k8s
Ansiblecm
A Docker based Ansible control machine for running playbooks in a consistent environment.
Stars: ✭ 26 (-54.39%)
Mutual labels:  ansible, playbook
K8s On Raspbian
Kubernetes on Raspbian (Raspberry Pi)
Stars: ✭ 839 (+1371.93%)
Mutual labels:  serverless, k8s
Serverless Swarm
Serverless with Swarm, Docker and StackStorm
Stars: ✭ 21 (-63.16%)
Mutual labels:  serverless, ansible
Faas
OpenFaaS - Serverless Functions Made Simple
Stars: ✭ 20,820 (+36426.32%)
Mutual labels:  serverless, k8s
Ansible Roles
Ansible Roles
Stars: ✭ 375 (+557.89%)
Mutual labels:  ansible, k8s
Kubeadm Playbook
Fully fledged (HA) Kubernetes Cluster using official kubeadm, ansible and helm. Tested on RHEL/CentOS/Ubuntu with support of http_proxy, dashboard installed, ingress controller, heapster - using official helm charts
Stars: ✭ 533 (+835.09%)
Mutual labels:  ansible, playbook
Rak8s
Stand up a Raspberry Pi based Kubernetes cluster with Ansible
Stars: ✭ 354 (+521.05%)
Mutual labels:  ansible, kubernetes-setup
Ansible Ssh Hardening
This Ansible role provides numerous security-related ssh configurations, providing all-round base protection.
Stars: ✭ 746 (+1208.77%)
Mutual labels:  ansible, playbook
Upcloud Ansible
Dynamic inventory and modules for managing servers via UpCloud's API
Stars: ✭ 50 (-12.28%)
Mutual labels:  ansible, playbook
Ansible Freeipa
Ansible roles and modules for FreeIPA
Stars: ✭ 284 (+398.25%)
Mutual labels:  ansible, playbook
Mac Dev Playbook
Mac setup and configuration via Ansible.
Stars: ✭ 4,202 (+7271.93%)
Mutual labels:  ansible, playbook
Ansible Collection Gns3
Ansible Collection for GNS3 Server REST API using gns3fy
Stars: ✭ 19 (-66.67%)
Mutual labels:  ansible, playbook

OpenFaaS-on-DigitalOcean

Ansible Playbook to get you up and running with OpenFaas on DigitalOcean. This is intended for evaluation / testing where quick and repeatable access to a clean instance is desired.

Please be aware this playbook is not idempotent, specifically in droplet creation; if you run it n times you will get n droplets.

Both swarm and kubernetes deployments are possible by passing -e "orchestrator=swarm" or -e "orchestrator=k8s".

Pre-requisites

These vary depending on the mechanism by which Ansible is being invoked. If Ansible is being installed onto a control machine then all three apply. Alternatively a Docker image has been made available at rgee0/ansible-playbook:2.6.0 which includes the first two pre-reqs.

Configure Variables

Configure the create_droplet role variables according to your needs.

  token: <your DO API token>
  sshid: <your ssh key ids>
  size_slug: <your required vm size>
  region: <your desired region>
  image: ubuntu-17-10-x64

  • token

Click API in the DigitalOcean Dashboard, then under Tokens/Keys click “Generate New Token”. Select Read & Write scopes.

  • sshid

The ssh key IDs can be found by running:

$ export DOTOKEN=<API token>
$ curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Bearer '$DOTOKEN "https://api.digitalocean.com/v2/account/keys" 2>/dev/null | python -m json.tool

Look at the “ssh_keys” section and pick one of the SSH keys you want to use to log into the new droplet we will create. Use the “name” field to identify the key and then copy the “id” field

  • size_slug

Its recommended that s-2vcpu-4gb is used as a minimum. Further options can be found on DigitalOcean

or through the API:

$ curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Bearer '$DOTOKEN "https://api.digitalocean.com/v2/sizes" 2>/dev/null | python -m json.tool
  • region
$ curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Bearer '$DOTOKEN "https://api.digitalocean.com/v2/regions" 2>/dev/null | python -m json.tool

Run the playbook

  • Using Swarm (Ansible via Docker)

Ensure the path to, and key names, are adjusted according to your set-up.

$ docker run --rm -it -v $(pwd):/ansible/playbooks \
                      -v ~/.ssh/id_rsa:/root/.ssh/id_rsa \
                      -v ~/.ssh/id_rsa.pub:/root/.ssh/id_rsa.pub \
                      rgee0/ansible-playbook:2.6.0 site.yml -e "orchestrator=swarm"
  • Using Kubernetes (Ansible via Docker)

Ensure the path to, and key names, are adjusted according to your set-up.

$ docker run --rm -it -v $(pwd):/ansible/playbooks \
                      -v ~/.ssh/id_rsa:/root/.ssh/id_rsa \
                      -v ~/.ssh/id_rsa.pub:/root/.ssh/id_rsa.pub \
                      rgee0/ansible-playbook:2.6.0 site.yml -e "orchestrator=k8s"
  • Using Swarm (local Ansible installation)
$ ansible-playbook site.yml -e "orchestrator=swarm"
  • Using Kubernetes (local Ansible installation)
$ ansible-playbook site.yml -e "orchestrator=k8s"

Head over to the UI

Check the output of the final task to find the location of the OpenFaaS UI. For example:

ok: [209.97.188.227] => {
    "msg": [
        "OpenFaaS Gateway: http://209.97.188.227:8080",
        "Gateway User: admin ",
        "Gateway Password: c2db2b6d59df518392a81eff57c52486f9f2f46e2480d9de150904bbce0560bc",
        "CLI Gateway Login: echo -n c2db2b6d59df518392a81eff57c52486f9f2f46e2480d9de150904bbce0560bc | faas-cli login --username=admin --password-stdin -g http://209.97.188.227:8080"
    ]
}

PLAY RECAP **************************************************************************************************************************
209.97.188.227             : ok=12   changed=6    unreachable=0    failed=0
localhost                  : ok=6    changed=2    unreachable=0    failed=0

As this deploys to public cloud basic auth is enabled by default for both orchestrators.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].