Since Paka currently only supports AWS, the quick start guide will be tailored to AWS.
- Install docker daemon and CLI.
- Install the aws cli and ensure your AWS credentials are correctly configured.
aws configure
- Install Paka.
pip install paka
Go to the AWS console and request a quota increase. Beware that there are two types of quotas: On-Demand and Spot. The On-Demand quota is the number of instances that are not preemptible, while the Spot quota is the number of instances that can be preempted. Spot instances are cheaper than On-Demand instances.
Paka supports mixed instance types, so you can use spot instances for cost savings and on-demand instances as a fallback.
Create a cluster.yaml
(could be any name) file. See cluster.yaml as an example. Refer to the cluster config for the fields that can be included in the cluster config file.
Provision the cluster with the following command:
paka cluster up -f cluster.yaml
Create an application skeleton. See invoice_extraction as an example. Ensure the following files are included in your application root directory:
- Procfile: Defines the entrypoint for your application. See Procfile.
- .cnignore file: Excludes any files that shouldn't be included in the build. See .cnignore.
- runtime.txt: Pins the version of the runtime your application uses. See runtime.txt.
- requirements.txt or package.json: Lists all necessary packages for your application.
paka function deploy --name APP_NAME --source . --entrypoint ENTRYPOINT_NAME
APP_NAME is the name of the application. The command above will build the source and deploy it as a serverless function.
--source
specifies the source directory of the application.
--entrypoint
specifies the entrypoint of the application, which is defined in the Procfile.
For AWS deployment, logs are sinked to AWS CloudWatch. You can view the logs by navigating to the CloudWatch console and selecting the log group for the function you want to monitor. Alternatively, you can use the Stern CLI (https://github.com/stern/stern) to view the logs.
To view the model logs, you can use the following command:
stern --selector app=model-group
To view the function logs, you can use the following command:
stern "my-app*"
You can set up a CI/CD pipeline to automate the deployment process. For example, you can use GitHub Actions to build and deploy the application on every push to the main branch. To deploy the local changes to the cloud, you can simply run the deploy command again.
paka function deploy --name APP_NAME --source . --entrypoint ENTRYPOINT_NAME
paka cluster down -f cluster.yaml -y