Skip to content
AWS Lightsail
Ephemeral instances
Any app
Just need a container
10min
install time

Full-fidelity preview environments for GitHub

PullPreview is a GitHub Action that automatically deploys your pull requests and branches to your AWS account. Works with any application that can be launched with Docker Compose.
PullPreview is a GitHub Action that automatically deploys your pull requests and branches

🚀 Git push, deployed

Once installed in your repository, this action is triggered any time a change is made to Pull Requests labelled with the pullpreview label, or one of the always-on branches.

When triggered, it will:

  1. Check out the repository code.
  2. Provision a cheap AWS Lightsail instance, with docker and docker-compose set up.
  3. Continuously deploy the specified pull requests and branches, using your docker-compose file(s).
  4. Report the preview instance URL in the GitHub UI.

It is designed to be the no-nonsense, cheap, and secure alternative to services that require access to your code and force your app to fit within their specific deployment system and/or require a specific config file.

Continuous deployment of your pull requests and branches to your AWS account

Testimonials

It saved us thousands in development costs, and the monthly cost of the Lightsail instances is immaterial compared to SaaS tools that want to license on a per user or per repository basis.

-
Casey Kinsey, CEO at HireLofty

An incredibly valuable tool for enhancing my workflow and improving collaboration with my team. One of the standout features of this action is its ease of setup.

-
Neil Raina, CTO at Copilot

We were stuck trying out lots of different managed solutions with Vercel, Render etc, but they all had problems. Using docker-compose with self-hosting made it so much simpler 👍

-
Tristan, Lead Engineer at Layer3

We were struggling with product reviews, as we performed them too late on the developpement cycle and faced difficulties to isolate the issues. It lead to long threads, frictions and was energy and time consuming for both technical and product teams. Then came PullPreview: an easy way to review PRs for product teams and ease communication between developers and PM/Designers.

-
Adam Feral, Head of Product at Malo

Features

  • Works with your existing tooling: If your app can be started with docker-compose, it can be deployed to preview environments with PullPreview.

  • Can be started and destroyed easily: You can manage preview environments by adding or removing the pullpreview label on your Pull Requests. You can set specific branches as always on, for instance to continuously deploy your master branch.

  • Cheap too run: Preview environments are launched on AWS Lightsail instances, which are both very cheap (10USD per month, proratized to the duration of the PR), and all costs included (bandwith, storage, etc.)

  • Takes the privacy of your code seriously: The workflow happens all within a GitHub Action, which means your code never leaves GitHub or your Lightsail instances.

  • Makes the preview URL easy to find for your reviewers: Deployment statuses and URLs are visible in the PR checks section, and on the Deployments tab in the GitHub UI.

  • Persists state across deploys: Any state stored in docker volumes (e.g. database data) will be persisted across deploys, making the life of reviewers easier.

  • Easy to troubleshoot: You can give specific GitHub users the authorization to SSH into the preview instance (with sudo privileges) to further troubleshoot any issue. The SSH keys that they use to push to GitHub will automatically be installed on the preview servers.

  • Fully integrated into the GitHub UI: Logs for each deployment run are available within the Actions section, and direct links to the preview environments are available in the Checks section of a PR, and in the Deployments tab of the repository.

Useful for the entire team

  • Product Owners: Interact with a new feature as it’s built, give valuable feedback earlier, reduce wasted development time.
  • Developers: Show your work in progress, find bugs early, deliver the right feature.
  • Ops: Concentrate on high value tasks, not maintaining staging environments.
  • CTOs: Don’t let your code run on third-party servers: your code always stays private on either GitHub’s or your servers.

Installation & Usage

→ Please see the wiki for the full documentation.

Example

Workflow file with the master branch always on:

.github/workflows/pullpreview.yml
name: PullPreview
on:
# the schedule is optional, but helps to make sure no dangling resources are left when GitHub Action does not behave properly
schedule:
- cron: "30 2 * * *"
push:
branches:
- main
pull_request:
types: [labeled, unlabeled, synchronize, closed, reopened]
jobs:
deploy:
if: github.event_name == 'schedule' || github.event_name == 'push' || github.event.label.name == 'pullpreview' || contains(github.event.pull_request.labels.*.name, 'pullpreview')
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: pullpreview/action@v5
with:
# Those GitHub users will have SSH access to the servers
admins: crohr,other-github-user
# A preview environment will always exist for the main branch
always_on: main
# Use the cidrs option to restrict access to the live environments to specific IP ranges
cidrs: "0.0.0.0/0"
# PullPreview will use those 2 files when running docker-compose up
compose_files: docker-compose.yml,docker-compose.pullpreview.yml
# The preview URL will target this port
default_port: 80
# Use a 512MB RAM instance type instead of the default 2GB
instance_type: nano
# Ports to open on the server
ports: 80,5432
env:
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
AWS_REGION: "us-east-1"

Is this free?

The code for this Action is completely open, but licensed under the Prosperity Public License (see LICENSE). In practice this means that:

  • If you are a non-profit individual, then it is free to run.

  • In all other cases, you must buy a commercial license. This costs 300€/year, and includes any number of repositories and users, within a single GitHub organization. You can try for 30 days before buying the license.

Then, for each preview environment, you will pay the per-hour cost of your instances. For example, a 1GB RAM micro instance will cost you 0.007$/hour, 0.168$/day, and 5$/month (AWS lightsail pricing).

That means you pay the retail price for the resources you use, without any additional markup, whether you have 2 or 20 temporary environments.

Example: if your team opens 50 pull requests with PullPreview enabled per month, and on average they stay open for 3 days, using a 4GB RAM instance this would cost you: 50720.028 = 100$ for AWS lightsail, plus 25€ for the licence, i.e. ~125$/month all included.

You won’t find a better solution around

  • Tech that everyone understands: no Kubernetes. One environment = one server.
  • Fully integrated into GitHub: no separate UI necessary.
  • No SaaS or third-party involved: Your code stays private, and the servers are hosted in your own AWS account.
  • Debugging is easy: you have root SSH access to the environment VM for any troubleshooting.
  • Advanced security: set custom firewall rules for your preview environment VMs, ensuring your data stays protected.
  • Custom domains: use your own domain or subdomain for your preview environments.
  • Support for SSL/TLS: automatically provision Let’s Encrypt certificates.

Who did this?

👋 I’m Cyril Rohr, a freelance CTO/DevOps from France. Over the years I’ve built and maintained many homemade solutions for this problem. PullPreview is the condensed version of everything I’ve learned. I hope you’ll find it useful.

You might also be interested in my other projects:

  • RunsOn: 10x cheaper GitHub Actions runners, fully self-hosted on AWS.
  • Packager.io: DEB/RPM packaging made simple.