Skip to content

Commit

Permalink
feat(project): add github pages deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
jwpradm committed Dec 8, 2021
1 parent c711d00 commit 8484572
Show file tree
Hide file tree
Showing 14 changed files with 2,624 additions and 24,672 deletions.
36 changes: 20 additions & 16 deletions docs/build-from-source.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,56 @@
# Build JW OTT Webapp from the Source Code

In order to create a deployable version of JW OTT Webapp, follow these instructions.
In order to create a deployable version of JW OTT Webapp, follow these instructions in this document.

## Prerequisites

The following tools are needed to start building JW OTT Webapp. Follow the instructions on the links below.
The following tools are needed to start building JW OTT Webapp. Follow the instructions on the links below:

- [GIT](https://git-scm.com/)
- [Node.js](https://nodejs.org/)
- [Yarn](https://yarnpkg.com/)

## Clone Repository
<br />

Clone this repository on your local machine using the following commands:
## Build the JW OTT Webapp

1. Clone the **jw-ott-webapp** repository on your local machine.

```shell
$ cd ~/

$ git clone https://github.com/jwplayer/jw-ott-webapp.git

$ cd jw-ott-webapp
```

## Install dependencies
<br />

Dependencies are installed using Yarn. Use the following command to install all required dependencies. This may take a few minutes.
2. Install the required dependencies. Optional dependencies include packages that are not necessary to build the project. These optional dependencies can be safely ignored.

```shell
$ yarn
$ yarn --ignore-optional
```

## Development server
> **NOTE**: Some of the [easy deployments](./easy-deployments.md) instructions require installing these optional dependencies. Use the `yarn` command to install all dependencies. The `yarn` command can be run even if `yarn --ignore-optional` has been previously run.
To start a local development server, run the following command.
<br />

3. Start the local development server.

```shell
$ yarn start
```

> **Note:** the development server isn't optimized for production usage. Use this only for development.
> **NOTE:** Only use the development server for development purposes. The development server is not optimized for production usage.
## Build deployable version
<br />

To build a deployable version of the JW OTT Webapp source code, run the following command.
4. Build a deployable version of the JW OTT Webapp source code.<br /><br />This command creates a new folder in the projects root folder named **build**. This folder can be uploaded to any hosting provider.

```shell
$ yarn build
```
<br />

This command results in a new folder in the projects root folder named `build`. This folder can be uploaded to any hosting provider.

If you haven't made any changes to the JW OTT Webapp configuration or source code, you are now ready to do so. Don't forget to run the `yarn build` command after making changes though.

If you have not made any changes to the JW OTT Webapp configuration or source code, changes can now be made. Be sure to run the `yarn build` command after making any changes.
49 changes: 49 additions & 0 deletions docs/easy-deployments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Easy Deployments

The instructions in this document will help you deploy your fork of the ott-web-app to some of the popular web application hosting platforms.

<br />

## Prerequisites

- [Fork this repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo).
- Follow the instructions in [docs/build-from-source.md](docs/build-from-source.md).

<br />

## Supported Platforms

- [GitHub Pages](#github-pages): A free, easy-to-use [web hosting service](https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages)

<br />

## Github Pages

### Technical Limitations

Github pages have some [usage limits](https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages#usage-limits). In general terms, approximately **20.000 NEW** users can visit your app each month<sup>1</sup>. If more than 20.000 users visit your app each month, you should consider other paid hosting solutions.

<sup>1</sup> *Based on 100GB Github Pages bandwidth / 5MB ott-web-app build dir size and assuming perfect browser cache by all visitors.*

<br />

### Usage Instructions

1. Confirm that you can [build this project from source](./build-from-source.md). Be sure to install optional dependencies.
2. Enable the [Github Pages feature](https://docs.github.com/en/pages/getting-started-with-github-pages) for the `gh-pages` branch in your repository.
3. Run `yarn deploy:github`. Be sure to follow the instructions that appear on the screen.
4. (Optional) If you need a customization option, review `yarn deploy:github --help`.

<br />

### Technical Documentation

The `yarn deploy:github` command executes a simple nodejs script located in `scripts/deploy-github.js`. The script executes the following commands:

1. Runs `yarn build` with `SNOWPACK_PUBLIC_BASE_URL` envvar.<br/><br />That envvar is used to set the URL location of the project. By default if `SNOWPACK_PUBLIC_BASE_URL` is empty, the value will be based on the `git remote get-url origin` command. You can also pass your own `SNOWPACK_PUBLIC_BASE_URL` envvar by running `SNOWPACK_PUBLIC_BASE_URL=/my-base/ yarn deploy:github`.
2. Runs `yarn gh-pages -o origin -d build`.<br /><br />You can change the remote from *origin* to *myremote* by running `yarn deploy:github --github-remote=myremote`. The `yarn deploy:github` command uses the GitHub remote to compute the default value for `SNOWPACK_PUBLIC_BASE_URL`.

<br />

>**TIP**: Before each of the previous steps, the script will ask if you want to continue. You can prevent these confirmation inquiries by providing `--build` or `--deploy` arguments to `yarn deploy:github`.
Loading

0 comments on commit 8484572

Please sign in to comment.