Deploying to Fly.io (Free)

The easiest way to deploy your own instance of SerpBear online is to use Fly.io . Follow the steps below to install the app locally, build it, and then deploy it to fly.io

Step 1:

Make sure git and nodejs are installed on your computer. Then install flyctl

Step 2:

Clone the SerpBear repo by running:

git clone git@github.com:towfiqi/serpbear.git
cd serpbear

Step 3:

Then Create your Fly.io app by running this command. Replace johndoeserp with an app name that is unique in fly.io Note that this unique name will be used to create your app domain. eg: https://johndoeserp.fly.dev

fly launch --name johndoeserp --region lax

Step 4:

Since Fly.io container data is not persistent, you will have to save the database file in a fly.io volume and then connect that volume to your app. So First Create a volume in your Fly account.

fly volumes create serpbear_data --size 1 --region lax

Step 5:

Open the newly created fly.toml file in your serpbear directory and add this to the very bottom to connect the newly created volume to your app.

[mounts]
    source="serpbear_data"
    destination="/app/data"

Step 6:

From the same fly.toml file, replace internal_port = 8080 with internal_port = 3000

Step 7:

You will also need to set the secret Environment variables for your Fly.io app instance. From the following command, replace johndoeserp with the app name you set in step 4. Then run the following command:

fly secrets set --app johndoeserp USER=admin PASSWORD=999999 NEXT_PUBLIC_APP_URL=https://johndoeserp.fly.dev/ SESSION_DURATION=24 APIKEY=5saedXklbylhnatihe2pihp3pih4fdnakljwq9 SECRET=4715aed3216f7b0a38e6b234a958362654e56d10fbc04700770d472af3dce43625jd

The details of the required environment variables can be found here.

Step 8:

Finally, Deploy the app to fly.io with the following command:

fly deploy

Updating the App

When there is a new release, you can simply run these commands to update the app & re-deploy it:

git pull
fly deploy

Last updated