App deployment simplified, GitOps without the hassles.
Clace is an Apache-2.0 licensed project building a web app development and deployment platform for internal tools. Clace allows you to deploy containerized apps and develop Hypermedia based web apps. Clace is cross-platform (Linux/Windows/OSX) and provides a GitOps workflow for managing web apps.
Clace apps are deployed directly from the git repo, no build step required. For example, Clace can be used to deploy Streamlit/Gradio apps, adding OAuth authentication for access control across a team.
This repo hosts the source code for Clace. The source for the documentation site clace.io is in the docs repo. App specifications, which are templates to create apps, are defined in the appspecs repo. Sample apps are in the apps repo.
Clace can be used to:
- Automatically generate a form based UI for backend actions
- Deploy containerized applications, Clace will build and manage the container lifecycle
- Build and deploy custom Hypermedia based applications using Starlark (no containers required)
Clace supports the following for all apps:
- Declarative app deployment
- Atomic updates (all or none) across multiple apps
- Staging mode for app updates, to verify whether code and config changes work on prod before making them live.
- Preview app creation support, for trying out code changes.
- Support for github integration, apps being directly deployed from github code.
- OAuth and SSO based authentication
- Support for domain based and path based routing at the app level.
- Integration with secrets managers, to securely access secrets.
For containerized apps, Clace supports:
- Managing image builds, in dev and prod mode
- Passing parameters for the container
- Building apps from spec, no code changes required in repo for supported frameworks (Flask, Streamlit and repos having a Containerfile)
- Support for pausing app containers which are idle
For building Hypermedia based apps, Clace supports:
- Automatic error handling support
- Automatic creation of ECMAScript modules using esbuild.
- Support for TailwindCSS and DaisyUI watcher integration.
- Automatic SSL certificate creation based on certmagic.
- Backend app code runs in a security sandbox, with allowlist based permissions.
- No build step, the development artifacts are ready for production use.
- Support for application data persistance using SQLite
- Virtual filesystem with content hash based file names backed by SQLite database, enabling aggressive static content caching.
- Brotli compression for static artifacts, HTTP early hints support for performance.
The feature roadmap for Clace is:
- SQLite is used for metadata storage currently. Support for postgres is planned. This will be used to allow for horizontal scaling.
Clace manages TLS cert using LetsEncrypt for prod environments. For dev environment, it is recommended to install mkcert. Clace will automatically create local certs using mkcert if it is present. Install mkcert and run mkcert -install
before starting Clace server. Installing Clace using brew will automatically install mkcert.
For container based apps, Docker or Podman or Orbstack should be installed and running on the machine. Clace automatically detects the container manager to use.
Clace uses an admin
user account as the default authentication for accessing apps. A random password is generated for this account during initial Clace server installation. Note down this password for accessing apps.
To install on OSX/Linux, run
curl -sSLo /tmp/install.sh https://clace.io/install.sh && source /tmp/install.sh
clace server start
To install using brew, run
brew tap claceio/homebrew-clace
brew install clace
brew services start clace
To install on Windows, run
powershell -Command "iwr https://clace.io/install.ps1 -useb | iex"
Start a new command window (to get the updated env) and run clace server start
to start the Clace service.
Once Clace server is running, to install apps declaratively, open a new window and run
clace apply --approve github.com/claceio/clace/examples/utils.star all
To install apps using the CLI, run
clace app create --approve github.com/claceio/apps/system/list_files /files
clace app create --approve github.com/claceio/apps/system/disk_usage /disk_usage
clace app create --approve github.com/claceio/apps/utils/bookmarks /book
Open https://localhost:25223 to see the app listing. The disk usage app is available at https://localhost:25223/disk_usage (port 25222 for HTTP). admin is the username, use the password printed by the install script. The bookmark manager is available at https://localhost:25223/book, the list files app is available at https://localhost:25223/files. Add the --auth none
flag to the app create
command to disable authentication.
See [installation]({{< ref "installation" >}}) for details. See [config options]({{< ref "configuration" >}}) for configuration options. To enable Let's Encrypt certificates, see [Automatic SSL]({{< ref "configuration/networking/#enable-automatic-signed-certificate" >}}).
The release binaries are also available at releases. See [install from source]({{< ref "installation/#install-from-source" >}}) to build from source.
To install a containerized app, ensure either Docker or Podman is running and run
clace app create --spec python-streamlit --branch master --approve github.com/streamlit/streamlit-example /streamlit
If the source repo has a Dockerfile
or Containerfile
, run
clace app create --spec container --approve <source_path> /myapp
to install the app.
To install a release build, follow steps in the installation docs.
To install from source:
- Ensure that a recent version of Go is available, version 1.21.0 or newer
- Checkout the Clace repo, cd to the checked out folder
- Build the clace binary and place in desired location, like $HOME
# Ensure go is in the $PATH
mkdir $HOME/clace_source && cd $HOME/clace_source
git clone -b main https://github.com/claceio/clace && cd clace
export CL_HOME=$HOME/clhome && mkdir -p $CL_HOME/config
go build -o $CL_HOME/clace ./cmd/clace/
To use the clace service, you need an initial config file with the service password and a work directory. The below instructions assume you are using $HOME/clhome/clace.toml as the config file and $HOME/clhome as the work directory location.
- Create the clhome directory
- Create the clace.toml file, and create a randomly generate password for the admin user account
cd $CL_HOME
git clone -C config https://github.com/claceio/appspecs
$CL_HOME/clace password > $CL_HOME/clace.toml
$CL_HOME/clace server start
This will print a random password on the screen, note that down as the password to use for accessing the applications. The service will be started on https://localhost:25223 by default (HTTP port 25222).
To create an app, run the Clace client
$HOME/clace app create --approve $HOME/clace_source/clace/examples/disk_usage/ /disk_usage
This will create an app at /disk_usage with the example disk_usage app. The disk_usage app provides a web interface for looking at file system disk usage, allowing the user to explore the sub-folders which are consuming most disk space.
To access the app, go to https://127.0.0.1:25223/disk_usage. Use admin
as the username and use the password previously generated. Allow the browser to connect to the self-signed certificate page. Or connect to http://127.0.0.1:25222/disk_usage to avoid the certificate related warning.
To create an app with a custom HTML page which shows a listing of files, create an directory ~/fileapp
with file app.star
file containing:
load("exec.in", "exec")
def handler(req):
ret = exec.run("ls", ["-l"])
if ret.error:
return {"Error": ret.error, "Lines": []}
return {"Error": "", "Lines": ret.value}
app = ace.app("File Listing",
custom_layout=True,
routes = [ace.html("/")],
permissions = [ace.permission("exec.in", "run", ["ls"])]
)
and file index.go.html
containing:
<!doctype html>
<html>
<head>
<title>File List</title>
</head>
<body>
<h1>File List</h1>
{{ .Data.Error }}
{{ range .Data.Lines }}
{{.}}
<br/>
{{end}}
</body>
</html>
Run clace app create --auth=none --approve ~/fileapp /files
. The app is available at https://localhost:25223/files
.
Clace docs are at https://clace.io/docs/. For doc bugs, raise a GitHub issue in the docs repo.
Please use Github Discussions for discussing Clace related topics. Please use the bug tracker only for bug reports and feature requests.
PRs welcome for bug fixes. For feature enhancements, please first file a ticket with the feature
label and discuss the change before working on the code changes.
The Google go style guide is used for Clace. For application behavior related fixes, refer the app unit test cases. Those test run as part of regular unit tests go test ./...
. For API related changes, Clace uses the commander-cli library for automated CLI tests. To run the CLI test, run gmake test
from the clace home directory.
Thanks for all contributions!