Coder Social home page Coder Social logo

lagonapp / lagon Goto Github PK

View Code? Open in Web Editor NEW
1.3K 1.3K 60.0 16.9 MB

Deploy Serverless Functions at the Edge. Current status: Alpha

Home Page: https://lagon.app

License: GNU Affero General Public License v3.0

TypeScript 49.37% CSS 0.36% JavaScript 1.42% Rust 42.53% HTML 0.49% MDX 5.82%
edge functions serverless typescript

lagon's People

Contributors

20k-ultra avatar akitasummer avatar anbraten avatar asharonbaltazar avatar await-ovo avatar aymene01 avatar bahlo avatar barbarbar338 avatar colinlienard avatar cyco130 avatar danielroe avatar diboune avatar ducan-ne avatar g3root avatar github-actions[bot] avatar hisamafahri avatar metrue avatar ming535 avatar murka avatar quiibz avatar renovate[bot] avatar tombyrer avatar xanderbarkhatov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

lagon's Issues

Load environment variables with a local `.env`

Currently, there is no way to inject environment variables with lagon dev, even if it's implemented in the Runtime. Ideally, we should add a --env option to specify a path to a .env file, which defaults to the local directory.

Function statistics

Now that the runtime is in Rust, we need to export the same statistics as with the Node.js runtime:

  • Requests
  • CPU time
  • Bytes IN/OUT

Instead of storing them in Postgres, we can maybe use Prometheus to scrape an exporter from serverless. But we also need a way to display these graphs on the website.

Create / delete organization

Add a new page to create an organization and a modal to delete one (if we are the owner).

We should also be able to switch between organizations using the dropdown in the top-right corner.

run pnpm lagon dev will throw module not found error

Describe the bug
A clear and concise description of what the bug is.

Pasted Graphic 1 copy

To Reproduce
Steps to reproduce the behavior:

  1. mkdir test-lagon && cd test-lagon
  2. pnpm init && pnpm add @lagon/cli
  3. pnpm lagon dev
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

The command can be executed successfully.

Information:

  • OS: macOS
  • Node.js Version: v16.15.1

It seems related to esbuild external dependencies with esm format(evanw/esbuild#1958).

Basic CLI

lagon CLI to deploy easily from the command line.

Create a .lagon folder in each deploy with a file to save the function id.

  • lagon --help
  • lagon --version
  • lagon login
  • lagon logout
  • lagon [path] / lagon deploy [path]
  • lagon rm [path] / lagon remove [path]
  • Auto updating

project name clash

Describe the bug
https://www.serverless.com/
Been around for years. Originally seemed like it was supposed to be an agnostic abstraction, but last 2 years was gobbled up by AWS, who have better lawyers than you ;)

Response streaming

Add back response streaming, now that the Rust runtime has been implemented. We can look at #85 which was the streaming implementation with the Node.js runtime.

RFC: Environment variables

Currently, environment variables are accessible with process.env, similar to Node.js. I came across an issue today with Lyra: to check if we are running in Node.js or an Edge runtime, they check if process !== undefined and then use an API that is available only on Node.js, but not on Lagon.

Using process.env to hold environment variables might be more challenging for external libraries to know in which environment they are running. Feel free to discuss your thoughts about this below.

For reference:

Add integration tests

We need strong integration tests along with the existing unit tests, to make sure nothing broke when changing code.

One example of a bug that should be covered by tests is #86

Complete `fetch` API

Currently, the fetch API doesn't care about the input, and always performs a GET on the given URL. Now that we got it working async within the event loop, we can support every HTTP method, headers, ...

`lagon dev` subcommand

Now that the Rust runtime & CLI are working, we can add lagon dev subcommand to launch a local dev server, using the real Lagon Rust runtime.

Arguments:

  • file: path to the function

Options:

  • --client, -c: path to a client file to bundle
  • --public, -p: path to a custom public folder
  • --port: change the default port (1234)
  • --host: change the default hostname (127.0.01)

Implement limits

Organizations:

  • 3-64 chars for organization name
  • 256 chars for organization description
  • 20 functions/organization

Functions:

  • 3-64 chars for Function name
  • X active deployments/function
  • 10 custom domains/function
  • 100 environment variables/function
  • 10MB function size
  • 10MB asset size
  • 100 assets/function
  • 128MB function memory limit
  • 50ms function CPU timeout
  • 200ms function CPU startup timeout

Environment variables:

  • 64 chars environment variable key length
  • 5KB environment variables value size

Support HatTip

Support HatTip router. It should already work out-of-the-box, but it's a good idea to verify and add an example.

Issue on HatTip's repo to track the progress:

Handle `fetch` errors

Right now, we don't handle any fetch error that might occur. In case of an error, the JS promise should reject with the error.

Function logs

Now that the runtime is in Rust, we need to see again live logs from console.* calls.

Runtime security features

To prevent malicious code from being executed inside an Isolate, we need to disable some JavaScript features:

  • eval()
  • new Function()
  • Date.now() / any time-related API

Cron functions

Cron functions are currently not working. A single edge location should run a cron function, so maybe an environment variable inside @lagon/serverless can be used to do this distinction.

[Question] V8 Isolate Security Model

I vaguely remember (I could be wrong) that CF mentioned that, because of Spectre attacks and the likes, they had to harden the V8 isolate security model. What's your take on this?

`dev` command on CLI

Add a lagon dev command in CLI to be able to launch a local HTTP server using @lagon/runtime.

Need support for console.*

HTTP/2

Support HTTP/2 in Nginx config.

Switch locale button

Now that #102 has been merged, we can add a button to switch the locale. The default one should be en.

Handle static files

Files in public folder (or the one specified with --public-folder) should be uploaded from the website through the CLI, then downloaded from @lagon/serverless.

Then we can have an API to read those files.

First idea, similar to Node.js fs:

  • fs.readFile(file: string): Promise<string>
  • fs.fileExists(file: string): Promise<boolean>

Second idea, check in @lagon/serverless if URL match an asset, and if so return it.

auto get available port in dev

Is your feature request related to a problem? Please describe.
image

Currently, if port 1234 is occupied, an error is thrown directly, but there is no way to change the port.

Describe the solution you'd like

  • There should be a way to specify the port when dev, for example lagon dev --port 8000
  • Ability to automatically get available port(get-port-please)

Support Next.js

Support Next.js SSR with the new Edge Runtime.

  • pages directory
  • app directory with React Server Components & streaming
  • Integration in the CLI to bundle all the edge functions in a single one

Style Deployments page

Currently, the deployments page is kinda ugly, so we need to make it prettier.

We can also anticipate space for the git commit.

i18n on the dashboard

Now that #102 has been merged, we can convert each page step by step to next-international.

  • /
  • /settings
  • /profile
  • /cli
  • /new
  • /playground/:id
  • /functions/:id

= to CloudFlare Workers?

If so, might want to join WinterCG.

I was fairly hot on CFW ~2 years ago, but got spooked with vendor lock-in, Google tie-ins, & politically vocal engineers.

This might be a better route than Just-JS & Unikernal/MicroVM. I'm not sure if this could help my Puppeteer/Playwright project, but otherwise this looks promising.

URL API

Following the documentation at: https://developer.mozilla.org/en-US/docs/Web/API/URL

URL needs support for:

  • Constructor with base
  • hash
  • host
  • hostname
  • href
  • origin
  • password
  • pathname
  • port
  • protocol
  • search
  • searchParams (which implies URLSearchParams)
  • username
  • toString()

URLSearchParams needs support for:

  • append(name, value)
  • delete(name)
  • entries()
  • forEach(callback)
  • get(name)
  • getAll(name)
  • has(name)
  • keys()
  • set(name, value)
  • sort()
  • toString()
  • values()

Presigned URLs

Currently, the CLI uploads files to website, which then uploads them to S3. We can speed things up and reduce load on website by using presigned URLs.

Stream APIs

Needs support for TransformStream, ReadableStream, WritableStream

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.