From 1854348f5116a60a910615103d069e12e8e2cb02 Mon Sep 17 00:00:00 2001 From: Alex Grin Date: Fri, 22 Oct 2021 10:40:02 -0400 Subject: [PATCH] Created Web app deployment (markdown) --- Web-app-deployment.md | 168 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 Web-app-deployment.md diff --git a/Web-app-deployment.md b/Web-app-deployment.md new file mode 100644 index 0000000..6edde23 --- /dev/null +++ b/Web-app-deployment.md @@ -0,0 +1,168 @@ +- [ ] Deploys from ansible +- [ ] PRODUCTION Copy .env to root of lbry-desktop repo + + ```jsx + # Base config + MATOMO_URL=https://analytics.lbry.com/ + MATOMO_ID=10 + WEBPACK_WEB_PORT=9090 + WEBPACK_ELECTRON_PORT=9091 + WEB_SERVER_PORT=1337 + LBRY_WEB_API=https://api.lbry.tv + LBRY_WEB_STREAMING_API=https://cdn.lbryplayer.xyz + WELCOME_VERSION=1.0 + # Custom Site info + DOMAIN=odysee.com + URL=https://odysee.com + KNOWN_APP_DOMAINS=open.lbry.com,lbry.tv,lbry.lat,odysee.com + + # UI + SITE_TITLE=odysee.com + SITE_NAME=Odysee + SITE_DESCRIPTION=Launch your own channel | Watch and share videos + LOGO_TITLE=odysee + AUTO_FOLLOW_CHANNELS= + ENABLE_COMMENT_REACTIONS=true + ENABLE_FILE_REACTIONS=true + ENABLE_CREATOR_REACTIONS=true + ENABLE_NO_SOURCE_CLAIMS=true + SHOW_ADS=false + CUSTOM_HOMEPAGE=true + + # IMAGES + OG_TITLE_SUFFIX=| odysee.com + OG_HOMEPAGE_TITLE=odysee.com + OG_IMAGE_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/odysee-og/e61572f5d41d236f694b9d0235f68f7cd5438fc0/3fafaa + YRBL_HAPPY_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/spaceman-happy/a544732cc5288ef392432d00816775c85922c608/ed4049 + YRBL_SAD_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/spaceman-sad/d19dc998af88c156aebb2657439774d80070b413/f75e86 + # LOGO_IMAGE + SITE_CANONICAL_URL=odysee.com + SIMPLE_SITE=true + # LOCALE + DEFAULT_LANGUAGE=en + ``` + +- [ ] DEV INSTANCE + +```jsx +# Base config +MATOMO_URL=https://analytics.lbry.com/ +MATOMO_ID=4 +WEBPACK_WEB_PORT=9090 +WEBPACK_ELECTRON_PORT=9091 +WEB_SERVER_PORT=1337 +LBRY_WEB_API=https://api.lbry.tv +LBRY_WEB_STREAMING_API=https://cdn.lbryplayer.xyz +WELCOME_VERSION=1.0 +# Custom Site info +DOMAIN=odysee.com +URL=https://odysee.com +KNOWN_APP_DOMAINS=open.lbry.com,lbry.tv,lbry.lat,odysee.com + +# UI +SITE_TITLE=odysee.com +SITE_NAME=Odysee +SITE_DESCRIPTION=Launch your own channel | Watch and share videos +LOGO_TITLE=odysee +AUTO_FOLLOW_CHANNELS= +ENABLE_COMMENT_REACTIONS=true +ENABLE_FILE_REACTIONS=true +ENABLE_CREATOR_REACTIONS=true +ENABLE_NO_SOURCE_CLAIMS=true +SHOW_ADS=false +# custom homepage true if you have installed the item below +CUSTOM_HOMEPAGE=false + +# IMAGES +OG_TITLE_SUFFIX=| odysee.com +OG_HOMEPAGE_TITLE=odysee.com +OG_IMAGE_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/odysee-og/e61572f5d41d236f694b9d0235f68f7cd5438fc0/3fafaa +YRBL_HAPPY_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/spaceman-happy/a544732cc5288ef392432d00816775c85922c608/ed4049 +YRBL_SAD_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/spaceman-sad/d19dc998af88c156aebb2657439774d80070b413/f75e86 +# LOGO_IMAGE +SITE_CANONICAL_URL=odysee.com +SIMPLE_SITE=true +# LOCALE +DEFAULT_LANGUAGE=en +``` + +- [ ] Clone the odysee-homepages repo as lbry-homepages + + ```jsx + git clone git@github.com:lbryio/odysee-homepages.git lbry-homepages + ``` + +- [ ] ssh-keygen on server and add deploy key to odysee-homepages repo (id_rsa.pub) + + ```jsx + ssh-keygen + ``` + + [](https://github.com/lbryio/odysee-homepages/settings/keys) + +- [ ] set the allow all robots.txt in lbry-desktop/custom/ + + ```jsx + cp ~/lbry-desktop/custom/robots.allowall ~/lbry-desktop/custom/robots.txt + ``` + +- [ ] Force rebuild + + ```jsx + cd lbry-desktop + git reset --hard HEAD~1 + cd .. + ./update_lbry_desktop.sh + ``` + + - [ ] Copy the update_lbry_desktop.sh script if not in ansible yet + + ```jsx + #!/bin/bash + # THIS FILE IS MANAGED BY ANSIBLE. Dont edit it by hand. + HOMEPAGE_CHANGED='false' + BRANCH="odysee" + if [ -e /home/lbry/lbry-desktop/.env ]; + then + export $(cat /home/lbry/lbry-desktop/.env | grep -v '#' | grep CUSTOM_HOMEPAGE | xargs) + else + CUSTOM_HOMEPAGE='false' + fi + if [ -d "/home/lbry/lbry-homepages/" ] && [ "$CUSTOM_HOMEPAGE" == 'true' ]; then + cd "/home/lbry/lbry-homepages" + HOMEPAGE_BRANCH="master" + CUR_HP_HEAD=$(git rev-parse HEAD) + git fetch --all 2>&1 && git reset --hard "origin/$HOMEPAGE_BRANCH" + NEW_HP_HEAD=$(git rev-parse HEAD) + cp /home/lbry/lbry-homepages/homepages/* /home/lbry/lbry-desktop/custom/homepages/ + cd "/home/lbry" + if [ "$CUR_HP_HEAD" != "$NEW_HP_HEAD" ]; then + HOMEPAGE_CHANGED='true'; + fi + fi + cd "/home/lbry/lbry-desktop" || exit 1; + CUR_HEAD=$(git rev-parse HEAD) + CUR_BRANCH=$(git rev-parse --abbrev-ref HEAD) + if [ "$CUR_BRANCH" != "$BRANCH" ]; then + git reset --hard HEAD && git checkout "$BRANCH" + fi + git fetch --all 2>&1 && git reset --hard "origin/$BRANCH" + NEW_HEAD=$(git rev-parse HEAD) + if [ "$CUR_HEAD" != "$NEW_HEAD" ] || [ "$HOMEPAGE_CHANGED" == 'true' ]; then + echo changed + #rm -r dist + yarn >/dev/null + NODE_ENV=production MOONPAY_SECRET_KEY="sk_live_nyRjUsClNiruRvyB2BKYnIpP9Vp7ue" yarn compile:web --display errors-only >/dev/null + pm2 restart ecosystem.config.js + curl -s -X POST --data-urlencode \ + "payload={\"channel\": \"#lbrytv-status\", \"text\": \"Deployed new version for lbry.tv $NEW_HEAD ($BRANCH)\"}" \ + {{slack_update_hook}} + curl -X POST "https://api.cloudflare.com/client/v4/zones/{{cloudflare_zone}}/purge_cache" \ + -H "X-Auth-Email: niko@lbry.io" \ + -H "X-Auth-Key: {{cloudflare_api_token}}" \ + -H "Content-Type: application/json" \ + --data '{"purge_everything":true}' + fi + ``` + + - [ ] update the "payload=..." line of the above config to say your instance name instead of 'lbry.tv' \ No newline at end of file