Deploying SerpBear on a Server

Getting up and running on a server takes only a few minutes. Once you have logged in using SSH, follow these steps to get it up and running on an Ubuntu server.

Step 1:

Install Docker using this tutorial.

Step 2:

Install Docker Compose by running the following commands:

# Install Docker Compose
mkdir -p ~/.docker/cli-plugins/
curl -SL -o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose
sudo chown $USER /var/run/docker.sock

# Verify that Docker Compose is installed
docker compose version

Step 2:

Install Nginx and connect your domain to your Server

  1. First, install Nginx

sudo apt install nginx

2. Then open the default site config file

sudo nano /etc/nginx/sites-available/default

3. Remove everything inside the location brackets and add proxies. Note: if localhost does not work use ip address from your droplet.

location / {
	proxy_pass http://localhost:3000;
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection 'upgrade';
	proxy_set_header Host $host;
	proxy_cache_bypass $http_upgrade;
  1. Above the location we have server_name_;. Set the server name to your domain name if you want to use a domain name for this app. It should look like this: server_name Exit and save: Ctrl+X & Y

  2. Check so nginx is configured properly sudo nginx -t It should say something like the test is successful

  3. Now restart the service sudo service nginx restart

Step 3

Add SSL for your domain following these commands

sudo snap install core; sudo snap refresh core
sudo apt-get remove certbot
sudo snap install --classic certbot
sudo certbot --nginx -d
sudo certbot renew --dry-run

Step 4:

Enable Firewall:

ufw enable
ufw allow ssh
sudo ufw allow 'Nginx Full'

Step 5:

Create a new directory called serpbear and create a docker-compose.yaml file with the following content:

version: "3.8"

    image: towfiqi/serpbear
    restart: unless-stopped
      - 3000:3000
      - USER=admin
      - PASSWORD=0123456789
      - SECRET=4715aed3216f7b0a38e6b534a958362654e96d10fbc04700770d572af3dce43625dd
      - APIKEY=5saedXklbslhnapihe2pihp3pih4fdnakhjwq5
      - NEXT_PUBLIC_APP_URL=http://localhost:3000
      - serpbear_appdata:/app/data
    driver: bridge

Change Environment Variables to your needs. The Details of the Environment Variables can be found here.

Step 6:

From the same directory, run the container using the following Command:

docker compose up

Updating the App

When there is a new version, and you want to update your instance of the app, navigate to the serpbear directory and run the following:

docker compose pull
docker compose up

Last updated