Skip to content

Latest commit

 

History

History
15 lines (10 loc) · 10 KB

README.md

File metadata and controls

15 lines (10 loc) · 10 KB

acorn_minikube_apps_repo

This is an example repo for acorn.io & kubernetes app developers. The code you'll find here can be templated from for local stand ups. As this is meant to be a demonstration of what one can do with flask, acorn, & minikube, it is stripped of volumns, secrets, and database. This is also because I found a way to include a importable database whilst using a spreadsheet. I also found a valuable way to mount said spreadsheet as a filesystem. Such thus far saves me on complexity of implementation but also making use of as few moving parts as possible.

Here's a review the contents of each file and then summarize what they do:

  1. script.sh
  2. requirements.txt
  3. Dockerfile
  4. app.py
  5. Acornfile

  1. script.sh:

    • This is a shell script that sets up and deploys an application on Minikube with ingress enabled. Minikube is a tool that lets you run Kubernetes locally.
    • The script does the following:
      • Starts Minikube with containerd as the container runtime.
      • Enables the ingress add-on in Minikube.
      • Installs, builds, and runs the application using the Acorn tool.
      • Lists the applications deployed via Acorn.
      • Retrieves the ingress resources from Kubernetes.
  2. requirements.txt:

    • This file lists the Python dependencies for the project. In this case, it only requires flask.
  3. Dockerfile:

    • This is a Dockerfile for building a Docker image of the application.
    • It uses Python 3.9 as the base image.
    • The working directory inside the container is set to /app.
    • Flask environment variables are set to run the app.
    • The Python requirements (from requirements.txt) are installed.
    • The application files are copied into the container.
    • Port 5000 is exposed for the Flask app.
    • The command to start the Flask app is specified.
  4. app.py:

    • This is a simple Flask application that has a single route (/) which returns the string "hello" when accessed.
  5. Acornfile:

    • Acorn is a tool for deploying applications. The Acornfile is a configuration file for Acorn.
    • It specifies arguments, containers, environment variables, directories, and ports for the application.
    • In this setup, it seems to indicate that if a dev argument is provided, the Flask environment is set to "development" and a directory is specified.
    • The port 5000 (which Flask runs on) is set to be published.

Summary:

The files collectively describe a Flask application that simply returns "hello" when accessed. The application can be containerized using the provided Dockerfile. The shell script (script.sh) sets up a Minikube environment, enables ingress, and uses Acorn to deploy and manage the application within this environment. The requirements.txt and Acornfile provide necessary configurations for the app's dependencies and deployment, respectively.

Templating from this setup other web apps:

Feel free to template from this and the notes for the docker image here, which might give you some insight into how the app was built.