You need to sign in or sign up before continuing.
Commit 85044dd3 authored by Jacklull's avatar Jacklull

Merge branch '2.5.305' into 'main'

2.5.305 See merge request !2
parents 2e35ebf1 4feba5af
...@@ -89,7 +89,7 @@ jobs: ...@@ -89,7 +89,7 @@ jobs:
strategy: strategy:
matrix: matrix:
dbtype: [postgres, mysql, mariadb, mssql, sqlite] dbtype: [postgres, mysql, mariadb, sqlite]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
...@@ -125,8 +125,8 @@ jobs: ...@@ -125,8 +125,8 @@ jobs:
include: include:
- platform: linux/arm64 - platform: linux/arm64
docker: arm64 docker: arm64
- platform: linux/arm/v7 # - platform: linux/arm/v7
docker: armv7 # docker: armv7
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
...@@ -192,7 +192,7 @@ jobs: ...@@ -192,7 +192,7 @@ jobs:
- name: Setup Node.js environment - name: Setup Node.js environment
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 18.x node-version: 20.x
- name: Download a Build Artifact - name: Download a Build Artifact
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
...@@ -257,8 +257,8 @@ jobs: ...@@ -257,8 +257,8 @@ jobs:
run: | run: |
echo "Creating the manifests..." echo "Creating the manifests..."
docker manifest create requarks/wiki:beta-$REL_VERSION_STRICT requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT requarks/wiki:canary-armv7-$REL_VERSION_STRICT docker manifest create requarks/wiki:beta-$REL_VERSION_STRICT requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT
docker manifest create ghcr.io/requarks/wiki:beta-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-armv7-$REL_VERSION_STRICT docker manifest create ghcr.io/requarks/wiki:beta-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT
echo "Pushing the manifests..." echo "Pushing the manifests..."
...@@ -307,14 +307,14 @@ jobs: ...@@ -307,14 +307,14 @@ jobs:
echo "Using major $MAJOR and minor $MINOR..." echo "Using major $MAJOR and minor $MINOR..."
echo "Creating the manifests..." echo "Creating the manifests..."
docker manifest create requarks/wiki:$REL_VERSION_STRICT requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT requarks/wiki:canary-armv7-$REL_VERSION_STRICT docker manifest create requarks/wiki:$REL_VERSION_STRICT requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT
docker manifest create requarks/wiki:$MAJOR requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT requarks/wiki:canary-armv7-$REL_VERSION_STRICT docker manifest create requarks/wiki:$MAJOR requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT
docker manifest create requarks/wiki:$MAJORMINOR requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT requarks/wiki:canary-armv7-$REL_VERSION_STRICT docker manifest create requarks/wiki:$MAJORMINOR requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT
docker manifest create requarks/wiki:latest requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT requarks/wiki:canary-armv7-$REL_VERSION_STRICT docker manifest create requarks/wiki:latest requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT
docker manifest create ghcr.io/requarks/wiki:$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-armv7-$REL_VERSION_STRICT docker manifest create ghcr.io/requarks/wiki:$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT
docker manifest create ghcr.io/requarks/wiki:$MAJOR ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-armv7-$REL_VERSION_STRICT docker manifest create ghcr.io/requarks/wiki:$MAJOR ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT
docker manifest create ghcr.io/requarks/wiki:$MAJORMINOR ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-armv7-$REL_VERSION_STRICT docker manifest create ghcr.io/requarks/wiki:$MAJORMINOR ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT
docker manifest create ghcr.io/requarks/wiki:latest ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-armv7-$REL_VERSION_STRICT docker manifest create ghcr.io/requarks/wiki:latest ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT ghcr.io/requarks/wiki:canary-arm64-$REL_VERSION_STRICT
echo "Pushing the manifests..." echo "Pushing the manifests..."
......
...@@ -8,16 +8,15 @@ ...@@ -8,16 +8,15 @@
[![Release](https://img.shields.io/github/release/Requarks/wiki.svg?style=flat&maxAge=3600)](https://github.com/Requarks/wiki/releases) [![Release](https://img.shields.io/github/release/Requarks/wiki.svg?style=flat&maxAge=3600)](https://github.com/Requarks/wiki/releases)
[![License](https://img.shields.io/badge/license-AGPLv3-blue.svg?style=flat)](https://github.com/requarks/wiki/blob/master/LICENSE) [![License](https://img.shields.io/badge/license-AGPLv3-blue.svg?style=flat)](https://github.com/requarks/wiki/blob/master/LICENSE)
[![Standard - JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-green.svg?style=flat&logo=javascript&logoColor=white)](http://standardjs.com/) [![Standard - JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-green.svg?style=flat&logo=javascript&logoColor=white)](http://standardjs.com/)
[![Build + Publish](https://github.com/Requarks/wiki/actions/workflows/build.yml/badge.svg)](https://github.com/Requarks/wiki/actions/workflows/build.yml)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/ngpixel?logo=github&color=ea4aaa)](https://github.com/users/NGPixel/sponsorship)
[![Open Collective backers and sponsors](https://img.shields.io/opencollective/all/wikijs?label=backers&color=218bff&logo=opencollective&logoColor=white)](https://opencollective.com/wikijs)
[![Downloads](https://img.shields.io/github/downloads/Requarks/wiki/total.svg?style=flat&logo=github)](https://github.com/Requarks/wiki/releases) [![Downloads](https://img.shields.io/github/downloads/Requarks/wiki/total.svg?style=flat&logo=github)](https://github.com/Requarks/wiki/releases)
[![Docker Pulls](https://img.shields.io/docker/pulls/requarks/wiki.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/requarks/wiki/) [![Docker Pulls](https://img.shields.io/docker/pulls/requarks/wiki.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/requarks/wiki/)
[![Build + Publish](https://github.com/Requarks/wiki/actions/workflows/build.yml/badge.svg)](https://github.com/Requarks/wiki/actions/workflows/build.yml) [![Chat on Discord](https://img.shields.io/badge/discord-join-8D96F6.svg?style=flat&logo=discord&logoColor=white)](https://discord.gg/rcxt9QS2jd)
[![Huntr](https://img.shields.io/badge/security%20bounty-disclose-brightgreen.svg?style=flat&logo=cachet&logoColor=white)](https://huntr.dev/bounties/disclose)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/ngpixel?logo=github&color=ea4aaa)](https://github.com/users/NGPixel/sponsorship)
[![Open Collective backers and sponsors](https://img.shields.io/opencollective/all/wikijs?label=backers&color=218bff&logo=opencollective&logoColor=white)](https://opencollective.com/wikijs)
[![Chat on Slack](https://img.shields.io/badge/slack-requarks-CC2B5E.svg?style=flat&logo=slack)](https://wiki.requarks.io/slack) [![Chat on Slack](https://img.shields.io/badge/slack-requarks-CC2B5E.svg?style=flat&logo=slack)](https://wiki.requarks.io/slack)
[![Follow on Twitter](https://img.shields.io/badge/twitter-%40requarks-blue.svg?style=flat&logo=twitter&logoColor=white)](https://twitter.com/requarks) [![Follow on Bluesky](https://img.shields.io/badge/bluesky-%40js.wiki-blue.svg?style=flat&logo=bluesky&logoColor=white)](https://bsky.app/profile/js.wiki)
[![Follow on Telegram](https://img.shields.io/badge/telegram-%40wiki__js-blue.svg?style=flat&logo=telegram)](https://t.me/wiki_js) [![Follow on Telegram](https://img.shields.io/badge/telegram-%40wiki__js-blue.svg?style=flat&logo=telegram)](https://t.me/wiki_js)
[![Chat on Discord](https://img.shields.io/badge/discord-join-8D96F6.svg?style=flat&logo=discord&logoColor=white)](https://discord.gg/rcxt9QS2jd)
[![Reddit](https://img.shields.io/badge/reddit-%2Fr%2Fwikijs-orange?logo=reddit&logoColor=white)](https://www.reddit.com/r/wikijs/) [![Reddit](https://img.shields.io/badge/reddit-%2Fr%2Fwikijs-orange?logo=reddit&logoColor=white)](https://www.reddit.com/r/wikijs/)
##### A modern, lightweight and powerful wiki app built on NodeJS ##### A modern, lightweight and powerful wiki app built on NodeJS
...@@ -31,7 +30,7 @@ ...@@ -31,7 +30,7 @@
- [Demo](https://docs.requarks.io/demo) - [Demo](https://docs.requarks.io/demo)
- [Changelog](https://github.com/requarks/wiki/releases) - [Changelog](https://github.com/requarks/wiki/releases)
- [Feature Requests](https://feedback.js.wiki/wiki) - [Feature Requests](https://feedback.js.wiki/wiki)
- [Chat with us on Slack](https://wiki.requarks.io/slack) - Chat with us on [Discord](https://discord.gg/rcxt9QS2jd) / [Slack](https://wiki.requarks.io/slack)
- [Translations](https://docs.requarks.io/dev/translations) *(We need your help!)* - [Translations](https://docs.requarks.io/dev/translations) *(We need your help!)*
- [E2E Testing Results](https://dashboard.cypress.io/projects/r7qxah/runs) - [E2E Testing Results](https://dashboard.cypress.io/projects/r7qxah/runs)
- [Special Thanks](#special-thanks) - [Special Thanks](#special-thanks)
...@@ -396,6 +395,23 @@ Support this project by becoming a sponsor. Your logo will show up in the Contri ...@@ -396,6 +395,23 @@ Support this project by becoming a sponsor. Your logo will show up in the Contri
<a href="https://opencollective.com/wikijs/sponsor/44/website" target="_blank"><img src="https://opencollective.com/wikijs/sponsor/44/avatar.svg"></a> <a href="https://opencollective.com/wikijs/sponsor/44/website" target="_blank"><img src="https://opencollective.com/wikijs/sponsor/44/avatar.svg"></a>
</td> </td>
</tr> </tr>
<tr>
<td align="center" valign="middle">
<a href="https://opencollective.com/wikijs/sponsor/40/website" target="_blank"><img src="https://opencollective.com/wikijs/sponsor/45/avatar.svg"></a>
</td>
<td align="center" valign="middle">
<a href="https://opencollective.com/wikijs/sponsor/41/website" target="_blank"><img src="https://opencollective.com/wikijs/sponsor/46/avatar.svg"></a>
</td>
<td align="center" valign="middle">
<a href="https://opencollective.com/wikijs/sponsor/42/website" target="_blank"><img src="https://opencollective.com/wikijs/sponsor/47/avatar.svg"></a>
</td>
<td align="center" valign="middle">
<a href="https://opencollective.com/wikijs/sponsor/43/website" target="_blank"><img src="https://opencollective.com/wikijs/sponsor/48/avatar.svg"></a>
</td>
<td align="center" valign="middle">
<a href="https://opencollective.com/wikijs/sponsor/44/website" target="_blank"><img src="https://opencollective.com/wikijs/sponsor/49/avatar.svg"></a>
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
......
# ========================= # =========================
# --- BUILD NPM MODULES --- # --- BUILD NPM MODULES ---
# ========================= # =========================
FROM node:18-alpine AS build FROM node:20-alpine AS build
RUN apk add yarn g++ make cmake python3 --no-cache RUN apk add yarn g++ make cmake python3 --no-cache
...@@ -16,7 +16,7 @@ RUN yarn patch-package ...@@ -16,7 +16,7 @@ RUN yarn patch-package
# =============== # ===============
# --- Release --- # --- Release ---
# =============== # ===============
FROM node:18-alpine FROM node:20-alpine
LABEL maintainer="requarks.io" LABEL maintainer="requarks.io"
RUN apk add bash curl git openssh gnupg sqlite --no-cache && \ RUN apk add bash curl git openssh gnupg sqlite --no-cache && \
......
# ==================== # ====================
# --- Build Assets --- # --- Build Assets ---
# ==================== # ====================
FROM node:18-alpine AS assets FROM node:20-alpine AS assets
RUN apk add yarn g++ make cmake python3 --no-cache RUN apk add yarn g++ make cmake python3 --no-cache
...@@ -25,7 +25,7 @@ RUN yarn patch-package ...@@ -25,7 +25,7 @@ RUN yarn patch-package
# =============== # ===============
# --- Release --- # --- Release ---
# =============== # ===============
FROM node:18-alpine FROM node:20-alpine
LABEL maintainer="requarks.io" LABEL maintainer="requarks.io"
RUN apk add bash curl git openssh gnupg sqlite --no-cache && \ RUN apk add bash curl git openssh gnupg sqlite --no-cache && \
......
...@@ -2,7 +2,7 @@ apiVersion: v2 ...@@ -2,7 +2,7 @@ apiVersion: v2
name: wiki name: wiki
# This is the chart version. This version number should be incremented each time you make changes # This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version. # to the chart and its templates, including the app version.
version: 2.2.0 version: 2.3.0
# This is the version number of the application being deployed. This version number should be # This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. # incremented each time you make changes to the application.
AppVersion: latest AppVersion: latest
......
...@@ -97,16 +97,16 @@ The following table lists the configurable parameters of the Wiki.js chart and t ...@@ -97,16 +97,16 @@ The following table lists the configurable parameters of the Wiki.js chart and t
| `image.repository` | Wiki.js image | `requarks/wiki` | | `image.repository` | Wiki.js image | `requarks/wiki` |
| `image.tag` | Wiki.js image tag | `latest` | | `image.tag` | Wiki.js image tag | `latest` |
| `imagePullPolicy` | Image pull policy | `IfNotPresent` | | `imagePullPolicy` | Image pull policy | `IfNotPresent` |
| `replicacount` | Amount of wiki.js service pods to run | `1` | | `replicacount` | Number of Wiki.js pods to run | `1` |
| `revisionHistoryLimit` | Total amount of revision history points | `10` | | `revisionHistoryLimit` | Total number of revision history points | `10` |
| `resources.limits` | wiki.js service resource limits | `nil` | | `resources.limits` | Wiki.js service resource limits | `nil` |
| `resources.requests` | wiki.js service resource requests | `nil` | | `resources.requests` | Wiki.js service resource requests | `nil` |
| `nodeSelector` | Node labels for wiki.js pod assignment | `{}` | | `nodeSelector` | Node labels for the Wiki.js pod assignment | `{}` |
| `affinity` | Affinity settings for wiki.js pod assignment | `{}` | | `affinity` | Affinity settings for the Wiki.js pod assignment | `{}` |
| `schedulerName` | Name of an alternate scheduler for wiki.js pod | `nil` | | `schedulerName` | Name of an alternate scheduler for the Wiki.js pod | `nil` |
| `tolerations` | Toleration labels for wiki.jsk pod assignment | `[]` | | `tolerations` | Toleration labels for the Wiki.js pod assignment | `[]` |
| `volumeMounts` | Volume mounts for Wiki.js container | `[]` | | `volumeMounts` | Volume mounts for the Wiki.js container | `[]` |
| `volumes` | Volumes for Wiki.js Pod | `[]` | | `volumes` | Volumes for the Wiki.js pod | `[]` |
| `ingress.enabled` | Enable ingress controller resource | `false` | | `ingress.enabled` | Enable ingress controller resource | `false` |
| `ingress.className` | Ingress class name | `""` | | `ingress.className` | Ingress class name | `""` |
| `ingress.annotations` | Ingress annotations | `{}` | | `ingress.annotations` | Ingress annotations | `{}` |
...@@ -114,7 +114,10 @@ The following table lists the configurable parameters of the Wiki.js chart and t ...@@ -114,7 +114,10 @@ The following table lists the configurable parameters of the Wiki.js chart and t
| `ingress.tls` | Ingress TLS configuration | `[]` | | `ingress.tls` | Ingress TLS configuration | `[]` |
| `sideload.enabled` | Enable sideloading of locale files from git | `false` | | `sideload.enabled` | Enable sideloading of locale files from git | `false` |
| `sideload.repoURL` | Git repository URL containing locale files | `https://github.com/Requarks/wiki-localization` | | `sideload.repoURL` | Git repository URL containing locale files | `https://github.com/Requarks/wiki-localization` |
| `sideload.env` | Environment variables for sideload Container | `{}` | | `sideload.env` | Environment variables for the sideload container | `{}` |
| `sideload.securityContext` | Security context for the sideload container | `nil` |
| `sideload.resources.limits` | Resource limits for the sideload container | `nil` |
| `sideload.resources.requests` | Resource requests for the sideload container | `nil` |
| `nodeExtraCaCerts` | Trusted certificates path | `nil` | | `nodeExtraCaCerts` | Trusted certificates path | `nil` |
| `postgresql.enabled` | Deploy postgres server (see below) | `true` | | `postgresql.enabled` | Deploy postgres server (see below) | `true` |
| `postgresql.postgresqlDatabase` | Postgres database name | `wiki` | | `postgresql.postgresqlDatabase` | Postgres database name | `wiki` |
...@@ -122,7 +125,7 @@ The following table lists the configurable parameters of the Wiki.js chart and t ...@@ -122,7 +125,7 @@ The following table lists the configurable parameters of the Wiki.js chart and t
| `postgresql.postgresqlHost` | External postgres host | `nil` | | `postgresql.postgresqlHost` | External postgres host | `nil` |
| `postgresql.postgresqlPassword` | External postgres password | `nil` | | `postgresql.postgresqlPassword` | External postgres password | `nil` |
| `postgresql.existingSecret` | Provide an existing `Secret` for postgres | `nil` | | `postgresql.existingSecret` | Provide an existing `Secret` for postgres | `nil` |
| `postgresql.existingSecretKey` | The postgres password key in the existing `Secret` | `postgresql-password` | | `postgresql.existingSecretKey` | The postgres password key in the existing `Secret` | `postgresql-password` |
| `postgresql.postgresqlPort` | External postgres port | `5432` | | `postgresql.postgresqlPort` | External postgres port | `5432` |
| `postgresql.ssl` | Enable external postgres SSL connection | `false` | | `postgresql.ssl` | Enable external postgres SSL connection | `false` |
| `postgresql.ca` | Certificate of Authority content for postgres | `nil` | | `postgresql.ca` | Certificate of Authority content for postgres | `nil` |
......
...@@ -14,6 +14,8 @@ spec: ...@@ -14,6 +14,8 @@ spec:
metadata: metadata:
labels: labels:
{{- include "wiki.selectorLabels" . | nindent 8 }} {{- include "wiki.selectorLabels" . | nindent 8 }}
annotations:
{{- toYaml .Values.podAnnotations | nindent 8 }}
spec: spec:
{{- with .Values.imagePullSecrets }} {{- with .Values.imagePullSecrets }}
imagePullSecrets: imagePullSecrets:
...@@ -25,15 +27,32 @@ spec: ...@@ -25,15 +27,32 @@ spec:
{{- if .Values.sideload.enabled }} {{- if .Values.sideload.enabled }}
initContainers: initContainers:
- name: {{ .Chart.Name }}-sideload - name: {{ .Chart.Name }}-sideload
securityContext:
{{- toYaml .Values.sideload.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ default "latest" .Values.image.tag }}" image: "{{ .Values.image.repository }}:{{ default "latest" .Values.image.tag }}"
imagePullPolicy: {{ default "IfNotPresent" .Values.image.imagePullPolicy }} imagePullPolicy: {{ default "IfNotPresent" .Values.image.imagePullPolicy }}
env: env:
{{- toYaml .Values.sideload.env | nindent 12 }} {{- toYaml .Values.sideload.env | nindent 12 }}
command: [ "sh", "-c" ] command: [ "sh", "-c" ]
args: [ "mkdir -p /wiki/data/sideload && git clone --depth=1 {{ .Values.sideload.repoURL }} /wiki/data/sideload/" ] args: [ "mkdir -p /wiki/data/sideload && git clone --depth=1 {{ .Values.sideload.repoURL }} /wiki/data/sideload/" ]
resources:
{{- toYaml .Values.sideload.resources | nindent 12 }}
{{- end }} {{- end }}
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
{{- if .Values.customFavicons.enabled }}
lifecycle:
postStart:
exec:
command:
- sh
- -c
- |
ls /wiki/assets && rm -rf /wiki/assets/favicons/* && rm -rf /wiki/assets/favicon.ico && \
curl -k -L {{ .Values.customFavicons.x192 }} -o /wiki/assets/favicons/android-chrome-192x192.png && \
curl -k -L {{ .Values.customFavicons.x32 }} -o /wiki/assets/favicons/favicon-32x32.png && \
curl -k -L {{ .Values.customFavicons.favicon }} -o /wiki/assets/favicon.ico
{{- end }}
securityContext: securityContext:
{{- toYaml .Values.securityContext | nindent 12 }} {{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ default "latest" .Values.image.tag }}" image: "{{ .Values.image.repository }}:{{ default "latest" .Values.image.tag }}"
......
...@@ -42,6 +42,8 @@ startupProbe: ...@@ -42,6 +42,8 @@ startupProbe:
path: /healthz path: /healthz
port: http port: http
podAnnotations: {}
podSecurityContext: {} podSecurityContext: {}
# fsGroup: 2000 # fsGroup: 2000
...@@ -113,6 +115,26 @@ sideload: ...@@ -113,6 +115,26 @@ sideload:
# - name: HTTPS_PROXY # - name: HTTPS_PROXY
# value: http://my.proxy.com:3128 # value: http://my.proxy.com:3128
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
## Append extra trusted certificates for node process from extra volume via NODE_EXTRA_CA_CERTS variable ## Append extra trusted certificates for node process from extra volume via NODE_EXTRA_CA_CERTS variable
# nodeExtraCaCerts: "/path/to/certs.pem" # nodeExtraCaCerts: "/path/to/certs.pem"
......
...@@ -222,7 +222,7 @@ module.exports = { ...@@ -222,7 +222,7 @@ module.exports = {
* Subscribe to database LISTEN / NOTIFY for multi-instances events * Subscribe to database LISTEN / NOTIFY for multi-instances events
*/ */
async subscribeToNotifications () { async subscribeToNotifications () {
const useHA = (WIKI.config.ha === true || WIKI.config.ha === 'true' || WIKI.config.ha === 1 || WIKI.config.ha === '1') const useHA = (WIKI.config.ha === true || (typeof WIKI.config.ha === 'string' && WIKI.config.ha.toLowerCase() === 'true') || WIKI.config.ha === 1 || WIKI.config.ha === '1')
if (!useHA) { if (!useHA) {
return return
} else if (WIKI.config.db.type !== 'postgres') { } else if (WIKI.config.db.type !== 'postgres') {
......
...@@ -499,6 +499,10 @@ module.exports = class User extends Model { ...@@ -499,6 +499,10 @@ module.exports = class User extends Model {
}) })
if (usr) { if (usr) {
if (!usr.isActive) {
throw new WIKI.Error.AuthAccountBanned()
}
await WIKI.models.users.query().patch({ await WIKI.models.users.query().patch({
password: newPassword, password: newPassword,
mustChangePwd: false mustChangePwd: false
...@@ -527,6 +531,9 @@ module.exports = class User extends Model { ...@@ -527,6 +531,9 @@ module.exports = class User extends Model {
if (!usr) { if (!usr) {
WIKI.logger.debug(`Password reset attempt on nonexistant local account ${email}: [DISCARDED]`) WIKI.logger.debug(`Password reset attempt on nonexistant local account ${email}: [DISCARDED]`)
return return
} else if (!usr.isActive) {
WIKI.logger.debug(`Password reset attempt on disabled local account ${email}: [DISCARDED]`)
return
} }
const resetToken = await WIKI.models.userKeys.generateToken({ const resetToken = await WIKI.models.userKeys.generateToken({
userId: usr.id, userId: usr.id,
......
...@@ -12,9 +12,10 @@ props: ...@@ -12,9 +12,10 @@ props:
hint: Should match the version of the Elasticsearch nodes you are connecting to hint: Should match the version of the Elasticsearch nodes you are connecting to
order: 1 order: 1
enum: enum:
- '8.x'
- '7.x' - '7.x'
- '6.x' - '6.x'
default: '6.x' default: '7.x'
hosts: hosts:
type: String type: String
title: Host(s) title: Host(s)
......
...@@ -19,6 +19,16 @@ module.exports = { ...@@ -19,6 +19,16 @@ module.exports = {
async init() { async init() {
WIKI.logger.info(`(SEARCH/ELASTICSEARCH) Initializing...`) WIKI.logger.info(`(SEARCH/ELASTICSEARCH) Initializing...`)
switch (this.config.apiVersion) { switch (this.config.apiVersion) {
case '8.x':
const { Client: Client8 } = require('elasticsearch8')
this.client = new Client8({
nodes: this.config.hosts.split(',').map(_.trim),
sniffOnStart: this.config.sniffOnStart,
sniffInterval: (this.config.sniffInterval > 0) ? this.config.sniffInterval : false,
tls: getTlsOptions(this.config),
name: 'wiki-js'
})
break
case '7.x': case '7.x':
const { Client: Client7 } = require('elasticsearch7') const { Client: Client7 } = require('elasticsearch7')
this.client = new Client7({ this.client = new Client7({
...@@ -54,7 +64,8 @@ module.exports = { ...@@ -54,7 +64,8 @@ module.exports = {
async createIndex() { async createIndex() {
try { try {
const indexExists = await this.client.indices.exists({ index: this.config.indexName }) const indexExists = await this.client.indices.exists({ index: this.config.indexName })
if (!indexExists.body) { // Elasticsearch 6.x / 7.x
if (this.config.apiVersion !== '8.x' && !indexExists.body) {
WIKI.logger.info(`(SEARCH/ELASTICSEARCH) Creating index...`) WIKI.logger.info(`(SEARCH/ELASTICSEARCH) Creating index...`)
try { try {
const idxBody = { const idxBody = {
...@@ -68,6 +79,7 @@ module.exports = { ...@@ -68,6 +79,7 @@ module.exports = {
tags: { type: 'text', boost: 8.0 } tags: { type: 'text', boost: 8.0 }
} }
} }
await this.client.indices.create({ await this.client.indices.create({
index: this.config.indexName, index: this.config.indexName,
body: { body: {
...@@ -88,7 +100,42 @@ module.exports = { ...@@ -88,7 +100,42 @@ module.exports = {
} catch (err) { } catch (err) {
WIKI.logger.error(`(SEARCH/ELASTICSEARCH) Create Index Error: `, _.get(err, 'meta.body.error', err)) WIKI.logger.error(`(SEARCH/ELASTICSEARCH) Create Index Error: `, _.get(err, 'meta.body.error', err))
} }
} // Elasticsearch 8.x
} else if (this.config.apiVersion === '8.x' && !indexExists) {
WIKI.logger.info(`(SEARCH/ELASTICSEARCH) Creating index...`)
try {
// 8.x Doesn't support boost in mappings, so we will need to boost at query time.
const idxBody = {
properties: {
suggest: { type: 'completion' },
title: { type: 'text' },
description: { type: 'text' },
content: { type: 'text' },
locale: { type: 'keyword' },
path: { type: 'text' },
tags: { type: 'text' }
}
}
await this.client.indices.create({
index: this.config.indexName,
body: {
mappings: idxBody,
settings: {
analysis: {
analyzer: {
default: {
type: this.config.analyzer
}
}
}
}
}
})
} catch (err) {
WIKI.logger.error(`(SEARCH/ELASTICSEARCH) Create Index Error: `, _.get(err, 'meta.body.error', err))
}
}
} catch (err) { } catch (err) {
WIKI.logger.error(`(SEARCH/ELASTICSEARCH) Index Check Error: `, _.get(err, 'meta.body.error', err)) WIKI.logger.error(`(SEARCH/ELASTICSEARCH) Index Check Error: `, _.get(err, 'meta.body.error', err))
} }
...@@ -129,7 +176,7 @@ module.exports = { ...@@ -129,7 +176,7 @@ module.exports = {
} }
}) })
return { return {
results: _.get(results, 'body.hits.hits', []).map(r => ({ results: _.get(results, this.config.apiVersion === '8.x' ? 'hits.hits' : 'body.hits.hits', []).map(r => ({
id: r._id, id: r._id,
locale: r._source.locale, locale: r._source.locale,
path: r._source.path, path: r._source.path,
...@@ -137,7 +184,7 @@ module.exports = { ...@@ -137,7 +184,7 @@ module.exports = {
description: r._source.description description: r._source.description
})), })),
suggestions: _.reject(_.get(results, 'suggest.suggestions', []).map(s => _.get(s, 'options[0].text', false)), s => !s), suggestions: _.reject(_.get(results, 'suggest.suggestions', []).map(s => _.get(s, 'options[0].text', false)), s => !s),
totalHits: _.get(results, 'body.hits.total.value', _.get(results, 'body.hits.total', 0)) totalHits: _.get(results, this.config.apiVersion === '8.x' ? 'hits.total.value' : 'body.hits.total.value', _.get(results, this.config.apiVersion === '8.x' ? 'hits.total' : 'body.hits.total', 0))
} }
} catch (err) { } catch (err) {
WIKI.logger.warn('Search Engine Error: ', _.get(err, 'meta.body.error', err)) WIKI.logger.warn('Search Engine Error: ', _.get(err, 'meta.body.error', err))
...@@ -182,7 +229,7 @@ module.exports = { ...@@ -182,7 +229,7 @@ module.exports = {
async created(page) { async created(page) {
await this.client.index({ await this.client.index({
index: this.config.indexName, index: this.config.indexName,
type: '_doc', ...(this.config.apiVersion !== '8.x' && { type: '_doc' }),
id: page.hash, id: page.hash,
body: { body: {
suggest: this.buildSuggest(page), suggest: this.buildSuggest(page),
...@@ -204,7 +251,7 @@ module.exports = { ...@@ -204,7 +251,7 @@ module.exports = {
async updated(page) { async updated(page) {
await this.client.index({ await this.client.index({
index: this.config.indexName, index: this.config.indexName,
type: '_doc', ...(this.config.apiVersion !== '8.x' && { type: '_doc' }),
id: page.hash, id: page.hash,
body: { body: {
suggest: this.buildSuggest(page), suggest: this.buildSuggest(page),
...@@ -226,7 +273,7 @@ module.exports = { ...@@ -226,7 +273,7 @@ module.exports = {
async deleted(page) { async deleted(page) {
await this.client.delete({ await this.client.delete({
index: this.config.indexName, index: this.config.indexName,
type: '_doc', ...(this.config.apiVersion !== '8.x' && { type: '_doc' }),
id: page.hash, id: page.hash,
refresh: true refresh: true
}) })
...@@ -239,13 +286,13 @@ module.exports = { ...@@ -239,13 +286,13 @@ module.exports = {
async renamed(page) { async renamed(page) {
await this.client.delete({ await this.client.delete({
index: this.config.indexName, index: this.config.indexName,
type: '_doc', ...(this.config.apiVersion !== '8.x' && { type: '_doc' }),
id: page.hash, id: page.hash,
refresh: true refresh: true
}) })
await this.client.index({ await this.client.index({
index: this.config.indexName, index: this.config.indexName,
type: '_doc', ...(this.config.apiVersion !== '8.x' && { type: '_doc' }),
id: page.destinationHash, id: page.destinationHash,
body: { body: {
suggest: this.buildSuggest(page), suggest: this.buildSuggest(page),
...@@ -314,8 +361,8 @@ module.exports = { ...@@ -314,8 +361,8 @@ module.exports = {
result.push({ result.push({
index: { index: {
_index: this.config.indexName, _index: this.config.indexName,
_type: '_doc', _id: doc.id,
_id: doc.id ...(this.config.apiVersion !== '8.x' && { _type: '_doc' })
} }
}) })
doc.safeContent = WIKI.models.pages.cleanHTML(doc.render) doc.safeContent = WIKI.models.pages.cleanHTML(doc.render)
......
This diff was suppressed by a .gitattributes entry.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment