Skip to content

Commit ae3c3c8

Browse files
authored
Update AWS Lambda runtime to Amazon Linux 2023 (#1361)
* Update AWS Lambda runtime to Amazon Linux 2023 * Fix AWS Lambda release packaging
1 parent a065bb8 commit ae3c3c8

5 files changed

Lines changed: 15 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ jobs:
108108
runs-on: ubuntu-latest
109109
steps:
110110
- uses: actions/checkout@v6
111+
- run: docker build -t sqlpage-lambda . -f lambda.Dockerfile --target runner
111112
- run: docker build -t sqlpage-lambda-builder . -f lambda.Dockerfile --target builder
112113
- run: docker run sqlpage-lambda-builder cat deploy.zip > sqlpage-aws-lambda.zip
113114
- uses: actions/upload-artifact@v7

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## unreleased
44

5+
- 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.
56
- `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.
67
- Form `options_source` URLs now preserve existing query parameters when adding the dynamic `search` parameter.
78

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,11 @@ An easy way to do so is using the provided docker image:
280280
281281
You can then just add your own SQL files to `sqlpage-aws-lambda.zip`,
282282
and [upload it to AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-package.html#gettingstarted-package-zip),
283-
selecting *Custom runtime on Amazon Linux 2* as a runtime.
283+
selecting *Custom runtime on Amazon Linux 2023* (`provided.al2023`) as the runtime.
284+
285+
The provided archive includes the empty `sqlpage` configuration directory required at startup.
286+
You can add a `sqlpage.json` file, custom templates, or migrations to it. Keep the directory in the
287+
archive because Lambda function packages are read-only and SQLPage cannot create it there.
284288
285289
### Hosting sql files directly inside the database
286290

configuration.md

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

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

220223
- the [`sqlpage.json`](#configuring-sqlpage) configuration file,

lambda.Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ RUN cargo build --release --features lambda-web
1010
RUN mv target/release/sqlpage bootstrap && \
1111
strip --strip-all bootstrap && \
1212
size bootstrap && \
13-
zip -9 -r deploy.zip bootstrap index.sql
13+
zip -9 -j deploy.zip bootstrap src/index.sql && \
14+
zip -9 deploy.zip sqlpage/
1415

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

0 commit comments

Comments
 (0)