Setup for this tutorial
Requirements
What is Adapt?
Although this tutorial doesn't assume any familiarity with using Adapt, we do recommend you read the What is Adapt? section of the Getting Started Guide.
HTML, CSS, and Programming
You should have at least some basic familiarity with HTML and CSS. We'll also assume you're familiar with common programming concepts like functions, objects, and arrays, but will not assume any specific knowledge of JavaScript or any other language.
However, as you become a more advanced user of Adapt, you may wish to review some JavaScript resources such as this tutorial from MDN.
Install Adapt
You'll need the Adapt CLI installed to follow along with this tutorial. The Getting Started Guide has installation instructions.
Docker
Although it's not a requirement for Adapt, this tutorial requires Docker.
You'll need one of the following:
Requirement Installation Instructions A Linux system with Docker Installing Docker on Linux A MacOS system with Docker Desktop for Mac Installing Docker Desktop for Mac Bash shell
Certain commands assume you're using the
bash
shell. If you use a different shell, you may need to adjust some commands slightly.
Set up local Kubernetes
Note
Adapt can deploy your apps to many different kinds of infrastructure, whether in a public or private cloud, in your own data center, or even to your laptop.
For this tutorial, we're going to deploy to Kubernetes, so we'll create a Kubernetes cluster on your local Docker system using k3s, a lightweight version of Kubernetes. In order to keep everything self-contained and easy to clean up, we'll use a Docker-in-Docker version of k3s.
To deploy the local cluster and get the credentials:
docker run --rm --privileged -d -p10001:2375 -p8443:8443 -p8080:8080 --name k3s unboundedsystems/k3s-dind
docker exec k3s get-kubeconfig.sh -json > kubeconfig.json
You now have a self-contained Docker-in-Docker Kubernetes cluster that exposes three ports, making them available on the host system:
- Port 10001: Inner Docker instance API
- Port 8443: Kubernetes API
- Port 8080: Our new app's web port
To make sure all the rest of the steps in this tutorial use the new Docker-in-Docker instance we just created, we need to change your DOCKER_HOST
environment variable.
We'll also save the old value, so we can set it back after we're done.
ORIG_DOCKER_HOST="${DOCKER_HOST}"
export DOCKER_HOST=localhost:10001
Next step
Next, we'll create an Adapt project.