Skip to content

Commit a1b03f6

Browse files
committed
fix aws compilation
1 parent 96cc3db commit a1b03f6

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
on:
2+
workflow_dispatch: {}
23
push:
34
# Sequence of patterns matched against refs/tags
45
tags:
@@ -38,13 +39,21 @@ jobs:
3839
with:
3940
name: sqlpage ${{ matrix.os }}
4041
path: ${{ matrix.binary_path }}
42+
build-aws:
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v3
46+
- run: docker build -t sqlpage-lambda-builder . -f lambda.Dockerfile --target builder
47+
- run: docker run sqlpage-lambda-builder cat deploy.zip > sqlpage-aws-lambda.zip
48+
- uses: actions/upload-artifact@v3
49+
with:
50+
name: sqlpage aws lambda serverless image
51+
path: sqlpage-aws-lambda.zip
4152
create_release:
4253
name: Create Release
43-
needs: build
54+
needs: [build, build-aws]
4455
runs-on: ubuntu-latest
4556
steps:
46-
- name: Checkout code
47-
uses: actions/checkout@v3
4857
- uses: actions/download-artifact@v3
4958
- run: |
5059
chmod +x sqlpage*/sqlpage;
@@ -63,4 +72,5 @@ jobs:
6372
files: |
6473
sqlpage windows-latest/sqlpage-windows.zip
6574
sqlpage-linux.tgz
66-
sqlpage-macos.tgz
75+
sqlpage-macos.tgz
76+
sqlpage aws lambda serverless image/sqlpage-aws-lambda.zip

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sqlpage"
3-
version = "0.7.1"
3+
version = "0.7.2"
44
edition = "2021"
55
description = "A SQL-only web application framework. Takes .sql files and formats the query result using pre-made configurable professional-looking components."
66
keywords = ["web", "sql", "framework"]

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,11 @@ An easy way to do so is using the provided docker image:
135135

136136
```bash
137137
docker build -t sqlpage-lambda-builder . -f lambda.Dockerfile --target builder
138-
docker run sqlpage-lambda-builder cat deploy.zip > deploy.zip
138+
docker run sqlpage-lambda-builder cat deploy.zip > sqlpage-aws-lambda.zip
139139
```
140140

141-
You can then use `deploy.zip` as the source for an AWS Lambda,
141+
You can then just add your own SQL files to `sqlpage-aws-lambda.zip`,
142+
and [upload it to AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-package.html#gettingstarted-package-zip),
142143
selecting *Custom runtime on Amazon Linux 2* as a runtime.
143144

144145
### Hosting sql files directly inside the database

src/webserver/http.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,15 +456,13 @@ pub fn create_app(
456456
pub async fn run_server(config: Config, state: AppState) -> anyhow::Result<()> {
457457
let listen_on = config.listen_on;
458458
let state = web::Data::new(state);
459+
let factory = move || create_app(web::Data::clone(&state));
459460

460461
#[cfg(feature = "lambda-web")]
461462
if lambda_web::is_running_on_lambda() {
462463
lambda_web::run_actix_on_lambda(factory).await?;
463464
return Ok(());
464465
}
465-
HttpServer::new(move || create_app(web::Data::clone(&state)))
466-
.bind(listen_on)?
467-
.run()
468-
.await?;
466+
HttpServer::new(factory).bind(listen_on)?.run().await?;
469467
Ok(())
470468
}

0 commit comments

Comments
 (0)