• Stars
    star
    130
  • Rank 277,575 (Top 6 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 5 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Pre-installed Kubernetes Lab for your browser with VSCode

workshop-vscode

OpenFaaS Workshop with in-browser version of VSCode from coder.com

All tools are pre-installed with OpenFaaS on Kubernetes with k3s available in the browser terminal.

How it works

  1. A Virtual Machine will be provisioned with a cloud hosting provider using cloudinit
  2. Kubernetes with k3s will be installed on the VM
  3. OpenFaaS will be installed into the k3s cluster
  4. A Docker image will be run which provides VSCode via a web-browser
  5. The login password for VSCode will be obtained via ssh
  6. VSCode can now be used in web-browser via your VM's IP. The self-signed certificate will provide encryption and the login password will protect against tampering.

Why do we need this?

This project provides a pre-installed Kubernetes environment within a VM so that your students can focus on your workshop.

The example in this repository is for The OpenFaaS Workshop. It is estimated that it would save students 1.5-2 hours of set-up time. Instructors could also pre-provision a set amount of VMs ahead of time and then give out IP address and password combinations.

Quick-start

You can run the instructions above on any cloud that supports cloudinit, or if you have a VM platform that does not allow, or support cloudinit, you can simply run the contents of "cloudinit.txt" as root on the VM after it has booted up.

Provision on DigitalOcean

  • Get 100 USD free credit for 60 days
  • Create a DigitalOcean VM size 4GB RAM in your local region
  • Add "user data" from cloudinit.txt
  • Pick "ssh" login or via root password over email
  • Deploy the VM

Skip to "After the deployment"

Provision on Civo

  • Get 50 USD credits for new sign-ups
  • Create a Medium sized VM and get your login details
  • cloudinit is not available on Civo at this time, but you can log in after the VM is ready and run the script manually instead
  • Use ssh to connect to the instance, now paste in the content from cloudinit.txt into your terminal

Skip to "After the deployment"

After the deployment

  • Locate the public IP given and navigate to https://IP:8443 in a web-browser. This will open VSCode.
  • You will need to accept the self-signed certificate, which will display as "insecure". Despite the warning, it will provide encryption for your connection.
  • You may have to wait for several minutes before the endpoint to comes up. See the second on Debugging if you want to check the logs.
  • Open a Terminal within VSCode and run through the files in ~/project/openfaas/
  • Next start the workshop from Lab 2

Get your password

Get the container's logs with:

export IP=""
ssh root@$IP "docker logs vscode | grep Password"

INFO  Password: 7d6ae6958e8d7e882ba08f57

Note: the password shown is an example, you will have your own password.

Debug / get the cloudinit logs

  • Log into instance ssh root@IP
  • View the logs for cloudinit

Either run /root/logs.sh or tail -f /var/log/cloud-init-output.log

Automation

Setup a VM using a script in the London region:

# ./provision-digitalocean.sh

Creating: of-workshop-ebddfcaf
==============================
Droplet: of-workshop-ebddfcaf has been created
IP: 178.128.42.184
URL: https://178.128.42.184:8443
Login: ssh [email protected]
==============================
To destroy this droplet run: doctl compute droplet delete -f 150218836

You'll be emailed the root password, which you can use to log in and get the VSCode password.

Customize for your own workshops and training sessions

There are two parts you can customize:

  • The Docker image: alexellis2/coder:2021-03-22, which is built from Dockerfile

The Docker image provides the VSCode hosting and the CLI tools within the built-in terminal. The Docker image is derrived from coder.com.

For instance, if you wanted to run a workshop on How to design helm charts - you may comment out the references to OpenFaaS and install helm/tiller into the Docker image.

More Repositories

1

serverless-openfaas

An OpenFaaS plugin for the Serverless Inc framework (work in progress)
JavaScript
86
star
2

rust-http-template

An unofficial OpenFaaS template for Rust
Rust
36
star
3

backer-thankyou

Thank your Patreon Backers and Sponsors via Twitter
Python
34
star
4

vcenter-connector

Extend vCenter with OpenFaaS
Go
28
star
5

faas-memory

An OpenFaaS Provider example using memory for state.
Go
24
star
6

node10-express-template

Node.js 10 Express Template for OpenFaaS
JavaScript
24
star
7

faas-rancher

Serverless with Rancher 1.x and (OpenFaaS)
Go
23
star
8

faas-federation

Enable routing between multiple OpenFaaS gateways or providers
Go
18
star
9

node10-express-service

OpenFaaS Node.js 10 (LTS) and Express.js micro-service template
JavaScript
16
star
10

nodejs-afterburn

Afterburn for Node.js and OpenFaaS
JavaScript
16
star
11

node8-express-template

Node.js 8 template for OpenFaaS with HTTP via Express.js
JavaScript
15
star
12

openfaas-function-auth

Examples of authentication in OpenFaaS Serverless functions.
Go
14
star
13

serverless-openfaas-nodejs

OpenFaaS & Node.js for Serverless Framework
JavaScript
11
star
14

java-afterburn

Java library to enable AfterBurn with OpenFaaS
Java
11
star
15

go-function-sdk

An SDK for building functions in Go
Go
7
star
16

powershell-http-template

OpenFaaS HTTP template for PowerShell
PowerShell
7
star
17

perl-template

Perl template for OpenFaaS
Dockerfile
5
star
18

openfaas-charm-example

An example for getting help / feedback from Canonical
Python
5
star
19

install-doks

Install OpenFaaS on DOKS without tiller
5
star
20

go-afterburn

Go template for OpenFaaS AfterBurn
Go
4
star
21

python3-debian

Template for Python3 on Debian for data-science / compiled pip modules
Python
4
star
22

java-template

Java template
Java
3
star
23

powershell-template

OpenFaaS template for Powershell Core
Dockerfile
3
star