github.com/soulteary/pocket-bookcase@v0.0.0-20240428065142-0b5a9a0fc98a/docs/Installation.md (about)

     1  There are several installation methods available :
     2  
     3  <!-- TOC -->
     4  
     5  - [Supported](#supported)
     6    - [Using Precompiled Binary](#using-precompiled-binary)
     7    - [Building From Source](#building-from-source)
     8    - [Using Docker Image](#using-docker-image)
     9  - [Community provided](#community-provided)
    10    - [Using Kubernetes manifests](#using-kubernetes-manifests)
    11  - [Managed Hosting](#managed-hosting)
    12    - [PikaPods](#pikapods)
    13  
    14  <!-- /TOC -->
    15  
    16  ## Supported
    17  
    18  ### Using Precompiled Binary
    19  
    20  Download the latest version of `shiori` from [the release page](https://github.com/soulteary/pocket-bookcase/releases/latest), then put it in your `PATH`.
    21  
    22  On Linux or MacOS, you can do it by adding this line to your profile file (either `$HOME/.bash_profile` or `$HOME/.profile`):
    23  
    24  ```
    25  export PATH=$PATH:/path/to/shiori
    26  ```
    27  
    28  Note that this will not automatically update your path for the remainder of the session. To do this, you should run:
    29  
    30  ```
    31  source $HOME/.bash_profile
    32  or
    33  source $HOME/.profile
    34  ```
    35  
    36  On Windows, you can simply set the `PATH` by using the advanced system settings.
    37  
    38  ### Building From Source
    39  
    40  Shiori uses Go module so make sure you have version of `go >= 1.14.1` installed, then run:
    41  
    42  ```
    43  go get -u -v github.com/soulteary/pocket-bookcase
    44  ```
    45  
    46  ### Using Docker Image
    47  
    48  To use Docker image, you can pull the latest automated build from Docker Hub :
    49  
    50  ```
    51  docker pull ghcr.io/soulteary/pocket-bookcase
    52  ```
    53  
    54  If you want to build the Docker image on your own, Shiori already has its [Dockerfile](https://github.com/soulteary/pocket-bookcase/blob/master/Dockerfile), so you can build the Docker image by running :
    55  
    56  ```
    57  docker build -t shiori .
    58  ```
    59  
    60  ## Community provided
    61  
    62  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.
    63  
    64  ### Using Kubernetes manifests
    65  
    66  If you're self-hosting with a Kubernetes cluster, here are manifest files that
    67  you can use to deploy Shiori:
    68  
    69  `deploy.yaml`:
    70  
    71  ```yaml
    72  apiVersion: apps/v1
    73  kind: Deployment
    74  metadata:
    75    name: shiori
    76    labels:
    77      app: shiori
    78  spec:
    79    replicas: 1
    80    selector:
    81      matchLabels:
    82        app: shiori
    83    template:
    84      metadata:
    85        labels:
    86          app: shiori
    87      spec:
    88        securityContext:
    89          runAsUser: 1000
    90          runAsGroup: 1000
    91          fsGroup: 1000
    92        volumes:
    93        - name: app
    94          hostPath:
    95            path: /path/to/data/dir
    96        containers:
    97        - name: shiori
    98          image: ghcr.io/soulteary/pocket-bookcase:latest
    99          command: ["/usr/bin/shiori", "serve", "--webroot", "/shiori"]
   100          imagePullPolicy: Always
   101          ports:
   102          - containerPort: 8080
   103          volumeMounts:
   104          - mountPath: /srv/shiori
   105            name: app
   106          env:
   107          - name: SHIORI_DIR
   108            value: /srv/shiori
   109          - name: HTTP_ROOT_PATH
   110            value: "/shiori"
   111  ```
   112  
   113  Here we are using a local directory to persist Shiori's data. You will need
   114  to replace `/path/to/data/dir` with the path to the directory where you want
   115  to keep your data. Since we haven't configured a database in particular,
   116  Shiori will use SQLite. I don't think Postgres or MySQL is worth it for
   117  such an app, but that's up to you. If you decide to use SQLite, I strongly
   118  suggest to keep `replicas` set to 1 since SQLite usually allows at most
   119  one writer to proceed concurrently.
   120  
   121  Also, not that we're serving the app on the `/shiori` suffix. This is
   122  only necessary if you want to access Shiori with an URL that looks like:
   123  `http://your_domain_name/shiori`. This is also why we override the container's
   124  command: to pass the webroot. If you want to use such suffix, you'll probably
   125  need to deploy an ingress as well:
   126  
   127  `ingress.yaml`:
   128  
   129  ```yaml
   130  apiVersion: networking.k8s.io/v1
   131  kind: Ingress
   132  metadata:
   133    name: shiori
   134  spec:
   135    ingressClassName: nginx
   136    rules:
   137    - http:
   138        paths:
   139        - path: /shiori
   140          pathType: Prefix
   141          backend:
   142            service:
   143              name: shiori
   144              port:
   145                number: 8080
   146  ```
   147  
   148  Finally, here is the service's config:
   149  
   150  `service.yaml`
   151  
   152  ```yaml
   153  apiVersion: v1
   154  kind: Service
   155  metadata:
   156    name: shiori
   157  spec:
   158    type: NodePort
   159    selector:
   160      app: shiori
   161    ports:
   162    - protocol: TCP
   163      port: 8080
   164      targetPort: 8080
   165      nodePort: 32654
   166  ```
   167  
   168  I'm using the NodePort type for the service so I can access it easily on
   169  my local network, but it's not necessary if you setup the ingress.
   170  
   171  ## Managed Hosting
   172  
   173  If you don't manage your own server, the below providers will host Shiori for you. None are endorsed by or affiliated with the team. Support is provided by the providers.
   174  
   175  ### PikaPods
   176  
   177  [PikaPods](https://www.pikapods.com/) offers Shiori hosting from $1/month with $5 free welcome credit. EU and US regions available. Updates are applied weekly and user data backed up daily.
   178  
   179  [![Run on PikaPods](https://www.pikapods.com/static/run-button.svg)](https://www.pikapods.com/pods?run=shiori)