Maybe, Just Maybe, someone will enjoy Maybe Financials. It’s a powerfull self hosted financial system and it’s something I need. I’m switching from my factory IT job to a School system. The school system moves me from a weekly paycheck to a monthly paycheck and a pay cut and a big pay cut. However, it’s worth it as this is my end goal. One thing I have always struggled with is knowing when money will leave the account. Last time paid my amazon card, it took a full 2 weeks to come out of my account. This hurt me when coming down to prodictable budgeting. I tried different tools and all of them just couldn’t cut it. The core issue is I’m a spender.

Thus, being monthly, it’s time to try another software. However, I want something self hosted, something I can reach by a domain name. Thus, I tried a few out and landed with Maybe Financials. This guide will show you how to install it and set it up so a ssl will work. I am running it through my apache reverse proxy that lives in the cloud and hosting in docker on a local computer. Lets get started.

Installing Maybe

The setup

We are assuming you have a docker setup. This install is pretty quick and simple as well. Here is the offical documentation. First, you want to create your directory for your maybe install. Then you want to download the compose example into that folder. I suggest being in it. After which you will want to secure it. Lets begin with the compose file.

mkdir /maybe
cd maybe
curl -o compose.yml https://raw.githubusercontent.com/maybe-finance/maybe/main/compose.example.yml

Now we have the example file. We need to set the passwords needed for it. If you open the compose.yml file, you will find postgres and rails are part of the system. Items like ${blah:something} are variables that will be found in the .env file. As you can see, the password and hash are both there. So, it’s time to grab a hash and a password.

openssl rand -hex 64

Now we take that information and put it inside the env file by using the following command.

nano .env

The file should look like this:

SECRET_KEY_BASE="replace me with the generated string from the prior step"
POSTGRES_PASSWORD="replace me with your desired database password"

Another way to do this is by using this one liner. It will prompt for a custom password.

read -s -p "Enter your desired Postgres password: " DB_PASS && echo -e "SECRET_KEY_BASE=\"$(openssl rand -hex 64)\"\nPOSTGRES_PASSWORD=\"$DB_PASS\"" > .env && echo -e "\n.env file created."

Note:

  • This is when you can change the port number you want maybe to run on. Do it by editing the compose.yml file with nano. Change the Port from 3000:3000 to 3000:<Your Custom Port>

Run docker

Once you have the env file in place, it’s time to run the docker commands.

docker compose up -d
docker compose ls

Now, you can navigate to yoru machines IP address at the port you wanted. For example http://192.168.0.5:3000. You will setup your email from this point.

Accessing it from a greater network.

If you want to go to your instance of Maybe Financials outside your home, you will have to set it up to do so. In my case, if you haven’t followed, I’m Gnatted. So, I have a reverse proxy up in the cloud that points back. For me, this is the process I went through to set it up to be reached from the outside. I have already pointed my dns to the reverse proxy.

  1. cd /etc/apache2/sites-available.
  2. nano maybe.therandomadmin.com.conf
  3. Pasted the below
<VirtualHost *:80>
    ServerName maybe.therandomadmin.com

    ProxyPreserveHost On
    ProxyPass / http://100.100.100.100:3000/
    ProxyPassReverse / http://100.100.100.100:3000/

    # Optional headers
    RequestHeader set X-Forwarded-Proto "http"
    RequestHeader set X-Forwarded-Port "80"

    ErrorLog ${APACHE_LOG_DIR}/maybe.therandomadmin.com-error.log
    CustomLog ${APACHE_LOG_DIR}/maybe.therandomadmin.com-access.log combined
</VirtualHost>

This is a basic reverse proxy virtual host. It’s very important to see the requestheader. If it doesn’t like such, it will not work. Not sure why, it’s soemthing to do with rails.

  1. a2ensite maybe.therandomadmin.com.conf
  2. systemctl reload apache2
  3. certbot –apache
  4. Selected the maybe.therandomadmin.com
  5. Once it finished, I was able to navigate to the site.

This is where the requestheaders were important. Take a look at the virutal host that was generated by the cert bot:

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName maybe.therandomadmin.com

    ProxyPreserveHost On
    ProxyPass / http://100.100.100.100:3000/
    ProxyPassReverse / http://100.100.100.100:3000/

    # Optional headers
    RequestHeader set X-Forwarded-Proto "https"
    RequestHeader set X-Forwarded-For "%{REMOTE_ADDR}s"

    ErrorLog ${APACHE_LOG_DIR}/maybe.therandomadmin.com-error.log
    CustomLog ${APACHE_LOG_DIR}/maybe.therandomadmin.com-access.log combined
                           <Items removed due to security>
</VirtualHost>
</IfModule>

Notice the port is not there. It’s important to change it and then reload apache. Maybe Financials should allow you to log in without any issues.

Remember, if you don’t change the requestheaders, you will get the following error message

What can we learn as a person

Knowing is half the battle. It took me about 30 minutes to figure out the error message I got. The change you wanted was rejected was as useful as a box of pins in a bollon shop. I found an abscure reference to ngnix proxy which lead me to figure out the requestheader issue. Since the logs are very unhelpful. If you tried installing maybe, you might run into the same issue when giving it it’s domain name. But thanks to this blog, you have the answer. Thus, no time wasted.

To solve a problem, the more you know at the start of the problem, the quicker you will resolve the issue. I have a problem with two credit cards. I used them to buy things that were needed in the house. At the time, I didn’t realize it can take 3 weeks to process a single payment. Which is ugly to say the least. This little program has already helped me understand some spending habbits I have. Can you guess what eats my money? Eating out. No suprise, an IT guy likes to eat. With knowing these patterns, I now have a plan that will get me debt free by this time next year while still having christmas.

Almost every single issue can be quickly resolved by having preknowledge. Take a step back, breath and see what’s going on.