Merge remote-tracking branch 'requarks/main' into tyclipso

pull/7734/head
Carl Richter 4 years ago
commit 364052ef05

@ -0,0 +1,387 @@
name: Build + Publish
on:
push:
branches:
- main
tags:
- 'v*'
env:
BASE_DEV_VERSION: 2.5.0
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v2
- name: Set Build Variables
run: |
if [[ "$GITHUB_REF" =~ ^refs/tags/v* ]]; then
echo "Using TAG mode: $GITHUB_REF_NAME"
echo "REL_VERSION=$GITHUB_REF_NAME" >> $GITHUB_ENV
echo "REL_VERSION_STRICT=${GITHUB_REF_NAME#?}" >> $GITHUB_ENV
else
echo "Using BRANCH mode: v$BASE_DEV_VERSION-dev.$GITHUB_RUN_NUMBER"
echo "REL_VERSION=v$BASE_DEV_VERSION-dev.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
echo "REL_VERSION_STRICT=$BASE_DEV_VERSION-dev.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
fi
- name: Disable DEV Flag + Set Version
run: |
sudo apt-get install jq -y
mv package.json pkg-temp.json
jq --arg vs "$REL_VERSION_STRICT" -r '. + {dev:false, version:$vs}' pkg-temp.json > package.json
rm pkg-temp.json
cat package.json
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v2.9.0
with:
context: .
file: dev/build/Dockerfile
push: true
tags: |
requarks/wiki:canary
requarks/wiki:canary-${{ env.REL_VERSION_STRICT }}
ghcr.io/requarks/wiki:canary
ghcr.io/requarks/wiki:canary-${{ env.REL_VERSION_STRICT }}
- name: Extract compiled files
run: |
mkdir -p _dist
docker create --name wiki ghcr.io/requarks/wiki:canary-$REL_VERSION_STRICT
docker cp wiki:/wiki _dist
docker rm wiki
rm _dist/wiki/config.yml
cp ./config.sample.yml _dist/wiki/config.sample.yml
find _dist/wiki/ -printf "%P\n" | tar -czf wiki-js.tar.gz --no-recursion -C _dist/wiki/ -T -
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2.3.1
with:
name: drop
path: wiki-js.tar.gz
cypress:
name: Run Cypress Tests
runs-on: ubuntu-latest
needs: [build]
strategy:
matrix:
dbtype: [postgres, mysql, mariadb, mssql, sqlite]
steps:
- uses: actions/checkout@v2
- name: Set Test Variables
run: |
if [[ "$GITHUB_REF" =~ ^refs/tags/v* ]]; then
echo "Using TAG mode: $GITHUB_REF_NAME"
echo "REL_VERSION_STRICT=${GITHUB_REF_NAME#?}" >> $GITHUB_ENV
else
echo "Using BRANCH mode: v$BASE_DEV_VERSION-dev.$GITHUB_RUN_NUMBER"
echo "REL_VERSION_STRICT=$BASE_DEV_VERSION-dev.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
fi
- name: Run Tests
env:
MATRIXENV: ${{ matrix.dbtype }}
CYPRESS_KEY: ${{ secrets.CYPRESS_KEY }}
run: |
chmod u+x dev/cypress/ci-setup.sh
dev/cypress/ci-setup.sh
docker run --name cypress --ipc=host --shm-size 1G -v $GITHUB_WORKSPACE:/e2e -w /e2e cypress/included:4.9.0 --record --key "$CYPRESS_KEY" --headless --group "$MATRIXENV" --ci-build-id "$REL_VERSION_STRICT-run$GITHUB_RUN_NUMBER.$GITHUB_RUN_ATTEMPT" --tag "$REL_VERSION_STRICT" --config baseUrl=http://172.17.0.1:3000
arm:
name: ARM Build
runs-on: ubuntu-latest
needs: [cypress]
permissions:
packages: write
strategy:
matrix:
include:
- platform: linux/arm64
docker: arm64
- platform: linux/arm/v7
docker: armv7
steps:
- uses: actions/checkout@v2
- name: Set Version Variables
run: |
if [[ "$GITHUB_REF" =~ ^refs/tags/v* ]]; then
echo "Using TAG mode: $GITHUB_REF_NAME"
echo "REL_VERSION_STRICT=${GITHUB_REF_NAME#?}" >> $GITHUB_ENV
else
echo "Using BRANCH mode: v$BASE_DEV_VERSION-dev.$GITHUB_RUN_NUMBER"
echo "REL_VERSION_STRICT=$BASE_DEV_VERSION-dev.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download a Build Artifact
uses: actions/download-artifact@v2.1.0
with:
name: drop
path: drop
- name: Extract Build
run: |
mkdir -p build
tar -xzf $GITHUB_WORKSPACE/drop/wiki-js.tar.gz -C $GITHUB_WORKSPACE/build --exclude=node_modules
- name: Build and push Docker images
uses: docker/build-push-action@v2.9.0
with:
context: .
file: dev/build-arm/Dockerfile
platforms: ${{ matrix.platform }}
push: true
tags: |
requarks/wiki:canary-${{ matrix.docker }}-${{ env.REL_VERSION_STRICT }}
ghcr.io/requarks/wiki:canary-${{ matrix.docker }}-${{ env.REL_VERSION_STRICT }}
windows:
name: Windows Build
runs-on: windows-latest
needs: [cypress]
steps:
- name: Setup Node.js environment
uses: actions/setup-node@v2.5.1
with:
node-version: 12.x
- name: Download a Build Artifact
uses: actions/download-artifact@v2.1.0
with:
name: drop
path: drop
- name: Extract Build
run: |
mkdir -p win
tar -xzf $env:GITHUB_WORKSPACE\drop\wiki-js.tar.gz -C $env:GITHUB_WORKSPACE\win --exclude=node_modules
- name: Install Dependencies
run: yarn --production --frozen-lockfile --non-interactive
working-directory: win
- name: Create Bundle
run: tar -czf wiki-js-windows.tar.gz -C $env:GITHUB_WORKSPACE\win .
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2.3.1
with:
name: drop-win
path: wiki-js-windows.tar.gz
beta:
name: Publish Beta Images
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs: [build, arm, windows]
permissions:
packages: write
steps:
- name: Set Version Variables
run: |
echo "Using TAG mode: $GITHUB_REF_NAME"
echo "REL_VERSION_STRICT=${GITHUB_REF_NAME#?}" >> $GITHUB_ENV
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and Push Manifests
run: |
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 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
echo "Pushing the manifests..."
docker manifest push -p requarks/wiki:beta-$REL_VERSION_STRICT
docker manifest push -p ghcr.io/requarks/wiki:beta-$REL_VERSION_STRICT
release:
name: Publish Release Images
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
environment: prod
needs: [beta]
permissions:
packages: write
contents: write
steps:
- name: Set Version Variables
run: |
echo "Using TAG mode: $GITHUB_REF_NAME"
echo "REL_VERSION_STRICT=${GITHUB_REF_NAME#?}" >> $GITHUB_ENV
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and Push Manifests
run: |
echo "Fetching semver tool..."
curl -LJO https://static.requarks.io/semver
chmod +x semver
MAJOR=`./semver get major $REL_VERSION_STRICT`
MINOR=`./semver get minor $REL_VERSION_STRICT`
MAJORMINOR="$MAJOR.$MINOR"
echo "Using major $MAJOR and minor $MINOR..."
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:$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:$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:latest requarks/wiki:canary-$REL_VERSION_STRICT requarks/wiki:canary-arm64-$REL_VERSION_STRICT 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 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 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 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 ghcr.io/requarks/wiki:canary-armv7-$REL_VERSION_STRICT
echo "Pushing the manifests..."
docker manifest push -p requarks/wiki:$REL_VERSION_STRICT
docker manifest push -p requarks/wiki:$MAJOR
docker manifest push -p requarks/wiki:$MAJORMINOR
docker manifest push -p requarks/wiki:latest
docker manifest push -p ghcr.io/requarks/wiki:$REL_VERSION_STRICT
docker manifest push -p ghcr.io/requarks/wiki:$MAJOR
docker manifest push -p ghcr.io/requarks/wiki:$MAJORMINOR
docker manifest push -p ghcr.io/requarks/wiki:latest
- name: Download Linux Build
uses: actions/download-artifact@v2.1.0
with:
name: drop
path: drop
- name: Download Windows Build
uses: actions/download-artifact@v2.1.0
with:
name: drop-win
path: drop-win
- name: Generate Changelog
id: changelog
uses: Requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
writeToFile: false
- name: Update GitHub Release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: false
name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}
artifacts: 'drop/wiki-js.tar.gz,drop-win/wiki-js-windows.tar.gz'
- name: Notify Slack Releases Channel
uses: slackapi/slack-github-action@v1.18.0
with:
payload: |
{
"text": "Wiki.js ${{ github.ref_name }} has been released."
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
build-do-image:
name: Build DigitalOcean Image
runs-on: ubuntu-latest
needs: [release]
steps:
- uses: actions/checkout@v2
- name: Set Version Variables
run: |
echo "Using TAG mode: $GITHUB_REF_NAME"
echo "REL_VERSION_STRICT=${GITHUB_REF_NAME#?}" >> $GITHUB_ENV
- name: Install Packer
run: |
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install packer
- name: Build Droplet Image
env:
DIGITALOCEAN_API_TOKEN: ${{ secrets.DO_TOKEN }}
WIKI_APP_VERSION: ${{ env.REL_VERSION_STRICT }}
working-directory: dev/packer
run: |
packer build digitalocean.json

@ -3,7 +3,7 @@ name: Helm Chart CI
on:
# Triggers the workflow on push or pull request events but only for the dev branch
push:
branches: [ dev ]
branches: [ main ]
paths: [ dev/helm/** ]
# Allows you to run this workflow manually from the Actions tab

@ -0,0 +1,31 @@
name: Build DigitalOcean Image
on:
workflow_dispatch:
inputs:
version:
description: 'App Version'
required: true
type: string
jobs:
build-do-image:
name: Build DigitalOcean Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Packer
run: |
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install packer
- name: Build Droplet Image
env:
DIGITALOCEAN_API_TOKEN: ${{ secrets.DO_TOKEN }}
WIKI_APP_VERSION: ${{ github.event.inputs.version }}
working-directory: dev/packer
run: |
packer build digitalocean.json

@ -4,15 +4,13 @@
[![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)
[![Backers on Open Collective](https://opencollective.com/wikijs/all/badge.svg)](https://opencollective.com/wikijs)
[![Standard - JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-green.svg?style=flat&logo=javascript&logoColor=white)](http://standardjs.com/)
[![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/)
[![Build status](https://dev.azure.com/requarks/wiki/_apis/build/status/build)](https://dev.azure.com/requarks/wiki/_build/latest?definitionId=9)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=wiki&metric=alert_status)](https://sonarcloud.io/dashboard?id=wiki)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=wiki&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=wiki)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=wiki&metric=security_rating)](https://sonarcloud.io/dashboard?id=wiki)
[![Standard - JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)
[![Huntr](https://img.shields.io/badge/security%20bounty-disclose-brightgreen.svg?style=flat&logo=cachet)](https://huntr.dev/bounties/disclose)
[![Build + Publish](https://github.com/Requarks/wiki/actions/workflows/build.yml/badge.svg)](https://github.com/Requarks/wiki/actions/workflows/build.yml)
[![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)
[![Twitter Follow](https://img.shields.io/badge/follow-%40requarks-blue.svg?style=flat&logo=twitter)](https://twitter.com/requarks)
[![Reddit](https://img.shields.io/badge/reddit-%2Fr%2Fwikijs-orange?logo=reddit&logoColor=white)](https://www.reddit.com/r/wikijs/)
@ -27,7 +25,7 @@
- [Requirements](https://docs.requarks.io/install/requirements)
- [Installation](https://docs.requarks.io/install)
- [Demo](https://docs.requarks.io/demo)
- [Change Log](https://docs.requarks.io/releases)
- [Changelog](https://docs.requarks.io/releases)
- [Feature Requests](https://feedback.js.wiki/wiki)
- [Chat with us on Slack](https://wiki.requarks.io/slack)
- [Translations](https://docs.requarks.io/dev/translations) *(We need your help!)*
@ -134,7 +132,9 @@ Support this project by becoming a sponsor. Your name will show up in the Contri
</tr>
</tbody>
</table>
</div>
<table><tbody><tr><td>
<img width="441" height="1" />
- Akira Suenami ([@a-suenami](https://github.com/a-suenami))
- Arnaud Marchand ([@snuids](https://github.com/snuids))
@ -148,15 +148,23 @@ Support this project by becoming a sponsor. Your name will show up in the Contri
- Elijah Zobenko ([@he110](https://github.com/he110))
- Ernie ([@iamernie](https://github.com/iamernie))
- Fabio Ferrari ([@devxops](https://github.com/devxops))
- Finsa S.p.A. ([@finsaspa](https://github.com/finsaspa))
- Florian Moss ([@florianmoss](https://github.com/florianmoss))
- GoodCorporateCitizen ([@GoodCorporateCitizen](https://github.com/GoodCorporateCitizen))
- HeavenBay ([@HeavenBay](https://github.com/heavenbay))
- Ian Hyzy ([@ianhyzy](https://github.com/ianhyzy))
- Jaimyn Mayer ([@jabelone](https://github.com/jabelone))
- Jay Lee ([@polyglotm](https://github.com/polyglotm))
- Kelly Wardrop ([@dropcoded](https://github.com/dropcoded))
- Loki ([@binaryloki](https://github.com/binaryloki))
- MaFarine ([@MaFarine](https://github.com/MaFarine))
- Marcilio Leite Neto ([@marclneto](https://github.com/marclneto))
</td><td>
<img width="441" height="1" />
- Mattias Johnson ([@mattiasJohnson](https://github.com/mattiasJohnson))
- Max Ricketts-Uy ([@MaxRickettsUy](https://github.com/MaxRickettsUy))
- Mitchell Rowton ([@mrowton](https://github.com/mrowton))
- M. Scott Ford ([@mscottford](https://github.com/mscottford))
- Nick Halase ([@nhalase](https://github.com/nhalase))
@ -164,7 +172,7 @@ Support this project by becoming a sponsor. Your name will show up in the Contri
- Noel Cower ([@nilium](https://github.com/nilium))
- Philipp Schmitt ([@pschmitt](https://github.com/pschmitt))
- Robert Lanzke ([@winkelement](https://github.com/winkelement))
- Sam Martin ([@winkelement](https://github.com/ABitMoreDepth))
- Sam Martin ([@ABitMoreDepth](https://github.com/ABitMoreDepth))
- Sean Coffey ([@seanecoffey](https://github.com/seanecoffey))
- Stephan Kristyn ([@stevek-pro](https://github.com/stevek-pro))
- Theodore Chu ([@TheodoreChu](https://github.com/TheodoreChu))
@ -178,6 +186,9 @@ Support this project by becoming a sponsor. Your name will show up in the Contri
- rburckner ([@rburckner](https://github.com/rburckner))
- scorpion ([@scorpion](https://github.com/scorpion))
- valantien ([@valantien](https://github.com/valantien))
</td></tr></tbody></table>
</div>
<h2 align="center">OpenCollective Sponsors</h2>
@ -313,7 +324,10 @@ Support this project by becoming a sponsor. Your logo will show up in the Contri
Thank you to all our patrons! 🙏 [[Become a patron](https://www.patreon.com/requarks)]
<!--5 start-->
<div align="center">
<table><tbody><tr><td>
<img width="441" height="1" />
- Al Romano
- Alex Balabanov
- Alex Zen
@ -330,6 +344,10 @@ Thank you to all our patrons! 🙏 [[Become a patron](https://www.patreon.com/re
- hong
- Hope
- Ian
</td><td>
<img width="441" height="1" />
- Iskander Callos
- Josh Stewart
- Justin Dunsworth
@ -346,7 +364,9 @@ Thank you to all our patrons! 🙏 [[Become a patron](https://www.patreon.com/re
- Stepan Sokolovskyi
- Zach Maynard
- 张白驹
<!--5 end-->
</td></tr></tbody></table>
</div>
<h2 align="center">OpenCollective Backers</h2>

@ -1,158 +0,0 @@
name: 2.6.$(Rev:r)
trigger:
- dev
- latest
stages:
- stage: build
displayName: Build stage
jobs:
# -------------------------------
# BUILD - LINUX
# -------------------------------
- job: buildLinux
displayName: Linux Build
timeoutInMinutes: 60
cancelTimeoutInMinutes: 1
pool:
name: Azure Pipelines
vmImage: ubuntu-latest
steps:
- task: CmdLine@2
displayName: Disable dev flag
inputs:
script: |
sudo apt-get install jq -y
mv package.json pkg-temp.json
jq -r '.dev |= false' pkg-temp.json > package.json
rm pkg-temp.json
workingDirectory: '$(Build.SourcesDirectory)'
- task: CmdLine@2
displayName: Set Package Version
inputs:
script: |
mv package.json pkg-temp.json
jq -r '.version |= "$(Build.BuildNumber)"' pkg-temp.json > package.json
rm pkg-temp.json
cat package.json
workingDirectory: '$(Build.SourcesDirectory)'
- task: Docker@2
displayName: Build Docker image
inputs:
containerRegistry: Docker Hub
repository: requarks/wiki
Dockerfile: dev/build/Dockerfile
buildContext: '$(System.DefaultWorkingDirectory)'
tags: |
canary
canary-$(Build.BuildNumber)
addPipelineData: false
- task: CmdLine@2
displayName: Extract compiled files
inputs:
script: |
docker create --name wiki requarks/wiki:canary
docker cp wiki:/wiki $(Build.StagingDirectory)
docker rm wiki
rm $(Build.StagingDirectory)/wiki/config.yml
cp $(System.DefaultWorkingDirectory)/config.sample.yml $(Build.StagingDirectory)/wiki/config.sample.yml
find $(Build.StagingDirectory)/wiki/ -printf "%P\n" | tar -czf wiki-js.tar.gz --no-recursion -C $(Build.StagingDirectory)/wiki/ -T -
workingDirectory: '$(Build.SourcesDirectory)'
- task: PublishBuildArtifacts@1
displayName: Publish Build Artifacts
inputs:
PathtoPublish: 'wiki-js.tar.gz'
ArtifactName: 'drop'
# -------------------------------
# TESTS - CYPRESS E2E TESTS
# -------------------------------
- job: testCypress
displayName: Cypress E2E Tests
dependsOn: buildLinux
strategy:
maxParallel: 5
matrix:
MariaDB:
MATRIXENV: mariadb
MySQL:
MATRIXENV: mysql
MSSQLServer:
MATRIXENV: mssql
PostgreSQL:
MATRIXENV: postgres
SQLite:
MATRIXENV: sqlite
timeoutInMinutes: 30
cancelTimeoutInMinutes: 1
pool:
name: Azure Pipelines
vmImage: ubuntu-latest
steps:
- task: Bash@3
displayName: Setup Environment
inputs:
targetType: filePath
filePath: './dev/cypress/ci-setup.sh'
workingDirectory: '$(Build.SourcesDirectory)'
- script: |
docker run --name cypress --ipc=host --shm-size 1G -v $BUILD_SOURCESDIRECTORY:/e2e -w /e2e cypress/included:4.9.0 --record --key "$(CYPRESS_KEY)" --headless --group "$MATRIXENV" --ci-build-id "$BUILD_BUILDNUMBER" --config baseUrl=http://172.17.0.1:3000
displayName: 'Run Tests'
# -------------------------------
# BUILD - WINDOWS
# -------------------------------
- job: buildWindows
displayName: Windows Build
dependsOn: buildLinux
pool:
name: Azure Pipelines
vmImage: windows-latest
timeoutInMinutes: 30
cancelTimeoutInMinutes: 1
steps:
- task: NodeTool@0
displayName: 'Use Node 14.x'
inputs:
versionSpec: 14.x
- task: 'geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@3'
displayName: 'Use Yarn 1.x'
- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
artifactName: drop
- script: |
mkdir -p $(Build.SourcesDirectory)\win
tar -xzf $(System.ArtifactsDirectory)\drop\wiki-js.tar.gz -C $(Build.SourcesDirectory)\win --exclude=node_modules
displayName: 'Extract build'
- script: 'yarn --production --frozen-lockfile --non-interactive'
workingDirectory: win
displayName: 'Install dependencies'
- task: ArchiveFiles@2
displayName: 'Archive app'
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)\win'
includeRootFolder: false
archiveType: tar
archiveFile: 'wiki-js-windows.tar.gz'
- task: PublishBuildArtifacts@1
displayName: Publish Build Artifacts
inputs:
PathtoPublish: 'wiki-js-windows.tar.gz'
ArtifactName: 'drop-win'

@ -290,12 +290,12 @@ const md = new MarkdownIt({
})
.use(underline)
.use(mdEmoji)
.use(mdTaskLists, {label: false, labelAfter: false})
.use(mdTaskLists, { label: false, labelAfter: false })
.use(mdExpandTabs)
.use(mdAbbr)
.use(mdSup)
.use(mdSub)
.use(mdMultiTable, {multiline: true, rowspan: true, headerless: true})
.use(mdMultiTable, { multiline: true, rowspan: true, headerless: true })
.use(mdMark)
.use(mdFootnote)
.use(mdImsize)

@ -5,9 +5,14 @@
img.animated.fadeIn(src='/_assets/svg/logo-wikijs.svg', alt='Wiki.js')
.headline.animated.fadeInUp {{ $t('welcome.title') }}
.subtitle-1.mt-3.animated.fadeInUp.wait-p1s {{ $t('welcome.subtitle') }}
v-btn.mt-5.animated.fadeInUp.wait-p2s(color='primary', :href='`/e/` + locale + `/home`', x-large)
v-icon(left) mdi-plus
span {{ $t('welcome.createhome') }}
div
v-btn.mt-5.mx-3.animated.fadeInUp.wait-p2s(color='primary', :href='`/e/` + locale + `/home`', x-large)
v-icon(left) mdi-plus
span {{ $t('welcome.createhome') }}
v-btn.mt-5.mx-3.animated.fadeInUp.wait-p3s(color='primary', href='/a', x-large)
v-icon(left) mdi-view-dashboard
span {{ $t('welcome.goadmin') }}
</template>
<script>

@ -108,6 +108,13 @@ bindIP: 0.0.0.0
logLevel: info
# ---------------------------------------------------------------------
# Log Format
# ---------------------------------------------------------------------
# Output format for logging, possible values: default, json
logFormat: default
# ---------------------------------------------------------------------
# Offline Mode
# ---------------------------------------------------------------------
@ -130,3 +137,11 @@ ha: false
# ---------------------------------------------------------------------
# Writeable data path used for cache and temporary user uploads.
dataPath: ./data
# ---------------------------------------------------------------------
# Body Parser Limit
# ---------------------------------------------------------------------
# Maximum size of API requests body that can be parsed. Does not affect
# file uploads.
bodyParserLimit: 5mb

@ -15,5 +15,6 @@ ssl:
provider: letsencrypt
domain: $(LETSENCRYPT_DOMAIN)
subscriberEmail: $(LETSENCRYPT_EMAIL)
logLevel: info
logLevel: $(LOG_LEVEL:info)
logFormat: $(LOG_FORMAT:default)
ha: $(HA_ACTIVE)

@ -6,7 +6,7 @@ postgres)
echo "Waiting for database connection..."
sleep 2
done
docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=postgres" -e "DB_HOST=localhost" -e "DB_PORT=5432" -e "DB_NAME=wiki" -e "DB_USER=wiki" -e "DB_PASS=Password123!" requarks/wiki:canary-$BUILD_BUILDNUMBER
docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=postgres" -e "DB_HOST=localhost" -e "DB_PORT=5432" -e "DB_NAME=wiki" -e "DB_USER=wiki" -e "DB_PASS=Password123!" requarks/wiki:canary-$REL_VERSION_STRICT
;;
mysql)
echo "Using MySQL..."
@ -15,7 +15,7 @@ mysql)
echo "Waiting for database connection..."
sleep 2
done
docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=mysql" -e "DB_HOST=localhost" -e "DB_PORT=3306" -e "DB_NAME=wiki" -e "DB_USER=wiki" -e "DB_PASS=Password123!" requarks/wiki:canary-$BUILD_BUILDNUMBER
docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=mysql" -e "DB_HOST=localhost" -e "DB_PORT=3306" -e "DB_NAME=wiki" -e "DB_USER=wiki" -e "DB_PASS=Password123!" requarks/wiki:canary-$REL_VERSION_STRICT
;;
mariadb)
echo "Using MariaDB..."
@ -24,7 +24,7 @@ mariadb)
echo "Waiting for database connection..."
sleep 2
done
docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=mariadb" -e "DB_HOST=localhost" -e "DB_PORT=3306" -e "DB_NAME=wiki" -e "DB_USER=wiki" -e "DB_PASS=Password123!" requarks/wiki:canary-$BUILD_BUILDNUMBER
docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=mariadb" -e "DB_HOST=localhost" -e "DB_PORT=3306" -e "DB_NAME=wiki" -e "DB_USER=wiki" -e "DB_PASS=Password123!" requarks/wiki:canary-$REL_VERSION_STRICT
;;
mssql)
echo "Using MS SQL Server..."
@ -33,11 +33,11 @@ mssql)
echo "Waiting for database connection..."
sleep 2
done
docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=mssql" -e "DB_HOST=localhost" -e "DB_PORT=1433" -e "DB_NAME=wiki" -e "DB_USER=SA" -e "DB_PASS=Password123!" requarks/wiki:canary-$BUILD_BUILDNUMBER
docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=mssql" -e "DB_HOST=localhost" -e "DB_PORT=1433" -e "DB_NAME=wiki" -e "DB_USER=SA" -e "DB_PASS=Password123!" requarks/wiki:canary-$REL_VERSION_STRICT
;;
sqlite)
echo "Using SQLite..."
docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=sqlite" -e "DB_FILEPATH=db.sqlite" requarks/wiki:canary-$BUILD_BUILDNUMBER
docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=sqlite" -e "DB_FILEPATH=db.sqlite" requarks/wiki:canary-$REL_VERSION_STRICT
;;
*)
echo "Invalid DB Type!"

@ -4,17 +4,17 @@
[![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)
[![Backers on Open Collective](https://opencollective.com/wikijs/all/badge.svg)](https://opencollective.com/wikijs)
[![Downloads](https://img.shields.io/github/downloads/Requarks/wiki/total.svg?style=flat)](https://github.com/Requarks/wiki/releases)
[![Docker Pulls](https://img.shields.io/docker/pulls/requarks/wiki.svg)](https://hub.docker.com/r/requarks/wiki/)
[![Build status](https://dev.azure.com/requarks/wiki/_apis/build/status/build)](https://dev.azure.com/requarks/wiki/_build/latest?definitionId=9)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=wiki&metric=alert_status)](https://sonarcloud.io/dashboard?id=wiki)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=wiki&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=wiki)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=wiki&metric=security_rating)](https://sonarcloud.io/dashboard?id=wiki)
[![Standard - JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](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/)
[![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/)
[![Build + Publish](https://github.com/Requarks/wiki/actions/workflows/build.yml/badge.svg)](https://github.com/Requarks/wiki/actions/workflows/build.yml)
[![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)
[![Twitter Follow](https://img.shields.io/badge/follow-%40requarks-blue.svg?style=flat&logo=twitter)](https://twitter.com/requarks)
[![Subscribe to Newsletter](https://img.shields.io/badge/newsletter-subscribe-yellow.svg?style=flat&logo=mailchimp)](https://wiki.js.org/newsletter)
[![Reddit](https://img.shields.io/badge/reddit-%2Fr%2Fwikijs-orange?logo=reddit&logoColor=white)](https://www.reddit.com/r/wikijs/)
[![Subscribe to Newsletter](https://img.shields.io/badge/newsletter-subscribe-yellow.svg?style=flat&logo=mailchimp)](https://blog.js.wiki/subscribe)
##### A modern, lightweight and powerful wiki app built on NodeJS
@ -104,6 +104,8 @@ The following table lists the configurable parameters of the Wiki.js chart and t
| `affinity` | Affinity settings for wiki.js pod assignment | `{}` |
| `schedulerName` | Name of an alternate scheduler for wiki.js pod | `nil` |
| `tolerations` | Toleration labels for wiki.jsk pod assignment | `[]` |
| `volumeMounts` | Volume mounts for Wiki.js container | `[]` |
| `volumes` | Volumes for Wiki.js Pod | `[]` |
| `ingress.enabled` | Enable ingress controller resource | `false` |
| `ingress.annotations` | Ingress annotations | `{}` |
| `ingress.hosts` | List of ingress rules | `[{"host": "wiki.local", "paths": ["/"]}]` |

@ -63,6 +63,10 @@ spec:
key: {{ template "wiki.postgresql.secretKey" . }}
- name: HA_ACTIVE
value: {{ .Values.replicaCount | int | le 2 | quote }}
{{- with .Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 3000
@ -85,3 +89,7 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}

@ -85,6 +85,10 @@ tolerations: []
affinity: {}
volumeMounts: []
volumes: []
# This will allow us to install locales even without internet access using a initContainer & wikjs "sideloading"
sideload:
enabled: false

@ -0,0 +1,85 @@
{
"variables": {
"do_api_token": "{{env `DIGITALOCEAN_API_TOKEN`}}",
"image_name": "wikijs-snapshot-{{timestamp}}",
"apt_packages": "apt-transport-https ca-certificates curl jq linux-image-extra-virtual software-properties-common gnupg-agent openssl ",
"application_name": "Wiki.js",
"application_version": "{{env `WIKI_APP_VERSION`}}",
"docker_compose_version": "1.29.2"
},
"sensitive-variables": [
"do_api_token"
],
"builders": [
{
"type": "digitalocean",
"api_token": "{{user `do_api_token`}}",
"image": "ubuntu-20-04-x64",
"region": "tor1",
"size": "s-1vcpu-1gb",
"ssh_username": "root",
"snapshot_name": "{{user `image_name`}}"
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"cloud-init status --wait"
]
},
{
"type": "file",
"source": "scripts/001-onboot.sh",
"destination": "/var/lib/cloud/scripts/per-instance/001-onboot.sh"
},
{
"type": "file",
"source": "scripts/099-one-click",
"destination": "/etc/update-motd.d/099-one-click"
},
{
"type": "shell",
"inline": [
"chmod +x /var/lib/cloud/scripts/per-instance/001-onboot.sh",
"chmod +x /etc/update-motd.d/099-one-click"
]
},
{
"type": "shell",
"environment_vars": [
"DEBIAN_FRONTEND=noninteractive",
"LC_ALL=C",
"LANG=en_US.UTF-8",
"LC_CTYPE=en_US.UTF-8"
],
"inline": [
"apt -qqy update",
"apt -qqy -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' full-upgrade",
"apt -qqy -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install {{user `apt_packages`}}",
"apt-get -qqy clean"
]
},
{
"type": "shell",
"environment_vars": [
"application_name={{user `application_name`}}",
"application_version={{user `application_version`}}",
"docker_compose_version={{user `docker_compose_version`}}",
"DEBIAN_FRONTEND=noninteractive",
"LC_ALL=C",
"LANG=en_US.UTF-8",
"LC_CTYPE=en_US.UTF-8"
],
"scripts": [
"scripts/010-docker.sh",
"scripts/011-docker-compose.sh",
"scripts/012-grub-opts.sh",
"scripts/013-docker-dns.sh",
"scripts/014-ufw-docker.sh",
"scripts/020-application-tag.sh",
"scripts/900-cleanup.sh"
]
}
]
}

@ -0,0 +1,15 @@
#!/bin/bash
# Scripts in this directory will be executed by cloud-init on the first boot of droplets
# created from your image. Things ike generating passwords, configuration requiring IP address
# or other items that will be unique to each instance should be done in scripts here.
openssl rand -base64 32 > /etc/wiki/.db-secret
if [[ -z $DATABASE_URL ]]; then
docker start db
fi
docker start wiki
docker start wiki-update-companion
# docker start nginx-proxy
# docker start watchtower

@ -0,0 +1,19 @@
#!/bin/bash
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt -qqy update
apt -qqy -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install docker-ce docker-ce-cli containerd.io
systemctl enable docker
systemctl start docker
mkdir -p /etc/wiki
docker network create wikinet
docker volume create pgdata
docker create --name=db -e POSTGRES_DB=wiki -e POSTGRES_USER=wiki -e POSTGRES_PASSWORD_FILE=/etc/wiki/.db-secret -v /etc/wiki/.db-secret:/etc/wiki/.db-secret:ro -v pgdata:/var/lib/postgresql/data --restart=unless-stopped -h db --network=wikinet postgres:11
docker create --name=wiki -e DB_TYPE=postgres -e DB_HOST=db -e DB_PORT=5432 -e DB_PASS_FILE=/etc/wiki/.db-secret -v /etc/wiki/.db-secret:/etc/wiki/.db-secret:ro -e DB_USER=wiki -e DB_NAME=wiki -e UPGRADE_COMPANION=1 --restart=unless-stopped -h wiki --network=wikinet -p 80:3000 -p 443:3443 ghcr.io/requarks/wiki:2
docker create --name=wiki-update-companion -v /var/run/docker.sock:/var/run/docker.sock:ro --restart=unless-stopped -h wiki-update-companion --network=wikinet requarks/wiki-update-companion:latest
# docker create --name=nginx-proxy -p 80:80 -p 443:443 -e DEFAULT_HOST=wiki.local --network=wikinet -v /var/run/docker.sock:/tmp/docker.sock:ro --restart=unless-stopped jwilder/nginx-proxy
# docker create --name=watchtower --network=wikinet -v /var/run/docker.sock:/var/run/docker.sock --restart=unless-stopped containrrr/watchtower --cleanup --schedule="0 2 * * 6" wiki

@ -0,0 +1,4 @@
#!/bin/sh
sudo curl -L "https://github.com/docker/compose/releases/download/${docker_compose_version}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose;
chmod +x /usr/local/bin/docker-compose;

@ -0,0 +1,6 @@
#!/bin/sh
sed -e 's|GRUB_CMDLINE_LINUX="|GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1|g' \
-i /etc/default/grub
update-grub

@ -0,0 +1,4 @@
#!/bin/sh
sed -e 's|#DOCKER_OPTS|DOCKER_OPTS|g' \
-i /etc/default/docker

@ -0,0 +1,9 @@
#!/bin/bash
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw --force enable
cat /dev/null > /var/log/ufw.log

@ -0,0 +1,24 @@
#!/bin/sh
################################
## PART: Write the application tag
##
## vi: syntax=sh expandtab ts=4
build_date=$(date +%Y-%m-%d)
distro="$(lsb_release -s -i)"
distro_release="$(lsb_release -s -r)"
distro_codename="$(lsb_release -s -c)"
distro_arch="$(uname -m)"
mkdir -p /var/lib/digitalocean
cat >> /var/lib/digitalocean/application.info <<EOM
application_name="${application_name}"
build_date="${build_date}"
distro="${distro}"
distro_release="${distro_release}"
distro_codename="${distro_codename}"
distro_arch="${distro_arch}"
application_version="${application_version}"
EOM

@ -0,0 +1,21 @@
#!/bin/sh
#
# Configured as part of the DigitalOcean 1-Click Image build process
myip=$(hostname -I | awk '{print$1}')
cat <<EOF
********************************************************************************
Welcome to Wiki.js's 1-Click DigitalOcean Droplet.
To keep this Droplet secure, the UFW firewall is enabled.
All ports are BLOCKED except 22 (SSH), 80 (Docker) and 443 (Docker).
* The Wiki.js 1-Click DigitalOcean Quickstart guide is available at:
https://docs.requarks.io/install/digitalocean
* You can SSH to this Droplet in a terminal as root: ssh root@$myip
* Docker is installed and configured per Docker's recommendations:
https://docs.docker.com/install/linux/docker-ce/ubuntu/
* Docker Compose is installed and configured per Docker's recommendations:
https://docs.docker.com/compose/install/#install-compose
For more information, visit https://docs.requarks.io/install/digitalocean
********************************************************************************
To delete this message of the day: rm -rf $(readlink -f ${0})
EOF

@ -0,0 +1,44 @@
#!/bin/bash
# Ensure /tmp exists and has the proper permissions before
# checking for security updates
# https://github.com/digitalocean/marketplace-partners/issues/94
if [[ ! -d /tmp ]]; then
mkdir /tmp
fi
chmod 1777 /tmp
apt-get -y update
apt-get -y upgrade
rm -rf /tmp/* /var/tmp/*
history -c
cat /dev/null > /root/.bash_history
unset HISTFILE
apt-get -y autoremove
apt-get -y autoclean
find /var/log -mtime -1 -type f -exec truncate -s 0 {} \;
rm -rf /var/log/*.gz /var/log/*.[0-9] /var/log/*-????????
rm -rf /var/lib/cloud/instances/*
rm -f /root/.ssh/authorized_keys /etc/ssh/*key*
touch /etc/ssh/revoked_keys
chmod 600 /etc/ssh/revoked_keys
# Securely erase the unused portion of the filesystem
GREEN='\033[0;32m'
NC='\033[0m'
printf "\n${GREEN}Writing zeros to the remaining disk space to securely
erase the unused portion of the file system.
Depending on your disk size this may take several minutes.
The secure erase will complete successfully when you see:${NC}
dd: writing to '/zerofile': No space left on device\n
Beginning secure erase now\n"
dd if=/dev/zero of=/zerofile &
PID=$!
while [ -d /proc/$PID ]
do
printf "."
sleep 5
done
sync; rm /zerofile; sync
cat /dev/null > /var/log/lastlog; cat /dev/null > /var/log/wtmp

@ -24,8 +24,10 @@ defaults:
min: 1
bindIP: 0.0.0.0
logLevel: info
logFormat: default
offline: false
ha: false
bodyParserLimit: 5mb
# DB defaults
api:
isEnabled: false

@ -241,6 +241,9 @@ module.exports = {
user.groups.forEach(grp => {
const grpId = _.isObject(grp) ? _.get(grp, 'id', 0) : grp
_.get(WIKI.auth.groups, `${grpId}.pageRules`, []).forEach(rule => {
if (rule.locales && rule.locales.length > 0) {
if (!rule.locales.includes(page.locale)) { return }
}
if (_.intersection(rule.roles, permissions).length > 0) {
switch (rule.match) {
case 'START':

@ -19,7 +19,7 @@ module.exports = {
} catch (err) {
WIKI.logger.error('Database Initialization Error: ' + err.message)
if (WIKI.IS_DEBUG) {
console.error(err)
WIKI.logger.error(err)
}
process.exit(1)
}

@ -6,14 +6,21 @@ const winston = require('winston')
module.exports = {
loggers: {},
init(uid) {
let logger = winston.createLogger({
const loggerFormats = [
winston.format.label({ label: uid }),
winston.format.timestamp()
]
if (WIKI.config.logFormat === 'json') {
loggerFormats.push(winston.format.json())
} else {
loggerFormats.push(winston.format.colorize())
loggerFormats.push(winston.format.printf(info => `${info.timestamp} [${info.label}] ${info.level}: ${info.message}`))
}
const logger = winston.createLogger({
level: WIKI.config.logLevel,
format: winston.format.combine(
winston.format.colorize(),
winston.format.label({ label: uid }),
winston.format.timestamp(),
winston.format.printf(info => `${info.timestamp} [${info.label}] ${info.level}: ${info.message}`)
)
format: winston.format.combine(...loggerFormats)
})
// Init Console (default)

@ -8,14 +8,18 @@ module.exports = {
/**
* Parse configuration value for environment vars
*
* Replaces `$(ENV_VAR_NAME)` with value of `ENV_VAR_NAME` environment variable.
*
* Also supports defaults by if provided as `$(ENV_VAR_NAME:default)`
*
* @param {any} cfg Configuration value
* @returns Parse configuration value
*/
parseConfigValue (cfg) {
return _.replace(
cfg,
/\$\(([A-Z0-9_]+)\)/g,
(fm, m) => { return process.env[m] }
/\$\(([A-Z0-9_]+)(?::(.+))?\)/g,
(fm, m, d) => { return process.env[m] || d }
)
},

@ -91,7 +91,7 @@ module.exports = async () => {
// GraphQL Server
// ----------------------------------------
app.use(bodyParser.json({ limit: '1mb' }))
app.use(bodyParser.json({ limit: WIKI.config.bodyParserLimit || '1mb' }))
await WIKI.servers.startGraphQL()
// ----------------------------------------

@ -371,8 +371,8 @@ module.exports = class Page extends Model {
// -> Check for page access
if (!WIKI.auth.checkAccess(opts.user, ['write:pages'], {
locale: opts.locale,
path: opts.path
locale: ogPage.localeCode,
path: ogPage.path
})) {
throw new WIKI.Error.PageUpdateForbidden()
}
@ -456,6 +456,14 @@ module.exports = class Page extends Model {
// -> Perform move?
if ((opts.locale && opts.locale !== page.localeCode) || (opts.path && opts.path !== page.path)) {
// -> Check target path access
if (!WIKI.auth.checkAccess(opts.user, ['write:pages'], {
locale: opts.locale,
path: opts.path
})) {
throw new WIKI.Error.PageMoveForbidden()
}
await WIKI.models.pages.movePage({
id: page.id,
destinationLocale: opts.locale,

@ -346,7 +346,6 @@ module.exports = class User extends Model {
}
}
}
console.info(redirect)
// Is 2FA required?
if (!skipTFA) {

@ -6,6 +6,6 @@ const mdTaskLists = require('markdown-it-task-lists')
module.exports = {
init (md, conf) {
md.use(mdTaskLists, {label: true, labelAfter: true})
md.use(mdTaskLists, { label: false, labelAfter: false })
}
}

@ -73,7 +73,7 @@ module.exports = {
mode: 0o600
})
} catch (err) {
console.error(err)
WIKI.logger.error(err)
throw err
}
}

@ -1,5 +0,0 @@
sonar.projectKey=wiki
sonar.organization=requarks
sonar.host.url=https://sonarcloud.io
sonar.sources=./server,./client
sonar.exclusions=./server/templates
Loading…
Cancel
Save