~/blog/run-postfacto-on-any-cloud-provider
Published on

Run Postfacto on any Cloud Provider

783 words4 min read
Authors
  • avatar

Postfacto is an excellent tool for Sprint Retrospectives, but the deployment instructions are limited to four platforms (at the time of writing).

If you only need a simple installation, it's entirely possible to get Postfacto running on any Cloud Provider, and using Docker.

What you'll need

To run through these steps, you'll need to have a Virtual Machine already provisioned and running Linux. I'll be using Ubuntu 20.04, but most of the commands should work across distros.

Install Docker

Note: it's always better to reference the official documentation but the steps, which are correct at the time of writing, have been copied here for ease.

  • Update the apt package index and install packages to allow apt to use a repository over HTTPS:
sudo apt-get update sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg
\ lsb-release
  • Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o
/usr/share/keyrings/docker-archive-keyring.gpg
  • Set up the stable repository.
echo \ "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg]
https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee
/etc/apt/sources.list.d/docker.list > /dev/null
  • Update the apt package index, and install the latest version of Docker Engine and containerd
sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io
  • Add your user to the docker group
sudo usermod -aG docker ${USER}
  • Log in and out of the VM

  • Confirm that your user is now added to the docker group (should output docker)

id -nG
  • Install docker-compose
sudo apt update sudo apt install docker-compose
  • Check installation was successful
docker-compose --version

Set-up Postfacto

Note: Make sure to replace all passwords with more secure values.

  • Create a docker-compose file with the following contents
version: '3.3'
services:
  postgres:
    image: postgres
    environment:
      - POSTGRES_PASSWORD=changeme
  redis:
    image: redis:5.0.5-alpine
  postfacto:
    image: postfacto/postfacto
    ports:
      - '3000:3000'
    environment:
      - DATABASE_URL=postgresql://postgres:changeme@postgres:5432/postgres
      - DISABLE_SSL_REDIRECT=true
      - SECRET_KEY_BASE=changeme
      - USE_POSTGRES_FOR_ACTION_CABLE=false
      - REDIS_URL=redis://redis:6379
    links:
      - postgres
      - redis
    depends_on:
      - postgres
  • Start the containers
docker-compose up -d
  • Register an admin user
docker-compose exec postfacto create-admin-user {email} {password}

Create a retro

  • Go to http://{server-ip}:3000/admin/ and login using the email/password from the last step
  • Go to the Retros tab and create a retro with the required configuration
  • Use your new retro at http://{server-ip}:3000/retros/{retro-slug}

Install/Setup Nginx Reverse Proxy

Note: This step is optional, and is only required if you want to use a domain name instead of the Public IP to use Postfacto.

  • Install Nginx
sudo apt-get install nginx
  • Create the postfacto configuration under /etc/nginx/sites-available/postfacto, with the follow contents:
server {
listen 80;
listen [::]:80;

server_name <yourdomain(s)>;

location / {
proxy_pass http://localhost:3000;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header   Upgrade $http_upgrade;
proxy_set_header   Connection "upgrade";
}
}
  • Enable the configuration
sudo ln -s /etc/nginx/sites-available/postfacto /etc/nginx/sites-enabled/
  • Test the config & Restart nginx
sudo service nginx configtest && sudo service nginx restart

TIP: You can pinpoint problems in your nginx config using the following command

sudo nginx -t
  • Create the necessary A (IPV4) and AAA (IPV6) records, to point the required domain and the public IP.

Install/Setup Certbot

Note: This step is optional, and is only required if you want to use SSL/HTTPS

  • Ensure that your version of snapd is up to date
sudo snap install core; sudo snap refresh core
  • Install Certbot
sudo snap install --classic certbot
  • Prepare the Certbot command
sudo ln -s /snap/bin/certbot /usr/bin/certbot
  • Get a certificate and have Certbot edit your Nginx configuration automatically to serve it, turning on HTTPS access in a single step
sudo certbot --nginx
  • Test automatic renewal
sudo certbot renew --dry-run
  • Confirm it worked by visiting your site over HTTPS