Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- run: docker build -t sqlpage-lambda . -f lambda.Dockerfile --target runner
- run: docker build -t sqlpage-lambda-builder . -f lambda.Dockerfile --target builder
- run: docker run sqlpage-lambda-builder cat deploy.zip > sqlpage-aws-lambda.zip
- uses: actions/upload-artifact@v7
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## unreleased

- AWS Lambda builds and documentation now use the supported Amazon Linux 2023 custom runtime instead of the end-of-life Amazon Linux 2 runtime. Release artifacts include the configuration directory required on Lambda's read-only filesystem.
- `sqlpage.send_mail` now supports rich email bodies. Use `body_html` for a caller-provided HTML alternative, or `body_md` to render Markdown as HTML. Messages retain a plain-text alternative; `body` may be omitted when `body_md` is used, and `body_md` and `body_html` cannot be combined.
- Form `options_source` URLs now preserve existing query parameters when adding the dynamic `search` parameter.

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,11 @@ An easy way to do so is using the provided docker image:

You can then just add your own SQL files to `sqlpage-aws-lambda.zip`,
and [upload it to AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-package.html#gettingstarted-package-zip),
selecting *Custom runtime on Amazon Linux 2* as a runtime.
selecting *Custom runtime on Amazon Linux 2023* (`provided.al2023`) as the runtime.

The provided archive includes the empty `sqlpage` configuration directory required at startup.
You can add a `sqlpage.json` file, custom templates, or migrations to it. Keep the directory in the
archive because Lambda function packages are read-only and SQLPage cannot create it there.

### Hosting sql files directly inside the database

Expand Down
3 changes: 3 additions & 0 deletions configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ The configuration directory is the `./sqlpage/` folder by default.
In the [official docker image](https://hub.docker.com/r/lovasoa/sqlpage), it is located in `/etc/sqlpage/`.
It can be configured using the `--config-dir` command-line argument, or the `SQLPAGE_CONFIGURATION_DIRECTORY` environment variable.

At startup, SQLPage creates the configuration directory when it is absent and rejects the path when it is not a directory.
AWS Lambda release artifacts include an empty `./sqlpage` directory because deployed function packages are read-only.

It can contain

- the [`sqlpage.json`](#configuring-sqlpage) configuration file,
Expand Down
8 changes: 5 additions & 3 deletions lambda.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ RUN cargo build --release --features lambda-web
RUN mv target/release/sqlpage bootstrap && \
strip --strip-all bootstrap && \
size bootstrap && \
zip -9 -r deploy.zip bootstrap index.sql
zip -9 -j deploy.zip bootstrap src/index.sql && \
zip -9 deploy.zip sqlpage/

FROM public.ecr.aws/lambda/provided:al2 AS runner
FROM public.ecr.aws/lambda/provided:al2023 AS runner
COPY --from=builder /usr/src/sqlpage/bootstrap /main
COPY --from=builder /usr/src/sqlpage/index.sql ./index.sql
COPY --from=builder /usr/src/sqlpage/src/index.sql ./index.sql
RUN mkdir -p ./sqlpage
ENTRYPOINT ["/main"]