1
Fly.io git
Rich In SQL edited this page 2022-09-10 18:56:13 +01:00

Deploying Actual on fly.io with git

Pre-requisites

There are some things we need to do before we get started though.

Fly.io Account

Create an account with fly.io. Although you are required to enter payment details, everything we do here will work on the free tier and you won't be charged.

Flyctl tool installation

  1. Open up Powershell on your local machine and paste the following command into the window:

    iwr https://fly.io/install.ps1 -useb | iex
    

    img/fly-install-1.png

  2. Flyctl should start installing

    img/fly-install-2.png

  3. Once done you should get a message saying Run flyctl --help to get started: /img/fly-install-3.png

Flyctl is now installed.

Installing Git On Your Local Machine

Download git for Windows from here: https://git-scm.com/download/win

  1. Identify the version that is suitable for your operating system

    If you are unsure if you are running 32bit run this command in the command prompt:

    wmic os get OSArchitecture
    

    /img/cmd-arch.png

  2. Download the setup file that is right for your system:

    /img/git-download.png

    It should then start downloading:

    /img/git-download-progress.png

  3. Once it is done, open it up - if asked click yes that you are happy for it to make changes to your device.

    /img/git-install-1.png

  4. Copy the settings as they are below and click next, next...

    /img/git-install-2.png /img/git-install-3.png /img/git-install-4.png /img/git-install-5.png /img/git-install-6.png /img/git-install-7.png /img/git-install-8.png /img/git-install-9.png /img/git-install-10.png /img/git-install-11.png /img/git-install-12.png /img/git-install-13.png /img/git-install-14.png /img/git-install-15.png /img/git-install-16.png

  5. Then git should begin installing:

    /img/git-install-17.png

  6. Open up a command prompt and type

    git --version
    

    to make sure it has installed correctly. If it has, you should see a version number as below:

    /img/git-install-18.png

That is it, Git is now installed.

Deploying Actual

I got Actual deployed to fly.io below are the instructions I used - understandably these are for Windows only but should work (with a few tweaks) for MacOSX & Linux.

  1. Press start (or hit the windows key on your keyboard), type cmd

    /img/windows-start-1.png

    when cmd appears in the search results, right click it and run it as Administrator

    /img/windows-start-2.png

  2. Navigate to the C:\ drive

    cd C:\
    

    /img/cmd-1.png

  3. Create a folder called github. (mkdir is a command to make a directory)

    mkdir github
    

    /img/cmd-2.png

  4. Once that is complete run this command

    flyctl auth login
    

    /img/cmd-9.png

    This should open a web browser and ask you to login - you will need to provide credit card details to proceed but actual shouldn't cost much if anything at all.

    /img/cmd-10.png

  5. Now we need to move into the github directory we just created on the C:\ drive, to do that we can use this command

    cd C:\github
    

    /img/cmd-3.png

    Note: CD means change directory

  6. Now run this command

    git clone https://github.com/actualbudget/actual-server.git
    

    /img/git-install-19.png

    This will pull down the latest files for actual-server from the git hub repository to our local machine.

  7. Then we need to move into that folder, to do that use this command

    cd actual-server
    

    /img/cmd-4.png

    Let's check to make sure we are in the correct place

    dir
    

    /img/cmd-5.png

    You should see a list of files, one of them being fly.template.toml. If you don't see them go back to step 6

  8. Copy fly.template.toml that is in the folder called actual-server within C:\GitHub and copy it back into the same directory with the name fly.toml

    copy fly.template.toml fly.toml
    

    /img/cmd-6.png

  9. Open the fly.toml file in notepad or a text editor of your choice like Visual Studio Code

    notepad fly.toml
    

    /img/cmd-7.png

    On line 1 change app = "%NAME%" to something of your choosing like app = "Actual" and save the file

    /img/cmd-8.png

  10. Go back to the command prompt and run

    flyctl launch
    
  11. You will see a message that says An existing fly.toml file was found for app Actual Budget ? Would you like to copy its configuration to the new app? (y/N)

    Type Y and hit enter

    /img/cmd-11.png

  12. It asked me to give my application a name, I just left it blank and it picked one for me. I did this because no matter what I typed it errored.

    /img/cmd-12.png

  13. Select your location using the up/down arrow keys when prompted:

    /img/cmd-13.png

  14. When prompted with ? Would you like to setup a Postgresql database now? (y/N)

    Type N and press enter:

    /img/cmd-14.png

  15. When prompted with ? Would you like to deploy now? (y/N)

    Type Y and press enter:

    /img/cmd-15.png

    The application should begin deploying.

    /img/cmd-17.png

  16. If you get a message about Windows Firewall, click 'Allow Access'

    /img/cmd-16.png

When complete you should see something like this:

/img/cmd-18.png

Persisting the data in Fly

When we update Actual, if we don't persist the data it will be erased each time we come to update.

  1. Run the following command

    flyctl volumes create actual_data --region lhr
    

    This will create a volume in the london region. Replace lhr with another region code if desired.

    /img/cmd-19.png

  2. You should then get a message to say it was successful

    /img/cmd-20.png

  3. Open up fly.toml in notepad - you can do this from the command line

    notepad fly.toml
    
  4. Add the following to the file

    [mounts]
        source="actual_data"
        destination="/data"
    

    If you created a volume with a different name, put that in the source. Save the file.

    /img/cmd-21.png

  5. Now from the command prompt run

    flyctl deploy
    

    /img/cmd-22.png

    Your application should be re-deployed with the updated configuration

    /img/cmd-23.png

If all went well, you should now be able to see your volume from the fly.io dashboard.

/img/fly-dash-3.png

Configuring Actual

Now everything is setup and configured, you should now be able to navigate to Actual using the URL provided by Fly in the dashboard.

  1. To find that open https://fly.io/dashboard in a browser and click the application you created, in my case myfirstbudget, it might have a really random name if you left it blank a few steps ago

    /img/fly-dash.png

  2. Once you are in there, you should see Hostname section under Application Information - click the link

    /img/fly-dash-2.png

    https://myfirstbudget.fly.dev
    

    This will now open Actual so we can start configuring it.

  3. You should then see this screen

    /img/actual-config-1.png

    Click the 'Use this domain' link

    /img/actual-config-2.png

  4. Set a password - remember this, you will need it in the future.

    /img/actual-config-3.png

  5. If everything went well you should then be taken to your very first budget.

    /img/actual-register.png

Actual is now up and running. Congratulations!

Exporting Data From Actual

Note this only applies to Actual Web

You can export your data from Actual at any time, to do this, login to your budget and click the three dots

/img/actual-config-4.png

Select Settings

/img/actual-config-5.png

Scroll down to the Export section and click Export Data

/img/actual-config-6.png

Save the file somewhere on your computer - that is it done.

Importing Data Into Actual

If you previously followed the above steps and have an Actual zip export, you can now import that using the web version of Actual.

To do this, login to your budget, then in the top right corner click Server

/img/actual-config-7.png

Then select Logout

/img/actual-config-8.png

Log back into your instance of Actual

/img/actual-config-9.png

From the next screen select Import File

/img/actual-config-10.png

Select Actual and then locate your Zip file, this will then import what you previously exported into Actual.

/img/actual-config-11.png

That is it - be careful though, importing might not create a new file (I haven't tested that bit)

Updating Actual

IMPORTANT: Before starting this step, backup your budget! You can find out how to do that here. Failure to do this may result in budget loss.

This section focuses on updating the actual-server

Press the start menu or windows key on your keyboard and type cmd

/img/windows-start-1.png

when command prompt appears in the search results, right click it and run it as Administrator

/img/windows-start-2.png

Navigate to the C:\ drive using this command

cd C:\

/img/cmd-1.png

Assuming you followed this guide before, navigate to the github directory you created to clone actual and then into the actual-server directory

cd github\actual-server

/img/cmd-26.png

We now need to clone the latest changes made to the actual-server repo, to do this, run the following command from your command prompt:

git pull origin master

/img/cmd-25.png

Once that is done, run the deployment command to push your changes to fly.

flyctl deploy.

Once that is complete, delete your browsing history and web files.

Load up your budget and if required restore your backup and that is Actual Server updated.

Frequent Issues

If you're stuck or find a step unclear, the community in Discord may be able to assist you.