Liusha

Docs · templates

Language templates

Every template is a small HTTP server that listens on PORT. Liusha packages your source, Buildpacks detects the language, and Knative routes https://name.liusha.app to it.

The local examples use PORT=8080. In production, do not hard-code a port and do not set PORTyourself. Your server must listen on the PORTenvironment variable provided by Liusha.

$ liusha templates
$ liusha init my-api --template python
$ cd my-api
$ liusha deploy

Node.js

node
$ liusha init hello-node --template node

Runs `npm start`; listen on `process.env.PORT`.

LocalPORT=8080 npm start

Deployliusha deploy

Envliusha secrets set KEY=valuethen read process.env.KEY after redeploy.

  • index.js
  • package.json
  • README.md

Python

python
$ liusha init hello-python --template python

Runs `python app.py`; listen on `os.environ["PORT"]`.

LocalPORT=8080 python app.py

Deployliusha deploy

Envliusha secrets set KEY=valuethen read os.environ["KEY"] after redeploy.

  • app.py
  • requirements.txt
  • Procfile
  • README.md

Go

go
$ liusha init hello-go --template go

Buildpacks compile the server from `go.mod`; listen on `PORT`.

LocalPORT=8080 go run .

Deployliusha deploy

Envliusha secrets set KEY=valuethen read os.Getenv("KEY") after redeploy.

  • main.go
  • go.mod
  • README.md

Java

java
$ liusha init hello-java --template java

Builds with Maven and starts the packaged jar.

Localmvn package && PORT=8080 java -jar target/liusha-function-1.0.0.jar

Deployliusha deploy

Envliusha secrets set KEY=valuethen read System.getenv("KEY") after redeploy.

  • pom.xml
  • src/main/java/com/liusha/Function.java
  • Procfile
  • README.md

Ruby

ruby
$ liusha init hello-ruby --template ruby

Runs `ruby app.rb`; listen on `ENV["PORT"]`.

Localbundle install && PORT=8080 ruby app.rb

Deployliusha deploy

Envliusha secrets set KEY=valuethen read ENV["KEY"] after redeploy.

  • app.rb
  • Gemfile
  • Procfile
  • README.md

PHP

php
$ liusha init hello-php --template php

Starts PHP built-in server on `PORT`.

LocalPORT=8080 sh start.sh

Deployliusha deploy

Envliusha secrets set KEY=valuethen read getenv("KEY") after redeploy.

  • index.php
  • composer.json
  • Procfile
  • start.sh
  • README.md

Rust

rust
$ liusha init hello-rust --template rust

Buildpacks compile the server from `Cargo.toml`; listen on `PORT`.

LocalPORT=8080 cargo run

Deployliusha deploy

Envliusha secrets set KEY=valuethen read std::env::var("KEY") after redeploy.

  • Cargo.toml
  • src/main.rs
  • README.md

Existing projects

You can deploy an existing project without a template. Liusha sends runtime metadata to the API and Buildpacks still does the real source detection:

$ liusha deploy --runtime auto
$ liusha deploy --runtime go