diff --git a/Makefile b/Makefile index 64b763bbd..e4b763731 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,10 @@ BASH ?= $(shell command -v bash 2> /dev/null) # Development SHIORI_DIR ?= dev-data +# Testing +GO_TEST_FLAGS ?= -v -race -count=1 -covermode=atomic -coverprofile=coverage.out +GOTESTFMT_FLAGS ?= + # Build CGO_ENABLED ?= 0 BUILD_TIME := $(shell date -u +%Y%m%d.%H%M%S) diff --git a/docs/CLI.md b/docs/CLI.md new file mode 100644 index 000000000..170a471a1 --- /dev/null +++ b/docs/CLI.md @@ -0,0 +1,48 @@ +Content +--- + + + +- [Add bookmark](#add-bookmark) + + + +Add bookmark +--- + +To add bookmark with CLI you can use `shiori add`. + +Shiori has flags to add bookmark: `shiori add --help` + +``` +Bookmark the specified URL + +Usage: + shiori add url [flags] + +Flags: + -e, --excerpt string Custom excerpt for this bookmark + -h, --help help for add + --log-archival Log the archival process + -a, --no-archival Save bookmark without creating offline archive + -o, --offline Save bookmark without fetching data from internet + -t, --tags strings Comma-separated tags for this bookmark + -i, --title string Custom title for this bookmark + +Global Flags: + --log-caller logrus report caller or not + --log-level string set logrus loglevel (default "info") + --portable run shiori in portable mode + --storage-directory string path to store shiori data +``` + +Examples: + +Add url: +`shiori add https://example.com` + +Add url with tags: +`shiori add https://example.com -t "example-1,example-2"` + +Add url with custom title: +`shiori add https://example.com --title "example example"` diff --git a/docs/Installation.md b/docs/Installation.md index 136d0028f..6bde29fc0 100644 --- a/docs/Installation.md +++ b/docs/Installation.md @@ -2,13 +2,18 @@ There are several installation methods available : -- [Using Precompiled Binary](#using-precompiled-binary) -- [Building From Source](#building-from-source) -- [Using Docker Image](#using-docker-image) +- [Supported](#supported) + - [Using Precompiled Binary](#using-precompiled-binary) + - [Building From Source](#building-from-source) + - [Using Docker Image](#using-docker-image) +- [Community provided](#community-provided) + - [Using Kubernetes manifests](#using-kubernetes-manifests) -## Using Precompiled Binary +## Supported + +### Using Precompiled Binary Download the latest version of `shiori` from [the release page](https://github.com/go-shiori/shiori/releases/latest), then put it in your `PATH`. @@ -28,7 +33,7 @@ source $HOME/.profile On Windows, you can simply set the `PATH` by using the advanced system settings. -## Building From Source +### Building From Source Shiori uses Go module so make sure you have version of `go >= 1.14.1` installed, then run: @@ -36,7 +41,7 @@ Shiori uses Go module so make sure you have version of `go >= 1.14.1` installed, go get -u -v github.com/go-shiori/shiori ``` -## Using Docker Image +### Using Docker Image To use Docker image, you can pull the latest automated build from Docker Hub : @@ -49,3 +54,110 @@ If you want to build the Docker image on your own, Shiori already has its [Docke ``` docker build -t shiori . ``` + +## Community provided + +Below this there are other ways to deploy Shiori which are not supported by the team but were provided by the community to help others have a starting point. + +### Using Kubernetes manifests + +If you're self-hosting with a Kubernetes cluster, here are manifest files that +you can use to deploy Shiori: + +`deploy.yaml`: + +```yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: shiori + labels: + app: shiori +spec: + replicas: 1 + selector: + matchLabels: + app: shiori + template: + metadata: + labels: + app: shiori + spec: + volumes: + - name: app + hostPath: + path: /path/to/data/dir + containers: + - name: shiori + image: ghcr.io/go-shiori/shiori:latest + command: ["/usr/bin/shiori", "serve", "--webroot", "/shiori"] + imagePullPolicy: Always + ports: + - containerPort: 8080 + volumeMounts: + - mountPath: /srv/shiori + name: app + env: + - name: SHIORI_DIR + value: /srv/shiori + - name: HTTP_ROOT_PATH + value: "/shiori" +``` + +Here we are using a local directory to persist Shiori's data. You will need +to replace `/path/to/data/dir` with the path to the directory where you want +to keep your data. Since we haven't configured a database in particular, +Shiori will use SQLite. I don't think Postgres or MySQL is worth it for +such an app, but that's up to you. If you decide to use SQLite, I strongly +suggest to keep `replicas` set to 1 since SQLite usually allows at most +one writer to proceed concurrently. + +Also, not that we're serving the app on the `/shiori` suffix. This is +only necessary if you want to access Shiori with an URL that looks like: +`http://your_domain_name/shiori`. This is also why we override the container's +command: to pass the webroot. If you want to use such suffix, you'll probably +need to deploy an ingress as well: + +`ingress.yaml`: + +```yaml +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: shiori +spec: + ingressClassName: nginx + rules: + - http: + paths: + - path: /shiori + pathType: Prefix + backend: + service: + name: shiori + port: + number: 8080 +``` + +Finally, here is the service's config: + +`service.yaml` + +```yaml +apiVersion: v1 +kind: Service +metadata: + name: shiori +spec: + type: NodePort + selector: + app: shiori + ports: + - protocol: TCP + port: 8080 + targetPort: 8080 + nodePort: 32654 +``` + +I'm using the NodePort type for the service so I can access it easily on +my local network, but it's not necessary if you setup the ingress. diff --git a/docs/index.md b/docs/index.md index 295d60024..060793682 100644 --- a/docs/index.md +++ b/docs/index.md @@ -7,6 +7,7 @@ Shiori is a simple bookmarks manager written in Go language. Intended as a simpl - [API](./API.md) (Deprecated) - [APIv1](./APIv1.md) ([What is this?](https://github.com/go-shiori/shiori/issues/640)) - [Contributing](./Contribute.md) +- [Command Line Interface](./CLI.md) - [Configuration](./Configuration.md) - [FAQ](./Frequently-Asked-Question.md) - [Installation](./Installation.md) diff --git a/docs/swagger/docs.go b/docs/swagger/docs.go index 75d21c634..ef6f0d9b8 100644 --- a/docs/swagger/docs.go +++ b/docs/swagger/docs.go @@ -126,7 +126,7 @@ const docTemplate = `{ } } }, - "/api/v1/bookmaeks/cache": { + "/api/v1/bookmarks/cache": { "put": { "produces": [ "application/json" diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index 88c337375..928908956 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -115,7 +115,7 @@ } } }, - "/api/v1/bookmaeks/cache": { + "/api/v1/bookmarks/cache": { "put": { "produces": [ "application/json" diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 89b0b4c05..611cff6df 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -195,7 +195,7 @@ paths: summary: Refresh a token for an account tags: - Auth - /api/v1/bookmaeks/cache: + /api/v1/bookmarks/cache: put: parameters: - description: Update Cache Payload diff --git a/internal/http/routes/api/v1/bookmarks.go b/internal/http/routes/api/v1/bookmarks.go index 7b7da45d7..78da720e0 100644 --- a/internal/http/routes/api/v1/bookmarks.go +++ b/internal/http/routes/api/v1/bookmarks.go @@ -204,7 +204,7 @@ func NewBookmarksPIRoutes(logger *logrus.Logger, deps *config.Dependencies) *Boo // @Produce json // @Success 200 {object} model.Bookmark // @Failure 403 {object} nil "Token not provided/invalid" -// @Router /api/v1/bookmaeks/cache [put] +// @Router /api/v1/bookmarks/cache [put] func (r *BookmarksAPIRoutes) updateCache(c *gin.Context) { ctx := context.NewContextFromGin(c) if !ctx.UserIsLogged() { diff --git a/internal/view/assets/js/component/bookmark.js b/internal/view/assets/js/component/bookmark.js index 97f3560bc..9b4c6a36c 100644 --- a/internal/view/assets/js/component/bookmark.js +++ b/internal/view/assets/js/component/bookmark.js @@ -4,7 +4,7 @@ var template = ` v-if="editMode" @click="selectBookmark"> - +

{{title}} @@ -19,7 +19,7 @@ var template = `

- + {{hostnameURL}}