From 59280953fff630935f6f9171e5f29fc6e5046392 Mon Sep 17 00:00:00 2001 From: Chengxun Lee <24319042+bclswl0827@users.noreply.github.com> Date: Mon, 18 Dec 2023 21:15:36 +0800 Subject: [PATCH] Add docs on headless mode --- .../AnyShake Observer/Development/headless.md | 40 ++++++++++--------- .../Development/src-build.md | 24 ++++++++++- .../Development/versioning.md | 5 --- docs/AnyShake Observer/questions.md | 8 ++-- docs/AnyShake Observer/versioning.md | 15 +++++++ 5 files changed, 63 insertions(+), 29 deletions(-) delete mode 100644 docs/AnyShake Observer/Development/versioning.md create mode 100644 docs/AnyShake Observer/versioning.md diff --git a/docs/AnyShake Observer/Development/headless.md b/docs/AnyShake Observer/Development/headless.md index 613f8a8..e9ae23b 100644 --- a/docs/AnyShake Observer/Development/headless.md +++ b/docs/AnyShake Observer/Development/headless.md @@ -4,26 +4,28 @@ sidebar_position: 3 # Headless Mode -For some reasons, you may want to run AnyShake Observer without its embedded frontend server. In this case, you can have AnyShake Observer provide only the back-end interface, hosting the front-end on Nginx, Apache or Caddy. +For some reasons, you may want to run AnyShake Observer without its web UI. In this case, you can have AnyShake Observer provide only the back-end APIs, hosting your own front-end dist on Nginx, Apache or Caddy. -## Nginx Configuration - -Here is an example of Nginx configuration, assuming that the AnyShake Observer is running on `http://localhost:8073`, your dist frontend root directory is `/var/www/html/anyshake`, the Nginx is listening on port `80` and the domain name is `localhost`. - -``` -TODO -``` - -The final URL will be `http://localhost/anyshake`. - -## Apache Configuration - -``` -TODO -``` - -## Caddy Configuration +To use AnyShake Observer in headless mode, you can set up a reverse proxy to forward requests to AnyShake Observer's back-end APIs. Assuming that your URL of AnyShake Observer is `https://127.0.0.1:8073`, and you want to host your front-end dist on `https://example.org`, an Nginx example is given as follows: ``` -TODO +server { + listen 80; + server_name example.org; + + location / { + index index.html; + root /path/to/your/dist; + } + + location /api { + proxy_pass https://127.0.0.1:8073/api; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header Connection "upgrade"; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } +} ``` diff --git a/docs/AnyShake Observer/Development/src-build.md b/docs/AnyShake Observer/Development/src-build.md index 732b27d..44c0210 100644 --- a/docs/AnyShake Observer/Development/src-build.md +++ b/docs/AnyShake Observer/Development/src-build.md @@ -28,9 +28,31 @@ If you don't have `git` installed, you can download the source code as a `.zip` - [github.com/anyshake/observer/archive/refs/heads/master.zip](https://github.com/anyshake/observer/archive/refs/heads/master.zip) - [github.com/anyshake/observer/archive/refs/heads/master.tar.gz](https://github.com/anyshake/observer/archive/refs/heads/master.tar.gz) +## Build Docs + +Install `swag` by running `go install` command. + +```bash +$ go install github.com/swaggo/swag/cmd/swag@latest +``` + +Check if `swag` is installed successfully. + +```bash +$ swag --version +swag version v1.16.2 +``` + +Enter the `docs` directory, use `swag init` to generate Swagger docs. + +```bash +$ cd docs +$ swag init -g ../cmd/main.go -d ../app,../server,../publisher -o ./ +``` + ## Build Frontend -Remove the `frontend/dist` to avoid conflicts. +Go back to the repository root directory, remove the `frontend/dist` to avoid conflicts. ``` bash $ rm -rf frontend/dist diff --git a/docs/AnyShake Observer/Development/versioning.md b/docs/AnyShake Observer/Development/versioning.md deleted file mode 100644 index 096faab..0000000 --- a/docs/AnyShake Observer/Development/versioning.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -sidebar_position: 5 ---- - -# Software Versioning diff --git a/docs/AnyShake Observer/questions.md b/docs/AnyShake Observer/questions.md index 3ddd1f0..2fdd5ab 100644 --- a/docs/AnyShake Observer/questions.md +++ b/docs/AnyShake Observer/questions.md @@ -6,21 +6,21 @@ sidebar_position: 5 Listed below are some frequently asked questions about AnyShake Observer. -## How to upgrade +## How to Upgrade To update AnyShake Observer, you can always get the latest version from [github.com/anyshake/observer/releases/latest](https://github.com/anyshake/observer/releases/latest) -## I have a feature request +## I Have a Feature Request If you have a feature request, please [open an issue](https://github.com/anyshake/observer/issues/new/choose) on GitHub, choose the `Feature Request` template and fill in the form. However, we may not be able to implement all feature requests, so please don't be disappointed if your feature request is rejected. -## AnyShake Observer crashes +## AnyShake Observer Crashes If you encounter a crash, please copy the log and [open an issue](https://github.com/anyshake/observer/issues/new/choose) on GitHub, choose the `Bug Report` template and fill in the form. -## Backward compatibility +## Backward Compatibility 1. For configuration files, backward compatibility applies to at least one major version. For example, AnyShake Observer v1.x.x supports configuration files from v2.x.x. 2. For data (Database, MiniSEED, SAC, etc.), backward compatibility applies to at least one minor version. For example, AnyShake Observer v2.1.x supports data from v2.0.x. diff --git a/docs/AnyShake Observer/versioning.md b/docs/AnyShake Observer/versioning.md new file mode 100644 index 0000000..2abb32e --- /dev/null +++ b/docs/AnyShake Observer/versioning.md @@ -0,0 +1,15 @@ +--- +sidebar_position: 6 +--- + +# Versioning + +AnyShake Observer follows the [Semantic Versioning (SemVer)](https://semver.org) principles. + +That means that with a version number x.y.z: + + - When releasing critical bug fixes, we make a patch release by changing the z number (ex: 2.1.2 to 2.1.3). + - When releasing new features or non-critical fixes, we make a minor release by changing the y number (ex: 2.1.2 to 2.2.0). + - When releasing breaking changes, we make a major release by changing the x number (ex: 2.1.2 to 3.0.0). + +Major releases can also contain new features, and any release can include bug fixes, minor releases are the most common type of release.