Skip to content

Quick installation in the cloud

Arnold Noronha edited this page Nov 4, 2024 · 12 revisions

This document describes how you can quickly set up an instance of Screenshotbot for your development needs, on a server you run.

All you need is one machine in the cloud (AWS EC2, Google Cloud Engine, Azure, Linode etc.) with a public IP address. You also need a domain name, which will be used for HTTPS.

We suggest using a block storage (e.g. EBS when using AWS) as a drive for the machine, as opposed to a physical disk. This will give you the ability to take backups with snapshots, resize the underlying storage, and most cloud providers will automatically restore a machine when it fails.

Setup

Create a machine using Debian 12 (bookworm). Please note that this script only supports Debian 12, and does not support Ubuntu or any Red Hat based distros. Once you create the machine, SSH to the machine and run the following command:

wget https://screenshotbot.io/setup-oss.sh && sudo sh setup-oss.sh

This will automatically set up everything, and also ask you for the domain name and automatically set up HTTPS. At the end of this, your site will be available at https://domainname.

Minimum requirements

To start with, we suggest at least 1 vCPU, 2GB of RAM, and 20GB of storage. This is not a hard requirement, and you could probably get away with 1GB of RAM and 8GB of storage. As you store more runs and screenshots, you might have to increase the machine to use more RAM and more storage. (EBS allows you to resize disks without downtime.) Usually CPU is not a bottleneck.

Upgrades

To upgrade, first take a snapshot of the block device. For instance, if you're using AWS, this would be an EBS snapshot. This will let you recover your state in case of any failure during the upgrade.

Then, ssh to the machine and run:

$ sudo systemctl stop screenshotbot
$ cd /home/screenshotbot/screenshotbot-oss && sudo -u screenshotbot git pull
$ sudo systemctl start screenshotbot

On restarting the service will automatically run any schema upgrades as long as it's not been too long since the last upgrade. We recommending upgrading at least once every 3 months. If it's been longer than that, just make sure you pick an earlier commit first, upgrade to that commit, and then incrementally get to the last commit.

In the future, we'll have versioned commit tags to make upgrading easier.

Failure mode

If the machine goes down, AWS will recreate the machine typically within a few minutes. This is good enough for most teams.

If you have a lot of screenshots and a lot of CI runs, then Screenshotbot can take several minutes to reload all the state into memory, during which the service will be down.

In our commercial installation, we run a cluster of three Screenshotbot servers, which can provide a much higher availability guarantee, typically 99.999% uptime. However, supporting this is beyond the scope of this discussion. If you need such high availability, you should reach out to us for an Enterprise installation and support.