Self-Host Maybe Finance Web App
Last updated on October 9, 2024 am
Self-Host Maybe Finance Web App
Maybe is an open-source personal finance web app that helps you track your income, expenses, and investments. It is built with Ruby on Rails.
In this post, I will show you how to host Maybe on your own Linux server using Docker and Nginx.
0. Environment
Software | Version |
---|---|
Ubuntu | 22.04.4 LTS |
Nginx | 1.18.0 |
Snap | 2.63 |
Docker | 27.2.0 (install later) |
Certbot | 2.11.0 (install later) |
1. Install Docker
This section is cherry-picked from the official Docker documentation: Install Docker Engine on Ubuntu | Docker Docs
1.1. Set up Docker APT repository:
1 |
|
1.2. Install Docker:
1 |
|
1.3. Check the installation:
1 |
|
2. Setup Docker Compose
The main doc is located at maybe/docs/hosting/docker.md
at main of Maybe’s GitHub repository, but some details are modified here.+
2.1. One-click Setup
1 |
|
Now the .env
file is created with a random secret key. Update the .env
file as follows:
1 |
|
2.2. Optional Configuration
Update the image
value of the maybe
service in compose.yml
to the stable version:
1 |
|
By default, docker compose will put the data in /var/lib/docker/volumes/
directory on Linux. You can change it by updating the volumes
section of each service in compose.yml
, and comment out the top-level volumes
section.
for example, to put the data in /var/app/maybe/postgres-data/
directory:
1 |
|
Similarly for app
service:
1 |
|
2.3. Start the Services
Start the services in the background:
1 |
|
Now it is available at http://localhost:3000/
or <your_pub_ip>:3000
. (Don’t forget to open the port of the server in the firewall.)
3. Setup SSL Certificates
At the moment, when you access to your bookkeeping app, the web browser will warn you that the connection is not secure. To fix this, we need to install SSL certificates.
3.1. Install Certbot
Certbot is a free, open-source software for manually-administrated websites to enable HTTPS by using Let’s Encrypt certificates.
This section is mainly based on the official Certbot documentation: Certbot Instructions | Certbot
The snap
is pre-installed on Ubuntu 20.04.
1 |
|
Replace yourdomain.com
with your actual domain name.
1 |
|
The certificates are stored in /etc/letsencrypt/live/yourdomain.com/
.
3.2. Configure nginx
to use the certificates
Update /etc/nginx/sites-available/yourdomain.com
as follows:
1 |
|
Then save and check the configuration:
1 |
|
Don’t forget to add respective A
DNS records (Or AAAA
for IPv6) on your domain registrar.
4. Disable default nginx
site
At the moment, the default nginx
site is still enabled on port 80 (accessible at http://your_pub_ip/
or http://your_pub_ip:80
) with default Nginx welcome page.
To disable it:
Update /etc/nginx/sites-available/default
as follows:
1 |
|
1 |
|
5. Setup Invitation Registration
For a self-hosted finance app, you may not want to allow anyone to register. Luckily, Maybe has an optional config to require an invite code to register.
Stop current services first:
1 |
|
Add REQUIRE_INVITE_CODE: "true"
to the app
service in compose.yml
:
1 |
|
Restart the services:
1 |
|
Now you can see that new registration will require an invite code.
You can run rake invites:create
to create an invite code. Rake
is a GNU Make-like program for Ruby-related tasks, so you probably need to have Ruby toolchain installed on your server.
6. Update for Future Versions
The latest version always have new features and bug fixes. To update the Maybe app to the latest version:
1 |
|