You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 2, 2021. It is now read-only.
You may already have a Kubernetes cluster, if not, then follow the instructions below picking either 1) or 2).
71
71
72
-
You can create a managed or self-hosted Kubernetes cluster using a Kubernetes engine such as GKE, AWS, DigitalOcean or by using `kubeadm`. Once set up make sure you have set your `KUBECONFIG` and / or `kubectl` tool to point at a the new cluster.
72
+
#### 1) Create a production cluster
73
73
74
-
* Create a local cluster for testing
74
+
You can create a managed or self-hosted Kubernetes cluster using a Kubernetes engine from a cloud provider, or by running either `kubeadm` or `k3s`.
Once set up make sure you have set your `KUBECONFIG` and / or `kubectl` tool to point at a the new cluster.
89
+
90
+
Check this with:
91
+
92
+
```sh
93
+
kubectl config get-contexts
94
+
```
95
+
96
+
#### 2) Create a local cluster for development / testing
75
97
76
98
For testing you can create a local cluster using `kind`, `minikube` or Docker Desktop. This is how you can install `kind` to setup a local cluster in a Docker container.
77
99
78
100
First install [Go 1.10 or newer](https://golang.org/dl/)
79
101
102
+
* Set your `GOPATH` if you don't already have one
103
+
104
+
```bash
105
+
export GOPATH=$HOME/go
106
+
```
107
+
108
+
* Download and build `kind`
109
+
80
110
Now use `go get` to install `kind` and point your `KUBECONFIG` variable at the new cluster.
81
111
82
112
```bash
@@ -88,90 +118,125 @@ export KUBECONFIG=$(kind get kubeconfig-path --name 1)
88
118
89
119
### Get `ofc-bootstrap`
90
120
91
-
* Set your `GOPATH` if you don't already have one
92
-
93
-
```bash
94
-
export GOPATH=$HOME/go
95
-
```
121
+
Now clone the GitHub repository, download the binary release and start customising your own `init.yaml` file.
* Download the latest `ofc-bootstrap`binary release from GitHub
106
132
107
-
Download [ofc-boostrap](https://github.com/openfaas-incubator/ofc-bootstrap/releases) from the GitHub releases page and move it to `/usr/local/bin/`. You may also need to run `chmod +x /usr/local/bin/ofc-bootstrap`.
133
+
Either run the following script, or follow the manual steps below.
Download [ofc-boostrap](https://github.com/openfaas-incubator/ofc-bootstrap/releases) from the GitHub releases page and move it to `/usr/local/bin/`.
148
+
149
+
You may also need to run `chmod +x /usr/local/bin/ofc-bootstrap`.
150
+
151
+
For Linux use the binary with no suffix, for MacOS, use the binary with the `-darwin` suffix.
108
152
109
153
### Create your own `init.yaml`
110
154
155
+
You will need to read the whole `init.yaml` file carefully including all the comments. Each setting is described with a comment to help you decide what value to set.
156
+
111
157
First run `cp example.init.yaml init.yaml` to get your own `init.yaml` file.
112
158
113
159
#### Set the `root_domain`
114
160
115
161
Edit `root_domain` and add your own domain i.e. `example.com` or `ofc.example.com`
116
162
117
-
See the appendix for how to set up DNS A records for this, or edit your hosts file later.
163
+
If you picked a root domain of `example.com`, then your URLs would correspond to the following:
164
+
165
+
*`system.example.com`
166
+
*`auth.system.example.com`
167
+
*`*.example.com`
168
+
169
+
After the installation has completed in a later step, you will need to create DNS A records with your DNS provider. You don't need to create these records now.
118
170
119
171
#### Prepare your Docker registry
120
172
121
-
Log into your Docker registry or the Docker Hub:
173
+
Log into your own private Docker registry, or the [Docker Hub](https://hub.docker.com):
122
174
123
175
* Open the Docker for Mac/Windows settings and uncheck "store my password securely" / "in a keychain"
124
176
* Run `docker login` to populate `~/.docker/config.json` - this will be used to configure your Docker registry or Docker Hub account for functions.
125
177
126
-
#### Pick your SCM
178
+
#### Pick your Source Control Management (SCM)
127
179
128
-
Choose SCM between GitHub and GitLab, by setting `scm: github` or `scm: gitlab`
180
+
Choose SCM between GitHub.com or GitLab self-hosted, by setting `scm: github` or `scm: gitlab`
129
181
130
182
#### Setup your GitHub or GitLab integration
131
183
132
184
Setup the GitHub / GitLab App and OAuth App
133
185
186
+
Your SCM will need to send webhooks to OpenFaaS Cloud's github-event or gitlab-event function for CI/CD. This is protected by a confidential secret called a *Webhook secret*. You can leave the field blank to have one generated for you, or you can set your own in `init.yaml`.
187
+
134
188
* For GitHub create a GitHub App and download the private key file
135
189
* Read the docs for how to [configure your GitHub App](https://docs.openfaas.com/openfaas-cloud/self-hosted/github/)
190
+
* Leave the `value:` for `github-webhook-secret` blank, or set your own password
136
191
* Update `init.yaml` where you see the `### User-input` section including your GitHub App's ID, Webhook secret and the path to its private key
192
+
137
193
* For GitLab create a System Hook
138
-
* Update the `### User-input` section including your System Hook's API Token and Webhook secret
194
+
* Leave the `value:` for `gitlab-webhook-secret` blank, or set your own password
195
+
* Update the `### User-input` section including your System Hook's API Token and *Webhook secret*
139
196
* Create your GitHub / GitLab OAuth App which is used for logging in to the dashboard
140
197
* For GitLab update `init.yaml` with your `gitlab_instance`
141
198
142
199
#### Setup your access control
143
200
144
-
Create your own GitHub repo with a CUSTOMERS ACL file
201
+
Access control to your OFC is controlled by a text file containing a list of valid usernames.
202
+
203
+
Create a new GitHub repository with a CUSTOMERS ACL file. This repository should not contain any code or functions.
145
204
146
205
* Create a new public GitHub repo
147
206
* Add a file named `CUSTOMERS` and place each username or GitHub org you will use on a separate line
148
-
* Add the GitHub RAW CDN URL into the init.yaml file
207
+
* Add the GitHub RAW CDN URL into the `init.yaml` file
149
208
150
209
#### Decide if you're using a LoadBalancer
151
210
152
-
It can be set up on a public cloud provider with a managed Kubernetes offering, where a `LoadBalancer` is available. If you are deploying to a cloud or Kubernetes cluster where the type `LoadBalancer` is unavailable then you will need to change `ingress: loadbalancer` to `ingress: host` in `init.yaml`. This will provision Nginx as a `DaemonSet` exposed on port `80` and `443`.
211
+
If you are using a public cloud offering and you know that they can offer a `LoadBalancer`, then the `ingress:` field will be set to `loadbalancer` which is the default.
212
+
213
+
If you are deploying to a cloud or Kubernetes cluster where the type `LoadBalancer` is unavailable then you will need to change `ingress: loadbalancer` to `ingress: host` in `init.yaml`. Nginx will be configured as a `DaemonSet` exposed on port `80` and `443` on each node in your cluster. It is recommended that you create a DNS mapping between a chosen name and the IP of each node.
153
214
154
215
> Note: it is a common error for new users to try to access the dashboard using the IP address of the load-balancer.
155
216
> You must use the DNS name for the dashboard: i.e. `system.example.com/dashboard/username`
156
217
157
-
#### Use authz (optional)
218
+
#### Use authz (recommended)
219
+
220
+
> This feature is optional, but highly recommended
158
221
159
222
If you'd like to restrict who can log in to just those who use a GitHub account then create a GitHub OAuth App.
160
223
161
224
Enable `auth` and fill out the OAuth App `client_id`. Configure `of-client-secret` with the OAuth App Client Secret.
162
225
For GitLab set your `oauth_provider_base_url`.
163
226
164
-
#### Use TLS (optional)
227
+
#### Use TLS (recommended)
228
+
229
+
> This feature is optional, but highly recommended
165
230
166
231
We can automatically provision TLS certificates for your OpenFaaS Cloud cluster using the DNS01 challenge.
167
232
168
233
Pick between the following providers for the DNS01 challenge:
169
234
235
+
* DigitalOcean DNS
170
236
* Google Cloud DNS
171
237
* AWS Route53
172
-
* DigitalOcean DNS via cert-manager 0.6.0
173
238
174
-
> Note: At time of writing DigitalOcean are offering free management of DNS.
239
+
> Note: At time of writing DigitalOcean are offering management of DNS records for free.
175
240
176
241
Configure or comment out as required in the relevant section.
177
242
@@ -186,60 +251,45 @@ In order to enable TLS, edit the following configuration:
186
251
187
252
You can start out by using the Staging issuer, then switch to the production issuer.
188
253
189
-
* Set `issuer_type: "staging"`
190
-
* Run ofc-bootstrap with the instructions bellow
191
-
192
-
When you want to switch to the Production issuer do the following:
254
+
* Set `issuer_type: "production"` (recommended) or `issuer_type: "staging"` (for testing)
> Note if you want to switch from the staging TLS certificates to production certificates, see the appendix.
219
257
220
258
#### Enable dockerfile language support (optional)
259
+
221
260
If you are planning on building functions using the `dockerfile` template you need to set `enable_dockerfile_lang: true`.
222
261
262
+
When this value is set to false, your users can only use your recommended set of templates.
263
+
223
264
#### Enable scaling to zero
265
+
224
266
If you want your functions to scale to zero then you need to set `scale_to_zero: true`.
225
267
226
268
#### Toggle network policies
227
269
228
-
Network policies restriction for the openfaas and openfaas-fn namespaces are applied by default. If you would like to remove that restriction set `network_policies: false`.
270
+
Network policies restriction for the `openfaas` and `openfaas-fn` namespaces are applied by default.
229
271
230
272
When deployed, network policies restrict communication so that functions cannot talk to the core OpenFaaS components in the `openfaas` namespace. They also prevent functions from invoking each other directly. It is recommended to enable this feature.
231
273
232
-
### Run the `ofc-bootstrap`
274
+
If you would like to remove that restriction set `network_policies: false`.
275
+
276
+
### Run `ofc-bootstrap`
277
+
278
+
If you are now ready, you can run the `ofc-bootstrap` tool:
Pay attention to the output from the tool and watch out for any errors that may come up. You will need to store the logs and share them with the maintainers if you run into any issues.
287
+
240
288
### Finish the configuration
241
289
242
-
If you get anything wrong, don't worry you can use the `./scripts/reset.sh` file to remove all the components. Then edit `init.yaml` and start over. Be careful running this script and make 100% sure that you are pointing at the correct cluster.
290
+
If you get anything wrong, don't worry you can use the `./scripts/reset.sh` file to remove all the components. Then edit `init.yaml` and start over.
291
+
292
+
> Note: Be careful running this script and make 100% sure that you are pointing at the correct cluster.
243
293
244
294
#### Configure DNS
245
295
@@ -256,10 +306,13 @@ When ofc-bootstrap has completed and you know the IP of your LoadBalancer:
256
306
Now over on GitHub / GitLab enter the URL for webhooks:
257
307
258
308
GitHub:
309
+
259
310
```
260
311
http://system.example.com/github-event
261
312
```
313
+
262
314
GitLab:
315
+
263
316
```
264
317
http://system.example.com/gitlab-event
265
318
```
@@ -268,13 +321,23 @@ For more details see the [GitLab instructions](https://github.com/openfaas/openf
268
321
269
322
Then you need to enter the Webhook secret that was generated during the bootstrap process. Run the following commands to extract and decode it:
Open the Github App UI and paste in the value into the "Webhook Secret" field.
274
331
275
332
### Smoke-test
276
333
277
-
Now run a smoke-test to check the dashboard shows correctly and that you can trigger a successful build.
334
+
Now check the following and run a smoke test:
335
+
336
+
* DNS is configured to the correct IP
337
+
* Check TLS certificates are issued as expected
338
+
* Check that you can trigger a build
339
+
* Check that your build is pushing images to your registry or the Docker Hub
340
+
* Check that your endpoint can be accessed
278
341
279
342
#### View your dashboard
280
343
@@ -290,6 +353,8 @@ Just replace `<username>` with your GitHub account.
290
353
291
354
Now you can install your GitHub app on a repo, run `faas-cli new` and then rename the YAML file to `stack.yml` and do a `git push`. Your OpenFaaS Cloud cluster will build and deploy the functions found in that GitHub repo.
292
355
356
+
If you're unsure how to do this, then you could use the [QuickStart for the Community Cluster](https://github.com/openfaas/community-cluster/tree/master/docs), just remember to change the URLs to your own cluster.
357
+
293
358
### Something went wrong?
294
359
295
360
If you think that everything is set up correctly but want to troubleshoot then head over to the GitHub App webpage and click "Advanced" - here you can find each request/response from the GitHub push events. You can resend them or view any errors.
@@ -298,6 +363,30 @@ If you think that everything is set up correctly but want to troubleshoot then h
298
363
299
364
Follow the detailed [Troubleshooting Guide](https://docs.openfaas.com/openfaas-cloud/self-hosted/troubleshoot/#still-not-working) in the OpenFaaS docs. If you are still stuck after that please chat with us in #openfas-cloud on Slack.
300
365
366
+
#### Access your OpenFaaS UI or API
367
+
368
+
OpenFaaS Cloud abstracts away the core OpenFaaS UI and API. Your new API is driven by pushing changes into a Git repository, rather than running commands, or browsing a UI.
369
+
370
+
You may still want access to your OpenFaaS cluster, in which case run the following:
At this point you can also view your UI dashboard at: http://127.0.0.1:31112
389
+
301
390
### Invite your team
302
391
303
392
For each user or org you want to enroll into your OpenFaaS Cloud edit the CUSTOMERS ACL file and add their username on a new line. For example if I wanted the user `alexellis` and the org `openfaas` to host git repos containing functions:
@@ -307,8 +396,39 @@ openfaas
307
396
alexellis
308
397
```
309
398
399
+
#### Switch from staging to production TLS
400
+
401
+
When you want to switch to the Production issuer from staging do the following:
0 commit comments