Skip to content

Commit

Permalink
fix: update to Python 3.11, use complete-platform JSON
Browse files Browse the repository at this point in the history
The latest supported AWS Lambda runtime is Python 3.11, so upgrade
from Python 3.9 to Python 3.11. To avoid falling into
#166, specify a complete-platform.json file,
generated using `pex3 interpreter inspect --markers --tags` in an AWS
Lambda Python 3.11 runtime.

Fixes #166
  • Loading branch information
vonschultz committed Jun 18, 2024
1 parent 40d9741 commit 20c8d92
Show file tree
Hide file tree
Showing 8 changed files with 258 additions and 314 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {
"ghcr.io/devcontainers/features/python:1": {
"version": "3.9"
"version": "3.11"
},
"ghcr.io/devcontainers-contrib/features/poetry:1": {}
},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.11

- uses: abatilo/actions-poetry@v2

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.11

- uses: abatilo/actions-poetry@v2

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Requirements

* python3.9
* python3.11
* [Poetry](https://python-poetry.org/docs/#installation)

## Commands
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Download latest version of `certbot-lambda.zip` from [releases](https://github.c

### AWS Lambda

1. Create new lambda in Google Dashboard with `Python 3.9` runtime.
1. Create new lambda in Google Dashboard with `Python 3.11` runtime.
2. Upload `certbot-lambda.zip` at `Code` > `Code source` > `Upload from` > `.zip file`.
3. Update handler to `main.handler` at `Code` > `Runtime settings` > `Handler`.
4. Create new `Execution role` at `Configuration` > `Execution role` > `Edit` > `Create a new role from AWS policy templates` with name `lambda-certbot`.
Expand Down Expand Up @@ -51,7 +51,7 @@ Then go to AWS Secrets dashboard and create a rotation rule for created secrets
2. Set trigger `Cloud Pub/Sub` _(create new topic)_.
4. Add runtime environment variables according your needs _(check configuration section and examples bellow)_.
5. Increase timeout to `540` seconds.
6. Select `Python 3.9` runtime.
6. Select `Python 3.11` runtime.
7. Select `Zip upload` source code type and upload `certbot-lambda.zip` _(you may need to create storage bucket where zip will be stored)_.
8. Deploy function.

Expand Down
1 change: 1 addition & 0 deletions complete-platform.json

Large diffs are not rendered by default.

555 changes: 249 additions & 306 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ packages = [
]

[tool.poetry.dependencies]
python = "~3.9"
python = "~3.11"
certbot = "^2.7.4"
boto3 = "^1.28.76"
certbot-dns-route53 = "^2.7.4"
Expand Down Expand Up @@ -43,7 +43,7 @@ build-backend = "poetry.core.masonry.api"

[tool.taskipy.tasks]
build = "rm -rf ./dist && task build-pex && task build-lambda"
build-pex = "pex . -o dist/certbot-lambda.zip"
build-pex = "pex . --complete-platform complete-platform.json -o dist/certbot-lambda.zip"
build-lambda = "lambdex build -e app.handler:handler -M main.py dist/certbot-lambda.zip"
test = "pytest --cov=app --cov-report xml tests/"
test-build = "task build && TESTMODE=true lambdex test --empty dist/certbot-lambda.zip"
Expand Down

0 comments on commit 20c8d92

Please sign in to comment.