Presentation on Cloud Native Development
Felicitas Pojtinger
2021-11-19
These study materials are heavily based on professor Heuzeroth’s “Spezielle Themen für Web-Anwendungen” lecture at HdM Stuttgart.
Found an error or have a suggestion? Please open an issue on GitHub (github.com/pojntfx/uni-webtopics-notes):
If you like the study materials, a GitHub star is always appreciated :)
Uni Web Topics Presentation (c) 2021 Felicitas Pojtinger and contributors
SPDX-License-Identifier: AGPL-3.0
DevOps also includes development!
Modern development should not be bound to any client attributes (it should not matter if the client is a RISC-V Linux machine, a locked-down Windows workstation or an Android phone)
Development should be possible from any platform, for any platform
The only truly cross-platform application framework is the web
PWAs make it possible for web apps to have all the features native apps have
PWAs work offline by default
Why not make our development environments PWAs?
Virtual machines and user-friendly hypervisors and containers make it possible to run the editor’s backend locally too
Source code can for example never leave the company’s system
Development environments can be quickly updated and tightened to prevent supply chain attacks and increase reproducibility
Imagine: You find a Free Software project, and all you have to do in order to contribute is press “.”!
Onboarding new developers becomes much easier
Independence of client choice enables the use of much cheaper or constrained client devices
Open standards and web technologies enable the adoption of new client and server hardware (i.e. RISC-V chips) easier and enables the easy use of and testing on multiple architectures
Autoscaling, ballooning etc. can be used server-side: There is no need to provision lots of development servers if no one is using them, and if there is a need for a lot of resources (for example if someone is compiling say a C++ project) the provisioner (i.e. Kubernetes) can dynamically decide to scale up the container or VM
There is no need to trust a project’s build system, everything can be sandboxed!
There are already multiple “cloud IDEs”
Most are based on VSCode (or, to be more precise, VSCode’s API specification)
VSCode (or its libre forks, like VSCodium) is already based on web technologies (Electron), so adapting it to run in the browser is possible
Theia is an example of an alternative implementation of VSCode’s API, which serves as a vendor-neutral implementation of VSCode
Cloud-Native IDEs can either be self-hosted or public SaaS, so let’s take a look at some of them!
GitPod: Live demo
Codespaces: Live demo
pojde: Live demo
But what if we want to develop things that one can’t normally develop remotely?
Apps which require Android devices as a target, require a programmer, USB or Bluetooth and are not using Web Bluetooth/Web Serial (i.e. Android apps, smart home projects, IoT devices, Arduinos)
Apps which require a Wayland compositor/a screen (i.e. desktop Linux apps, GTK/QT apps)
Apps which require public ports
Binaries
dlopen
and package
management, dynamic linking can also be used. Most of the time
(especially on non-Linux OSes), at least the C library and external
dependencies (i.e. SQLite
) thus need to be available in
LD_LIBRARY_PATH
at runtime; if they are not, the
application can’t continue. This makes the binaries non-portable across
distributions; for example, if a binary is built on a Debian 11 host, it
most probably won’t run on a Debian 10 host due to the different
versions of the GNU C library used. This does however also have a few
big advantages, which apply especially to Linux distributions.CGO_ENABLE=1
) Go
binary, running ldd
on it and running it in two containers
(Debian and Alpine Linux), then retrying it with a statically-linked
(CGO_ENABLE=0
) binaryGPG signing
.asc
file) no longer matches.Portability
Applications should be portable
Portability can mean different things: Portability as in amount of platforms it can be compiled for, platforms it can be compiled on, platforms it can run on in compiled form, constraints the compiled form needs
There are many reasons to make apps portable, both from a developer’s and a user’s point of view
Apps can be tuned for portability with a few simple steps (see in part https://drewdevault.com/2021/09/27/Let-distros-do-their-job.html)
Portability is however often overlooked; product owners mostly see no value in it, unless things break. It is up to the developer to take initiative
Demo: Compiling the Links browser from source with Autotools
Reproducibility
Why we need more than “just binaries”
What is a package?
.tar.gz
) in
combination with a metadata file and signatureWhat is a package manager?
dpkg
on Debian, rpm
on Fedora) and a
high-level tool to search, download, install and resolve dependencies
(apt
on Debian, dnf
on Fedora)Repository
Source packages and tarballs
tar
-files, tape archives: A linear storage
format used internally for physical tapes but also for files. Contains
all source code; often zipped (.tar.gz
).debian.tar.gz
)Binary packages
Documentation packages
mariadb
the documentation package is called
mariadb-docs
Dependencies
gccgo
as one of the Go compilers to choose from or OpenSSL
and LibreSSL as one of the SSL libraries to choose fromMetadata
.desktop
files) is a standard for this data.desktop
files provide shortcuts, application
categories and window menu options (mostly of use in a desktop context,
but can also be used as an alternative to launching binaries
directly)systemd and systemd Units
Demo: Downloading, updating, extracting a package
.pkg
installers are usedNative
scp
to serversystemctl
and
journalctl
Docker
docker build
docker tag
and docker push
docker pull
docker run
docker logs
Kubernetes
kubectl apply
kubectl get
kubectl delete
k9s
and Lens can make management
easierHelm
helm package
.tar.gz
to repohelm repo add
helm install repo/chart
helm list
helm delete
k9s
(which also supports Helm) and
Kubeapps can make management easierSkaffold
skaffold
(dev or production)skaffold dev
skaffold run
skaffold delete
chroot
s and a
cross-compiler (fast but tricky to set up) or binfmt
and
qemu-user-static
(slow but easy to set up)printf
) with
bagccgop and run it on the PowerBookactions/checkout
: git clone
s the source
code of the branch on which the event has been triggereddocker/setup-qemu-action
: Installs QEMU, which allows
the pipeline to run binaries for different target architecturesdocker/setup-buildx-action
: Installs
buildx
, the next-generation build command for Docker with
better support for multiple architecturesactions/upload-artifact
and
actions/download-artifact
: Upload/download an artifact to
the current run’s cache (i.e. to exchange it between jobs)marvinpinto/action-automatic-releases
: Create as a
GitHub releases and uploads assets; see the next sectiongit tag
(i.e. git tag v0.1.0
)