Skip to content

Commit cac1ba8

Browse files
docs: improve kubernetes deployment docs (#1065)
Co-authored-by: Felipe Martin <[email protected]>
1 parent 378e633 commit cac1ba8

File tree

1 file changed

+28
-40
lines changed

1 file changed

+28
-40
lines changed

docs/Installation.md

Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ spec:
8585
labels:
8686
app: shiori
8787
spec:
88-
securityContext:
89-
runAsUser: 1000
90-
runAsGroup: 1000
91-
fsGroup: 1000
9288
volumes:
9389
- name: app
9490
hostPath:
@@ -99,25 +95,23 @@ spec:
9995
containers:
10096
- name: shiori
10197
image: ghcr.io/go-shiori/shiori:latest
102-
command: ["/usr/bin/shiori", "serve", "--webroot", "/shiori"]
98+
command: ["/usr/bin/shiori", "serve"]
10399
imagePullPolicy: Always
104100
ports:
105101
- containerPort: 8080
102+
env:
103+
- name: SHIORI_DIR
104+
value: /srv/shiori
106105
volumeMounts:
107106
- mountPath: /srv/shiori
108107
name: app
109108
- mountPath: /tmp
110109
name: tmp
111-
env:
112-
- name: SHIORI_DIR
113-
value: /srv/shiori
114-
- name: HTTP_ROOT_PATH
115-
value: "/shiori"
116110
```
117111
118112
Here we are using a local directory to persist Shiori's data. You will need
119113
to replace `/path/to/data/dir` with the path to the directory where you want
120-
to keep your data. We are also mounting an `EmptyDir` volume for `/tmp` so
114+
to keep your data. We are also mounting an `EmptyDir` volume for `/tmp` so
121115
we can successfully generate ebooks.
122116

123117
Since we haven't configured a database in particular,
@@ -126,11 +120,28 @@ such an app, but that's up to you. If you decide to use SQLite, I strongly
126120
suggest to keep `replicas` set to 1 since SQLite usually allows at most
127121
one writer to proceed concurrently.
128122

129-
Also, not that we're serving the app on the `/shiori` suffix. This is
130-
only necessary if you want to access Shiori with an URL that looks like:
131-
`http://your_domain_name/shiori`. This is also why we override the container's
132-
command: to pass the webroot. If you want to use such suffix, you'll probably
133-
need to deploy an ingress as well:
123+
To route requests to your deployment, you will need a `Service` that gets used
124+
by an `Ingress` to handle routing. If you wand to add a path suffix or use a
125+
sub domain, you can do so through the ingress config. We only show the bare
126+
minimum config to get you started.
127+
128+
`service.yaml`
129+
130+
```yaml
131+
apiVersion: v1
132+
kind: Service
133+
metadata:
134+
name: shiori
135+
spec:
136+
type: LoadBalancer
137+
selector:
138+
app: shiori
139+
ports:
140+
- port: 8080
141+
targetPort: 8080
142+
```
143+
144+
This is using a `LoadBalancer` type which gives the most flexibility.
134145

135146
`ingress.yaml`:
136147

@@ -144,7 +155,7 @@ spec:
144155
rules:
145156
- http:
146157
paths:
147-
- path: /shiori
158+
- path: /
148159
pathType: Prefix
149160
backend:
150161
service:
@@ -153,29 +164,6 @@ spec:
153164
number: 8080
154165
```
155166

156-
Finally, here is the service's config:
157-
158-
`service.yaml`
159-
160-
```yaml
161-
apiVersion: v1
162-
kind: Service
163-
metadata:
164-
name: shiori
165-
spec:
166-
type: NodePort
167-
selector:
168-
app: shiori
169-
ports:
170-
- protocol: TCP
171-
port: 8080
172-
targetPort: 8080
173-
nodePort: 32654
174-
```
175-
176-
I'm using the NodePort type for the service so I can access it easily on
177-
my local network, but it's not necessary if you setup the ingress.
178-
179167
## Managed Hosting
180168

181169
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.

0 commit comments

Comments
 (0)