Bar Assistant - Running a frugal side project

14th century drawing of a bartender making a cocktail

I've been making an app for managing cocktail recipes for a while now and recently, I've launched a new website and cloud-based offering making it easier to start managing your cocktail recipe collection.

In this write-up I'll try to go through on how I've orchestrated this managed "cloud" offering, and how much it costs me.

DigitalOcean Droplet (18 EUR)

I'm using a basic droplet with 2GB of RAM and 2 vCPU-s. I've been using DigitalOcean for my personal projects, including this website, for a while now, and I'm satisfied with the service. I almost went to Hetzner since they seem to offer a better hardware specs for a similar amount of money, but since I'm also using Spaces for S3 storage I get some bandwidth savings between official droplets and spaces.

Depending on traffic and performance I can easily resize the droplet in future. Even better, since everything is in containers I can easily move to another host if needed.

Maybe I'll try kubernetes in future (I probably won't).

Docker / Services

I've been slowly learning Docker for a few years now, and I'm currently comfortable enough to setup few compose files and run most of my services in containers.

Since I already publish docker images for Bar Assistant services, production setup was pretty straightforward.

One thing however differs from a basic Bar Assistant stack setup. I'm using custom php-fpm image and I mount whole app directory directly as volume. This was needed since I also have another app container that handles queues, which just runs queue worker.

I also have easier access to the code if something needs to be hotfixed.

The actual API backend is standard Laravel application.

PHP 8 + FPM + SQLite 3

Bar Assistant backend API is made with Laravel framework, and the database driver is SQLite3. This is a really light setup that works great and allows fast dev cycles.

Redis

Used for caching and queue management via Laravel horizon. Running in separate docker container.

Paddle

Laravel has a official package for handling subscription based billing code called Cashier, Paddle is one of the supported drivers. I'm very satisfied with Paddle's support and available features.

This is the first time I'm implementing recurring billing so it was a learning experience.

Meilisearch

User facing search in the app is powered by Meilisearch. Combined with official Laravel Scout package, syncing data between backend and search engine is a couple of lines of code.

Caddy

My choice for production web server is Caddy. I'm using it with Cloudflare provider for my SSL certificates. It's a bit annoying that you have to build a custom image if you want specific DNS providers, but overall I'm happy with how easy it is to configure.

Bar Assistant marketing image

Plausible analytics

In general, I'm not really interested in a lot of analytics data, I mostly check what pages are getting clicks and from what size devices. I'm using a self-hosted Plausible analytics for a few years now and I'm very happy with it. It's privacy oriented I has everything I need. I currently have around 10 websites getting tracked.

DigitalOcean Spaces (5 EUR)

I'm using S3 compatible storage offered by DigitalOcean called Spaces. It's 5€ per month with included 250GB storage.

I'm using it specifically for the following two services.

Litestream + SQLite

I'm using SQLite3 as my main application database. I think this is the best database to start a new project if you don't know/want to manage a database server.

Litestream is database replication service for SQLite. It runs in background and continuously pushes database changes to my S3 storage. For a really quick and operationally simple setup you get a robust database from a "small" database engine as sqlite.

access-key-id: XXX
secret-access-key: XXX

dbs:
  - path: /my/path/to/bar-assistant/database.ba3.sqlite
    replicas:
      - url: s3://bucket.ams3.digitaloceanspaces.com/database

Rclone

Another use case I have for S3 storage is full backup. While Litestream handles db replication and backup, I still need to backup user uploaded media like images. Rclone was pretty easy to install and setup, it also handles deleting old backups.

I have a cronjob that runs the following script every hour. It basically zips the images folder, uploads it to s3, and cleans up. Backups are held for 7 days.

filename="backup-$(date -d "today" +"%Y%m%d%H%M").zip"
zip -r $filename uploads -q
rclone sync /path/to/$filename s3:bucket/backup
rm $filename
rclone delete s3:bucket/backup --min-age 7d

I'm expecting that my S3 bill will increase in future since uploads folder continues to grow, but for now it's under 250GB.

SMTP2GO

For email sending I'm currently subscribed to SMTP2GO's free plan that offers 1000 free emails per month. This is currently more than enough for my needs. The only emails that are being sent are transactional emails; like account confirmation, password resets and similar.

Cloudflare

I'm using Cloudflare as my DNS and CDN provider. This is good because when I notice that a lot of popular website are down because of some global outage, I'll know for certain that Bar Assistant is down as well.

Error tracking

Monitoring and observability is a tricky thing to be frugal about. I've used Sentry, ELK, Bugsnag in past and I really liked them, but they all seemed like a huge overkill for my case. So I went with the dumbest route. I log everything I can to files on a disk and use logrotate to handle log rotation.

Thankfully I didn't find any serious errors in the logs, meaning the app is running perfectly and without any issues.

For parsing and filtering I use lnav.

Image of lnav filtering production logsI'm still learning all the details of that tool, but currently it's doing everything I need.

Other services

Here's some other bits and pieces that helped me in some way.

Figma

I use figma for most of my design stuff. In general it's just small things like creating logos, and marketing images.

Porkbun (12 EUR)

I use Porkbun as my domain provider. I chose them because I like their branding.

GitHub

I use Git and GitHub for my version control.

ChatGPT

For some more complicated queries that I'm too lazy to understand.

Notepad.exe

This is my favorite project management software.

Future plans

I like open source, and most of the services that I use are open source, including Bar Assistant.

In future I would also like to publish my infrastructure configuration, but I would like to first switch to Ansible or something similar. Currently it's a sensible mess of docker compose files, and there is no point in making it public yet (or, I'm just too embarrassed to show it to anyone).

I also plan to open all my riveting analytics dashboards to public, because Plausible has a built-in feature for that, and why not use it if it's there?

Total

In total running Bar Assistant costs me around 30 EUR per month.

Find me on