This is an example of deploying PostOwl on Clever Cloud with automatic SQLite backups to Cellar S3 using Litestream.
PostOwl is a self-hosted platform for blogging, sharing posts with friends via secret links, and maintaining private journals.
PostOwl is installed from source and runs on Clever Cloud's Node.js runtime. It uses:
# Clone PostOwl
git clone https://github.com/PostOwl/postowl.git
cd postowl
# Install dependencies
npm install
# Copy and configure environment variables
cp .env.example .env
# Edit .env with your settings
# Initialize the database
sqlite3 data/db.sqlite3 < scripts/schema.sql
# Start development server
npm run dev
The application will be accessible at http://localhost:5173.
You have two options to deploy your application on Clever Cloud: using the Web Console or using the Clever Tools CLI.
If you don't already have an account, go to the Clever Cloud console and follow the registration instructions.
Fork the PostOwl repository and clone your fork:
git clone https://github.com/<your-username>/postowl.git
cd postowl
Copy the deployment scripts from this example into your fork:
# Copy the clevercloud directory
cp -r /path/to/this/example/clevercloud ./clevercloud
chmod +x clevercloud/*.sh
Commit and push these files to your fork.
postowl-backups)In your application's dashboard, go to "Environment Variables" and set:
PostOwl configuration:
| Variable | Description | Example |
|---|---|---|
| ORIGIN | Your application's public URL | https://your-app.cleverapps.io |
| ADMIN_PASSWORD | Password to access the admin | your-secure-password |
| ADMIN_NAME | Display name for the admin | Your Name |
| ADMIN_EMAIL | Admin email address | [email protected] |
| DATABASE_URL | Path to the SQLite database | ./data/db.sqlite3 |
SMTP configuration (for email notifications):
| Variable | Description | Example |
|---|---|---|
| SMTP_HOST | SMTP server host | smtp.example.com |
| SMTP_PORT | SMTP server port | 587 |
| SMTP_USER | SMTP username | your-smtp-user |
| SMTP_PASS | SMTP password | your-smtp-password |
Litestream configuration:
| Variable | Description | Example |
|---|---|---|
| LITESTREAM_VERSION | Litestream version to install | 0.3.13 |
| DB_PATH | Path to the SQLite database | data/db.sqlite3 |
| DATA_DIR | Directory for the database | data |
| LITESTREAM_BUCKET | Cellar S3 bucket name | postowl-backups |
| LITESTREAM_BACKUPS | Path inside the bucket | backups |
| BUCKET_DIRECTORY | Bucket directory | backups |
The
CELLAR_ADDON_HOST,CELLAR_ADDON_KEY_ID,CELLAR_ADDON_KEY_SECRET, andCELLAR_REGIONvariables are automatically set when you link the Cellar add-on to your application.
Clever Cloud hooks:
| Variable | Value |
|---|---|
| CC_POST_BUILD_HOOK | ./clevercloud/post-build.sh |
| CC_PRE_RUN_HOOK | ./clevercloud/pre-run.sh |
You can deploy your application using Git:
# Add Clever Cloud as a remote repository
git remote add clever git+ssh://[email protected]/app_<your-app-id>.git
# Push your code to deploy
git push clever master
Install the Clever Tools CLI following the official documentation:
# Using npm
npm install -g clever-tools
# Or using Homebrew (macOS)
brew install clever-tools
clever login
# Clone your fork of PostOwl
git clone https://github.com/<your-username>/postowl.git
cd postowl
# Copy the deployment scripts from this example
cp -r /path/to/this/example/clevercloud ./clevercloud
chmod +x clevercloud/*.sh
# Commit the deployment scripts
git add clevercloud/
git commit -m "Add Clever Cloud deployment scripts"
# Initialize the current directory as a Clever Cloud application
clever create --type node postowl-example
# Create Cellar add-on
clever addon create cellar-addon postowl-example-cellar --link postowl-example
# PostOwl configuration
clever env set ORIGIN "https://$(clever domain | tr -d " ")"
clever env set ADMIN_PASSWORD "your-secure-password"
clever env set ADMIN_NAME "Your Name"
clever env set ADMIN_EMAIL "[email protected]"
clever env set DATABASE_URL "./data/db.sqlite3"
# SMTP configuration
clever env set SMTP_HOST "smtp.example.com"
clever env set SMTP_PORT "587"
clever env set SMTP_USER "your-smtp-user"
clever env set SMTP_PASS "your-smtp-password"
# Litestream configuration
clever env set LITESTREAM_VERSION "0.5.9"
clever env set DB_PATH "data/db.sqlite3"
clever env set DATA_DIR "data"
clever env set LITESTREAM_BUCKET "$(clever domain | tr -d " " | tr -d "/" | awk -F. '{print $1}')"
clever env set LITESTREAM_BACKUPS "backups"
clever env set BUCKET_DIRECTORY "backups"
# Clever Cloud hooks
clever env set CC_POST_BUILD_HOOK "./clevercloud/post-build.sh"
clever env set CC_PRE_RUN_HOOK "./clevercloud/pre-run.sh"
clever deploy
clever open
The deployment uses Litestream to continuously replicate your SQLite database to Cellar S3:
CC_POST_BUILD_HOOK): Litestream is downloaded, configured, and restores the latest backup from S3 (if one exists). This step is cached between deploys.CC_PRE_RUN_HOOK): If no backup was restored (fresh deploy), the database is initialized from the schema. Then Litestream replication starts in the background, continuously backing up changes to S3.npm run start, with Litestream replicating in the background.This ensures your data persists across deployments and restarts, even though Clever Cloud uses ephemeral file systems.
Once deployed, you can monitor your application through:
clever logs to view application logs and clever status to check the status of your application.