From ad1395a5b9d307fc9cafc2ebf4ee71e33240db4b Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Tue, 15 Jun 2021 14:47:47 -0300 Subject: [PATCH 1/4] describe how to install a web instance --- documents/resources/web-instance.md | 65 +++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 documents/resources/web-instance.md diff --git a/documents/resources/web-instance.md b/documents/resources/web-instance.md new file mode 100644 index 0000000..7d676ea --- /dev/null +++ b/documents/resources/web-instance.md @@ -0,0 +1,65 @@ +Hosting your own LBRY Web Instance +---- + +## Preparing the SDK +### Building your own image + +Create a config.yaml file and modify as you need. This is a good start: +``` +allowed_origin: "*" +max_key_fee: "0.0 USD" +save_files: false +save_blobs: false +streaming_server: "0.0.0.0:5280" +api: "0.0.0.0:5279" +data_dir: /tmp +download_dir: /tmp +wallet_dir: /tmp +``` + +Note that it is required to have `streaming_server` and `api` set to public IPs. Or at least the same network where the app will be served. + +Now move the config file to `docker/webconf.yaml` and run: +``` +docker build -f docker/Dockerfile.web -t / . +docker push +``` + + +### Using pre-built docker image + +TODO: use official images + +This image comes with `save_blobs` and `save_files` to `false`, so it won't use disk. +``` +docker run -d -p :5279 -p :5280 vshyba/websdk +``` + +## Webapp + +Clone and install the app as described in the [lbry-desktop repo README](https://github.com/lbryio/lbry-desktop). +If you want to customize it further, follow the extra steps in `Customize the web app` section. Otherwise: +``` +git clone https://github.com/lbryio/lbry-desktop.git +yarn +cp .env.defaults .env +``` + +Configure .env as you need. This is a sample: +``` +SDK_API_PATH=http://:/ +... +WEB_SERVER_PORT= +LBRY_API_URL=http://disabled-api/ +LBRY_WEB_API=http://: +LBRY_WEB_STREAMING_API=http://: +LBRY_WEB_BUFFER_API=https://disabled +... +customize UI and other values as needed +``` + +Compile and run: +``` +NODE_ENV=production yarnpkg compile:web +nodejs web/index.js +``` -- 2.45.2 From 55d0a6df63d6237caf2303a53c7bbf18736dca07 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Tue, 15 Jun 2021 14:49:06 -0300 Subject: [PATCH 2/4] format title/description --- documents/resources/web-instance.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/documents/resources/web-instance.md b/documents/resources/web-instance.md index 7d676ea..c2ed4c8 100644 --- a/documents/resources/web-instance.md +++ b/documents/resources/web-instance.md @@ -1,4 +1,7 @@ -Hosting your own LBRY Web Instance +--- +title: Hosting your own LBRY Web Instance +description: Setting up an app instance as a webpage. +--- ---- ## Preparing the SDK -- 2.45.2 From 0e95e6dc728cce2ba174837fd3b84849d37f61d4 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Tue, 15 Jun 2021 16:04:49 -0300 Subject: [PATCH 3/4] move prebuilt image section up, add step to clone sdk repo --- documents/resources/web-instance.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/documents/resources/web-instance.md b/documents/resources/web-instance.md index c2ed4c8..6a0261e 100644 --- a/documents/resources/web-instance.md +++ b/documents/resources/web-instance.md @@ -5,8 +5,23 @@ description: Setting up an app instance as a webpage. ---- ## Preparing the SDK + + +### Using pre-built docker image + +TODO: use official images + +This image comes with `save_blobs` and `save_files` to `false`, so it won't use disk. +``` +docker run -d -p :5279 -p :5280 vshyba/websdk + ### Building your own image +Clone the SDK repo: +``` +git clone https://github.com/lbryio/lbry-sdk.git +``` + Create a config.yaml file and modify as you need. This is a good start: ``` allowed_origin: "*" @@ -27,15 +42,6 @@ Now move the config file to `docker/webconf.yaml` and run: docker build -f docker/Dockerfile.web -t / . docker push ``` - - -### Using pre-built docker image - -TODO: use official images - -This image comes with `save_blobs` and `save_files` to `false`, so it won't use disk. -``` -docker run -d -p :5279 -p :5280 vshyba/websdk ``` ## Webapp -- 2.45.2 From 34f7842505f25bd8296431bffd6a28bd5292a5cc Mon Sep 17 00:00:00 2001 From: Alex Grin Date: Tue, 15 Jun 2021 15:21:13 -0400 Subject: [PATCH 4/4] Update web-instance.md --- documents/resources/web-instance.md | 81 +++++++++++++++-------------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/documents/resources/web-instance.md b/documents/resources/web-instance.md index 6a0261e..63ee128 100644 --- a/documents/resources/web-instance.md +++ b/documents/resources/web-instance.md @@ -2,27 +2,59 @@ title: Hosting your own LBRY Web Instance description: Setting up an app instance as a webpage. --- ----- -## Preparing the SDK +Run your own instance of https://lbry.tv using Docker images. -### Using pre-built docker image +## Run the SDK -TODO: use official images +The LBRY SDK provides RPC and streaming endpoints to interact with the LBRY network. Web users will connect to it directly, so it must be web-accessible. You may have to open ports on your firewall. -This image comes with `save_blobs` and `save_files` to `false`, so it won't use disk. ``` -docker run -d -p :5279 -p :5280 vshyba/websdk +docker run -d -p 5279:5279 -p 5280:5280 vshyba/websdk +``` -### Building your own image +This image will not save files to disk. It has the `save_blobs` and `save_files` config options set to `false`. If you want to save files, see [Building your own SDK image](#building-your-own-sdk-image) below. + + +## Run the web app + +Clone and install the app as described in the [lbry-desktop repo README](https://github.com/lbryio/lbry-desktop). +If you want to customize it further, follow the extra steps in `Customize the web app` section. Otherwise: + +``` +git clone https://github.com/lbryio/lbry-desktop.git +yarn +cp .env.defaults .env +``` + +Configure .env with the following settings. They must match the SDK ports in the previous section. +``` +WEB_SERVER_PORT=8080 +SDK_API_PATH=http://localhost:5279 +LBRY_WEB_API=http://localhost:5279 +LBRY_WEB_STREAMING_API=http://localhost:5280 +LBRY_API_URL=http://disabled-api/ +LBRY_WEB_BUFFER_API=https://disabled +``` + +Compile and run +``` +NODE_ENV=production yarn compile:web +nodejs web/index.js +``` + + +## Building your own SDK image + +If you want to customize the SDK settings, you can Clone the SDK repo: ``` git clone https://github.com/lbryio/lbry-sdk.git ``` -Create a config.yaml file and modify as you need. This is a good start: +Create a `docker/webconf.yaml` file and modify as you need. This is a good start: ``` allowed_origin: "*" max_key_fee: "0.0 USD" @@ -35,40 +67,13 @@ download_dir: /tmp wallet_dir: /tmp ``` -Note that it is required to have `streaming_server` and `api` set to public IPs. Or at least the same network where the app will be served. +Note that it is required to have `streaming_server` and `api` set to user-accessible IPs. If you want this to be accessible on the open web, that means setting them to `0.0.0.0`. -Now move the config file to `docker/webconf.yaml` and run: + +To build the image, run: ``` docker build -f docker/Dockerfile.web -t / . docker push ``` -``` -## Webapp -Clone and install the app as described in the [lbry-desktop repo README](https://github.com/lbryio/lbry-desktop). -If you want to customize it further, follow the extra steps in `Customize the web app` section. Otherwise: -``` -git clone https://github.com/lbryio/lbry-desktop.git -yarn -cp .env.defaults .env -``` - -Configure .env as you need. This is a sample: -``` -SDK_API_PATH=http://:/ -... -WEB_SERVER_PORT= -LBRY_API_URL=http://disabled-api/ -LBRY_WEB_API=http://: -LBRY_WEB_STREAMING_API=http://: -LBRY_WEB_BUFFER_API=https://disabled -... -customize UI and other values as needed -``` - -Compile and run: -``` -NODE_ENV=production yarnpkg compile:web -nodejs web/index.js -``` -- 2.45.2