Deploy PostOwl on Clever Cloud #29
juliamrch
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
@juliamrch Thank you so much, this is brilliant. I haven't tried it yet, but will give it a go when I get back from being on the road. Couple of questions:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What is Clever Cloud
Clever Cloud is a European cloud provider that handles all the infrastructure so developers can focus on their code. Deployments are immutable, meaning your app will restart when scaling, crashing or updating. PostOwl uses SQLite, so this tutorial explains how to deploy PostOwl with a replicated and always updated database. At the end, you'll get:
For this, we are going to use Litestream and Clever Cloud deployment hooks and its S3-like object storage service, Cellar.
Requirements
📁 Backup your local SQLite
You'll need an object storage bucket (also called S3 storage) where you'll store your database snapshots. From the Clever Cloud Console, create an Cellar add-on:
On Cellar dashboard, check Informations with the environment variables you'll need in your project:
CELLAR_ADDON_HOST
CELLAR_ADDON_KEY_ID
CELLAR_ADDON_KEY_SECRET
Copy those values and save it somewhere safe.
At the root of your project, create a
litestream.yml
and fill it with these environment variables values:Now you can run the command to replicate your SQLite database :
./litestream replicate -config litestream.yml
.💡I usually advise that you create a specific folder in your bucket to host the database snapshots, you can use s3cmd CLI or a S3 client like Cyberduck to do so. If you create a folder in your bucket, make sure to change the
path
value in yourlitestream.yml
.Finally, add⚠️ never commit it anywhere!
litestream.yml
to your gitignore, and🛠️ Configure your PostOwl app
At the root of your repository, create a a
litestream.sh
file and fill it with the following:This file will:
Give it permissions with
chmod +rwx litestream.sh
and commit it.Time to deploy!
🚀 Deployment
Follow these steps to deploy your PostOwl app.
1. Declare your app
BUCKET_DIRECTORY
andLITESTREAM_BACKUPS
.Add variables from your project's
.env
file as well. Variables will be dynamically injected on deployment.2. Connect Cellar add-on
Before pushing your code, we'll connect your Cellar add-on to your app so its environment variables will be injected as well.
3. Push the code
Now your deployment has started, which you can follow from the Logs panel.
Beta Was this translation helpful? Give feedback.
All reactions