Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Self hosting

Cory Watilo edited this page Apr 17, 2022 · 1 revision

After spinning up a server, grab the JavaScript embed code or React component and place wherever you want it to appear on your site. (It works great at the end of your docs template - so visitors can ask questions without leaving the page. And because the questions & answers stay on your site, they'll be useful for others in the future.)

Requirements

Squeak! is currently self-hosted, but we make deployment simple using a Docker container. You'll need:

  • Docker and docker hosting - Runs client-side widget, admin panel
  • A Supabase account - Hosted Postgres database, authentication
  • Mailgun (optional) - Email notifications for users when someone answers their question
  • Slack (optional) - Moderator notifications for new questions and community replies

Getting started

1. Create a project in Supabase

This will take a few minutes. (We'll come back here.)

Be sure to save your database password. You'll need this later.

2. Host the Docker container

We've made it easy to deploy to DigitalOcean.

  1. On step one, choose Detect from source code
  2. On step 2 (environment vars), under Web, click edit, an

3. Configure server's environment variables

  1. Delete SUPABASE_SERVICE_ROLE_KEY, then re-add

Find these in Supabase at:

<https://app.supabase.io/project/{your-project-id}>

Mapping environment variables

Read more about how we use these in the appendix at the bottom of this page.

Untitled

4. Database credentials (optional)

This step will run database migrations when the service is started.

If you don't enter your credentials, you'll just need to copy/paste a SQL query to create the table structure.

Build your connection string

Enter your database's password and hostname into the following string.

postgresql://postgres:{your-password}@{your-host}:5432/postgres

Find your database hostname at the following URL:

<https://app.supabase.io/project/{your-project-id}/settings/database>

Untitled

Use the resulting value in the DATABASE_URL field. (Voila, that was the hardest part!)

5. Return to your Docker project and name the app

Something like {your-project}-squeak works great.

6. Build the app

The deployment will take 2-4 minutes.

Using DigitalOcean? You'll need to set up billing before building. You can host with DigitalOcean for as little as $5 by choosing the Basic plan, then adjusting the Basic Size.

7. Disable email confirmations in Supabase

While Docker is building, visit the following URL:

<https://app.supabase.io/project/{your-project-id}/auth/settings>

Under Email Auth, toggle OFF Enable email confirmations.

This will allow users to post questions without leaving the widget.

Note: This form sometimes takes a few seconds to update.

8. Complete setup process

The first time you run your app, you'll be redirected to:

{your-url}.{tld}/setup/welcome

9. Create database table structure

Skip this step if you added your database connection string (from step 4)

  1. Copy the SQL query from the setup process
  2. Visit the Supabase SQL Editor and choose New query
  3. Paste and run the SQL command
  4. You'll see "Success. No rows returns"
  5. Return to the setup process

10. Create a login for the admin panel

You'll also be able to reply to questions with this authentication.

11. Enter Mailgun and Slack credentials (optional)

Mailgun

  1. Find your Private API key in Mailgun and enter it as the Mailgun API key
  2. Enter the domain name you'll be sending from, your company name, and your site's URL (so the email can link back to it)

Slack

  1. Optionally, create a new Slack channel for Squeak! notifications
  2. Copy and replace the app manifest
  3. Install to workspace
  4. In Slack, visit the OAuth & Permissions page (at `https://api.slack.com/apps/{your-app-id}/oauth
  5. Copy the value of Bot User OAuth Token and add to the setup wizard
  6. After entering your OAuth token, you'll be asked to select your desired Slack channel

12. Add the JavaScript snippet to your website or docs!

It can be installed on a single page template, or in a snippet references across your site like a layout template.

Note: If you use React, install the squeak-react package instead with yarn add squeak-react


Appendix

More info about tokens and how they're used

Find the values for these keys in your Supabase project.

Untitled

Clone this wiki locally