Skip to content

ed-asriyan/watch-together

Repository files navigation

Movie Together CD

Web application built on Svelte.js and Firebase for watching movies together on different devices.

watchtogether.online.mp4

Setup

Init

  1. Setup Firebase project
    1. Create Firebase Realtime database: https://console.firebase.google.com
    2. Copy Firebase project cofiguration
      1. Copy firebase config values to .env file
      2. Copy service account key to FIREBASE_SERVICE_ACCOUNT_KEY repository secret
    3. Setup Firebase Realtime database rules:
      {
        "rules": {
          "room": {
            "$room_id": {
              ".read": true,
              ".write": true
            }
          },
          "$other": {
            ".read": false,
            ".write": false
          }
        }
      }
    4. Add domain where you're going to host the website to "Authorized Domains" section of "Authentication"
  2. (optional) Setup Google Analytics (should be created with Firebase)
    1. Copy Google Analytics meashurement ID to .env file
  3. (optional) Setup Sentry account and create Svelte project
  4. Copy Sentry DSN value to .env file
  5. Create ENV_FILE_CONTENT repository variable and copy content of filled by you .env file in it

Local development

  1. Install docker
  2. Install dependencies:
    make dev_install

Now you can run the dev server locally:

make dev_serve

Or generate production bundle:

make prod_build_bundle

Deployment

CD

Each push to master triggers CD.yml pipeline that builds production bundle and published it on Cloudflare Pages. To make it work you must have

GitHub repository environment variables:

  • ENV_FILE_CONTENT with content of filled .env

GitHub repository secrets:

  • CLOUDFLARE_PROJECT_NAME - name of Cloudflare Pages project
  • CLOUDFLARE_ACCOUNT_ID - Cloudflare account id that owns the project
  • CLOUDFLARE_API_TOKEN - Cloudflare API token that have edit rights in the project

Auto clean up

Every 1 day of a month, teams last updated more than 31 days ago are deleted by clean-db.yml workflow. To make it work you must have:

GitHub repository environment variables:

  • ENV_FILE_CONTENT

GitHub repository secrets:

  • FIREBASE_SERVICE_ACCOUNT_KEY