Skip to content

Commit

Permalink
Update developer guide
Browse files Browse the repository at this point in the history
  • Loading branch information
ggodlewski committed Aug 11, 2024
1 parent e11a6e6 commit 9aa3967
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 17 deletions.
7 changes: 3 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
CLIENT_ID=
CLIENT_SECRET=

RENDER_IMAGE=hugo_render
VOLUME_DATA=/home//wikigdrive
VOLUME_PREVIEW=/home//wikigdrive-preview
DOMAIN=localhost
VOLUME_DATA=/srv/wikigdrive
VOLUME_PREVIEW=/srv/www
DOMAIN=http://localhost:3000
17 changes: 9 additions & 8 deletions src/wikigdrive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,21 @@ cd $MAIN_DIR

POSITIONAL_ARGS=()
CMD=""
INSPECT=""
OPTS=""

ORIG_ARGS=$@

while [[ $# -gt 0 ]]; do
case $1 in
--inspect)
INSPECT="$1"
--inspect | watch)
OPTS="$OPTS $1"
shift # past argument
;;
--watch-path)
OPTS="$OPTS $1 $2"
shift # past argument
shift # past value
;;
--link_mode | --workdir | --drive | --debug | --client_id | --client_secret | --service_account | --share_email | --server_port | --transform_subdir)
POSITIONAL_ARGS+=("$1") # save positional arg1
POSITIONAL_ARGS+=("$2") # save positional arg2
Expand All @@ -43,8 +48,4 @@ if [[ ! -f "$MAIN_DIR/src/cli/wikigdrive-$CMD.ts" ]]; then
CMD="usage"
fi

if test "$INSPECT" = "--inspect"; then
/usr/bin/env node --inspect --no-warnings --enable-source-maps --experimental-specifier-resolution=node --loader ts-node/esm $MAIN_DIR/src/cli/wikigdrive-$CMD.ts $ORIG_ARGS
else
/usr/bin/env node --no-warnings --enable-source-maps --experimental-specifier-resolution=node --loader ts-node/esm $MAIN_DIR/src/cli/wikigdrive-$CMD.ts $ORIG_ARGS
fi
/usr/bin/env node $OPTS --no-warnings --enable-source-maps --experimental-specifier-resolution=node --loader ts-node/esm $MAIN_DIR/src/cli/wikigdrive-$CMD.ts $ORIG_ARGS
29 changes: 24 additions & 5 deletions website/docs/developer-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ See [Node setup on the system](#node-setup-on-the-system) for prereq.
## using OS

```
curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -
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 16.15.0
sudo n 20.10.0
```

## Version Strategy
Expand All @@ -44,23 +44,42 @@ wikigdrive --workdir ~/wikigdrive --service_account ~/workspaces/mieweb/wikigdri
## Running locally with docker

```
# Create some dir for wikigdrive data
mkdir ~/wikigdrive
# Create some dir for wikigdrive rendered html files
mkdir ~/wikigdrive_html/docs -p
# 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 ~/wikigdrive_html/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) -it \
-v /data/wikigdrive:/data \
-v ~/wikigdrive:/srv/wikigdrive \
-v ~/wikigdrive_html/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 \
--link zipkin:zipkin \
--publish 127.0.0.1:3000:3000 \
--publish 127.0.0.1:24678:24678 \
wikigdrive \
./src/wikigdrived.sh --service_account /service_account.json --share_email mie-docs-wikigdrive@wikigdrive.iam.gserviceaccount.com --workdir /data server 3000
./src/wikigdrive.sh --watch-path /usr/src/app/src --service_account /service_account.json --share_email mie-docs-wikigdrive@wikigdrive.iam.gserviceaccount.com --workdir /srv/wikigdrive server 3000
# Stop wikigdrive
docker rm -f wikigdrive
# 24678 - vite hot reload port
Expand Down Expand Up @@ -148,7 +167,7 @@ ZIPKIN_URL=http://localhost:9411
## Debugging

```
./src/wikigdrived.sh --inspect --workdir ~/wikigdrive --service_account ~/workspaces/mieweb/wikigdrive-with-service-account.json --share_email mie-docs-wikigdrive@wikigdrive.iam.gserviceaccount.com server 3000
./src/wikigdrive.sh --inspect --workdir ~/wikigdrive --service_account ~/workspaces/mieweb/wikigdrive-with-service-account.json --share_email mie-docs-wikigdrive@wikigdrive.iam.gserviceaccount.com server 3000
```

Chrome
Expand Down

0 comments on commit 9aa3967

Please sign in to comment.