Skip to content

Latest commit

 

History

History
196 lines (131 loc) · 5.82 KB

developer-guide.md

File metadata and controls

196 lines (131 loc) · 5.82 KB
title navWeight
Developer Guide
-15

Developer Guide

See Node setup on the system for prereq.

Example Google Drive Shared Folder

Node setup on the system

using OS

curl -sL https://deb.nodesource.com/setup_20.x | sudo bash -
sudo apt install nodejs

If you wish to support multiple versions, add n

sudo npm install -g n
sudo n 20.10.0

Version Strategy

Install locally

Copy and adjust .env.example .env

sudo apt install libkrb5-dev libssh2-1-dev

npm install

wikigdrive --workdir ~/wikigdrive --service_account ~/workspaces/mieweb/wikigdrive-with-service-account.json --share_email [email protected] server 3000

Running locally with docker

export VOLUME_DATA=~/wikigdrive
export VOLUME_PREVIEW=~/wikigdrive_html

# Create some dir for wikigdrive data
mkdir -p $VOLUME_DATA
# Create some dir for wikigdrive rendered html files
mkdir -p $VOLUME_PREVIEW

# Running zipkin is an option
docker run --name zipkin -d -p 9411:9411 --restart unless-stopped openzipkin/zipkin

# Build action runner
docker build -t wgd-action-runner apps/wgd-action-runner

# Build hugo docs
docker run \
        -v ~/workspaces/mieweb/wikiGDrive/hugo:/site \
        -v ~/workspaces/mieweb/wikiGDrive/website:/website \
        -v $VOLUME_PREVIEW/docs:/dist/hugo \
        --env CONFIG_TOML="/site/config/_default/config.toml" --env BASE_URL="https://localhost:3000" \
        wgd-action-runner /steps/step_render_hugo

# Build wikigdrive
docker build -t wikigdrive .

# Run wikigdrive
docker run --rm --user=$(id -u):$(getent group docker | cut -d: -f3) -it \
        -v $VOLUME_DATA:/srv/wikigdrive \
        -v $VOLUME_PREVIEW:$VOLUME_PREVIEW \
        -v $VOLUME_PREVIEW/docs:/usr/src/app/dist/hugo \
        -v ~/workspaces/mieweb/wikigdrive-with-service-account.json:/service_account.json \
        -v ~/workspaces/mieweb/wikiGDrive:/usr/src/app \
        -v /var/run/docker.sock:/var/run/docker.sock \
        -e VOLUME_DATA=$VOLUME_DATA \
        -e VOLUME_PREVIEW=$VOLUME_PREVIEW \
        --link zipkin:zipkin \
        --publish 127.0.0.1:3000:3000 \
        --publish 127.0.0.1:24678:24678 \
        --name wikigdrive-develop \
        wikigdrive \
        ./src/wikigdrive.sh --watch-path /usr/src/app/src --service_account /service_account.json --share_email [email protected] --workdir /srv/wikigdrive server 3000

# Stop wikigdrive
docker rm -f wikigdrive

# 24678 - vite hot reload port

Domain

  • wikigdrive.com (hosted by??)
  • DNS SERVER?

Authentication

Client ID for the Web Application Add-On / Authentication

Link to production's OAUTH configuration: https://console.cloud.google.com/apis/credentials/oauthclient/762352378313-3u5pagjnk24g9640a5j1bmlsvobtlq2k.apps.googleusercontent.com?project=wikigdrive

Stored in /home/wikigdrive/env.prod

This is for the Service Account

https://console.cloud.google.com/iam-admin/serviceaccounts/details/103184696095283927333?project=wikigdrive

Add On Service - Google MarketPlace

This is for configuring Google Apps and their Console to permit the Google Marketplace to the store.

See folder /apps/app-script in the sources

Runner

The Actions Runner runs on vps1.ovh.wikigdrive.com

wikiGDrive Server

ssh 184.175.182.25

Google Doc Setup Documentation

Developer Test

Production Docker

root@wgd-dev:~# docker exec -it wikigdrive-prod bash
wikigdrive --service_account /service_account.json  drives

Code Diagram src

Cool trick to watch changes as they happen in a document:

cd /var/lib/docker/volumes/wikiGDriveDevelop/_data/0APmwe3yIhGabUk9PVA
watch -d odt2txt 1WfXOsKmPgOtdsZxXdl6RpqMrlkQP2O1GrprnaFxK0oE.odt

Another cool trick to see diffs in images:

Zipkin telemetry setup

Start zipkin with:

docker run --name zipkin -d -p 9411:9411 --restart unless-stopped openzipkin/zipkin

Set app env var to:

ZIPKIN_URL=http://localhost:9411

Debugging

./src/wikigdrive.sh --inspect --workdir ~/wikigdrive --service_account ~/workspaces/mieweb/wikigdrive-with-service-account.json --share_email [email protected] server 3000

Chrome

Go to `chrome://inspect`

Visual Studio Code 1.10+

In the Debug panel, click the settings icon to open .vscode/launch.json. Select "Node.js" for initial setup.

JetBrains WebStorm and other JetBrains IDEs

Create a new Node.js debug configuration and hit Debug. --inspect will be used by default for Node.js 7+. To disable uncheck js.debugger.node.use.inspect in the IDE Registry. To learn more about running and debugging Node.js in WebStorm and other JetBrains IDEs, check out WebStorm online help.