Skip to content

Collection of simple applications for Learning By Doing across different XaaS (Anything as a Service) stacks and cloud infrastructures

License

Notifications You must be signed in to change notification settings

frugan-dev/lbd-xaas

Repository files navigation

License: GPL v3

Learning By Doing: Exploring XaaS with Simple Applications

Collection of simple applications for Learning By Doing across different XaaS (Anything as a Service) stacks and cloud infrastructures.

Inspired by

Getting Started

1) First of all clone this repository:

$ git clone [email protected]:frugan-dev/lbd-xaas.git
$ cd lbd-xaas

2) Copy and rename these files:

src/.env.dist -> src/.env
src/private/app/.env.dist -> src/private/app/.env

and edit them according to your needs.

Docker compose

Requirements
Installation

1) Create local CA with mkcert:

$ mkcert -install

2) Run install script:

$ cd src
$ sudo chmod  x install.sh
$ ./install.sh
$ docker compose up -d

3) Capture the Docker PHP-FPM container logs:

$ docker compose logs -f php-fpm

and wait until all initialization operations are completed.

4) Browse via HTTPS to the following address https://localhost.

5) Stop, delete everything and return to parent folder:

$ docker compose down
$ docker system prune --all
$ cd ../

Google App Engine standard (second-generation runtime)

Requirements
Installation

Note: PHP v8.2 is used, instead of v8.3, because at the time of writing the following error message appears:

RuntimeError: Unknown runtime 'php83'; supported runtimes are 'go119', 'go120', 'go121', 'go122', 'php81', 'php82', 'python310', 'python311', 'python312', 'python38', 'python39'.

1) Run deploy script:

$ cd gae-standard
$ sudo chmod  x deploy.sh
$ ./deploy.sh

2) Capture the Docker container logs:

$ docker compose logs -f local

and wait until all initialization operations are completed.

3) Browse the application via HTTP to the following address http://localhost:8080.

4) Browse the administration console via HTTP to the following address http://localhost:8000.

5) Stop, delete everything and return to parent folder:

$ docker compose down
$ docker system prune --all
$ cd ../

Google App Engine flexible (second-generation runtime)

Requirements
Installation

Note: at the time of writing, despite having followed the official documentation, this stack does not work and the following error message appears:

In env: flex, only the following runtimes are allowed: ('python-compat', 'go', 'custom')

1) Run deploy script:

$ cd gae-flexible
$ sudo chmod  x deploy.sh
$ ./deploy.sh

2) Capture the Docker container logs:

$ docker compose logs -f local

and wait until all initialization operations are completed.

3) Browse the application via HTTP to the following address http://localhost:8080.

4) Browse the administration console via HTTP to the following address http://localhost:8000.

5) Stop, delete everything and return to parent folder:

$ docker compose down
$ docker system prune --all
$ cd ../

Kubernetes (stateful)

Requirements
Installation

1) Create stateful-app image in your Docker local registry:

$ DOCKER_BUILDKIT=1 docker build \
  -f k8s-stateful/Dockerfile \
  -t registry.local/stateful-app:latest \
  .

Note: about DOCKER_BUILDKIT=1 see here https://stackoverflow.com/a/57774684/3929620.

2) Verify that the image was created correctly in Docker local registry:

$ docker image ls

3) Start Minikube cluster:

$ minikube start

4) Push Docker local image to Minikube local registry:

$ minikube image load registry.local/stateful-app

5) Verify that the image was created correctly in Minikube local registry:

$ minikube image ls

6) Apply resources from Kustomize configurations:

$ kubectl apply -k ./k8s-stateful

7) Verify that all pods are in Running state:

$ kubectl get pods

8) Get the NodePort using the service command:

$ minikube service stateful-app-service --url

9) Browse via HTTP to the address returned (e.g. http://192.168.0.0:12345).

10) Stop and delete everything:

$ kubectl delete -k ./k8s-stateful
$ minikube image rm registry.local/stateful-app
$ minikube image rm docker.io/bitnami/apache
$ minikube stop
$ minikube delete
$ docker system prune --all

Kubernetes (stateless)

Requirements
Installation

1) Create stateless-app image in your Docker local registry:

$ DOCKER_BUILDKIT=1 docker build \
  --secret id=.env,src=$PWD/src/.env \
  -f k8s-stateless/Dockerfile \
  -t registry.local/stateless-app:latest \
  .

Note: about DOCKER_BUILDKIT=1 see here https://stackoverflow.com/a/57774684/3929620.

2) Verify that the image was created correctly in Docker local registry:

$ docker image ls

3) Start Minikube cluster:

$ minikube start

4) Push Docker local image to Minikube local registry:

$ minikube image load registry.local/stateless-app

5) Verify that the image was created correctly in Minikube local registry:

$ minikube image ls

6) Apply resources from Kustomize configurations:

$ kubectl apply -k ./k8s-stateless

7) Verify that all pods are in Running state:

$ kubectl get pods

8) Get the NodePort using the service command:

$ minikube service stateless-app-service --url

9) Browse via HTTP to the address returned (e.g. http://192.168.0.0:12345).

10) Stop and delete everything:

$ kubectl delete -k ./k8s-stateless
$ minikube image rm registry.local/stateless-app
$ minikube stop
$ minikube delete
$ docker system prune --all

Known issues

Docker use root user/group in host machine

1) Get your Unix user/group informations:

$ id

2) Add this to /etc/subuid:

{USER}:{UID}:1
...

3) Add this to /etc/subgid:

{USER}:{DOCKER_GUI}:1
...

4) Add this to /etc/docker/daemon.json:

{
  "userns-remap": "{USER}"
} 

to enable Docker's user namespace feature.

5) Restart Docker engine:

$ sudo service docker restart

More info:

More info

See LINKS file.

Changelog

See auto-CHANGELOG file.

Contributing

For your contributions please use:

Support

Buy Me A Coffee

License

(ɔ) Copyleft 2024 Frugan.
GNU GPLv3, see COPYING file.

About

Collection of simple applications for Learning By Doing across different XaaS (Anything as a Service) stacks and cloud infrastructures

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published