English
Deploy SerpBear
SerpBear is an open source tool for tracking keyword rankings on Google. This guide runs SerpBear with Docker Compose on port 4444 of the server, while the website on FlashPanel forwards requests for the domain (for example serpbear.domain.com) to that port.
Prerequisites
- Server connected to FlashPanel
- Domain DNS pointed to the server's IP
Step 1: Install Docker
Go to the server management page, click the Apps menu, select the Not Installed tab, find Docker, then click Install. See Applications for details.
Step 2: Create a Website
- Go to the server management page, click the Sites menu in the sidebar, then click the New Site button
- Enter the Domain Name (e.g.,
serpbear.domain.com) - Enter the Proxy Port:
4444(you can choose another free port) - Click Create Site
Step 3: Install SSL
On the site management page, click the SSL menu and install a certificate for the domain. See SSL.
Step 4: Create the docker-compose.yaml File
Open Terminal on the server's overview page (logged in as root), create a directory for SerpBear and open the configuration file:
bash
mkdir -p /root/serpbear
cd /root/serpbear
nano docker-compose.yamlYou can also use File Manager on the server's overview page to create the file /root/serpbear/docker-compose.yaml.
Paste the following content into the file and save it:
yaml
services:
app:
image: towfiqi/serpbear
restart: unless-stopped
ports:
- 127.0.0.1:4444:3000
environment:
- USER=admin
- PASSWORD=0123456789
- SECRET=4715aed3216f7b0a38e6b534a958362654e96d10fbc04700770d572af3dce43625dd
- APIKEY=5saedXklbslhnapihe2pihp3pih4fdnakhjwq5
- SESSION_DURATION=24
- NEXT_PUBLIC_APP_URL=https://serpbear.domain.com
volumes:
- serpbear_appdata:/app/data
volumes:
serpbear_appdata:Notes on the highlighted lines:
127.0.0.1:4444:3000:3000is SerpBear's fixed port inside the container and should not be changed.4444is the Proxy Port of the website created in step 2. The127.0.0.1:part keeps port4444open only inside the server: Docker adds its own network rules and bypasses the UFW firewall, so with just4444:3000the port would be reachable directly from the Internet even if the firewall does not open itUSER: the username for logging in to SerpBear, for exampleadminPASSWORD: the login password. Use a strong password instead of the sample value0123456789SECRET: the secret key used to encrypt third-party API keys and passwordsAPIKEY: the key used to access SerpBear's APISESSION_DURATION: duration (in hours) of the login session, for example24NEXT_PUBLIC_APP_URL: the URL used to access SerpBear, which is the domain of the website created in step 2
TIP
Do not use the sample values for SECRET and APIKEY. Generate random strings with openssl rand -hex 32 and paste them in.
Step 5: Start SerpBear
In the server's Terminal, run:
bash
cd /root/serpbear
docker compose up -dVerify the Result
- Run
docker compose psin/root/serpbear; theappcontainer shows therunningstatus - Visit
https://serpbear.domain.comand log in with theUSER/PASSWORDyou configured
Updating the Configuration or Version
After editing docker-compose.yaml, run the command below again. Docker Compose recreates the container with the new configuration (docker restart does not apply changes made to docker-compose.yaml):
bash
cd /root/serpbear
docker compose up -dTo update SerpBear to a new version, pull the new image and recreate the container. Your data is kept in the serpbear_appdata volume:
bash
cd /root/serpbear
docker compose pull
docker compose up -dTroubleshooting
502 Bad Gateway
- Check that the container is running:
docker compose ps - Make sure port
4444indocker-compose.yamlmatches the website's Proxy Port - View the container logs:
docker compose logs -f app
Cannot Log In
Double-check USER, PASSWORD and NEXT_PUBLIC_APP_URL (it must be the correct domain, including https://), then run docker compose up -d again.