The actor model is a math model for concurrent computations, where the 🧔 actor symbolizes the universal primitive of concurrent computation.
For this project, I will showcase three examples where Dapr (Python SDK) can work using the actor model. This project will run within Kubernetes.
This project is a technical demonstration of what you can achieve with virtual actors and how to adapt our code.
Creating a virtual environment, activating it, and installing the necessary packages.
# Create Python's virtual environment
python3 -m venv .venv
# Activate Python's virtual environment
source .venv/bin/activate
# Upgrade pip to the latest version
python -m pip install --upgrade pip# Production
python -m pip install -r requirements.txt
# Development
# python -m pip install -r requirements-dev.txtExit Python's virtual environment.
# Exit Python's virtual environment
deactivate
# Remove Python's virtual environment folder
rm -rf .venv/Docker will create an image with is compatible with the Open Container Initiative (OCI).
Login to your own private or public docker repository. You can port forward the deployed Docker registry to your host.
docker login docker-registry.docker-registry.svc.cluster.local:5000
# docker login host:portBuild your image based on a Dockerfile file, ignore what is not needed within the .dockerignore file, tag this build, and based it for x86 platforms if you are running this on a different architecture.
docker build --platform=linux/amd64 -t docker-registry.docker-registry.svc.cluster.local:5000/demo_actor:latest . Push this image to your Dokcer repository.
docker image push docker-registry.docker-registry.svc.cluster.local:5000/demo_actor:latestLogout of Docker registry.
docker logout docker-registry.docker-registry.svc.cluster.local:5000