Skip to content

Commit

Permalink
fix aws compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
lovasoa committed Jul 2, 2023
1 parent 96cc3db commit a1b03f6
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
on:
workflow_dispatch: {}
push:
# Sequence of patterns matched against refs/tags
tags:
Expand Down Expand Up @@ -38,13 +39,21 @@ jobs:
with:
name: sqlpage ${{ matrix.os }}
path: ${{ matrix.binary_path }}
build-aws:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- 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@v3
with:
name: sqlpage aws lambda serverless image
path: sqlpage-aws-lambda.zip
create_release:
name: Create Release
needs: build
needs: [build, build-aws]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- run: |
chmod +x sqlpage*/sqlpage;
Expand All @@ -63,4 +72,5 @@ jobs:
files: |
sqlpage windows-latest/sqlpage-windows.zip
sqlpage-linux.tgz
sqlpage-macos.tgz
sqlpage-macos.tgz
sqlpage aws lambda serverless image/sqlpage-aws-lambda.zip
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sqlpage"
version = "0.7.1"
version = "0.7.2"
edition = "2021"
description = "A SQL-only web application framework. Takes .sql files and formats the query result using pre-made configurable professional-looking components."
keywords = ["web", "sql", "framework"]
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ An easy way to do so is using the provided docker image:

```bash
docker build -t sqlpage-lambda-builder . -f lambda.Dockerfile --target builder
docker run sqlpage-lambda-builder cat deploy.zip > deploy.zip
docker run sqlpage-lambda-builder cat deploy.zip > sqlpage-aws-lambda.zip
```

You can then use `deploy.zip` as the source for an AWS Lambda,
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.

### Hosting sql files directly inside the database
Expand Down
6 changes: 2 additions & 4 deletions src/webserver/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,15 +456,13 @@ pub fn create_app(
pub async fn run_server(config: Config, state: AppState) -> anyhow::Result<()> {
let listen_on = config.listen_on;
let state = web::Data::new(state);
let factory = move || create_app(web::Data::clone(&state));

#[cfg(feature = "lambda-web")]
if lambda_web::is_running_on_lambda() {
lambda_web::run_actix_on_lambda(factory).await?;
return Ok(());
}
HttpServer::new(move || create_app(web::Data::clone(&state)))
.bind(listen_on)?
.run()
.await?;
HttpServer::new(factory).bind(listen_on)?.run().await?;
Ok(())
}

0 comments on commit a1b03f6

Please sign in to comment.