Skip to content

About

The website of Pyjoyment, on AWS Lambda behind CloudFront

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Home License Tests Trunk Check

pyjoyment.dev

The website of Pyjoyment, at https://pyjoyment.dev: an application of Pyjoyment that runs as a function of AWS Lambda behind CloudFront, with its static files and its dynamic pages.

Running locally

The application is site/app.py, a script of Pyjoyment.Lite, with its templates in site/templates and its static files in site/public:

uv run --directory site python app.py daemon

It listens on http://127.0.0.1:3000. The tests run it as a server and as the function of Lambda:

uv run --project site python -m Pyjo.Prove -l -r t

Building the function

generate lambda-zip writes site/dist/function.zip, with the application alone, for the public layer of Pyjoyment of Pyjoyment-Lambda-Layers:

uv run --directory site python app.py generate lambda-zip --arch arm64 --runtime python3.15 --function-only

Deployment

A push to main builds the function and deploys it, with the role of the environment production. deploy.py deploys a build by hand too:

AWS_PROFILE=<profile> uv run --project site python deploy.py --distribution E3L54LJQ60FS5U site/dist/function.zip

Infrastructure

tofu/ creates the function, its Function URL, the CloudFront distribution, the certificate and the records of the domain in Cloudflare. It needs a profile of AWS of the account 959435416781 and a token of the API of Cloudflare, in tofu/terraform.tfvars:

cloudflare_api_token = "..."

The first apply takes the function of the build above:

AWS_PROFILE=<profile> tofu -chdir=tofu init
AWS_PROFILE=<profile> tofu -chdir=tofu plan -out=tfplan
AWS_PROFILE=<profile> tofu -chdir=tofu apply tfplan

License

Artistic License 2.0.

About

The website of Pyjoyment, on AWS Lambda behind CloudFront

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages