Skip to content
This repository was archived by the owner on Oct 13, 2024. It is now read-only.

Demo Deployment

samhuk edited this page Mar 10, 2023 · 5 revisions

You can build and deploy Exhibitor as a static site to demo your component library. You can see a live example of this over at https://demo.exhibitor.dev and the repository that is used for it over at https://github.com/samhuk/exhibitor-demo.

NOTE: This feature is in Alpha status and so production/important use is discouraged.

Prerequisites

  • Ensure that you have the latest package store data
    • Linux-based OS: sudo apt update && sudo apt upgrade
    • Windows OS: [Can likely skip this]
  • Git
  • Node.js
    • Linux-based OS:
      • Install Node.js (this will likely be an old outdated version): sudo apt install nodejs
      • Install Node Version Manager (NVM). See guidance at: https://github.com/nvm-sh/nvm
      • Re-source your .profile shell startup scripts (or restart your shell)
      • See list of available Node.js versions: nvm list-remote
      • Download desired Node.js version: nvm install {version string}
      • Use desired Node.js version: nvm use {version string}
    • Windows OS:
  • Docker

Repository Setup

  • Clone your component library (with Exhibitor) code repository onto the host machine you would like to deploy the demo instance on. For example: git clone https://github.com/your-user-name/your-repo-name.git
  • cd into your new cloned repository directory: cd your-repo-name
  • Download your repository's NPM dependencies: npm install
  • It is advised to have a demo npm script that runs the demo Exhibitor CLI script with your desired arguments. For example:
      "scripts": {
        "exh-demo": "exhibitor demo --config=./exh-configs/exh.config.json"
      }

HTTP-only Deployment

  • Ensure that you have demo.enableHttps as false in your Exhibitor configuration file. For example:
    "demo": {
      "enableHttps": false
    }
  • Build the demo deployment files: npx exhibitor demo
    • By default, ./.exh/demo will now be populated with all of the files necessary to deploy.
  • Build the Docker images: sudo docker compose -f ./.exh/demo/docker-compose.yaml build
  • Run it: sudo docker compose -f ./.exh/demo/docker-compose.yaml up
  • By default, the Exhibitor Site will now be accessible at http://localhost:80. If you are deploying to a VM (say in the cloud), ensure that port 80 ingress and egress network traffic is not blocked.

Deploying with HTTPS

  • At the moment, only Let's Encrypt is used.
  • Ensure that you have a HTTP-only version of your site up and publicly accessible (i.e. by Let's Encrypt). See the previous section HTTP-only Deployment for guidance.
  • In your Exhibitor configuration file, set demo.enableHttps to true and provide the domain(s) you would like to register your HTTPS certificate for. For example:
    "demo": {
      "enableHttps": true,
      "httpsDomains": ["demo.example.org"],
    }
    • Note: Failure to specify at least one entry for httpsDomains will result in a configuration validation error.
  • Build the demo deployment files: npx exhibitor demo
  • Run certbot with your domain(s) as the last argument: sudo docker compose -f .exh/demo/docker-compose.certbot.yaml run --rm certbot certonly --webroot --webroot-path /var/www/certbot/ -d demo.example.org
    • Certbot will contact Let's Encrypt and request a new HTTPS certificate for your domain. If successful, then by default your HTTPS certificate details will be saved to ./.exh/demo/certbot.
  • Build the Docker images: sudo docker compose -f ./.exh/demo/docker-compose.yaml build
  • Run it: sudo docker compose -f ./.exh/demo/docker-compose.yaml up
  • By default, the Exhibitor Site will now be accessible at http://localhost:80 and https://localhost:443. If you are deploying to a VM (say in the cloud), ensure that port 80 and port 443 ingress and egress network traffic is not blocked.

Clone this wiki locally