Compare commits

..

44 Commits

Author SHA1 Message Date
renovate f67040c83b fix(deps): update dependency lowlight to v3
continuous-integration/drone/pr Build is failing Details
2024-02-11 13:05:37 +00:00
renovate 3a65324a7d fix(deps): update tiptap to v2.2.2
continuous-integration/drone/push Build is passing Details
2024-02-11 09:37:38 +00:00
renovate bec11d42fc fix(deps): update module golang.org/x/oauth2 to v0.17.0
continuous-integration/drone/push Build is failing Details
2024-02-11 09:36:08 +00:00
renovate d2eeac2dbe fix(deps): pin dependencies
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is failing Details
2024-02-11 09:05:38 +00:00
renovate 05e7468135 fix(deps): update module xorm.io/xorm to v1.3.8
continuous-integration/drone/push Build is passing Details
2024-02-11 08:34:26 +00:00
renovate 4babe72f24 fix(deps): update module github.com/getsentry/sentry-go to v0.27.0
continuous-integration/drone/push Build is failing Details
2024-02-11 08:34:04 +00:00
renovate e9fe927644 fix(deps): update module golang.org/x/sys to v0.17.0
continuous-integration/drone/push Build is failing Details
2024-02-11 08:33:24 +00:00
renovate 7cefb86a78 fix(deps): update dependency vue to v3.4.18
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is failing Details
2024-02-11 08:05:32 +00:00
kolaente 6c4122264a
chore(ci): sign drone config
continuous-integration/drone/push Build is passing Details
2024-02-10 15:18:46 +01:00
kolaente 4162c64ed9
fix(ci): publish frontend assets into correct directory
continuous-integration/drone/push Build was killed Details
2024-02-10 15:17:19 +01:00
kolaente 2e57b6e409
chore: release preparation
continuous-integration/drone/push Build is passing Details
2024-02-10 14:46:33 +01:00
kolaente 8752ae2a0b
fix(webhook): fetch all event details before sending the webhook
continuous-integration/drone/push Build is passing Details
Resolves https://community.vikunja.io/t/webhook-comment-data-issues/1952
2024-02-10 14:15:32 +01:00
kolaente 7edb53ca12
fix(export): don't crash when an exported file does not exist
continuous-integration/drone/push Build is passing Details
Related to https://github.com/go-vikunja/vikunja/issues/110
2024-02-10 13:45:12 +01:00
kolaente 25a03d1789
chore: remove unused import 2024-02-10 13:31:19 +01:00
kolaente 5ab9fb89bb
fix(tasks): check for cycles during creation of task relations and prevent them 2024-02-10 13:30:41 +01:00
kolaente 55e271b329
fix(ci): deploy packages into the correct directory
continuous-integration/drone/push Build is passing Details
2024-02-09 23:26:54 +01:00
kolaente 6ea5266c55
fix(docs): old install pages redirect
continuous-integration/drone/push Build is failing Details
2024-02-09 20:35:58 +01:00
kolaente ddf6a30e19
fix(docs): old install pages redirect
continuous-integration/drone/push Build is failing Details
2024-02-09 20:34:41 +01:00
kolaente b1745edfa6
chore: remove unused build args
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is failing Details
2024-02-09 19:44:52 +01:00
kolaente 1984527fae
docs: adjust documentation to reflect single-binary deployments
continuous-integration/drone/pr Build is passing Details
2024-02-09 19:09:19 +01:00
kolaente 11b72765c9
chore(ci): run desktop build without waiting on the frontend when not doing release builds
continuous-integration/drone/pr Build is passing Details
2024-02-09 16:08:38 +01:00
kolaente d36b1608cf
fix: lint
continuous-integration/drone/pr Build is passing Details
2024-02-09 15:32:12 +01:00
kolaente adf7b73b6b
fix: create dummy frontend files in test to make the pipeline run
continuous-integration/drone/pr Build was killed Details
2024-02-09 15:13:12 +01:00
kolaente e12e9f1bf2
feat: update drone config to release single-binary bundles
continuous-integration/drone/pr Build is failing Details
2024-02-09 14:57:39 +01:00
kolaente 60006aeac5
chore: remove old frontend docker files 2024-02-09 14:45:17 +01:00
kolaente ca68b52991
feat: replace api url with public url 2024-02-09 14:44:41 +01:00
kolaente 2d32d900c8
feat: replace api url with public url 2024-02-09 14:42:07 +01:00
kolaente 119c68be9d
feat: rename frontend url config to public url 2024-02-09 14:41:55 +01:00
kolaente 78df83ee69
feat: replace api url 2024-02-09 14:38:54 +01:00
kolaente db2ec45378
feat: move custom logo setting to api 2024-02-09 14:33:21 +01:00
kolaente d7dc209f15
feat: move allow icon changes setting to api 2024-02-09 14:30:21 +01:00
kolaente 0f28767acc
feat: enable infinite nesting always, remove setting 2024-02-09 14:26:42 +01:00
kolaente a0e770438d
feat: move sentry configuration from frontend to api 2024-02-09 14:24:29 +01:00
kolaente 1899f16207
chore(ci): sign drone config 2024-02-09 13:42:27 +01:00
kolaente f77ba0d4f1
feat: only one dockerfile with api and frontend 2024-02-09 13:42:05 +01:00
kolaente b3228794c7
feat: add caching rules for more files 2024-02-09 13:42:05 +01:00
kolaente 4a66c2202f
chore: only use api version as it is coming from the same codebase 2024-02-09 13:42:03 +01:00
kolaente aab36eb89c
chore: add pnpm run dev alias 2024-02-09 13:41:51 +01:00
kolaente 8b3cf2ed7e
chore: remove static path config option 2024-02-09 13:41:51 +01:00
kolaente 9c45d9ca15
feat: cache header and etag generation 2024-02-09 13:41:51 +01:00
kolaente 81455242ae
chore: copy static file handler 2024-02-09 13:41:50 +01:00
kolaente 6c5194b892
feat: bundle frontend files with api in one static bundle 2024-02-09 13:41:50 +01:00
kolaente 392f5cd468
fix(ci): run desktop pipeline only on PRs
continuous-integration/drone/push Build is failing Details
2024-02-08 21:43:26 +01:00
kolaente 9633a705cd
fix(ci): update shasum
continuous-integration/drone/push Build is failing Details
2024-02-08 21:41:13 +01:00
75 changed files with 2250 additions and 2451 deletions

View File

@ -7,3 +7,8 @@ docker-manifest.tmpl
docker-manifest-unstable.tmpl
*.db
*.zip
# Frontend
/frontend/node_modules/
/frontend/.direnv
/frontend/dist

View File

@ -1,7 +1,7 @@
---
kind: pipeline
type: docker
name: testing
name: build-and-test-api
workspace:
base: /go
@ -117,6 +117,8 @@ steps:
GOPROXY: 'https://goproxy.kolaente.de'
commands:
- mage -compile ./mage-static
- mkdir -p frontend/dist
- touch frontend/dist/index.html
when:
event: [ push, tag, pull_request ]
@ -338,7 +340,7 @@ steps:
---
kind: pipeline
type: docker
name: build-frontend
name: build-and-test-frontend
trigger:
branch:
@ -358,26 +360,6 @@ services:
VIKUNJA_LOG_LEVEL: DEBUG
steps:
# Disabled until we figure out why it is so slow
# - name: restore-cache
# image: meltwater/drone-cache:dev
# pull: always
# environment:
# AWS_ACCESS_KEY_ID:
# from_secret: cache_aws_access_key_id
# AWS_SECRET_ACCESS_KEY:
# from_secret: cache_aws_secret_access_key
# settings:
# debug: true
# restore: true
# bucket: kolaente.dev-drone-dependency-cache
# endpoint: https://s3.fr-par.scw.cloud
# region: fr-par
# path_style: true
# cache_key: '{{ .Repo.Name }}_{{ checksum "pnpm-lock.yaml" }}_{{ arch }}_{{ os }}'
# mount:
# - .cache
- name: dependencies
image: node:20.11.0-alpine
pull: always
@ -459,26 +441,6 @@ steps:
depends_on:
- build-prod
# - name: rebuild-cache
# image: meltwater/drone-cache:dev
# pull: always
# environment:
# AWS_ACCESS_KEY_ID:
# from_secret: cache_aws_access_key_id
# AWS_SECRET_ACCESS_KEY:
# from_secret: cache_aws_secret_access_key
# settings:
# rebuild: true
# bucket: kolaente.dev-drone-dependency-cache
# endpoint: https://s3.fr-par.scw.cloud
# region: fr-par
# path_style: true
# cache_key: '{{ .Repo.Name }}_{{ checksum "pnpm-lock.yaml" }}_{{ arch }}_{{ os }}'
# mount:
# - .cache
# depends_on:
# - dependencies
- name: deploy-preview
image: williamjackson/netlify-cli
pull: always
@ -513,7 +475,7 @@ type: docker
name: generate-swagger-docs
depends_on:
- testing
- build-and-test-api
workspace:
base: /go
@ -552,16 +514,13 @@ steps:
from_secret: git_push_ssh_key
---
########
# Build a release when tagging
########
kind: pipeline
type: docker
name: release
depends_on:
- testing
- build-and-test-api
- build-and-test-frontend
workspace:
base: /source
@ -579,6 +538,30 @@ steps:
commands:
- git fetch --tags
- name: frontend-dependencies
image: node:20.11.0-alpine
pull: always
environment:
PNPM_CACHE_FOLDER: .cache/pnpm
CYPRESS_CACHE_FOLDER: .cache/cypress
PUPPETEER_SKIP_DOWNLOAD: true
commands:
- cd frontend
- corepack enable && pnpm config set store-dir .cache/pnpm
- pnpm install --fetch-timeout 100000
- name: frontend-build
image: node:20.11.0-alpine
pull: always
environment:
PNPM_CACHE_FOLDER: .cache/pnpm
commands:
- cd frontend
- corepack enable && pnpm config set store-dir .cache/pnpm
- pnpm run build
depends_on:
- frontend-dependencies
# We're statically compiling the magefile to avoid race condition issues caused by multiple pipeline steps
# compiling the same magefile at the same time. It's also faster if each step does not need to compile it first.
- name: mage
@ -612,7 +595,9 @@ steps:
- export PATH=$PATH:$GOPATH/bin
- go install github.com/magefile/mage
- ./mage-static release:windows
depends_on: [ before-static-build ]
depends_on:
- before-static-build
- frontend-build
- name: static-build-linux
image: techknowlogick/xgo:latest
@ -626,7 +611,9 @@ steps:
- export PATH=$PATH:$GOPATH/bin
- go install github.com/magefile/mage
- ./mage-static release:linux
depends_on: [ before-static-build ]
depends_on:
- before-static-build
- frontend-build
- name: static-build-darwin
image: techknowlogick/xgo:latest
@ -640,7 +627,9 @@ steps:
- export PATH=$PATH:$GOPATH/bin
- go install github.com/magefile/mage
- ./mage-static release:darwin
depends_on: [ before-static-build ]
depends_on:
- before-static-build
- frontend-build
- name: after-build-compress
image: kolaente/upx
@ -678,7 +667,7 @@ steps:
detach_sign: true
# Push the releases to our pseudo-s3-bucket
- name: release-latest
- name: release-unstable
image: plugins/s3
pull: always
settings:
@ -692,7 +681,7 @@ steps:
path_style: true
strip_prefix: dist/zip/
source: dist/zip/*
target: /api/unstable/
target: /vikunja/unstable/
when:
branch:
- main
@ -714,7 +703,7 @@ steps:
path_style: true
strip_prefix: dist/zip/
source: dist/zip/*
target: /api/${DRONE_TAG##v}/
target: /vikunja/${DRONE_TAG##v}/
when:
event:
- tag
@ -766,7 +755,7 @@ steps:
path_style: true
strip_prefix: dist/os-packages/
source: dist/os-packages/*
target: /api/unstable/
target: /vikunja/unstable/
when:
branch:
- main
@ -788,59 +777,12 @@ steps:
path_style: true
strip_prefix: dist/os-packages/
source: dist/os-packages/*
target: /api/${DRONE_TAG##v}/
target: /vikunja/${DRONE_TAG##v}/
when:
event:
- tag
depends_on: [ build-os-packages-version ]
---
kind: pipeline
type: docker
name: deploy-docs
workspace:
base: /go
path: src/code.vikunja.io/api
clone:
depth: 50
trigger:
event:
- push
branch:
- main
steps:
- name: theme
image: kolaente/toolbox
pull: always
commands:
- mkdir docs/themes/vikunja -p
- cd docs/themes/vikunja
- wget https://dl.vikunja.io/theme/vikunja-theme.tar.gz
- tar -xzf vikunja-theme.tar.gz
- name: build
image: klakegg/hugo:0.111.3
pull: always
commands:
- cd docs
- hugo
- mv public/docs/* public # Hugo seems to be not capable of setting a different theme for a home page, so we do this ugly hack to fix it.
- name: docker
image: plugins/docker
pull: always
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: vikunja/docs
context: docs/
dockerfile: docs/Dockerfile
---
kind: pipeline
@ -848,7 +790,8 @@ type: docker
name: docker-release
depends_on:
- testing
- build-and-test-api
- build-and-test-frontend
trigger:
ref:
@ -870,7 +813,7 @@ steps:
from_secret: docker_username
password:
from_secret: docker_password
repo: vikunja/api
repo: vikunja/vikunja
tags: unstable
platforms:
- linux/386
@ -903,7 +846,7 @@ steps:
from_secret: docker_username
password:
from_secret: docker_password
repo: vikunja/api
repo: vikunja/vikunja
platforms:
- linux/386
- linux/amd64
@ -915,43 +858,14 @@ steps:
ref:
- "refs/tags/**"
---
kind: pipeline
type: docker
name: notify
trigger:
ref:
- refs/heads/main
- "refs/tags/**"
name: frontend-release-unstable
depends_on:
- testing
- release
- deploy-docs
- docker-release
steps:
- name: notify
image: plugins/matrix
settings:
homeserver: https://matrix.org
roomid: WqBDCxzghKcNflkErL:matrix.org
username:
from_secret: matrix_username
password:
from_secret: matrix_password
when:
status:
- success
- failure
---
kind: pipeline
type: docker
name: frontend-release-latest
depends_on:
- build-frontend
- build-and-test-frontend
trigger:
branch:
@ -965,24 +879,6 @@ steps:
commands:
- git fetch --tags
# - name: restore-cache
# image: meltwater/drone-cache:dev
# pull: always
# environment:
# AWS_ACCESS_KEY_ID:
# from_secret: cache_aws_access_key_id
# AWS_SECRET_ACCESS_KEY:
# from_secret: cache_aws_secret_access_key
# settings:
# restore: true
# bucket: kolaente.dev-drone-dependency-cache
# endpoint: https://s3.fr-par.scw.cloud
# region: fr-par
# path_style: true
# cache_key: '{{ .Repo.Name }}_{{ checksum "pnpm-lock.yaml" }}_{{ arch }}_{{ os }}'
# mount:
# - .cache
- name: build
image: node:20.11.0-alpine
pull: always
@ -995,25 +891,19 @@ steps:
PUPPETEER_SKIP_DOWNLOAD: true
commands:
- cd frontend
- apk add git
- corepack enable && pnpm config set store-dir .cache/pnpm
- pnpm install --fetch-timeout 100000 --frozen-lockfile
- pnpm run lint
- "echo '{\"VERSION\": \"'$(git describe --tags --always --abbrev=10 | sed 's/-/+/' | sed 's/^v//' | sed 's/-g/-/')'\"}' > src/version.json"
- pnpm run build
- sed -i 's/http\:\\/\\/localhost\\:3456\\/api\\/v1/\\/api\\/v1/g' dist/index.html # Override the default api url used for developing
# depends_on:
# - restore-cache
- name: static
image: kolaente/zip
pull: always
commands:
- cd frontend
- cp src/version.json dist
- cd dist
- zip -r ../vikunja-frontend-unstable.zip *
- cd ..
depends_on: [ build ]
- name: release
@ -1029,16 +919,16 @@ steps:
region: fr-par
path_style: true
source: frontend/vikunja-frontend-unstable.zip
target: /frontend/
target: /
depends_on: [ static ]
---
kind: pipeline
type: docker
name: release-frontend-version
name: frontend-release-version
depends_on:
- build-frontend
- build-and-test-frontend
trigger:
event:
@ -1050,24 +940,6 @@ steps:
commands:
- git fetch --tags
# - name: restore-cache
# image: meltwater/drone-cache:dev
# pull: always
# environment:
# AWS_ACCESS_KEY_ID:
# from_secret: cache_aws_access_key_id
# AWS_SECRET_ACCESS_KEY:
# from_secret: cache_aws_secret_access_key
# settings:
# restore: true
# bucket: kolaente.dev-drone-dependency-cache
# endpoint: https://s3.fr-par.scw.cloud
# region: fr-par
# path_style: true
# cache_key: '{{ .Repo.Name }}_{{ checksum "pnpm-lock.yaml" }}_{{ arch }}_{{ os }}'
# mount:
# - .cache
- name: build
image: node:20.11.0-alpine
pull: always
@ -1079,25 +951,18 @@ steps:
SENTRY_PROJECT: frontend-oss
commands:
- cd frontend
- apk add git
- corepack enable && pnpm config set store-dir .cache/pnpm
- pnpm install --fetch-timeout 100000 --frozen-lockfile
- pnpm run lint
- "echo '{\"VERSION\": \"'$(git describe --tags --always --abbrev=10 | sed 's/-/+/' | sed 's/^v//' | sed 's/-g/-/')'\"}' > src/version.json"
- pnpm run build
- sed -i 's/http\:\\/\\/localhost\\:3456\\/api\\/v1/\\/api\\/v1/g' dist/index.html # Override the default api url used for developing
# depends_on:
# - restore-cache
- name: static
image: kolaente/zip
pull: always
commands:
- cd frontend
- cp src/version.json dist
- cd dist
- zip -r ../vikunja-frontend-${DRONE_TAG##v}.zip *
- cd ..
depends_on: [ build ]
- name: release
@ -1113,95 +978,12 @@ steps:
region: fr-par
path_style: true
source: frontend/vikunja-frontend-${DRONE_TAG##v}.zip
target: /frontend/
target: /
depends_on: [ static ]
---
kind: pipeline
type: docker
name: frontend-docker-release
depends_on:
- build-frontend
trigger:
ref:
- refs/heads/main
- "refs/tags/**"
event:
exclude:
- cron
steps:
- name: fetch-tags
image: docker:git
commands:
- git fetch --tags
- name: docker-unstable
image: thegeeklab/drone-docker-buildx
privileged: true
pull: always
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: vikunja/frontend
tags: unstable
build_args:
- USE_RELEASE=false
platforms:
- linux/386
- linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm64/v8
context: ./frontend
dockerfile: ./frontend/Dockerfile
depends_on: [ fetch-tags ]
when:
ref:
- refs/heads/main
- name: generate-tags
image: thegeeklab/docker-autotag
environment:
DOCKER_AUTOTAG_VERSION: ${DRONE_TAG}
DOCKER_AUTOTAG_EXTRA_TAGS: latest
DOCKER_AUTOTAG_OUTPUT_FILE: .tags
depends_on: [ fetch-tags ]
when:
ref:
- "refs/tags/**"
- name: docker-release
image: thegeeklab/drone-docker-buildx
privileged: true
pull: always
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: vikunja/frontend
build_args:
- USE_RELEASE=false
platforms:
- linux/386
- linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm64/v8
context: ./frontend
dockerfile: ./frontend/Dockerfile
depends_on: [ generate-tags ]
when:
ref:
- "refs/tags/**"
---
kind: pipeline
type: docker
name: update-translations
trigger:
@ -1267,16 +1049,12 @@ kind: pipeline
type: docker
name: desktop-build
depends_on:
- frontend-release-latest
trigger:
branch:
exclude:
include:
- main
event:
include:
- push
- pull_request
steps:
@ -1284,24 +1062,24 @@ steps:
image: docker:git
commands:
- git fetch --tags
- name: restore-cache
image: meltwater/drone-cache:dev
pull: true
environment:
AWS_ACCESS_KEY_ID:
from_secret: cache_aws_access_key_id
AWS_SECRET_ACCESS_KEY:
from_secret: cache_aws_secret_access_key
settings:
restore: true
bucket: kolaente.dev-drone-dependency-cache
endpoint: https://s3.fr-par.scw.cloud
region: fr-par
path_style: true
cache_key: '{{ .Repo.Name }}_{{ checksum "desktop/yarn.lock" }}_{{ arch }}_{{ os }}'
mount:
- '.cache'
#
# - name: restore-cache
# image: meltwater/drone-cache:dev
# pull: true
# environment:
# AWS_ACCESS_KEY_ID:
# from_secret: cache_aws_access_key_id
# AWS_SECRET_ACCESS_KEY:
# from_secret: cache_aws_secret_access_key
# settings:
# restore: true
# bucket: kolaente.dev-drone-dependency-cache
# endpoint: https://s3.fr-par.scw.cloud
# region: fr-par
# path_style: true
# cache_key: '{{ .Repo.Name }}_{{ checksum "desktop/yarn.lock" }}_{{ arch }}_{{ os }}'
# mount:
# - '.cache'
- name: build
image: electronuserland/builder:wine-mono
@ -1310,7 +1088,7 @@ steps:
YARN_CACHE_FOLDER: .cache/yarn/
depends_on:
- fetch-tags
- restore-cache
# - restore-cache
commands:
- cd desktop
- export VERSION=${DRONE_TAG##v}
@ -1323,25 +1101,25 @@ steps:
- yarn install
- yarn dist --linux --windows
- name: rebuild-cache
image: meltwater/drone-cache:dev
pull: true
environment:
AWS_ACCESS_KEY_ID:
from_secret: cache_aws_access_key_id
AWS_SECRET_ACCESS_KEY:
from_secret: cache_aws_secret_access_key
settings:
rebuild: true
bucket: kolaente.dev-drone-dependency-cache
endpoint: https://s3.fr-par.scw.cloud
region: fr-par
path_style: true
cache_key: '{{ .Repo.Name }}_{{ checksum "desktop/yarn.lock" }}_{{ arch }}_{{ os }}'
mount:
- '.cache'
depends_on:
- build
# - name: rebuild-cache
# image: meltwater/drone-cache:dev
# pull: true
# environment:
# AWS_ACCESS_KEY_ID:
# from_secret: cache_aws_access_key_id
# AWS_SECRET_ACCESS_KEY:
# from_secret: cache_aws_secret_access_key
# settings:
# rebuild: true
# bucket: kolaente.dev-drone-dependency-cache
# endpoint: https://s3.fr-par.scw.cloud
# region: fr-par
# path_style: true
# cache_key: '{{ .Repo.Name }}_{{ checksum "desktop/yarn.lock" }}_{{ arch }}_{{ os }}'
# mount:
# - '.cache'
# depends_on:
# - build
---
kind: pipeline
@ -1349,7 +1127,8 @@ type: docker
name: desktop-release
depends_on:
- frontend-release-latest
- frontend-release-unstable
- frontend-release-version
trigger:
ref:
@ -1362,23 +1141,23 @@ steps:
commands:
- git fetch --tags
- name: restore-cache
image: meltwater/drone-cache:dev
pull: true
environment:
AWS_ACCESS_KEY_ID:
from_secret: cache_aws_access_key_id
AWS_SECRET_ACCESS_KEY:
from_secret: cache_aws_secret_access_key
settings:
restore: true
bucket: kolaente.dev-drone-dependency-cache
endpoint: https://s3.fr-par.scw.cloud
region: fr-par
path_style: true
cache_key: '{{ .Repo.Name }}_{{ checksum "desktop/yarn.lock" }}_{{ arch }}_{{ os }}'
mount:
- '.cache'
# - name: restore-cache
# image: meltwater/drone-cache:dev
# pull: true
# environment:
# AWS_ACCESS_KEY_ID:
# from_secret: cache_aws_access_key_id
# AWS_SECRET_ACCESS_KEY:
# from_secret: cache_aws_secret_access_key
# settings:
# restore: true
# bucket: kolaente.dev-drone-dependency-cache
# endpoint: https://s3.fr-par.scw.cloud
# region: fr-par
# path_style: true
# cache_key: '{{ .Repo.Name }}_{{ checksum "desktop/yarn.lock" }}_{{ arch }}_{{ os }}'
# mount:
# - '.cache'
- name: build
image: electronuserland/builder:wine-mono
@ -1387,7 +1166,7 @@ steps:
YARN_CACHE_FOLDER: .cache/yarn/
depends_on:
- fetch-tags
- restore-cache
# - restore-cache
commands:
- cd desktop
- export VERSION=${DRONE_TAG##v}
@ -1401,25 +1180,25 @@ steps:
- cat package.json
- yarn dist --linux --windows
- name: rebuild-cache
image: meltwater/drone-cache:dev
pull: true
environment:
AWS_ACCESS_KEY_ID:
from_secret: cache_aws_access_key_id
AWS_SECRET_ACCESS_KEY:
from_secret: cache_aws_secret_access_key
settings:
rebuild: true
bucket: kolaente.dev-drone-dependency-cache
endpoint: https://s3.fr-par.scw.cloud
region: fr-par
path_style: true
cache_key: '{{ .Repo.Name }}_{{ checksum "desktop/yarn.lock" }}_{{ arch }}_{{ os }}'
mount:
- '.cache'
depends_on:
- build
# - name: rebuild-cache
# image: meltwater/drone-cache:dev
# pull: true
# environment:
# AWS_ACCESS_KEY_ID:
# from_secret: cache_aws_access_key_id
# AWS_SECRET_ACCESS_KEY:
# from_secret: cache_aws_secret_access_key
# settings:
# rebuild: true
# bucket: kolaente.dev-drone-dependency-cache
# endpoint: https://s3.fr-par.scw.cloud
# region: fr-par
# path_style: true
# cache_key: '{{ .Repo.Name }}_{{ checksum "desktop/yarn.lock" }}_{{ arch }}_{{ os }}'
# mount:
# - '.cache'
# depends_on:
# - build
- name: release-latest
image: plugins/s3
@ -1499,8 +1278,88 @@ steps:
# - mc config host add scw-fr-par https://s3.fr-par.scw.cloud $ACCESS_KEY $SECRET_KEY --api S3v4
# - mc cp ./dist/*.dmg scw-fr-par/vikunja-releases/desktop/$VERSION/
# - mc cp ./dist/*.dmg.blockmap scw-fr-par/vikunja-releases/desktop/$VERSION/
---
kind: pipeline
type: docker
name: deploy-docs
workspace:
base: /go
path: src/code.vikunja.io/api
clone:
depth: 50
trigger:
event:
- push
branch:
- main
steps:
- name: theme
image: kolaente/toolbox
pull: always
commands:
- mkdir docs/themes/vikunja -p
- cd docs/themes/vikunja
- wget https://dl.vikunja.io/theme/vikunja-theme.tar.gz
- tar -xzf vikunja-theme.tar.gz
- name: build
image: klakegg/hugo:0.111.3
pull: always
commands:
- cd docs
- hugo
- mv public/docs/* public # Hugo seems to be not capable of setting a different theme for a home page, so we do this ugly hack to fix it.
- name: docker
image: plugins/docker
pull: always
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: vikunja/docs
context: docs/
dockerfile: docs/Dockerfile
---
kind: pipeline
type: docker
name: notify
trigger:
ref:
- refs/heads/main
- "refs/tags/**"
depends_on:
- build-and-test-api
- build-and-test-frontend
- release
- deploy-docs
- docker-release
- desktop-release
steps:
- name: notify
image: plugins/matrix
settings:
homeserver: https://matrix.org
roomid: WqBDCxzghKcNflkErL:matrix.org
username:
from_secret: matrix_username
password:
from_secret: matrix_password
when:
status:
- success
- failure
---
kind: signature
hmac: a3d01559d320a62a56ea541e4b439ff68bb09b0087dbc889df17fcba86cfcb5d
hmac: 128214182f90834702da16ed7b0f1dec09dc61bbbe7f293aea7cb6c46e7edae2
...

View File

@ -7,6 +7,108 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
All releases can be found on https://code.vikunja.io/api/releases.
## [0.23.0] - 2024-02-10
### Bug Fixes
* *(assignees)* Use correct amount of spacing in assignee selection
* *(ci)* cd to frontend in frontend pipelines
* *(ci)* Deploy packages into the correct directory
* *(ci)* Swagger docs generate should use the correct url
* *(ci)* Typo
* *(ci)* Update shasum
* *(docs)* Old install pages redirect
* *(editor)* Don't set editor content intitially
* *(export)* Don't crash when an exported file does not exist
* *(filters)* Add explicit check for string slice filter
* *(gantt)* Correctly import languages from dayjs
* *(kanban)* Assignee spacing
* *(kanban)* Bottom spacing of labels
* *(notifications)* Mark all notifications as read in ui directly when marking as read on the server
* *(progress)* Cleanup unused css
* *(progress)* Less rounding
* *(reminders)* Set reminder date on datepicker when editing a reminder
* *(task)* Make sure the drag handle is shown as intended
* *(task)* Move cover image setter to store
* *(task)* Remove default task color
* *(tasks)* Check for cycles during creation of task relations and prevent them
* *(tasks)* Show any errors happening during task load
* *(tests)* Adjust gantt rows identifier
* *(webhook)* Fetch all event details before sending the webhook
### Features
* Merge API, Frontend and Desktop repos
* *(ci)* Combine api and frontend drone configs
* *(ci)* Merge desktop ci config
* *(ci)* Save .tags file to generate release tags
* *(ci)* Run desktop build without waiting on the frontend when not doing release builds
* *(ci)* Run desktop pipeline only on PRs
* *(editor)* Use primary color for currently selected node
* *(filters)* Log type if unknown filter type
* *(progress)* Move customizations into progress bar component
### Dependencies
* *(deps)* Update dependency @4tw/cypress-drag-drop to v1.8.1 (#693)
* *(deps)* Update dependency @fortawesome/vue-fontawesome to v3.0.6
* *(deps)* Update dependency @kyvg/vue3-notification to v3.1.4
* *(deps)* Update dependency @types/node to v20.11.10
* *(deps)* Update dependency autoprefixer to v10.3.3 (#684)
* *(deps)* Update dependency autoprefixer to v10.3.4 (#697)
* *(deps)* Update dependency axios to v0.21.2 (#698)
* *(deps)* Update dependency axios to v0.21.3 (#700)
* *(deps)* Update dependency cypress to v8.3.1 (#689)
* *(deps)* Update dependency electron to v28.2.1 (#186)
* *(deps)* Update dependency electron to v28.2.2 (#187)
* *(deps)* Update dependency esbuild to v0.12.23 (#683)
* *(deps)* Update dependency esbuild to v0.12.24 (#688)
* *(deps)* Update dependency esbuild to v0.12.25 (#696)
* *(deps)* Update dependency esbuild to v0.14.53 (#2217)
* *(deps)* Update dependency eslint-plugin-vue to v7.17.0 (#686)
* *(deps)* Update dependency floating-vue to v5.2.1
* *(deps)* Update dependency floating-vue to v5.2.2
* *(deps)* Update dependency jest to v27.1.0 (#687)
* *(deps)* Update dependency marked to v3.0.1 (#677)
* *(deps)* Update dependency marked to v3.0.2 (#682)
* *(deps)* Update dependency postcss to v8.4.19 (#2673)
* *(deps)* Update dependency sass to v1.38.1 (#679)
* *(deps)* Update dependency sass to v1.38.2 (#690)
* *(deps)* Update dependency sass to v1.39.0 (#695)
* *(deps)* Update dependency typescript to v4.4.2 (#685)
* *(deps)* Update dependency ufo to v1.4.0
* *(deps)* Update dependency vite to v2.5.1 (#680)
* *(deps)* Update dependency vite to v2.5.2 (#692)
* *(deps)* Update dependency vite to v2.5.3 (#694)
* *(deps)* Update dependency vite-plugin-pwa to v0.11.2 (#681)
* *(deps)* Update dependency vue to v3.2.45
* *(deps)* Update dependency vue-i18n to v9.9.1
* *(deps)* Update goreleaser/nfpm docker tag to v2.35.3 (#1692)
* *(deps)* Update module github.com/arran4/golang-ical to v0.2.4
* *(deps)* Update module github.com/mattn/go-sqlite3 to v1.14.21
* *(deps)* Update module github.com/mattn/go-sqlite3 to v1.14.22
* *(deps)* Update module github.com/swaggo/swag to v1.16.3
* *(deps)* Update module github.com/yuin/goldmark to v1.7.0
* *(deps)* Update pnpm to v8.15.0
* *(deps)* Update pnpm to v8.15.1
* *(deps)* Update sentry-javascript monorepo to v7.100.1
* *(deps)* Update sentry-javascript monorepo to v7.17.2 (#2587)
* *(deps)* Update sentry-javascript monorepo to v7.19.0 (#2670)
* *(deps)* Update sentry-javascript monorepo to v7.99.0
* *(deps)* Update src.techknowlogick.com/xgo digest to 45b9ea6
* *(deps)* Update src.techknowlogick.com/xgo digest to 5aae655
* *(deps)* Update tiptap to v2.2.0
* *(deps)* Update tiptap to v2.2.1
* *(deps)* Update typescript-eslint monorepo to v4.29.3 (#676)
* *(deps)* Update typescript-eslint monorepo to v4.30.0 (#691)
### Miscellaneous Tasks
* *(Expandable)* Spelling ⛈
* *(deps)* Move renovate config
* *(deps)* Remove redundant renovate config
* *(quick actions)* Format
## [0.22.1] - 2024-01-28
### Bug Fixes

View File

@ -1,15 +1,25 @@
# syntax=docker/dockerfile:1
# ┬─┐┬ ┐o┬ ┬─┐
# │─││ │││ │ │
# ┘─┘┘─┘┘┘─┘┘─┘
FROM --platform=$BUILDPLATFORM node:20.11.0-alpine AS frontendbuilder
FROM --platform=$BUILDPLATFORM techknowlogick/xgo:go-1.21.x AS builder
WORKDIR /build
ENV PNPM_CACHE_FOLDER .cache/pnpm/
ENV PUPPETEER_SKIP_DOWNLOAD true
COPY frontend/ ./
RUN corepack enable && \
pnpm install && \
pnpm run build
FROM --platform=$BUILDPLATFORM techknowlogick/xgo:go-1.21.x AS apibuilder
RUN go install github.com/magefile/mage@latest && \
mv /go/bin/mage /usr/local/go/bin
WORKDIR /go/src/code.vikunja.io/api
COPY . ./
COPY --from=frontendbuilder /build/dist ./frontend/dist
ARG TARGETOS TARGETARCH TARGETVARIANT
@ -41,4 +51,4 @@ RUN apk --update --no-cache add tzdata tini shadow && \
COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod 0755 /entrypoint.sh && mkdir files
COPY --from=builder /build/vikunja-* vikunja
COPY --from=apibuilder /build/vikunja-* vikunja

View File

@ -2,12 +2,12 @@
[![Build Status](https://drone.kolaente.de/api/badges/vikunja/vikunjaa/status.svg)](https://drone.kolaente.de/vikunja/vikunja)
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](LICENSE)
[![Download](https://img.shields.io/badge/download-v0.22.1-brightgreen.svg)](https://dl.vikunja.io)
[![Download](https://img.shields.io/badge/download-v0.23.0-brightgreen.svg)](https://dl.vikunja.io)
[![Docker Pulls](https://img.shields.io/docker/pulls/vikunja/vikunja.svg)](https://hub.docker.com/r/vikunja/vikunja/)
[![Swagger Docs](https://img.shields.io/badge/swagger-docs-brightgreen.svg)](https://try.vikunja.io/api/v1/docs)
[![Go Report Card](https://goreportcard.com/badge/kolaente.dev/vikunja/vikunja)](https://goreportcard.com/report/kolaente.dev/vikunja/vikunja)
# Vikunja API
# Vikunja
> The Todo-app to organize your life.
@ -43,12 +43,9 @@ All docs can be found on [the Vikunja home page](https://vikunja.io/docs/).
See [the roadmap](https://my.vikunja.cloud/share/QFyzYEmEYfSyQfTOmIRSwLUpkFjboaBqQCnaPmWd/auth) (hosted on Vikunja!) for more!
* [ ] [Mobile apps](https://code.vikunja.io/app) (separate repo) *In Progress*
* [ ] [Webapp](https://code.vikunja.io/frontend) (separate repo) *In Progress*
## Contributing
Fork -> Push -> Pull-Request. Also see the [dev docs](https://vikunja.io/docs/development/) for more info.
Please check out the contribuition guidelines on [the website](https://vikunja.io/docs/development/).
## License

View File

@ -16,14 +16,12 @@ service:
unixsocket:
# Permission bits for the Unix socket. Note that octal values must be prefixed by "0o", e.g. 0o660
unixsocketmode:
# The URL of the frontend, used to send password reset emails.
frontendurl: ""
# The public facing URL where your users can reach Vikunja. Used in emails and for the communication between api and frontend.
publicurl: ""
# The base path on the file system where the binary and assets are.
# Vikunja will also look in this path for a config file, so you could provide only this variable to point to a folder
# with a config file which will then be used.
rootpath: <rootpath>
# Path on the file system to serve static files from. Set to the path of the frontend files to host frontend alongside the api.
staticpath: ""
# The max number of items which can be returned per page
maxitemsperpage: 50
# Enable the caldav endpoint, see the docs for more details
@ -42,8 +40,6 @@ service:
enabletaskcomments: true
# Whether totp is enabled. In most cases you want to leave that enabled.
enabletotp: true
# If not empty, enables logging of crashes and unhandled errors in sentry.
sentrydsn: ''
# If not empty, this will enable `/test/{table}` endpoints which allow to put any content in the database.
# Used to reset the db before frontend tests. Because this is quite a dangerous feature allowing for lots of harm,
# each request made to this endpoint needs to provide an `Authorization: <token>` header with the token from below. <br/>
@ -62,6 +58,22 @@ service:
# If set to true, the frontend will show a big red warning not to use this instance for real data as it will be cleared out.
# You probably don't need to set this value, it was created specifically for usage on [try](https://try.vikunja.io).
demomode: false
# Allow changing the logo and other icons based on various occasions throughout the year.
allowiconchanges: true
# Allow using a custom logo via external URL.
customlogourl: ''
sentry:
# If set to true, enables anonymous error tracking of api errors via Sentry. This allows us to gather more
# information about errors in order to debug and fix it.
enabled: false
# Configure the Sentry dsn used for api error tracking. Only used when Sentry is enabled for the api.
dsn: "https://440eedc957d545a795c17bbaf477497c@o1047380.ingest.sentry.io/4504254983634944"
# If set to true, enables anonymous error tracking of frontend errors via Sentry. This allows us to gather more
# information about errors in order to debug and fix it.
frontendenabled: false
# Configure the Sentry dsn used for frontend error tracking. Only used when Sentry is enabled for the frontend.
frontenddsn: "https://85694a2d757547cbbc90cd4b55c5a18d@o1047380.ingest.sentry.io/6024480"
database:
# Database type to use. Supported types are mysql, postgres and sqlite.
@ -120,7 +132,7 @@ cors:
# Whether to enable or disable cors headers.
# Note: If you want to put the frontend and the api on separate domains or ports, you will need to enable this.
# Otherwise the frontend won't be able to make requests to the api through the browser.
enable: true
enable: false
# A list of origins which may access the api. These need to include the protocol (`http://` or `https://`) and port, if any.
origins:
- "*"

View File

@ -1,5 +1,8 @@
# Changelog
THIS CHANGELOG ONLY EXISTS FOR HISTORICAL REASONS.
Starting with version 0.23.0, all changes are logged in the CHANGELOG.md in the root of this repository since the repos were merged.
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

View File

@ -2,9 +2,8 @@
set -xe
frontend_version=$(sed -n 's/.*"VERSION": "\([^"]*\)".*/\1/p' ./frontend/version.json)
frontend_version=$(git describe --tags --always --abbrev=10)
sed -i "s/\${version}/$frontend_version/g" package.json
sed -i "s/\"version\": \".*\"/\"version\": \"$frontend_version\"/" package.json

View File

@ -55,7 +55,7 @@
"electron-builder": "24.9.1"
},
"dependencies": {
"connect-history-api-fallback": "^2.0.0",
"express": "^4.17.1"
"connect-history-api-fallback": "2.0.0",
"express": "4.18.2"
}
}

View File

@ -558,7 +558,7 @@ config-file-ts@^0.2.4:
glob "^7.1.6"
typescript "^4.0.2"
connect-history-api-fallback@^2.0.0:
connect-history-api-fallback@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz#647264845251a0daf25b97ce87834cace0f5f1c8"
integrity sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==
@ -829,7 +829,7 @@ etag@~1.8.1:
resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887"
integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==
express@^4.17.1:
express@4.18.2:
version "4.18.2"
resolved "https://registry.yarnpkg.com/express/-/express-4.18.2.tgz#3fabe08296e930c796c19e3c516979386ba9fd59"
integrity sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==

View File

@ -19,7 +19,7 @@ Please refer to its documentation for information about how to use flags etc.
To add a new cli command, add something like the following:
{{< highlight golang >}}
```go
func init() {
rootCmd.AddCommand(myCmd)
}
@ -31,4 +31,4 @@ var myCmd = &cobra.Command{
// Call other functions
},
}
{{</ highlight >}}
```

View File

@ -32,10 +32,10 @@ Then run `mage generate-docs` to generate the configuration docs from the sample
To retrieve a configured value call the key with a getter for the type you need.
For example:
{{< highlight golang >}}
```go
if config.CacheEnabled.GetBool() {
// Do something with enabled caches
}
{{< /highlight >}}
```
Take a look at the methods declared on the type to see what's available.

View File

@ -16,13 +16,13 @@ The package exposes a `cron.Schedule` method with two arguments: The first one t
A basic function to register a cron task looks like this:
{{< highlight golang >}}
```go
func RegisterSomeCronTask() {
err := cron.Schedule("0 * * * *", func() {
// Do something every hour
}
}
{{< /highlight >}}
```
Call the register method in the `FullInit()` method of the `init` package to actually register it.

View File

@ -27,9 +27,9 @@ and a more in-depth description of what the migration actually does.
To easily get a new id, run the following on any unix system:
{{< highlight bash >}}
```
date +%Y%m%d%H%M%S
{{< /highlight >}}
```
New migrations should be added via the `init()` function to the `migrations` variable.
All migrations are sorted before being executed, since `init()` does not guarantee the order.
@ -44,7 +44,7 @@ It will ask you for a table name and generate an empty migration similar to the
### Example
{{< highlight golang >}}
```go
package migration
import (
@ -73,6 +73,6 @@ func init() {
},
})
}
{{< /highlight >}}
```
You should always copy the changed parts of the struct you're changing when adding migrations.

View File

@ -18,7 +18,7 @@ and a human-readable error message about what went wrong.
An error consists of multiple functions and definitions:
{{< highlight golang >}}
```go
// This struct holds any information about this specific error.
// In this case, it contains the user ID of a nonexistent user.
// This type should always be a struct, even if it has no values in it.
@ -69,4 +69,4 @@ func (err ErrUserDoesNotExist) HTTPError() web.HTTPError {
Message: "The user does not exist.",
}
}
{{< /highlight >}}
```

View File

@ -28,11 +28,11 @@ This document explains how events and listeners work in Vikunja, how to use them
Each event has to implement this interface:
{{< highlight golang >}}
```go
type Event interface {
Name() string
}
{{< /highlight >}}
```
An event can contain whatever data you need.
@ -75,7 +75,7 @@ To dispatch an event, simply call the `events.Dispatch` method and pass in the e
The `TaskCreatedEvent` is declared in the `pkg/models/events.go` file as follows:
{{< highlight golang >}}
```go
// TaskCreatedEvent represents an event where a task has been created
type TaskCreatedEvent struct {
Task *Task
@ -86,11 +86,11 @@ type TaskCreatedEvent struct {
func (t *TaskCreatedEvent) Name() string {
return "task.created"
}
{{< /highlight >}}
```
It is dispatched in the `createTask` function of the `models` package:
{{< highlight golang >}}
```go
func createTask(s *xorm.Session, t *Task, a web.Auth, updateAssignees bool) (err error) {
// ...
@ -102,7 +102,7 @@ func createTask(s *xorm.Session, t *Task, a web.Auth, updateAssignees bool) (err
// ...
}
{{< /highlight >}}
```
As you can see, the current task and doer are injected into it.
@ -122,13 +122,13 @@ A single event can have multiple listeners who are independent of each other.
All listeners must implement this interface:
{{< highlight golang >}}
```go
// Listener represents something that listens to events
type Listener interface {
Handle(msg *message.Message) error
Name() string
}
{{< /highlight >}}
```
The `Handle` method is executed when the event this listener listens on is dispatched.
* As the single parameter, it gets the payload of the event, which is the event struct when it was dispatched decoded as json object and passed as a slice of bytes.
@ -165,7 +165,7 @@ See the example below.
### Example
{{< highlight golang >}}
```go
// RegisterListeners registers all event listeners
func RegisterListeners() {
events.RegisterListener((&ListCreatedEvent{}).Name(), &IncreaseListCounter{})
@ -183,22 +183,22 @@ func (s *IncreaseTaskCounter) Name() string {
func (s *IncreaseTaskCounter) Handle(payload message.Payload) (err error) {
return keyvalue.IncrBy(metrics.TaskCountKey, 1)
}
{{< /highlight >}}
```
## Testing
When testing, you should call the `events.Fake()` method in the `TestMain` function of the package you want to test.
This prevents any events from being fired and lets you assert an event has been dispatched like so:
{{< highlight golang >}}
```go
events.AssertDispatched(t, &TaskCreatedEvent{})
{{< /highlight >}}
```
### Testing a listener
You can call an event listener manually with the `events.TestListener` method like so:
{{< highlight golang >}}
```go
ev := &TaskCommentCreatedEvent{
Task: &task,
Doer: u,
@ -206,6 +206,6 @@ ev := &TaskCommentCreatedEvent{
}
events.TestListener(t, ev, &SendTaskCommentNotification{})
{{< /highlight >}}
```
This will call the listener's `Handle` method and assert it did not return an error when calling.

View File

@ -25,9 +25,9 @@ It returns the `limit` (max-length) and `offset` parameters needed for SQL-Queri
You can feed this function directly into xorm's `Limit`-Function like so:
{{< highlight golang >}}
```go
projects := []*Project{}
err := x.Limit(getLimitFromPageIndex(pageIndex, itemsPerPage)).Find(&projects)
{{< /highlight >}}
```
// TODO: Add a full example from start to finish, like a tutorial on how to create a new endpoint?

View File

@ -53,23 +53,23 @@ These tasks are automatically run in our CI every time someone pushes to main or
### Build Vikunja
{{< highlight bash >}}
```
mage build:build
{{< /highlight >}}
```
or
{{< highlight bash >}}
```
mage build
{{< /highlight >}}
```
Builds a `vikunja`-binary in the root directory of the repo for the platform it is run on.
### clean
{{< highlight bash >}}
```
mage build:clean
{{< /highlight >}}
```
Cleans all build and executable files
@ -94,9 +94,9 @@ Various code-checks are available:
### Build Releases
{{< highlight bash >}}
```
mage release
{{< /highlight >}}
```
Builds binaries for all platforms and zips them with a copy of the `templates/` folder.
All built zip files are stored into `dist/zips/`. Binaries are stored in `dist/binaries/`,
@ -118,17 +118,17 @@ binary to be able to use it.
### Build os packages
{{< highlight bash >}}
```
mage release:packages
{{< /highlight >}}
```
Will build `.deb`, `.rpm` and `.apk` packages to `dist/os-packages`.
### Make a debian repo
{{< highlight bash >}}
```
mage release:reprepro
{{< /highlight >}}
```
Takes an already built debian package and creates a debian repo structure around it.
@ -138,25 +138,25 @@ Used to be run inside a [docker container](https://git.kolaente.de/konrad/reprep
### unit
{{< highlight bash >}}
```
mage test:unit
{{< /highlight >}}
```
Runs all tests except integration tests.
### coverage
{{< highlight bash >}}
```
mage test:coverage
{{< /highlight >}}
```
Runs all tests except integration tests and generates a `coverage.html` file to inspect the code coverage.
### integration
{{< highlight bash >}}
```
mage test:integration
{{< /highlight >}}
```
Runs all integration tests.
@ -164,9 +164,9 @@ Runs all integration tests.
### Create a new migration
{{< highlight bash >}}
```
mage dev:create-migration
{{< /highlight >}}
```
Creates a new migration with the current date.
Will ask for the name of the struct you want to create a migration for.
@ -177,16 +177,16 @@ See also [migration docs]({{< ref "mage.md" >}}).
### Format the code
{{< highlight bash >}}
```
mage fmt
{{< /highlight >}}
```
Formats all source code using `go fmt`.
### Generate swagger definitions from code comments
{{< highlight bash >}}
```
mage do-the-swag
{{< /highlight >}}
```
Generates swagger definitions from the comment annotations in the code.

View File

@ -23,7 +23,7 @@ First, define a `const` with the metric key in redis. This is done in `pkg/metri
To expose a new metric, you need to register it in the `init` function inside of the `metrics` package like so:
{{< highlight golang >}}
```go
// Register total user count metric
promauto.NewGaugeFunc(prometheus.GaugeOpts{
Name: "vikunja_team_count", // The key of the metric. Must be unique.
@ -32,7 +32,7 @@ promauto.NewGaugeFunc(prometheus.GaugeOpts{
count, _ := GetCount(TeamCountKey) // TeamCountKey is the const we defined earlier.
return float64(count)
})
{{< /highlight >}}
```
Then you'll need to set the metrics initial value on every startup of Vikunja.
This is done in `pkg/routes/routes.go` to avoid cyclic imports.

View File

@ -18,13 +18,13 @@ Vikunja provides a simple abstraction to send notifications per mail and in the
Each notification has to implement this interface:
{{< highlight golang >}}
```go
type Notification interface {
ToMail() *Mail
ToDB() interface{}
Name() string
}
{{< /highlight >}}
```
Both functions return the formatted messages for mail and database.
@ -35,7 +35,7 @@ For example, if your notification should not be recorded in the database but onl
A list of chainable functions is available to compose a mail:
{{< highlight golang >}}
```go
mail := NewMail().
// The optional sender of the mail message.
From("test@example.com").
@ -54,7 +54,7 @@ mail := NewMail().
Action("The Action", "https://example.com").
// Another line of text.
Line("This should be an outro line").
{{< /highlight >}}
```
If not provided, the `from` field of the mail contains the value configured in [`mailer.fromemail`](https://vikunja.io/docs/config-options/#fromemail).
@ -74,14 +74,14 @@ It takes the name of the notification and the package where the notification wil
Notifiables can receive a notification.
A notifiable is defined with this interface:
{{< highlight golang >}}
```go
type Notifiable interface {
// Should return the email address this notifiable has.
RouteForMail() string
// Should return the id of the notifiable entity
RouteForDB() int64
}
{{< /highlight >}}
```
The `User` type from the `user` package implements this interface.
@ -92,7 +92,7 @@ It takes a notifiable and a notification as input.
For example, the email confirm notification when a new user registers is sent like this:
{{< highlight golang >}}
```go
n := &EmailConfirmNotification{
User: update.User,
IsNew: false,
@ -100,7 +100,7 @@ n := &EmailConfirmNotification{
err = notifications.Notify(update.User, n)
return
{{< /highlight >}}
```
## Testing
@ -110,9 +110,9 @@ If it was called, no mails are being sent and you can instead assert they have b
When testing, you should call the `notifications.Fake()` method in the `TestMain` function of the package you want to test.
This prevents any notifications from being sent and lets you assert a notifications has been sent like this:
{{< highlight golang >}}
```go
notifications.AssertSent(t, &ReminderDueNotification{})
{{< /highlight >}}
```
## Example

View File

@ -16,13 +16,7 @@ Not all steps are necessary for every release.
* New Features: If there are new features worth mentioning the feature page should be updated.
* New Screenshots: If an overhaul of an existing feature happened so that it now looks different from the existing screenshot, a new one is required.
* Generate changelogs (with git-cliff)
* Frontend
* API
* Desktop
* Tag a new version: Include the changelog for that version as the tag message
* Frontend
* API
* Desktop
* Once built: Prune the cloudflare cache so that the new versions show up at [dl.vikunja.io](https://dl.vikunja.io/)
* Update the [Flathub desktop package](https://github.com/flathub/io.vikunja.Vikunja)
* Release Highlights Blogpost

View File

@ -21,7 +21,7 @@ These comments will show up in the documentation, it'll make it easier for devel
As an example, this is the definition of a project with all comments:
{{< highlight golang >}}
```go
type Project struct {
// The unique, numeric id of this project.
ID int64 `xorm:"bigint autoincr not null unique pk" json:"id" param:"project"`
@ -69,7 +69,7 @@ type Project struct {
web.CRUDable `xorm:"-" json:"-"`
web.Rights `xorm:"-" json:"-"`
}
{{< /highlight >}}
```
## Documenting api Endpoints
@ -78,7 +78,7 @@ When generating the api docs with mage, the swagger cli will pick these up and p
A comment looks like this:
{{< highlight golang >}}
```go
// @Summary Login
// @Description Logs a user in. Returns a JWT-Token to authenticate further requests.
// @tags user
@ -93,4 +93,4 @@ A comment looks like this:
func Login(c echo.Context) error {
// Handler logic
}
{{< /highlight >}}
```

View File

@ -27,9 +27,9 @@ The easies way to do that is to set the environment variable `VIKUNJA_SERVICE_RO
To run unit tests with [mage]({{< ref "mage.md">}}), execute
{{< highlight bash >}}
```
mage test:unit
{{< /highlight >}}
```
In Vikunja, everything that is not an integration test counts as unit test - even if it accesses the db.
This definition is a bit blurry, but we haven't found a better one yet.
@ -71,18 +71,18 @@ You should put new fixtures in this folder.
When initializing db fixtures, you are responsible for defining which tables your package needs in your test init function.
Usually, this is done as follows (this code snippet is taken from the `user` package):
{{< highlight go >}}
```go
err = db.InitTestFixtures("users")
if err != nil {
log.Fatal(err)
}
{{< /highlight >}}
```
In your actual tests, you then load the fixtures into the in-memory db like so:
{{< highlight go >}}
```go
db.LoadAndAssertFixtures(t)
{{< /highlight >}}
```
This will load all fixtures you defined in your test init method.
You should always use this method to load fixtures, the only exception is when your package tests require extra test
@ -97,13 +97,13 @@ Check out the docs [in the frontend repo](https://kolaente.dev/vikunja/vikunja/s
To run the frontend unit tests, run
{{< highlight bash >}}
```
pnpm run test:unit
{{< /highlight >}}
```
The frontend also has a watcher available that re-runs all unit tests every time you change something.
To use it, simply run
{{< highlight bash >}}
```
pnpm run test:unit-watch
{{< /highlight >}}
```

View File

@ -24,33 +24,33 @@ To back up attachments and other files, it is enough to copy them [from the atta
To create a backup from mysql use the `mysqldump` command:
{{< highlight bash >}}
```
mysqldump -u <user> -p -h <db-host> <database> > vkunja-backup.sql
{{< /highlight >}}
```
You will be prompted for the password of the mysql user.
To restore it, simply pipe it back into the `mysql` command:
{{< highlight bash >}}
```
mysql -u <user> -p -h <db-host> <database> < vkunja-backup.sql
{{< /highlight >}}
```
### PostgreSQL
To create a backup from PostgreSQL use the `pg_dump` command:
{{< highlight bash >}}
```
pg_dump -U <user> -h <db-host> <database> > vikunja-backup.sql
{{< /highlight >}}
```
You might be prompted for the password of the database user.
To restore it, simply pipe it back into the `psql` command:
{{< highlight bash >}}
```
psql -U <user> -h <db-host> <database> < vikunja-backup.sql
{{< /highlight >}}
```
For more information, please visit the [relevant PostgreSQL documentation](https://www.postgresql.org/docs/12/backup-dump.html).

View File

@ -10,10 +10,24 @@ menu:
# Build Vikunja from source
To completely build Vikunja from source, you need to build the api and frontend.
To fully build Vikunja from source files, you need to build the api and frontend.
{{< table_of_contents >}}
## General Preparations
1. Make sure you have git installed
2. Clone the repo with `git clone https://code.vikunja.io/vikunja` and switch into the directory.
## Frontend
The code for the frontend is located in the `frontend/` sub folder of the main repo.
1. Make sure you have [pnpm](https://pnpm.io/installation) properly installed on your system.
2. Install all dependencies with `pnpm install`
3. Build the frontend with `pnpm run build`. This will result in a static js bundle in the `dist/` folder.
4. You can either deploy that static js bundle directly, or read on to learn how to bundle it all up in a static binary with the api.
## API
The Vikunja API has no other dependencies than go itself.
@ -21,20 +35,11 @@ That means compiling it boils down to these steps:
1. Make sure [Go](https://golang.org/doc/install) is properly installed on your system. You'll need at least Go `1.21`.
2. Make sure [Mage](https://magefile.org) is properly installed on your system.
3. Clone the repo with `git clone https://code.vikunja.io/api` and switch into the directory.
4. Run `mage build` in the source of this repo. This will build a binary in the root of the repo which will be able to run on your system.
3. If you did not build the frontend in the steps before, you need to either do that or create a dummy index file with `mkdir -p frontend/dist && touch index.html`.
4. Run `mage build` in the source of the main repo. This will build a binary in the root of the repo which will be able to run on your system.
### Build for different architectures
To build for other platforms and architectures than the one you're currently on, simply run `mage release:release` or `mage release:{linux|windows|darwin}`.
To build for other platforms and architectures than the one you're currently on, simply run `mage release` or `mage release:{linux|windows|darwin}`.
More options are available, please refer to the [magefile docs]({{< ref "../development/mage.md">}}) for more details.
## Frontend
The code for the frontend is located at [code.vikunja.io/frontend](https://code.vikunja.io/frontend).
1. Make sure you have [pnpm](https://pnpm.io/installation) properly installed on your system.
2. Clone the repo with `git clone https://code.vikunja.io/frontend` and switch into the directory.
3. Install all dependencies with `pnpm install`
4. Build the frontend with `pnpm run build`. This will result in a static js bundle in the `dist/` folder which you can deploy.

View File

@ -16,16 +16,17 @@ Right now it is not possible to configure openid authentication via environment
Variables are nested in the `config.yml`, these nested variables become `VIKUNJA_FIRST_CHILD` when configuring via
environment variables. So setting
{{< highlight bash >}}
```
export VIKUNJA_FIRST_CHILD=true
{{< /highlight >}}
```
is the same as defining it in a `config.yml` like so:
{{< highlight yaml >}}
```yaml
```yaml
first:
child: true
{{< /highlight >}}
```
# Formats
@ -137,15 +138,15 @@ Full path: `service.unixsocketmode`
Environment path: `VIKUNJA_SERVICE_UNIXSOCKETMODE`
### frontendurl
### publicurl
The URL of the frontend, used to send password reset emails.
The public facing URL where your users can reach Vikunja. Used in emails and for the communication between api and frontend.
Default: `<empty>`
Full path: `service.frontendurl`
Full path: `service.publicurl`
Environment path: `VIKUNJA_SERVICE_FRONTENDURL`
Environment path: `VIKUNJA_SERVICE_PUBLICURL`
### rootpath
@ -161,17 +162,6 @@ Full path: `service.rootpath`
Environment path: `VIKUNJA_SERVICE_ROOTPATH`
### staticpath
Path on the file system to serve static files from. Set to the path of the frontend files to host frontend alongside the api.
Default: `<empty>`
Full path: `service.staticpath`
Environment path: `VIKUNJA_SERVICE_STATICPATH`
### maxitemsperpage
The max number of items which can be returned per page
@ -271,17 +261,6 @@ Full path: `service.enabletotp`
Environment path: `VIKUNJA_SERVICE_ENABLETOTP`
### sentrydsn
If not empty, enables logging of crashes and unhandled errors in sentry.
Default: `<empty>`
Full path: `service.sentrydsn`
Environment path: `VIKUNJA_SERVICE_SENTRYDSN`
### testingtoken
If not empty, this will enable `/test/{table}` endpoints which allow to put any content in the database.
@ -345,6 +324,80 @@ Full path: `service.demomode`
Environment path: `VIKUNJA_SERVICE_DEMOMODE`
### allowiconchanges
Allow changing the logo and other icons based on various occasions throughout the year.
Default: `true`
Full path: `service.allowiconchanges`
Environment path: `VIKUNJA_SERVICE_ALLOWICONCHANGES`
### customlogourl
Allow using a custom logo via external URL.
Default: `<empty>`
Full path: `service.customlogourl`
Environment path: `VIKUNJA_SERVICE_CUSTOMLOGOURL`
---
## sentry
### enabled
If set to true, enables anonymous error tracking of api errors via Sentry. This allows us to gather more
information about errors in order to debug and fix it.
Default: `false`
Full path: `sentry.enabled`
Environment path: `VIKUNJA_SENTRY_ENABLED`
### dsn
Configure the Sentry dsn used for api error tracking. Only used when Sentry is enabled for the api.
Default: `https://440eedc957d545a795c17bbaf477497c@o1047380.ingest.sentry.io/4504254983634944`
Full path: `sentry.dsn`
Environment path: `VIKUNJA_SENTRY_DSN`
### frontendenabled
If set to true, enables anonymous error tracking of frontend errors via Sentry. This allows us to gather more
information about errors in order to debug and fix it.
Default: `false`
Full path: `sentry.frontendenabled`
Environment path: `VIKUNJA_SENTRY_FRONTENDENABLED`
### frontenddsn
Configure the Sentry dsn used for frontend error tracking. Only used when Sentry is enabled for the frontend.
Default: `https://85694a2d757547cbbc90cd4b55c5a18d@o1047380.ingest.sentry.io/6024480`
Full path: `sentry.frontenddsn`
Environment path: `VIKUNJA_SENTRY_FRONTENDDSN`
---
## database
@ -611,7 +664,7 @@ Whether to enable or disable cors headers.
Note: If you want to put the frontend and the api on separate domains or ports, you will need to enable this.
Otherwise the frontend won't be able to make requests to the api through the browser.
Default: `true`
Default: `false`
Full path: `cors.enable`
@ -1159,8 +1212,10 @@ The provider needs to support the `openid`, `profile` and `email` scopes.<br/>
**Note:** Some openid providers (like gitlab) only make the email of the user available through openid claims if they have set it to be publicly visible.
If the email is not public in those cases, authenticating will fail.
**Note 2:** The frontend expects to be redirected after authentication by the third party
to <frontend-url>/auth/openid/<auth key>. Please make sure to configure the redirect url with your third party
to <frontend-url>/auth/openid/<auth key>. Please make sure to configure the redirect url in your third party
auth service accordingly if you're using the default vikunja frontend.
The frontend will automatically provide the api with the redirect url, composed from the current url where it's hosted.
If you want to use the desktop client with openid, make sure to allow redirects to `127.0.0.1`.
Take a look at the [default config file](https://kolaente.dev/vikunja/vikunja/src/branch/main/config.yml.sample) for more information about how to configure openid authentication.
Default: `<empty>`
@ -1320,7 +1375,7 @@ Environment path: `VIKUNJA_DEFAULTSETTINGS_WEEK_START`
### language
The language of the user interface. Must be an ISO 639-1 language code followed by an ISO 3166-1 alpha-2 country code. Check https://kolaente.dev/vikunja/vikunja/src/branch/main/frontend/src/i18n/lang for a list of possible languages. Will default to the browser language the user uses when signing up.
The language of the user interface. Must be an ISO 639-1 language code followed by an ISO 3166-1 alpha-2 country code. Check https://kolaente.dev/vikunja/vikunja/frontend/src/branch/main/src/i18n/lang for a list of possible languages. Will default to the browser language the user uses when signing up.
Default: `<unset>`

View File

@ -27,89 +27,53 @@ Create a directory for the project where all data and the compose file will live
Create a `docker-compose.yml` file with the following contents in your directory:
{{< highlight yaml >}}
```yaml
version: '3'
services:
db:
image: mariadb:10
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
MYSQL_ROOT_PASSWORD: supersecret
MYSQL_USER: vikunja
MYSQL_PASSWORD: secret
MYSQL_DATABASE: vikunja
volumes:
- ./db:/var/lib/mysql
restart: unless-stopped
api:
image: vikunja/api
environment:
VIKUNJA_DATABASE_HOST: db
VIKUNJA_DATABASE_PASSWORD: secret
VIKUNJA_DATABASE_TYPE: mysql
VIKUNJA_DATABASE_USER: vikunja
VIKUNJA_DATABASE_DATABASE: vikunja
VIKUNJA_SERVICE_JWTSECRET: <a super secure random secret>
VIKUNJA_SERVICE_FRONTENDURL: https://<your public frontend url with slash>/
volumes:
- ./files:/app/vikunja/files
depends_on:
- db
restart: unless-stopped
frontend:
image: vikunja/frontend
restart: unless-stopped
proxy:
image: nginx
ports:
- 80:80
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- api
- frontend
restart: unless-stopped
{{< /highlight >}}
vikunja:
image: vikunja/vikunja
environment:
VIKUNJA_SERVICE_PUBLICURL: http://<the public url where vikunja is reachable>
VIKUNJA_DATABASE_HOST: db
VIKUNJA_DATABASE_PASSWORD: secret
VIKUNJA_DATABASE_TYPE: mysql
VIKUNJA_DATABASE_USER: vikunja
VIKUNJA_DATABASE_DATABASE: vikunja
VIKUNJA_SERVICE_JWTSECRET: <a super secure random secret>
ports:
- 3456:3456
volumes:
- ./files:/app/vikunja/files
depends_on:
- db
restart: unless-stopped
db:
image: mariadb:10
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
MYSQL_ROOT_PASSWORD: supersupersecret
MYSQL_USER: vikunja
MYSQL_PASSWORD: supersecret
MYSQL_DATABASE: vikunja
volumes:
- ./db:/var/lib/mysql
restart: unless-stopped
```
This defines four services, each with their own container:
This defines two services, each with their own container:
* An api service which runs the vikunja api. Most of the core logic lives here.
* The frontend which will make vikunja actually usable for most people.
* A Vikunja service which runs the vikunja api and hosts its frontend.
* A database container which will store all projects, tasks, etc. We're using mariadb here, but you're free to use mysql or postgres if you want.
* A proxy service which makes the frontend and api available on the same port, redirecting all requests to `/api` to the api container.
If you already have a proxy on your host, you may want to check out the [reverse proxy examples]() to use that.
By default, it uses port 80 on the host.
If you already have a proxy on your host, you may want to check out the [reverse proxy examples]({{< ref "reverse-proxies.md" >}}) to use that.
By default, Vikunja will be exposed on port 3456 on the host.
To change to something different, you'll need to change the `ports` section in the service definition.
The number before the colon is the host port - This is where you can reach vikunja from the outside once all is up and running.
For the proxy service we'll need another bit of configuration.
Create an `nginx.conf` in your directory (next to the `docker-compose.yml` file) and add the following contents to it:
{{< highlight conf >}}
server {
listen 80;
location / {
proxy_pass http://frontend:80;
}
location ~* ^/(api|dav|\.well-known)/ {
proxy_pass http://api:3456;
client_max_body_size 20M;
}
}
{{< /highlight >}}
This is a simple proxy configuration which will forward all requests to `/api/` to the api container and everything else to the frontend.
<div class="notification is-info">
<b>NOTE:</b> Even if you want to make your installation available under a different port, you don't need to change anything in this configuration.
</div>
<div class="notification is-warning">
<b>NOTE:</b> If you change the max upload size in Vikunja's settings, you'll need to also change the <code>client_max_body_size</code> in the nginx proxy config.
</div>
You'll need to change the value of the `VIKUNJA_SERVICE_PUBLICURL` environment variable to the public port or hostname where Vikunja is reachable.
## Run it
@ -118,8 +82,8 @@ When first started, Vikunja will set up the database and run all migrations etc.
Once it is ready, you should see a message like this one in your console:
```
api_1 | 2020-05-24T11:15:37.560386009Z: INFO ▶ cmd/func1 025 Vikunja version 0.13.1+19-e9bc3246ce, built at Sun, 24 May 2020 11:10:36 +0000
api_1 | ⇨ http server started on [::]:3456
vikunja_1 | 2024-02-09T14:44:06.990677157+01:00: INFO ▶ cmd/func29 05d Vikunja version 0.23.0
vikunja_1 | ⇨ http server started on [::]:3456
```
This indicates all setup has been successful.
@ -159,20 +123,6 @@ If not, there might be a different error or a bug with Vikunja, please reach out
(If you have an idea about how we could improve this, we'd like to hear it!)
#### "Not a directory"
If you get an error like this one:
```
ERROR: for vikunja_proxy_1 Cannot start service proxy: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"vikunja/nginx.conf\\\" to rootfs \\\"/var/lib/docker/overlay2/9c8b8f9419c29dad0d1233fbb0a3c36cf403dabd7a55d6f0a47b0c1dd6029994/merged\\\" at \\\"/var/lib/docker/overlay2/9c8b8f9419c29dad0d1233fbb0a3c36cf403dabd7a55d6f0a47b0c1dd6029994/merged/etc/nginx/conf.d/default.conf\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
```
this means docker tried to mount a directory from the host to a file in the container.
This can happen if you did not create the `nginx.conf` file.
Because there is a volume mount for it in the `docker-compose.yml`, Docker will create a folder because non exists, assuming you want to mount a folder into the container.
To fix this, create the file and restart the containers again.
#### Migration failed: commands out of sync
If you get an error like this one:
@ -192,20 +142,46 @@ To do this, first stop everything by running `sudo docker-compose down`, then re
Head over to `http://<host-ip or url>/api/v1/info` in a browser.
You should see something like this:
{{< highlight json >}}
```json
{
"version": "0.13.1+19-e9bc3246ce",
"frontend_url": "http://localhost:8080/",
"motd": "test",
"link_sharing_enabled": true,
"max_file_size": "20MB",
"registration_enabled": true,
"available_migrators": [
"todoist"
],
"task_attachments_enabled": true
"version": "v0.23.0",
"frontend_url": "https://try.vikunja.io/",
"motd": "",
"link_sharing_enabled": true,
"max_file_size": "20MB",
"registration_enabled": true,
"available_migrators": [
"vikunja-file",
"ticktick",
"todoist"
],
"task_attachments_enabled": true,
"enabled_background_providers": [
"upload",
"unsplash"
],
"totp_enabled": false,
"legal": {
"imprint_url": "",
"privacy_policy_url": ""
},
"caldav_enabled": true,
"auth": {
"local": {
"enabled": true
},
"openid_connect": {
"enabled": false,
"providers": null
}
},
"email_reminders_enabled": true,
"user_deletion_enabled": true,
"task_comments_enabled": true,
"demo_mode_enabled": true,
"webhooks_enabled": true
}
{{< /highlight >}}
```
This shows you can reach the api through the api proxy.

View File

@ -10,11 +10,15 @@ menu:
# Full docker example
This docker compose configuration will run Vikunja with backend and frontend with a mariadb database.
It uses an nginx container or traefik on the host to proxy backend and frontend into a single port.
This docker compose configuration will run Vikunja with a mariadb database.
It uses a proxy configuration to make it available under a domain.
For all available configuration options, see [configuration]({{< ref "config.md">}}).
Once deployed, you might want to change the [`PUID` and `GUID` settings]({{< ref "install.md">}}#setting-user-and-group-id-of-the-user-running-vikunja) or [set the time zone]({{< ref "config.md">}}#timezone).
After registering all your users, you might also want to [disable the user registration]({{<ref "config.md">}}#enableregistration).
<div class="notification is-warning">
<b>NOTE:</b> If you intend to run Vikunja with mysql and/or to use non-latin characters
<a href="{{< ref "utf-8.md">}}">make sure your db is utf-8 compatible</a>.<br/>
@ -23,35 +27,12 @@ All examples on this page already reflect this and do not require additional wor
{{< table_of_contents >}}
## Redis
While Vikunja has support to use redis as a caching backend, you'll probably not need it unless you're using Vikunja with more than a handful of users.
To use redis, you'll need to add this to the config examples below:
{{< highlight yaml >}}
version: '3'
services:
api:
image: vikunja/api
environment:
VIKUNJA_REDIS_ENABLED: 1
VIKUNJA_REDIS_HOST: 'redis:6379'
VIKUNJA_CACHE_ENABLED: 1
VIKUNJA_CACHE_TYPE: redis
volumes:
- ./files:/app/vikunja/files
redis:
image: redis
{{< /highlight >}}
## PostgreSQL
Vikunja supports postgres, mysql and sqlite as a database backend. The examples on this page use mysql with a mariadb container.
To use postgres as a database backend, change the `db` section of the examples to this:
{{< highlight yaml >}}
```yaml
db:
image: postgres:13
environment:
@ -60,7 +41,7 @@ db:
volumes:
- ./db:/var/lib/postgresql/data
restart: unless-stopped
{{< /highlight >}}
```
You'll also need to change the `VIKUNJA_DATABASE_TYPE` to `postgres` on the api container declaration.
@ -73,13 +54,15 @@ You'll also need to change the `VIKUNJA_DATABASE_TYPE` to `postgres` on the api
Vikunja supports postgres, mysql and sqlite as a database backend. The examples on this page use mysql with a mariadb container.
To use sqlite as a database backend, change the `api` section of the examples to this:
{{< highlight yaml >}}
api:
image: vikunja/api
```yaml
vikunja:
image: vikunja/vikunja
environment:
VIKUNJA_SERVICE_JWTSECRET: <a super secure random secret>
VIKUNJA_SERVICE_FRONTENDURL: http://<your public frontend url with slash>/
# Note the default path is /app/vikunja/vikunja.db This moves to a different folder so you can use a volume and store this outside of the container so state is persisted even if container destroyed.
VIKUNJA_SERVICE_PUBLICURL: http://<your public frontend url with slash>/
# Note the default path is /app/vikunja/vikunja.db.
# This config variable moves it to a different folder so you can use a volume and
# store the database file outside the container so state is persisted even if the container is destroyed.
VIKUNJA_DATABASE_PATH: /db/vikunja.db
ports:
- 3456:3456
@ -87,11 +70,12 @@ api:
- ./files:/app/vikunja/files
- ./db:/db
restart: unless-stopped
{{< /highlight >}}
```
The default path Vikunja uses for sqlite is relative to the binary, which in the docker container would be `/app/vikunja/vikunja.db`. This config moves to a different folder using `VIKUNJA_DATABASE_PATH` so you can use a volume at `/db` and store this outside of the container so state is persisted even if container destroyed.
The default path Vikunja uses for sqlite is relative to the binary, which in the docker container would be `/app/vikunja/vikunja.db`.
The `VIKUNJA_DATABASE_PATH` environment variable moves changes it so that the database file is stored in a volume at `/db`, to persist state across restarts.
You'll also need to remove or change the `VIKUNJA_DATABASE_TYPE` to `sqlite` on the api container declaration.
You'll also need to remove or change the `VIKUNJA_DATABASE_TYPE` to `sqlite` on the container declaration.
You can also remove the db section.
@ -101,35 +85,27 @@ You can also remove the db section.
## Example without any proxy
This example lets you host Vikunja without any reverse proxy in front of it. This is the absolute minimum configuration you need to get something up and running. If you want to host Vikunja on one single port instead of two different ones or need tls termination, check out one of the other examples.
This example lets you host Vikunja without any reverse proxy in front of it.
This is the absolute minimum configuration you need to get something up and running.
If you want to make Vikunja available on a domain or need tls termination, check out one of the other examples.
Note that you need to change the `VIKUNJA_API_URL` environment variable to the ip (the docker host you're running this on) is reachable at. Because the browser you'll use to access the Vikunja frontend uses that url to make the requests, it has to be able to reach that ip + port from the outside. Putting everything in a private network won't work.
Note that you need to change the [`VIKUNJA_SERVICE_PUBLICURL`]({{< ref "config.md" >}}#publicurl) environment variable to the ip (the docker host you're running this on) is reachable at.
Because the browser you'll use to access the Vikunja frontend uses that url to make the requests, it has to be able to reach that ip + port from the outside.
{{< highlight yaml >}}
```yaml
version: '3'
services:
db:
image: mariadb:10
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
MYSQL_ROOT_PASSWORD: supersecret
MYSQL_USER: vikunja
MYSQL_PASSWORD: secret
MYSQL_DATABASE: vikunja
volumes:
- ./db:/var/lib/mysql
restart: unless-stopped
api:
image: vikunja/api
vikunja:
image: vikunja/vikunja
environment:
VIKUNJA_SERVICE_PUBLICURL: http://<the public url where vikunja is reachable>
VIKUNJA_DATABASE_HOST: db
VIKUNJA_DATABASE_PASSWORD: secret
VIKUNJA_DATABASE_TYPE: mysql
VIKUNJA_DATABASE_USER: vikunja
VIKUNJA_DATABASE_DATABASE: vikunja
VIKUNJA_SERVICE_JWTSECRET: <a super secure random secret>
VIKUNJA_SERVICE_FRONTENDURL: http://<your public frontend url with slash>/
ports:
- 3456:3456
volumes:
@ -137,125 +113,6 @@ services:
depends_on:
- db
restart: unless-stopped
frontend:
image: vikunja/frontend
ports:
- 80:80
environment:
VIKUNJA_API_URL: http://<your-ip-here>:3456/api/v1
restart: unless-stopped
{{< /highlight >}}
## Example with traefik 2
This example assumes [traefik](https://traefik.io) version 2 installed and configured to [use docker as a configuration provider](https://docs.traefik.io/providers/docker/).
We also make a few assumptions here which you'll most likely need to adjust for your traefik setup:
* Your domain is `vikunja.example.com`
* The entrypoint you want to make vikunja available from is called `https`
* The tls cert resolver is called `acme`
{{< highlight yaml >}}
version: '3'
services:
api:
image: vikunja/api
environment:
VIKUNJA_DATABASE_HOST: db
VIKUNJA_DATABASE_PASSWORD: supersecret
VIKUNJA_DATABASE_TYPE: mysql
VIKUNJA_DATABASE_USER: vikunja
VIKUNJA_DATABASE_DATABASE: vikunja
VIKUNJA_SERVICE_JWTSECRET: <a super secure random secret>
VIKUNJA_SERVICE_FRONTENDURL: https://<your public frontend url with slash>/
volumes:
- ./files:/app/vikunja/files
networks:
- web
- default
depends_on:
- db
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.vikunja-api.rule=Host(`vikunja.example.com`) && (PathPrefix(`/api/v1`) || PathPrefix(`/dav/`) || PathPrefix(`/.well-known/`))"
- "traefik.http.routers.vikunja-api.entrypoints=https"
- "traefik.http.routers.vikunja-api.tls.certResolver=acme"
frontend:
image: vikunja/frontend
labels:
- "traefik.enable=true"
- "traefik.http.routers.vikunja-frontend.rule=Host(`vikunja.example.com`)"
- "traefik.http.routers.vikunja-frontend.entrypoints=https"
- "traefik.http.routers.vikunja-frontend.tls.certResolver=acme"
networks:
- web
- default
restart: unless-stopped
db:
image: mariadb:10
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
MYSQL_ROOT_PASSWORD: supersupersecret
MYSQL_USER: vikunja
MYSQL_PASSWORD: supersecret
MYSQL_DATABASE: vikunja
volumes:
- ./db:/var/lib/mysql
restart: unless-stopped
command: --max-connections=1000
networks:
web:
external: true
{{< /highlight >}}
## Example with traefik 1
This example assumes [traefik](https://traefik.io) in version 1 installed and configured to [use docker as a configuration provider](https://docs.traefik.io/v1.7/configuration/backends/docker/).
{{< highlight yaml >}}
version: '3'
services:
api:
image: vikunja/api
environment:
VIKUNJA_DATABASE_HOST: db
VIKUNJA_DATABASE_PASSWORD: supersecret
VIKUNJA_DATABASE_TYPE: mysql
VIKUNJA_DATABASE_USER: vikunja
VIKUNJA_DATABASE_DATABASE: vikunja
VIKUNJA_SERVICE_JWTSECRET: <a super secure random secret>
VIKUNJA_SERVICE_FRONTENDURL: https://<your public frontend url with slash>/
volumes:
- ./files:/app/vikunja/files
networks:
- web
- default
depends_on:
- db
restart: unless-stopped
labels:
- "traefik.docker.network=web"
- "traefik.enable=true"
- "traefik.frontend.rule=Host:vikunja.example.com;PathPrefix:/api/v1,/dav/,/.well-known"
- "traefik.port=3456"
- "traefik.protocol=http"
frontend:
image: vikunja/frontend
labels:
- "traefik.docker.network=web"
- "traefik.enable=true"
- "traefik.frontend.rule=Host:vikunja.example.com;PathPrefix:/"
- "traefik.port=80"
- "traefik.protocol=http"
networks:
- web
- default
restart: unless-stopped
db:
image: mariadb:10
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
@ -267,152 +124,126 @@ services:
volumes:
- ./db:/var/lib/mysql
restart: unless-stopped
command: --max-connections=1000
```
networks:
web:
external: true
{{< /highlight >}}
## Example with Traefik 2
## Example with nginx as proxy
This example assumes [traefik](https://traefik.io) version 2 installed and configured to [use docker as a configuration provider](https://docs.traefik.io/providers/docker/).
You'll need to save this nginx configuration on your host under `nginx.conf`
(or elsewhere, but then you'd need to adjust the proxy mount at the bottom of the compose file):
We also make a few assumptions here which you'll most likely need to adjust for your traefik setup:
{{< highlight conf >}}
server {
listen 80;
* Your domain is `vikunja.example.com`
* The entrypoint you want to make vikunja available from is called `https`
* The tls cert resolver is called `acme`
location / {
proxy_pass http://frontend:80;
}
location ~* ^/(api|dav|\.well-known)/ {
proxy_pass http://api:3456;
client_max_body_size 20M;
}
}
{{< /highlight >}}
<div class="notification is-warning">
<b>NOTE:</b> If you change the max upload size in Vikunja's settings, you'll need to also change the <code>client_max_body_size</code> in the nginx proxy config.
</div>
`docker-compose.yml` config:
{{< highlight yaml >}}
```yaml
version: '3'
services:
db:
image: mariadb:10
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
MYSQL_ROOT_PASSWORD: supersecret
MYSQL_USER: vikunja
MYSQL_PASSWORD: secret
MYSQL_DATABASE: vikunja
volumes:
- ./db:/var/lib/mysql
restart: unless-stopped
api:
image: vikunja/api
vikunja:
image: vikunja/vikunja
environment:
VIKUNJA_SERVICE_PUBLICURL: http://<the public url where vikunja is reachable>
VIKUNJA_DATABASE_HOST: db
VIKUNJA_DATABASE_PASSWORD: secret
VIKUNJA_DATABASE_PASSWORD: supersecret
VIKUNJA_DATABASE_TYPE: mysql
VIKUNJA_DATABASE_USER: vikunja
VIKUNJA_DATABASE_DATABASE: vikunja
VIKUNJA_SERVICE_JWTSECRET: <a super secure random secret>
VIKUNJA_SERVICE_FRONTENDURL: https://<your public frontend url with slash>/
volumes:
- ./files:/app/vikunja/files
networks:
- web
- default
depends_on:
- db
restart: unless-stopped
frontend:
image: vikunja/frontend
restart: unless-stopped
proxy:
image: nginx
ports:
- 80:80
labels:
- "traefik.enable=true"
- "traefik.http.routers.vikunja.rule=Host(`vikunja.example.com`)"
- "traefik.http.routers.vikunja.entrypoints=https"
- "traefik.http.routers.vikunja.tls.certResolver=acme"
db:
image: mariadb:10
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
MYSQL_ROOT_PASSWORD: supersupersecret
MYSQL_USER: vikunja
MYSQL_PASSWORD: supersecret
MYSQL_DATABASE: vikunja
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- api
- frontend
- ./db:/var/lib/mysql
restart: unless-stopped
{{< /highlight >}}
networks:
web:
external: true
```
## Example with Caddy v2 as proxy
You will need the following `Caddyfile` on your host (or elsewhere, but then you'd need to adjust the proxy mount at the bottom of the compose file):
{{< highlight conf >}}
```conf
vikunja.example.com {
reverse_proxy /api/* api:3456
reverse_proxy /.well-known/* api:3456
reverse_proxy /dav/* api:3456
reverse_proxy frontend:80
reverse_proxy api:3456
}
{{< /highlight >}}
```
`docker-compose.yml` config:
Note that you need to change the [`VIKUNJA_SERVICE_PUBLICURL`]({{< ref "config.md" >}}#publicurl) environment variable to the ip (the docker host you're running this on) is reachable at.
Because the browser you'll use to access the Vikunja frontend uses that url to make the requests, it has to be able to reach that ip + port from the outside.
{{< highlight yaml >}}
Docker Compose config:
```yaml
version: '3'
services:
db:
image: mariadb:10
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
MYSQL_ROOT_PASSWORD: supersecret
MYSQL_USER: vikunja
MYSQL_PASSWORD: secret
MYSQL_DATABASE: vikunja
volumes:
- ./db:/var/lib/mysql
restart: unless-stopped
api:
image: vikunja/api
vikunja:
image: vikunja/vikunja
environment:
VIKUNJA_SERVICE_PUBLICURL: http://<the public url where vikunja is reachable>
VIKUNJA_DATABASE_HOST: db
VIKUNJA_DATABASE_PASSWORD: secret
VIKUNJA_DATABASE_TYPE: mysql
VIKUNJA_DATABASE_USER: vikunja
VIKUNJA_DATABASE_DATABASE: vikunja
VIKUNJA_SERVICE_JWTSECRET: <a super secure random secret>
VIKUNJA_SERVICE_FRONTENDURL: https://<your public frontend url with slash>/
ports:
- 3456:3456
volumes:
- ./files:/app/vikunja/files
depends_on:
- db
restart: unless-stopped
frontend:
image: vikunja/frontend
db:
image: mariadb:10
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
MYSQL_ROOT_PASSWORD: supersupersecret
MYSQL_USER: vikunja
MYSQL_PASSWORD: supersecret
MYSQL_DATABASE: vikunja
volumes:
- ./db:/var/lib/mysql
restart: unless-stopped
caddy:
image: caddy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "80:80"
- "443:443"
depends_on:
- api
- frontend
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
{{< /highlight >}}
- ./Caddyfile:/etc/caddy/Caddyfile:ro
```
## Setup on a Synology NAS
There is a proxy preinstalled in DSM, so if you want to access vikunja from outside,
you can prepare 2 proxy rules:
* a redirection rule for vikunja's api (see example screenshot using port 3456)
* a similar redirection rule for vikunja's frontend (using port 4321)
There is a proxy preinstalled in DSM, so if you want to access Vikunja from outside,
you need to prepare a proxy rule the Vikunja Service.
![Synology Proxy Settings](/docs/synology-proxy-1.png)
@ -423,64 +254,46 @@ docker main folders:
* vikunja
* mariadb
Synology has its own GUI for managing Docker containers... But it's easier via docker compose.
Synology has its own GUI for managing Docker containers, but it's easier via docker compose.
To do that, you can
* either activate SSH and paste the adapted compose file in a terminal (using Putty or similar)
* without activating SSH as a "custom script" (go to Control Panel / Task Scheduler / Create / Scheduled Task / User-defined script)
* without activating SSH, by using Portainer (you have to install first, check out [this tutorial](https://www.portainer.io/blog/how-to-install-portainer-on-a-synology-nas) for exmple):
* Either activate SSH and paste the adapted compose file in a terminal (using Putty or similar)
* Without activating SSH as a "custom script" (go to Control Panel / Task Scheduler / Create / Scheduled Task / User-defined script)
* Without activating SSH, by using Portainer (you have to install first, check out [this tutorial](https://www.portainer.io/blog/how-to-install-portainer-on-a-synology-nas) for exmple):
1. Go to **Dashboard / Stacks** click the button **"Add Stack"**
2. Give it the name Vikunja and paste the adapted docker compose file
3. Deploy the Stack with the "Deploy Stack" button:
![Portainer Stack deploy](/docs/synology-proxy-2.png)
The docker-compose file we're going to use is very similar to the [example without any proxy](#example-without-any-proxy) above:
{{< highlight yaml >}}
version: '3'
services:
db:
image: mariadb:10
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
MYSQL_ROOT_PASSWORD: supersecret
MYSQL_USER: vikunja
MYSQL_PASSWORD: secret
MYSQL_DATABASE: vikunja
volumes:
- ./db:/var/lib/mysql
restart: unless-stopped
api:
image: vikunja/api
environment:
VIKUNJA_DATABASE_HOST: db
VIKUNJA_DATABASE_PASSWORD: secret
VIKUNJA_DATABASE_TYPE: mysql
VIKUNJA_DATABASE_USER: vikunja
VIKUNJA_DATABASE_DATABASE: vikunja
VIKUNJA_SERVICE_JWTSECRET: <a super secure random secret>
VIKUNJA_SERVICE_FRONTENDURL: https://<your public frontend url with slash>/
ports:
- 3456:3456
volumes:
- ./files:/app/vikunja/files
depends_on:
- db
restart: unless-stopped
frontend:
image: vikunja/frontend
ports:
- 4321:80
environment:
VIKUNJA_API_URL: http://vikunja-api-domain.tld/api/v1
restart: unless-stopped
{{< /highlight >}}
The docker-compose file we're going to use is exactly the same from the [example without any proxy](#example-without-any-proxy) above.
You may want to change the volumes to match the rest of your setup.
Once deployed, you might want to change the [`PUID` and `GUID` settings]({{< ref "install-backend.md">}}#setting-user-and-group-id-of-the-user-running-vikunja) or [set the time zone]({{< ref "config.md">}}#timezone).
Once deployed, you might want to change the [`PUID` and `GUID` settings]({{< ref "install.md">}}#setting-user-and-group-id-of-the-user-running-vikunja) or [set the time zone]({{< ref "config.md">}}#timezone).
After registering all your users, you might also want to [disable the user registration]({{<ref "config.md">}}#enableregistration).
## Redis
While Vikunja has support to use redis as a caching backend, you'll probably not need it unless you're using Vikunja with more than a handful of users.
To use redis, you'll need to add this to the config examples below:
```yaml
version: '3'
services:
vikunja:
image: vikunja/vikunja
environment:
VIKUNJA_REDIS_ENABLED: 1
VIKUNJA_REDIS_HOST: 'redis:6379'
VIKUNJA_CACHE_ENABLED: 1
VIKUNJA_CACHE_TYPE: redis
volumes:
- ./files:/app/vikunja/files
redis:
image: redis
```

View File

@ -1,283 +0,0 @@
---
date: "2019-02-12:00:00+02:00"
title: "Install Backend"
draft: false
type: "doc"
menu:
sidebar:
parent: "setup"
---
# Backend
<div class="notification is-warning">
<b>NOTE:</b> If you intend to run Vikunja with mysql and/or to use non-latin characters
<a href="{{< ref "utf-8.md">}}">make sure your db is utf-8 compatible</a>.
</div>
{{< table_of_contents >}}
## Install from binary
Download a copy of Vikunja from the [download page](https://vikunja.io/en/download/) for your architecture.
{{< highlight bash >}}
wget <download-url>
{{< /highlight >}}
### Verify the GPG signature
Starting with version `0.7`, all releases are signed using pgp.
Releases from `main` will always be signed.
To validate the downloaded zip file use the signiture file `.asc` and the key `FF054DACD908493A`:
{{< highlight bash >}}
gpg --keyserver keyserver.ubuntu.com --recv FF054DACD908493A
gpg --verify vikunja-0.7-linux-amd64-full.zip.asc vikunja-0.7-linux-amd64-full.zip
{{< /highlight >}}
### Set it up
Once you've verified the signature, you need to unzip it and make it executable, you'll also need to
create a symlink to it so you can execute Vikunja by typing `vikunja` on your system.
We'll install vikunja to `/opt/vikunja`, change the path where needed if you want to install it elsewhere.
{{< highlight bash >}}
mkdir -p /opt/vikunja
unzip <vikunja-zip-file> -d /opt/vikunja
chmod +x /opt/vikunja
ln -s /opt/vikunja/vikunja /usr/bin/vikunja
{{< /highlight >}}
### Systemd service
Save the following service file to `/etc/systemd/system/vikunja.service` and adapt it to your needs:
{{< highlight service >}}
[Unit]
Description=Vikunja
After=syslog.target
After=network.target
# Depending on how you configured Vikunja, you may want to uncomment these:
#Requires=mysql.service
#Requires=mariadb.service
#Requires=postgresql.service
#Requires=redis.service
[Service]
RestartSec=2s
Type=simple
WorkingDirectory=/opt/vikunja
ExecStart=/usr/bin/vikunja
Restart=always
# If you want to bind Vikunja to a port below 1024 uncomment
# the two values below
###
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
{{< /highlight >}}
If you've installed Vikunja to a directory other than `/opt/vikunja`, you need to adapt `WorkingDirectory` accordingly.
After you made all necessary modifications, it's time to start the service:
{{< highlight bash >}}
sudo systemctl enable vikunja
sudo systemctl start vikunja
{{< /highlight >}}
### Build from source
To build vikunja from source, see [building from source]({{< ref "build-from-source.md">}}).
### Updating
Simply replace the binary and templates with the new version, then restart Vikunja.
It will automatically run all necessary database migrations.
**Make sure to take a look at the changelog for the new version to not miss any manual steps the update may involve!**
## Docker
(Note: this assumes some familiarity with docker)
Usage with docker is pretty straightforward:
{{< highlight bash >}}
docker run -p 3456:3456 vikunja/api
{{< /highlight >}}
to run with a standard configuration.
This will expose vikunja on port `3456` on the host running the container.
You can mount a local configuration like so:
{{< highlight bash >}}
docker run -p 3456:3456 -v /path/to/config/on/host.yml:/app/vikunja/config.yml:ro vikunja/api
{{< /highlight >}}
Though it is recommended to use environment variables or `.env` files to configure Vikunja in docker.
See [config]({{< ref "config.md">}}) for a list of available configuration options.
### Files volume
By default the container stores all files uploaded and used through vikunja inside of `/app/vikunja/files` which is created as a docker volume.
You should mount the volume somewhere to the host to permanently store the files and don't loose them if the container restarts.
### Setting user and group id of the user running vikunja
You can set the user and group id of the user running vikunja with the `PUID` and `PGID` environment variables.
This follows the pattern used by [the linuxserver.io](https://docs.linuxserver.io/general/understanding-puid-and-pgid) docker images.
This is useful to solve general permission problems when host-mounting volumes such as the volume used for task attachments.
### Docker compose
To run the backend with a mariadb database you can use this example [docker-compose](https://docs.docker.com/compose/) file:
{{< highlight yaml >}}
version: '2'
services:
api:
image: vikunja/api:latest
environment:
VIKUNJA_DATABASE_HOST: db
VIKUNJA_DATABASE_PASSWORD: secret
VIKUNJA_DATABASE_TYPE: mysql
VIKUNJA_DATABASE_USER: vikunja
VIKUNJA_SERVICE_JWTSECRET: <generated secret>
VIKUNJA_SERVICE_FRONTENDURL: https://<your public frontend url with slash>/
volumes:
- ./files:/app/vikunja/files
db:
image: mariadb:10
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
MYSQL_ROOT_PASSWORD: supersecret
MYSQL_USER: vikunja
MYSQL_PASSWORD: secret
MYSQL_DATABASE: vikunja
volumes:
- ./db:/var/lib/mysql
{{< /highlight >}}
See [full docker example]({{< ref "full-docker-example.md">}}) for more variations of this config.
## Debian packages
Since version 0.7 Vikunja is also released as debian packages.
To install these, grab a copy from [the download page](https://vikunja.io/en/download/) and run
{{< highlight bash >}}
dpkg -i vikunja.deb
{{< /highlight >}}
This will install the backend to `/opt/vikunja`.
To configure it, use the config file in `/etc/vikunja/config.yml`.
## FreeBSD / FreeNAS
Unfortunately, we currently can't provide pre-built binaries for FreeBSD.
As a workaround, it is possible to compile vikunja for FreeBSD directly on a FreeBSD machine, a guide is available below:
*Thanks to HungrySkeleton who originally created this guide [in the forum](https://community.vikunja.io/t/freebsd-support/69/11).*
### Jail Setup
1. Create jail named ```vikunja```
2. Set jail properties to 'auto start'
3. Mount storage (```/mnt``` to ```jailData/vikunja```)
4. Start jail & SSH into it
### Installing packages
{{< highlight bash >}}
pkg update && pkg upgrade -y
pkg install nano git go gmake
go install github.com/magefile/mage
{{< /highlight >}}
### Clone vikunja repo
{{< highlight bash >}}
mkdir /mnt/GO/code.vikunja.io
cd /mnt/GO/code.vikunja.io
git clone https://code.vikunja.io/api
cd /mnt/GO/code.vikunja.io/api
{{< /highlight >}}
### Compile binaries
{{< highlight bash >}}
go install
mage build
{{< /highlight >}}
### Create folder to install backend server into
{{< highlight bash >}}
mkdir /mnt/backend
cp /mnt/GO/code.vikunja.io/api/vikunja /mnt/backend/vikunja
cd /mnt/backend
chmod +x /mnt/backend/vikunja
{{< /highlight >}}
### Set vikunja to boot on startup
{{< highlight bash >}}
nano /etc/rc.d/vikunja
{{< /highlight >}}
Then paste into the file:
{{< highlight bash >}}
#!/bin/sh
. /etc/rc.subr
name=vikunja
rcvar=vikunja_enable
command="/mnt/backend/${name}"
load_rc_config $name
run_rc_command "$1"
{{< /highlight >}}
Save and exit. Then execute:
{{< highlight bash >}}
chmod +x /etc/rc.d/vikunja
nano /etc/rc.conf
{{< /highlight >}}
Then add line to bottom of file:
{{< highlight bash >}}
vikunja_enable="YES"
{{< /highlight >}}
Test vikunja now works with
{{< highlight bash >}}
service vikunja start
{{< /highlight >}}
The API is now available through IP:
```
192.168.1.XXX:3456
```
## Configuration
See [available configuration options]({{< ref "config.md">}}).
## Default Password
After successfully installing Vikunja, there is no default user or password.
You only need to register a new account and set all the details when creating it.

View File

@ -1,138 +0,0 @@
---
date: "2019-02-12:00:00+02:00"
title: "Install Frontend"
draft: false
type: "doc"
menu:
sidebar:
parent: "setup"
---
# Frontend
Installing the frontend is just a matter of hosting a bunch of static files somewhere.
With nginx or apache, you have to [download](https://vikunja.io/en/download/) the frontend files first.
Unzip them and store them somewhere your server can access them.
You also need to configure a rewrite condition to internally redirect all requests to `index.html` which handles all urls.
{{< table_of_contents >}}
## API URL configuration
By default, the frontend assumes it can reach the api at `/api/v1` relative to the frontend url.
This means that if you make the frontend available at, say `https://vikunja.example.com`, it tries to reach the api
at `https://vikunja.example.com/api/v1`.
In this scenario it is not possible for the frontend and the api to live on separate servers or even just separate ports on the same server with [the use of a reverse proxy]({{< ref "reverse-proxies.md">}}).
To make configurations like this possible, the api url can be set in the `index.html` file of the frontend releases.
Just open the file with a text editor - there are comments which will explain how to set the url.
**Note:** This needs to be done again after every update.
(If you have a good idea for a better solution than this, we'd love to [hear it](https://vikunja.io/contact/))
## Docker
The docker image is based on nginx and just contains all necessary files for the frontend.
To run it, all you need is
{{< highlight bash >}}
docker run -p 80:80 vikunja/frontend
{{< /highlight >}}
which will run the docker image and expose port 80 on the host.
See [full docker example]({{< ref "full-docker-example.md">}}) for more variations of this config.
The docker container runs as an unprivileged user and does not mount anything.
### API URL configuration in docker
When running the frontend with docker, it is possible to set the environment variable `$VIKUNJA_API_URL` to the api url.
It is therefore not needed to change the url manually inside the docker container.
## NGINX
Below are two example configurations which you can put in your `nginx.conf`:
You may need to adjust `server_name` and `root` accordingly.
After configuring them, you need to reload nginx (`service nginx reload`).
### with gzip enabled (recommended)
{{< highlight conf >}}
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml;
server {
listen 80;
server_name localhost;
location / {
root /path/to/vikunja/static/frontend/files;
try_files $uri $uri/ /;
index index.html index.htm;
}
}
{{< /highlight >}}
### without gzip
{{< highlight conf >}}
server {
listen 80;
server_name localhost;
location / {
root /path/to/vikunja/static/frontend/files;
try_files $uri $uri/ /;
index index.html index.htm;
}
}
{{< /highlight >}}
## Apache
Apache needs to have `mod_rewrite` enabled for this to work properly:
{{< highlight bash >}}
a2enmod rewrite
service apache2 restart
{{< /highlight >}}
Put the following config in `cat /etc/apache2/sites-available/vikunja.conf`:
{{< highlight aconf >}}
<VirtualHost *:80>
ServerName localhost
DocumentRoot /path/to/vikunja/static/frontend/files
RewriteEngine On
RewriteRule ^\/?(favicon\.ico|assets|audio|fonts|images|manifest\.webmanifest|robots\.txt|sw\.js|workbox-.*|api|dav|\.well-known) - [L]
RewriteRule ^(.*)$ /index.html [QSA,L]
</VirtualHost>
{{< /highlight >}}
You probably want to adjust `ServerName` and `DocumentRoot`.
Once you've customized your config, you need to enable it:
{{< highlight bash >}}
a2ensite vikunja
service apache2 reload
{{< /highlight >}}
## Updating
To update, it should be enough to download the new files and overwrite the old ones.
The paths contain hashes, so all caches are invalidated automatically.

View File

@ -11,42 +11,277 @@ menu:
# Installing
Vikunja consists of two parts: [API](https://code.vikunja.io/api) and [frontend](https://code.vikunja.io/frontend).
Architecturally, Vikunja is made up of two parts: [API](https://code.vikunja.io/api) and [frontend](https://code.vikunja.io/api/frontend).
You will always need to install at least the API.
To actually use Vikunja you'll also need to somehow install a frontend to use it.
You can either:
Both are bundled into one single deployable binary (or docker container).
That means you only need to install one thing to be able to use Vikunja.
* [Install the web frontend]({{< ref "install-frontend.md">}})
* Use the desktop app, which is essentially a web frontend packaged for easy installation on desktop devices
You can also:
* Use the desktop app, which is essentially the web frontend packaged for easy installation on desktop devices
* Use the mobile app only, but as of right now it only supports the very basic features of Vikunja
Vikunja can be installed in various ways.
This document provides an overview and instructions for the different methods.
<div class="notification is-warning">
<b>NOTE:</b> If you intend to run Vikunja with mysql and/or to use non-latin characters
<a href="{{< ref "utf-8.md">}}">make sure your db is utf-8 compatible</a>.
</div>
* [API]({{< ref "install-backend.md">}})
* [Installing from binary]({{< ref "install-backend.md#install-from-binary">}})
* [Verify the GPG signature]({{< ref "install-backend.md#verify-the-gpg-signature">}})
* [Set it up]({{< ref "install-backend.md#set-it-up">}})
* [Systemd service]({{< ref "install-backend.md#systemd-service">}})
* [Updating]({{< ref "install-backend.md#updating">}})
* [Build from source]({{< ref "install-backend.md#build-from-source">}})
* [Docker]({{< ref "install-backend.md#docker">}})
* [Debian packages]({{< ref "install-backend.md#debian-packages">}})
* [Configuration]({{< ref "config.md">}})
* [UTF-8 Settings]({{< ref "utf-8.md">}})
* [Frontend]({{< ref "install-frontend.md">}})
* [Docker]({{< ref "install-frontend.md#docker">}})
* [NGINX]({{< ref "install-frontend.md#nginx">}})
* [Apache]({{< ref "install-frontend.md#apache">}})
* [Updating]({{< ref "install-frontend.md#updating">}})
Vikunja can be installed in various ways.
This document provides an overview and instructions for the different methods:
* [Installing from binary](#install-from-binary)
* [Build from source]({{< ref "build-from-source.md">}})
* [Docker](#docker)
* [Debian packages](#debian-packages)
* [FreeBSD](#freebsd--freenas)
* [Kubernetes]({{< ref "k8s.md" >}})
And after you installed Vikunja, you may want to check out these other ressources:
* [Configuration]({{< ref "config.md">}})
* [UTF-8 Settings]({{< ref "utf-8.md">}})
* [Reverse proxies]({{< ref "reverse-proxies.md">}})
* [Full docker example]({{< ref "full-docker-example.md">}})
* [Backups]({{< ref "backups.md">}})
## Installation on kubernetes
## Install from binary
A third-party Helm Chart is available from the k8s-at-home project [here](https://github.com/k8s-at-home/charts/tree/master/charts/stable/vikunja).
Download a copy of Vikunja from the [download page](https://dl.vikunja.io/vikunja) for your architecture.
```
wget <download-url>
```
### Verify the GPG signature
All releases are signed using GPG.
To validate the downloaded zip file use the signiture file `.asc` and the key `FF054DACD908493A`:
```
gpg --keyserver keyserver.ubuntu.com --recv FF054DACD908493A
gpg --verify vikunja-<vikunja version>-linux-amd64-full.zip.asc vikunja-<vikunja version>-linux-amd64-full.zip
```
### Set it up
Once you've verified the signature, you need to unzip and make it executable.
You'll also need to create a symlink to the binary, so that you can execute Vikunja by typing `vikunja` on your system.
We'll install vikunja to `/opt/vikunja`, change the path where needed if you want to install it elsewhere.
Run these commands to install it:
```
mkdir -p /opt/vikunja
unzip <vikunja-zip-file> -d /opt/vikunja
chmod +x /opt/vikunja
sudo ln -s /opt/vikunja/vikunja /usr/bin/vikunja
```
### Systemd service
To automatically start Vikunja when your system boots and to ensure all dependent services are met, you want to use an init system like systemd.
Save the following service file to `/etc/systemd/system/vikunja.service` and adapt it to your needs:
```unit file (systemd)
[Unit]
Description=Vikunja
After=syslog.target
After=network.target
# Depending on how you configured Vikunja, you may want to uncomment these:
#Requires=mysql.service
#Requires=mariadb.service
#Requires=postgresql.service
#Requires=redis.service
[Service]
RestartSec=2s
Type=simple
WorkingDirectory=/opt/vikunja
ExecStart=/usr/bin/vikunja
Restart=always
# If you want to bind Vikunja to a port below 1024 uncomment
# the two values below
###
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
```
If you've installed Vikunja to a directory other than `/opt/vikunja`, you need to adapt `WorkingDirectory` accordingly.
After you made all necessary modifications, it's time to start the service:
```
sudo systemctl enable vikunja
sudo systemctl start vikunja
```
### Build from source
To build vikunja from source, see [building from source]({{< ref "build-from-source.md">}}).
### Updating
[Make a backup first]({{< ref "backups.md" >}}).
Simply replace the binary with the new version, then restart Vikunja.
It will automatically run all necessary database migrations.
**Make sure to take a look at the changelog for the new version to not miss any manual steps the update may involve!**
## Docker
(Note: this assumes some familiarity with docker)
To get up and running quickly, use this command:
```
touch vikunja.db
docker run -p 3456:3456 -v $PWD/files:/app/vikunja/files -v $PWD/vikunja.db:/app/vikunja/vikunja.db vikunja/vikunja
```
This will expose vikunja on port `3456` on the host running the container and use sqlite as database backend.
You can mount a local configuration like so:
```
touch vikunja.db
docker run -p 3456:3456 -v /path/to/config/on/host.yml:/app/vikunja/config.yml:ro -v $PWD/files:/app/vikunja/files -v $PWD/vikunja.db:/app/vikunja/vikunja.db vikunja/vikunja
```
Though it is recommended to use environment variables or `.env` files to configure Vikunja in docker.
See [config]({{< ref "config.md">}}) for a list of available configuration options.
Check out the [docker examples]({{<ref "full-docker-example.md">}}) for more advanced configuration using mysql / postgres and a reverse proxy.
### Files volume
By default, the container stores all files uploaded and used through vikunja inside of `/app/vikunja/files` which is created as a docker volume.
You should mount the volume somewhere to the host to permanently store the files and don't lose them if the container restarts.
### Setting user and group id of the user running vikunja
You can set the user and group id of the user running vikunja with the `PUID` and `PGID` environment variables.
This follows the pattern used by [the linuxserver.io](https://docs.linuxserver.io/general/understanding-puid-and-pgid) docker images.
This is useful to solve general permission problems when host-mounting volumes such as the volume used for task attachments.
### Docker compose
Check out the [docker examples]({{<ref "full-docker-example.md">}}) for more advanced configuration using docker compose.
## Debian packages
Vikunja is available as debian packages.
To install these, grab a `.deb` file from [the download page](https://dl.vikunja.io/vikunja) and run
```
dpkg -i vikunja.deb
```
This will install Vikunja to `/opt/vikunja`.
To configure it, use the config file in `/etc/vikunja/config.yml`.
## FreeBSD / FreeNAS
Unfortunately, we currently can't provide pre-built binaries for FreeBSD.
As a workaround, it is possible to compile vikunja for FreeBSD directly on a FreeBSD machine, a guide is available below:
*Thanks to HungrySkeleton who originally created this guide [in the forum](https://community.vikunja.io/t/freebsd-support/69/11).*
### Jail Setup
1. Create a jail named `vikunja`
2. Set jail properties to 'auto start'
3. Mount storage (`/mnt` to `jailData/vikunja`)
4. Start jail & SSH into it
### Installing packages
```
pkg update && pkg upgrade -y
pkg install nano git go gmake
go install github.com/magefile/mage
```
### Clone vikunja repo
```
mkdir /mnt/GO/code.vikunja.io
cd /mnt/GO/code.vikunja.io
git clone https://code.vikunja.io/api
cd /mnt/GO/code.vikunja.io/api
```
### Compile binaries
```
cd frontend
pnpm install
pnpm run build
cd ..
mage build
```
### Create folder to install Vikunja into
```
mkdir /mnt/vikunja
cp /mnt/GO/code.vikunja.io/api/vikunja /mnt/vikunja
cd /mnt/vikunja
chmod +x /mnt/vikunja
```
### Set vikunja to boot on startup
```
nano /etc/rc.d/vikunja
```
Then paste into the file:
```
#!/bin/sh
. /etc/rc.subr
name=vikunja
rcvar=vikunja_enable
command="/mnt/vikunja/${name}"
load_rc_config $name
run_rc_command "$1"
```
Save and exit. Then execute:
```
chmod +x /etc/rc.d/vikunja
nano /etc/rc.conf
```
Then add line to bottom of file:
```
vikunja_enable="YES"
```
Test vikunja now works with
```
service vikunja start
```
Vikunja is now available through IP:
```
192.168.1.XXX:3456
```
## Other installation resources
@ -57,3 +292,12 @@ A third-party Helm Chart is available from the k8s-at-home project [here](https:
* [Self-Hosted To-Do List with Vikunja in Docker](https://www.youtube.com/watch?v=DqyqDWpEvKI) (Youtube)
* [Vikunja self-hosted (step by step)](https://nguyenminhhung.com/vikunja-self-hosted-step-by-step/)
* [How to Install Vikunja on Your Synology NAS](https://mariushosting.com/how-to-install-vikunja-on-your-synology-nas/)
## Configuration
See [available configuration options]({{< ref "config.md">}}).
## Default Password
After successfully installing Vikunja, there is no default user or password.
You only need to register a new account and set all the details when creating it.

View File

@ -8,73 +8,28 @@ menu:
parent: "setup"
---
# Setup behind a reverse proxy which also serves the frontend
# Setup behind a reverse proxy
These examples assume you have an instance of the backend running on your server listening on port `3456`.
These examples assume you have an instance of Vikunja running on your server listening on port `3456`.
If you've changed this setting, you need to update the server configurations accordingly.
{{< table_of_contents >}}
## NGINX
Below are two example configurations which you can put in your `nginx.conf`:
You may need to adjust `server_name` and `root` accordingly.
### with gzip enabled (recommended)
{{< highlight conf >}}
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml;
```conf
server {
listen 80;
server_name localhost;
location / {
root /path/to/vikunja/static/frontend/files;
try_files $uri $uri/ /;
index index.html index.htm;
}
location ~* ^/(api|dav|\.well-known)/ {
proxy_pass http://localhost:3456;
client_max_body_size 20M;
}
}
{{< /highlight >}}
<div class="notification is-warning">
<b>NOTE:</b> If you change the max upload size in Vikunja's settings, you'll need to also change the <code>client_max_body_size</code> in the nginx proxy config.
</div>
### without gzip
{{< highlight conf >}}
server {
listen 80;
server_name localhost;
location / {
root /path/to/vikunja/static/frontend/files;
try_files $uri $uri/ /;
index index.html index.htm;
}
location ~* ^/(api|dav|\.well-known)/ {
proxy_pass http://localhost:3456;
client_max_body_size 20M;
}
}
{{< /highlight >}}
```
<div class="notification is-warning">
<b>NOTE:</b> If you change the max upload size in Vikunja's settings, you'll need to also change the <code>client_max_body_size</code> in the nginx proxy config.
@ -82,33 +37,28 @@ server {
## NGINX Proxy Manager (NPM)
### Method 1
Following the [Docker Walkthrough]({{< ref "docker-start-to-finish.md" >}}) guide, you should be able to get Vikunja to work via HTTP connection to your server IP.
From there, all you have to do is adjust the following things:
#### In `docker-compose.yml`
Under `api:`,
1. Change `VIKUNJA_SERVICE_FRONTENDURL:` to your desired domain with `https://` and `/`.
### In `docker-compose.yml`
1. Change `VIKUNJA_SERVICE_PUBLICURL:` to your desired domain with `https://` and `/`.
2. Expose your desired port on host under `ports:`.
example:
```yaml
api:
image: vikunja/api
vikunja:
image: vikunja/vikunja
environment:
VIKUNJA_SERVICE_PUBLICURL: https://vikunja.your-domain.com/ # change vikunja.your-domain.com to your desired domain/subdomain.
VIKUNJA_DATABASE_HOST: db
VIKUNJA_DATABASE_PASSWORD: secret
VIKUNJA_DATABASE_TYPE: mysql
VIKUNJA_DATABASE_USER: vikunja
VIKUNJA_DATABASE_DATABASE: vikunja
VIKUNJA_SERVICE_JWTSECRET: <your-random-secret>
VIKUNJA_SERVICE_FRONTENDURL: https://vikunja.your-domain.com/ # change vikunja.your-domain.com to your desired domain/subdomain.
ports:
- 3456:3456 # Change 3456 on the left to the port of your choice.
volumes:
@ -118,56 +68,17 @@ example:
restart: unless-stopped
```
Under `frontend:`,
### In your DNS provider
1. Add `VIKUNJA_API_URL:` under `environment:` and input your desired `API` domain with `https://` and `/api/v1/`. The `API` domain should be different from the one in `VIKUNJA_SERVICE_FRONTENDURL:`.
Add an `A` records that points to your server IP.
example:
You are of course free to change them to whatever domain/subdomain you desire and modify the `docker-compose.yml` accordingly.
```yaml
frontend:
image: vikunja/frontend
environment:
VIKUNJA_API_URL: https://api.your-domain.com/api/v1/ # change api.your-domain.com to your desired domain/subdomain, it should be different from your frontend domain
restart: unless-stopped
```
(Tested on Cloudflare DNS. Settings are different for different DNS provider, in this case the end result should be `vikunja.your-domain.com`)
Under `proxy:`,
### In Nginx Proxy Manager
1. Since we'll be using Nginx Proxy Manager, it should by default uses the port `80` and thus you should change `ports:` to expose another port not occupied by any service.
example:
```yaml
proxy:
image: nginx
ports:
- 1078:80 # change the number infront (host port) to whatever you desire, but make sure it's not 80 which will be used by Nginx Proxy Manager
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- api
- frontend
restart: unless-stopped
```
#### In your DNS provider
Add two `A` records that points to your server IP.
1. `vikunja` for accessing the frontend
2. `api` for accessing the api
You are of course free to change them to whatever domain/subdomain you desire and modify the `docker-compose.yml` accordingly but the two should be different.
(Tested on Cloudflare DNS. Settings are different for different DNS provider, in this case the end result should bei `vikunja.your-domain.com` and `api.your-domain.com` respectively.)
#### In Nginx Proxy Manager
Add two Proxy Host as you normally would, and you don't have to add anything extra in Advanced.
##### Frontend
Add a Proxy Host as you normally would, and you don't have to add anything extra in Advanced.
Under `Details`:
@ -178,46 +89,6 @@ Scheme:
http
Forward Hostname/IP:
your-server-ip
Forward Port:
1078
Cached Assets:
Optional.
Block Common Exploits:
Toggled.
Websockets Support:
Toggled.
```
Under `SSL`:
```
SSL Certificate:
However you prefer.
Force SSL:
Toggled.
HTTP/2 Support:
Toggled.
HSTS Enabled:
Toggled.
HSTS Subdomains:
Toggled.
Use a DNS Challenge:
Not toggled.
Email Address for Let's Encrypt:
your-email@email.com
```
##### API
Under `Details`:
```
Domain Names:
api.your-domain.com
Scheme:
http
Forward Hostname/IP:
your-server-ip
Forward Port:
3456
Cached Assets:
@ -249,27 +120,11 @@ Email Address for Let's Encrypt:
Your Vikunja service should now work and your HTTPS frontend should be able to reach the API after `docker-compose`.
### Method 2
1. Create a standard Proxy Host for the Vikunja Frontend within NPM and point it to the URL you plan to use. The next several steps will enable the Proxy Host to successfully navigate to the API (on port 3456).
2. Verify that the page will pull up in your browser. (Do not bother trying to log in. It won't work. Trust me.)
3. Now, we'll work with the NPM container, so you need to identify the container name for your NPM installation. e.g. NGINX-PM
4. From the command line, enter `sudo docker exec -it [NGINX-PM container name] /bin/bash` and navigate to the proxy hosts folder where the `.conf` files are stashed. Probably `/data/nginx/proxy_host`. (This folder is a persistent folder created in the NPM container and mounted by NPM.)
5. Locate the `.conf` file where the server_name inside the file matches your Vikunja Proxy Host. Once found, add the following code, unchanged, just above the existing location block in that file. (They are listed by number, not name.)
```nginx
location ~* ^/(api|dav|\.well-known)/ {
proxy_pass http://api:3456;
client_max_body_size 20M;
}
```
6. After saving the edited file, return to NPM's UI browser window and refresh the page to verify your Proxy Host for Vikunja is still online.
7. Now, switch over to your Vikunja browser window and hit refresh. If you configured your URL correctly in original Vikunja container, you should be all set and the browser will correctly show Vikunja. If not, you'll need to adjust the address in the top of the login subscreen to match your proxy address.
## Apache
Put the following config in `cat /etc/apache2/sites-available/vikunja.conf`:
{{< highlight aconf >}}
```aconf
<VirtualHost *:80>
ServerName localhost
@ -277,40 +132,21 @@ Put the following config in `cat /etc/apache2/sites-available/vikunja.conf`:
Order Deny,Allow
Allow from all
</Proxy>
ProxyPass /api http://localhost:3456/api
ProxyPassReverse /api http://localhost:3456/api
ProxyPass /dav http://localhost:3456/dav
ProxyPassReverse /dav http://localhost:3456/dav
ProxyPass /.well-known http://localhost:3456/.well-known
ProxyPassReverse /.well-known http://localhost:3456/.well-known
DocumentRoot /var/www/html
RewriteEngine On
RewriteRule ^\/?(favicon\.ico|assets|audio|fonts|images|manifest\.webmanifest|robots\.txt|sw\.js|workbox-.*|api|dav|\.well-known) - [L]
RewriteRule ^(.*)$ /index.html [QSA,L]
ProxyPass / http://localhost:3456/
ProxyPassReverse / http://localhost:3456/
</VirtualHost>
{{< /highlight >}}
```
**Note:** The apache modules `proxy`, `proxy_http` and `rewrite` must be enabled for this.
For more details see the [frontend apache configuration]({{< ref "install-frontend.md#apache">}}).
## Caddy
{{< highlight conf >}}
Use the following Caddyfile to get Vikunja up and running:
```conf
vikunja.domainname.tld {
@paths {
path /api/* /.well-known/* /dav/*
}
handle @paths {
handle /* {
reverse_proxy 127.0.0.1:3456
}
handle {
encode zstd gzip
root * /var/www/html/vikunja
try_files {path} index.html
file_server
}
}
{{< /highlight >}}
```

View File

@ -38,9 +38,7 @@ After saving, build Vikunja as normal.
pnpm run build
```
Once you have the build files you can deploy them as usual.
Note that when deploying in docker you'll need to put the files in a web container yourself, you
can't use the `Dockerfile` in the repo without modifications.
Once you have the frontend built, you can proceed to build the binary as outlined in [building from source]({{< ref "build-from-source.md">}}#api).
## API

View File

@ -30,9 +30,9 @@ To fix this, follow the steps below.
To find out if your db supports utf-8, run the following in a shell or similar, assuming the database
you're using for vikunja is called `vikunja`:
{{< highlight sql >}}
```sql
SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = 'vikunja';
{{< /highlight >}}
```
This will get you a result like the following:
@ -57,7 +57,7 @@ Before attempting any conversion, please [back up your database]({{< ref "backup
Copy the following sql statements in a file called `preAlterTables.sql` and replace all occurrences of `vikunja` with the name of your database:
{{< highlight sql >}}
```sql
use information_schema;
SELECT concat("ALTER DATABASE `",table_schema,"` CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;") as _sql
FROM `TABLES` where table_schema like 'vikunja' and TABLE_TYPE='BASE TABLE' group by table_schema;
@ -67,31 +67,31 @@ SELECT concat("ALTER TABLE `",table_schema,"`.`",table_name, "` CHANGE `",column
FROM `COLUMNS` where table_schema like 'vikunja' and data_type in ('varchar','char');
SELECT concat("ALTER TABLE `",table_schema,"`.`",table_name, "` CHANGE `",column_name,"` `",column_name,"` ",data_type," CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci",IF(is_nullable="YES"," NULL"," NOT NULL"),";") as _sql
FROM `COLUMNS` where table_schema like 'vikunja' and data_type in ('text','tinytext','mediumtext','longtext');
{{< /highlight >}}
```
### 2. Run the pre-conversion script
Running this will create the actual migration script for your particular database structure and save it in a file called `alterTables.sql`:
{{< highlight bash >}}
```
mysql -uroot < preAlterTables.sql | egrep '^ALTER' > alterTables.sql
{{< /highlight >}}
```
### 3. Convert the database
At this point converting is just a matter of executing the previously generated sql script:
{{< highlight bash >}}
```
mysql -uroot < alterTables.sql
{{< /highlight >}}
```
### 4. Verify it was successfully converted
If everything worked as intended, your db collation should now look like this:
{{< highlight sql >}}
```sql
SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = 'vikunja';
{{< /highlight >}}
```
Should get you:

View File

@ -36,7 +36,7 @@ The demo instance at [try.vikunja.io](https://try.vikunja.io) automatically upda
First you should create a backup of your current setup!
Switching between versions is the same process as [upgrading]({{< ref install-backend.md >}}#updating).
Switching between versions is the same process as [upgrading]({{< ref install.md >}}#updating).
Simply replace the stable binary with an unstable one or vice-versa.
For installations using docker, it is as simple as using the `unstable` or `latest` tag to switch between versions.

View File

@ -41,9 +41,9 @@ Creates a zip file with all vikunja-related files.
This includes config, version, all files and the full database.
Usage:
{{< highlight bash >}}
```
$ vikunja dump
{{< /highlight >}}
```
### `help`
@ -51,37 +51,37 @@ Shows more detailed help about any command.
Usage:
{{< highlight bash >}}
```
$ vikunja help [command]
{{< /highlight >}}
```
### `migrate`
Run all database migrations which didn't already run.
Usage:
{{< highlight bash >}}
```
$ vikunja migrate [flags]
$ vikunja migrate [command]
{{< /highlight >}}
```
#### `migrate list`
Shows a list with all database migrations.
Usage:
{{< highlight bash >}}
```
$ vikunja migrate list
{{< /highlight >}}
```
#### `migrate rollback`
Roll migrations back until a certain point.
Usage:
{{< highlight bash >}}
```
$ vikunja migrate rollback [flags]
{{< /highlight >}}
```
Flags:
* `-n`, `--name` string: The id of the migration you want to roll back until.
@ -91,18 +91,18 @@ Flags:
Restores a previously created dump from a zip file, see `dump`.
Usage:
{{< highlight bash >}}
```
$ vikunja restore <path to dump zip file>
{{< /highlight >}}
```
### `testmail`
Sends a test mail using the configured smtp connection.
Usage:
{{< highlight bash >}}
```
$ vikunja testmail <email to send the test mail to>
{{< /highlight >}}
```
### `user`
@ -113,9 +113,9 @@ Bundles a few commands to manage users.
Enable or disable a user. Will toggle the current status if no flag (`--enable` or `--disable`) is provided.
Usage:
{{< highlight bash >}}
```
$ vikunja user change-status <user id> <flags>
{{< /highlight >}}
```
Flags:
* `-d`, `--disable`: Disable the user.
@ -126,9 +126,9 @@ Flags:
Create a new user.
Usage:
{{< highlight bash >}}
```
$ vikunja user create <flags>
{{< /highlight >}}
```
Flags:
* `-a`, `--avatar-provider`: The avatar provider of the new user. Optional.
@ -144,9 +144,9 @@ With the flag the user is deleted **immediately**.
**USE WITH CAUTION.**
{{< highlight bash >}}
```
$ vikunja user delete <id> <flags>
{{< /highlight >}}
```
Flags:
* `-n`, `--now` If provided, deletes the user immediately instead of emailing them first.
@ -156,18 +156,18 @@ Flags:
Shows a list of all users.
Usage:
{{< highlight bash >}}
```
$ vikunja user list
{{< /highlight >}}
```
#### `user reset-password`
Reset a users password, either through mailing them a reset link or directly.
Usage:
{{< highlight bash >}}
```
$ vikunja user reset-password <flags>
{{< /highlight >}}
```
Flags:
* `-d`, `--direct`: If provided, reset the password directly instead of sending the user a reset mail.
@ -178,9 +178,9 @@ Flags:
Update an existing user.
Usage:
{{< highlight bash >}}
```
$ vikunja user update <user id>
{{< /highlight >}}
```
Flags:
* `-a`, `--avatar-provider`: The new avatar provider of the new user.
@ -193,15 +193,15 @@ Prints the version of Vikunja.
This is either the semantic version (something like `0.7`) or version + git commit hash.
Usage:
{{< highlight bash >}}
```
$ vikunja version
{{< /highlight >}}
```
### `web`
Starts Vikunja's REST api server.
Usage:
{{< highlight bash >}}
```
$ vikunja web
{{< /highlight >}}
```

View File

@ -70,30 +70,31 @@ This document describes the different errors Vikunja can return.
## Task
| ErrorCode | HTTP Status Code | Description |
|-----------|------------------|-------------|
| 4001 | 400 | The project task text cannot be empty. |
| 4002 | 404 | The project task does not exist. |
| 4003 | 403 | All bulk editing tasks must belong to the same project. |
| 4004 | 403 | Need at least one task when bulk editing tasks. |
| 4005 | 403 | The user does not have the right to see the task. |
| 4006 | 403 | The user tried to set a parent task as the task itself. |
| ErrorCode | HTTP Status Code | Description |
|-----------|------------------|----------------------------------------------------------------------------|
| 4001 | 400 | The project task text cannot be empty. |
| 4002 | 404 | The project task does not exist. |
| 4003 | 403 | All bulk editing tasks must belong to the same project. |
| 4004 | 403 | Need at least one task when bulk editing tasks. |
| 4005 | 403 | The user does not have the right to see the task. |
| 4006 | 403 | The user tried to set a parent task as the task itself. |
| 4007 | 400 | The user tried to create a task relation with an invalid kind of relation. |
| 4008 | 409 | The user tried to create a task relation which already exists. |
| 4009 | 404 | The task relation does not exist. |
| 4010 | 400 | Cannot relate a task with itself. |
| 4011 | 404 | The task attachment does not exist. |
| 4012 | 400 | The task attachment is too large. |
| 4013 | 400 | The task sort param is invalid. |
| 4014 | 400 | The task sort order is invalid. |
| 4015 | 404 | The task comment does not exist. |
| 4016 | 400 | Invalid task field. |
| 4017 | 400 | Invalid task filter comparator. |
| 4018 | 400 | Invalid task filter concatinator. |
| 4019 | 400 | Invalid task filter value. |
| 4020 | 400 | The provided attachment does not belong to that task. |
| 4021 | 400 | This user is already assigned to that task. |
| 4022 | 400 | The task has a relative reminder which does not specify relative to what. |
| 4008 | 409 | The user tried to create a task relation which already exists. |
| 4009 | 404 | The task relation does not exist. |
| 4010 | 400 | Cannot relate a task with itself. |
| 4011 | 404 | The task attachment does not exist. |
| 4012 | 400 | The task attachment is too large. |
| 4013 | 400 | The task sort param is invalid. |
| 4014 | 400 | The task sort order is invalid. |
| 4015 | 404 | The task comment does not exist. |
| 4016 | 400 | Invalid task field. |
| 4017 | 400 | Invalid task filter comparator. |
| 4018 | 400 | Invalid task filter concatinator. |
| 4019 | 400 | Invalid task filter value. |
| 4020 | 400 | The provided attachment does not belong to that task. |
| 4021 | 400 | This user is already assigned to that task. |
| 4022 | 400 | The task has a relative reminder which does not specify relative to what. |
| 4023 | 409 | Tried to create a task relation which would create a cycle. |
## Team

View File

@ -22,4 +22,12 @@ server {
location /docs/docs {
return 301 $scheme://vikunja.io/docs;
}
location /docs/install-backend {
return 301 $scheme://vikunja.io/docs/installing;
}
location /docs/install-frontend {
return 301 $scheme://vikunja.io/docs/installing;
}
}

View File

@ -1,5 +1,8 @@
# Changelog
THIS CHANGELOG ONLY EXISTS FOR HISTORICAL REASONS.
Starting with version 0.23.0, all changes are logged in the CHANGELOG.md in the root of this repository since the repos were merged.
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres

View File

@ -1,73 +0,0 @@
# syntax=docker/dockerfile:1
# ┬─┐┬ ┐o┬ ┬─┐
# │─││ │││ │ │
# ┘─┘┘─┘┘┘─┘┘─┘
FROM --platform=$BUILDPLATFORM node:20.11.0-alpine AS builder
WORKDIR /build
ARG USE_RELEASE=false
ARG RELEASE_VERSION=unstable
ENV PNPM_CACHE_FOLDER .cache/pnpm/
ENV PUPPETEER_SKIP_DOWNLOAD true
COPY package.json ./
COPY pnpm-lock.yaml ./
COPY patches ./patches/
RUN if [ "$USE_RELEASE" != true ]; then \
# https://pnpm.io/installation#using-corepack
corepack enable && \
pnpm install; \
fi
COPY . ./
RUN if [ "$USE_RELEASE" != true ]; then \
apk add --no-cache --virtual .build-deps git jq && \
git describe --tags --always --abbrev=10 | sed 's/-/+/; s/^v//; s/-g/-/' | \
xargs -0 -I{} jq -Mcnr --arg version {} '{VERSION:$version}' | \
tee src/version.json && \
apk del .build-deps; \
fi
RUN if [ "$USE_RELEASE" = true ]; then \
wget "https://dl.vikunja.io/frontend/vikunja-frontend-${RELEASE_VERSION}.zip" -O frontend-release.zip && \
unzip frontend-release.zip -d dist/; \
else \
# we don't use corepack prepare here by intend since
# we have renovate to keep our dependencies up to date
# Build the frontend
pnpm run build; \
fi
# ┌┐┐┌─┐o┌┐┐┐ │
# ││││ ┬││││┌┼┘
# ┘└┘┘─┘┘┘└┘┘ └
FROM nginx:stable-alpine AS runner
WORKDIR /usr/share/nginx/html
LABEL maintainer="maintainers@vikunja.io"
ENV VIKUNJA_HTTP_PORT 80
ENV VIKUNJA_HTTP2_PORT 81
ENV VIKUNJA_LOG_FORMAT main
ENV VIKUNJA_API_URL /api/v1
ENV VIKUNJA_SENTRY_ENABLED false
ENV VIKUNJA_SENTRY_DSN https://85694a2d757547cbbc90cd4b55c5a18d@o1047380.ingest.sentry.io/6024480
ENV VIKUNJA_PROJECT_INFINITE_NESTING_ENABLED false
ENV VIKUNJA_ALLOW_ICON_CHANGES true
ENV VIKUNJA_CUSTOM_LOGO_URL "''"
COPY docker/injector.sh /docker-entrypoint.d/50-injector.sh
COPY docker/ipv6-disable.sh /docker-entrypoint.d/60-ipv6-disable.sh
COPY docker/nginx.conf /etc/nginx/nginx.conf
COPY docker/templates/. /etc/nginx/templates/
# copy compiled files from stage 1
COPY --from=builder /build/dist ./
# manage permissions
RUN chmod 0755 /docker-entrypoint.d/*.sh /etc/nginx/templates && \
chmod -R 0644 /etc/nginx/nginx.conf && \
chown -R nginx:nginx ./ /etc/nginx/conf.d /etc/nginx/templates && \
rm -f /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh

View File

@ -1,18 +0,0 @@
#!/usr/bin/env sh
set -e
echo "info: API URL is $VIKUNJA_API_URL"
echo "info: Sentry enabled: $VIKUNJA_SENTRY_ENABLED"
# Escape the variable to prevent sed from complaining
VIKUNJA_API_URL="$(echo "$VIKUNJA_API_URL" | sed -r 's/([:;])/\\\1/g')"
VIKUNJA_SENTRY_DSN="$(echo "$VIKUNJA_SENTRY_DSN" | sed -r 's/([:;])/\\\1/g')"
sed -ri "s:^(\s*window.API_URL\s*=)\s*.+:\1 '${VIKUNJA_API_URL}':g" /usr/share/nginx/html/index.html
sed -ri "s:^(\s*window.SENTRY_ENABLED\s*=)\s*.+:\1 ${VIKUNJA_SENTRY_ENABLED}:g" /usr/share/nginx/html/index.html
sed -ri "s:^(\s*window.SENTRY_DSN\s*=)\s*.+:\1 '${VIKUNJA_SENTRY_DSN}':g" /usr/share/nginx/html/index.html
sed -ri "s:^(\s*window.PROJECT_INFINITE_NESTING_ENABLED\s*=)\s*.+:\1 '${VIKUNJA_PROJECT_INFINITE_NESTING_ENABLED}':g" /usr/share/nginx/html/index.html
sed -ri "s:^(\s*window.ALLOW_ICON_CHANGES\s*=)\s*.+:\1 ${VIKUNJA_ALLOW_ICON_CHANGES}:g" /usr/share/nginx/html/index.html
sed -ri "s:^(\s*window.CUSTOM_LOGO_URL\s*=)\s*.+:\1 ${VIKUNJA_CUSTOM_LOGO_URL}:g" /usr/share/nginx/html/index.html
date -uIseconds | xargs echo 'info: started at'

View File

@ -1,19 +0,0 @@
#!/usr/bin/env sh
set -e
if [ ! -f "/proc/net/if_inet6" ]; then
echo "info: IPv6 is not available! Removing IPv6 listen configuration"
find /etc/nginx/conf.d -name '*.conf' -type f | \
while IFS= read -r CONFIG; do
sed -r '/^\s*listen\s*\[::\]:.+$/d' "$CONFIG" > "$CONFIG.temp"
if ! diff -U 5 "$CONFIG" "$CONFIG.temp" > "$CONFIG.diff"; then
echo "info: Removing IPv6 lines from $CONFIG" | \
cat - "$CONFIG.diff"
echo "# IPv6 is disabled because /proc/net/if_inet6 was not found" | \
cat - "$CONFIG.temp" > "$CONFIG"
else
echo "info: Skipping $CONFIG because it does not have IPv6 listen"
fi
rm -f "$CONFIG.temp" "$CONFIG.diff"
done
fi

View File

@ -1,111 +0,0 @@
# Generated by nginxconfig.io
# https://www.digitalocean.com/community/tools/nginx?domains.0.server.domain=localhost&domains.0.server.documentRoot=%2Fusr%2Fshare%2Fnginx%2Fhtml&domains.0.server.cdnSubdomain=true&domains.0.https.https=false&domains.0.php.php=false&domains.0.routing.index=index.html&domains.0.routing.fallbackHtml=true&domains.0.routing.fallbackPhp=false&global.performance.assetsExpiration=1d&global.performance.mediaExpiration=1d&global.performance.svgExpiration=1d&global.performance.fontsExpiration=1d&global.logging.accessLog=%2Fdev%2Fstdout&global.logging.errorLog=%2Fdev%2Fstderr%20warn&global.logging.logNotFound=true&global.nginx.user=nginx&global.nginx.pid=%2Fvar%2Frun%2Fnginx.pid&global.nginx.clientMaxBodySize=50&global.docker.dockerfile=true&global.tools.modularizedStructure=false&global.tools.symlinkVhost=false
# and then edited manually ;)
pid /tmp/nginx.pid;
worker_processes auto;
events {
multi_accept on;
worker_connections 1024;
}
http {
charset utf-8;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
types_hash_max_size 2048;
types_hash_bucket_size 64;
# rootless
client_body_temp_path /tmp/client_temp;
proxy_temp_path /tmp/proxy_temp_path;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;
# MIME
include mime.types;
default_type application/octet-stream;
types {
application/manifest+json webmanifest;
}
# Logging
log_format json escape=json
'{'
'"bytes_sent": "$bytes_sent",'
'"http_user_agent": "$http_user_agent",'
'"nginx_version": "$nginx_version",'
'"query_string": "$query_string",'
'"realip_remote_addr": "$realip_remote_addr",'
'"remote_addr": "$remote_addr",'
'"remote_user": "$remote_user",'
'"request_length": "$request_length",'
'"request_method": "$request_method",'
'"request_time": "$request_time",'
'"server_addr": "$server_addr",'
'"server_port": "$server_port",'
'"server_protocol": "$server_protocol",'
'"status": "$status",'
'"time_local": "$time_local",'
'"uri": "$uri"'
'}';
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /dev/stdout main;
error_log /dev/stderr warn;
keepalive_timeout 65;
# compression
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types
text/plain
text/css
application/json
application/x-javascript
application/javascript
text/xml
application/xml
application/xml+rss
text/javascript
application/vnd.ms-fontobject
application/x-font-ttf
font/opentype
image/svg+xml
image/x-icon
audio/wav;
map_hash_max_size 128;
map_hash_bucket_size 128;
map $sent_http_content_type $expires {
default off;
text/css max;
application/javascript max;
text/javascript max;
application/vnd.ms-fontobject max;
application/x-font-ttf max;
font/opentype max;
font/woff2 max;
image/svg+xml max;
image/x-icon max;
audio/wav max;
~images/ max;
~font/ max;
}
include /etc/nginx/conf.d/*.conf;
}

View File

@ -1,85 +0,0 @@
server {
listen ${VIKUNJA_HTTP_PORT};
listen [::]:${VIKUNJA_HTTP_PORT};
## Needed when behind HAProxy with SSL termination + HTTP/2 support
listen ${VIKUNJA_HTTP2_PORT} default_server http2 proxy_protocol;
listen [::]:${VIKUNJA_HTTP2_PORT} default_server http2 proxy_protocol;
server_name _;
expires $expires;
root /usr/share/nginx/html;
access_log /dev/stdout ${VIKUNJA_LOG_FORMAT};
# security headers
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Content-Security-Policy "default-src 'self' http: https: ws: wss: data: blob: 'unsafe-inline'; frame-ancestors 'self';" always;
add_header Permissions-Policy "interest-cohort=()" always;
# . files
location ~ /\.(?!well-known) {
deny all;
}
# assume that everything else is handled by the application router, by injecting the index.html.
location / {
autoindex off;
expires off;
add_header Cache-Control "public, max-age=0, s-maxage=0, must-revalidate" always;
try_files $uri /index.html =404;
}
# Disable caching for sw
location = /sw.js {
autoindex off;
expires off;
add_header Cache-Control "public, max-age=0, s-maxage=0, must-revalidate" always;
}
# Disable caching for webmanifest
location = /manifest.webmanifest {
autoindex off;
expires off;
add_header Cache-Control "public, max-age=0, s-maxage=0, must-revalidate" always;
}
# favicon.ico
location = /favicon.ico {
log_not_found off;
access_log off;
}
# robots.txt
location = /robots.txt {
log_not_found off;
access_log off;
expires -1; # no-cache
}
location = /ready {
return 200 "";
access_log off;
expires -1; # no-cache
}
# all assets contain hash in filename, cache forever
location ^~ /assets/ {
add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable";
try_files $uri =404;
}
# all workbox scripts are compiled with hash in filename, cache forever3
location ^~ /workbox- {
add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable";
try_files $uri =404;
}
# assets, media
location ~* .(txt|webmanifest|css|js|mjs|map|svg|jpg|jpeg|png|ico|ttf|woff|woff2|wav)$ {
try_files $uri $uri/ =404;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html { }
}

22
frontend/embed.go Normal file
View File

@ -0,0 +1,22 @@
// Vikunja is a to-do list application to facilitate your life.
// Copyright 2018-present Vikunja and contributors. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public Licensee as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public Licensee for more details.
//
// You should have received a copy of the GNU Affero General Public Licensee
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package frontend
import "embed"
//go:embed dist
var Files embed.FS

View File

@ -23,17 +23,6 @@
// It has to be the full url, including the last /api/v1 part and port.
// You can change this if your api is not reachable on the same port as the frontend.
window.API_URL = 'http://localhost:3456/api/v1'
// Enable error tracking with sentry. If this is set to true, will send anonymized data to
// our sentry instance to notify us of potential problems.
window.SENTRY_ENABLED = false
window.SENTRY_DSN = 'https://85694a2d757547cbbc90cd4b55c5a18d@o1047380.ingest.sentry.io/6024480'
// If enabled, allows the user to nest projects infinitely, instead of the default 2 levels.
// This setting might change in the future or be removed completely.
window.PROJECT_INFINITE_NESTING_ENABLED = false
// Allow changing the logo and other icons based on various occasions throughout the year.
window.ALLOW_ICON_CHANGES = true
// Allow using a custom logo via external URL.
window.CUSTOM_LOGO_URL = ''
</script>
</body>
</html>

View File

@ -24,7 +24,8 @@
],
"type": "module",
"scripts": {
"serve": "vite",
"dev": "vite",
"serve": "pnpm run dev",
"preview": "vite preview --port 4173",
"preview:dev": "vite preview --outDir dist-dev --mode development --port 4173",
"build": "vite build && workbox copyLibraries dist/",
@ -57,39 +58,39 @@
"@kyvg/vue3-notification": "3.1.4",
"@sentry/tracing": "7.100.1",
"@sentry/vue": "7.100.1",
"@tiptap/core": "2.2.1",
"@tiptap/extension-blockquote": "2.2.1",
"@tiptap/extension-bold": "2.2.1",
"@tiptap/extension-bullet-list": "2.2.1",
"@tiptap/extension-code": "2.2.1",
"@tiptap/extension-code-block-lowlight": "2.2.1",
"@tiptap/extension-document": "2.2.1",
"@tiptap/extension-dropcursor": "2.2.1",
"@tiptap/extension-gapcursor": "2.2.1",
"@tiptap/extension-hard-break": "2.2.1",
"@tiptap/extension-heading": "2.2.1",
"@tiptap/extension-history": "2.2.1",
"@tiptap/extension-horizontal-rule": "2.2.1",
"@tiptap/extension-image": "2.2.1",
"@tiptap/extension-italic": "2.2.1",
"@tiptap/extension-link": "2.2.1",
"@tiptap/extension-list-item": "2.2.1",
"@tiptap/extension-ordered-list": "2.2.1",
"@tiptap/extension-paragraph": "2.2.1",
"@tiptap/extension-placeholder": "2.2.1",
"@tiptap/extension-strike": "2.2.1",
"@tiptap/extension-table": "2.2.1",
"@tiptap/extension-table-cell": "2.2.1",
"@tiptap/extension-table-header": "2.2.1",
"@tiptap/extension-table-row": "2.2.1",
"@tiptap/extension-task-item": "2.2.1",
"@tiptap/extension-task-list": "2.2.1",
"@tiptap/extension-text": "2.2.1",
"@tiptap/extension-typography": "2.2.1",
"@tiptap/extension-underline": "2.2.1",
"@tiptap/pm": "2.2.1",
"@tiptap/suggestion": "2.2.1",
"@tiptap/vue-3": "2.2.1",
"@tiptap/core": "2.2.2",
"@tiptap/extension-blockquote": "2.2.2",
"@tiptap/extension-bold": "2.2.2",
"@tiptap/extension-bullet-list": "2.2.2",
"@tiptap/extension-code": "2.2.2",
"@tiptap/extension-code-block-lowlight": "2.2.2",
"@tiptap/extension-document": "2.2.2",
"@tiptap/extension-dropcursor": "2.2.2",
"@tiptap/extension-gapcursor": "2.2.2",
"@tiptap/extension-hard-break": "2.2.2",
"@tiptap/extension-heading": "2.2.2",
"@tiptap/extension-history": "2.2.2",
"@tiptap/extension-horizontal-rule": "2.2.2",
"@tiptap/extension-image": "2.2.2",
"@tiptap/extension-italic": "2.2.2",
"@tiptap/extension-link": "2.2.2",
"@tiptap/extension-list-item": "2.2.2",
"@tiptap/extension-ordered-list": "2.2.2",
"@tiptap/extension-paragraph": "2.2.2",
"@tiptap/extension-placeholder": "2.2.2",
"@tiptap/extension-strike": "2.2.2",
"@tiptap/extension-table": "2.2.2",
"@tiptap/extension-table-cell": "2.2.2",
"@tiptap/extension-table-header": "2.2.2",
"@tiptap/extension-table-row": "2.2.2",
"@tiptap/extension-task-item": "2.2.2",
"@tiptap/extension-task-list": "2.2.2",
"@tiptap/extension-text": "2.2.2",
"@tiptap/extension-typography": "2.2.2",
"@tiptap/extension-underline": "2.2.2",
"@tiptap/pm": "2.2.2",
"@tiptap/suggestion": "2.2.2",
"@tiptap/vue-3": "2.2.2",
"@types/is-touch-device": "1.0.2",
"@types/lodash.clonedeep": "4.5.9",
"@vueuse/core": "10.7.2",
@ -115,7 +116,7 @@
"sortablejs": "1.15.2",
"tippy.js": "6.3.7",
"ufo": "1.4.0",
"vue": "3.4.15",
"vue": "3.4.18",
"vue-advanced-cropper": "2.8.8",
"vue-flatpickr-component": "11.0.3",
"vue-i18n": "9.9.1",

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
4a7c1293c7b12e9ab476cdf35251a407c6a1cd005d22c06df994222cccfb25cde5f47d15866a098c9d739778fee4dc19 ./scripts/deploy-preview-netlify.mjs
d58cd9ebc135407aa29d093b046d84b72ec7073b3f08cedfdbb936318a0ad3e272fab921d3ff91a82c1a7059fcdecd7b ./scripts/deploy-preview-netlify.mjs

View File

@ -74,7 +74,7 @@
</ProjectSettingsDropdown>
</div>
<ProjectsNavigation
v-if="canNestDeeper && childProjectsOpen && canCollapse"
v-if="childProjectsOpen && canCollapse"
:model-value="childProjects"
:can-edit-order="true"
:can-collapse="canCollapse"
@ -95,7 +95,6 @@ import ProjectSettingsDropdown from '@/components/project/project-settings-dropd
import {getProjectTitle} from '@/helpers/getProjectTitle'
import ColorBubble from '@/components/misc/colorBubble.vue'
import ProjectsNavigation from '@/components/home/ProjectsNavigation.vue'
import {canNestProjectDeeper} from '@/helpers/canNestProjectDeeper'
const {
project,
@ -116,16 +115,10 @@ const currentProject = computed(() => baseStore.currentProject)
const childProjectsOpen = ref(true)
const childProjects = computed(() => {
if (!canNestDeeper.value) {
return []
}
return projectStore.getChildProjects(project.id)
.filter(p => !p.isArchived)
.sort((a, b) => a.position - b.position)
})
const canNestDeeper = computed(() => canNestProjectDeeper(level))
</script>
<style lang="scss" scoped>

View File

@ -13,8 +13,6 @@
</template>
<script setup lang="ts">
import {defineProps} from 'vue'
defineProps({
value: {
type: Number,

View File

@ -1,7 +0,0 @@
export function canNestProjectDeeper(level: number) {
if (level < 2) {
return true
}
return level >= 2 && window.PROJECT_INFINITE_NESTING_ENABLED
}

View File

@ -1093,8 +1093,7 @@
},
"about": {
"title": "About",
"frontendVersion": "Frontend Version: {version}",
"apiVersion": "API Version: {version}"
"version": "Version: {version}"
},
"time": {
"units": {

View File

@ -5,7 +5,6 @@ import pinia from './pinia'
import router from './router'
import App from './App.vue'
import {error, success} from './message'
import {VERSION} from './version.json'
// Notifications
import Notifications from '@kyvg/vue3-notification'
@ -19,16 +18,13 @@ import {getBrowserLanguage, i18n, setLanguage} from './i18n'
declare global {
interface Window {
API_URL: string;
SENTRY_ENABLED: boolean;
SENTRY_DSN: string;
PROJECT_INFINITE_NESTING_ENABLED: boolean;
SENTRY_ENABLED?: boolean;
SENTRY_DSN?: string;
ALLOW_ICON_CHANGES: boolean;
CUSTOM_LOGO_URL?: string;
}
}
console.info(`Vikunja frontend version ${VERSION}`)
// Check if we have an api url in local storage and use it if that's the case
const apiUrlFromStorage = localStorage.getItem('API_URL')
if (apiUrlFromStorage !== null) {

View File

@ -8,7 +8,7 @@ export default async function setupSentry(app: App, router: Router) {
Sentry.init({
app,
dsn: window.SENTRY_DSN,
dsn: window.SENTRY_DSN ?? '',
release: import.meta.env.VITE_PLUGIN_SENTRY_CONFIG.release,
dist: import.meta.env.VITE_PLUGIN_SENTRY_CONFIG.dist,
integrations: [

View File

@ -13,10 +13,7 @@
>
<div class="p-4">
<p>
{{ $t('about.frontendVersion', {version: frontendVersion}) }}
</p>
<p>
{{ $t('about.apiVersion', {version: apiVersion}) }}
{{ $t('about.version', {version: apiVersion}) }}
</p>
</div>
<template #footer>
@ -34,10 +31,8 @@
<script setup lang="ts">
import {computed} from 'vue'
import {VERSION} from '@/version.json'
import {useConfigStore} from '@/stores/config'
const configStore = useConfigStore()
const apiVersion = computed(() => configStore.version)
const frontendVersion = VERSION
</script>

View File

@ -19,8 +19,6 @@ import postcssEasingGradients from 'postcss-easing-gradients'
const pathSrc = fileURLToPath(new URL('./src', import.meta.url))
import {VERSION} from './src/version.json'
// the @use rules have to be the first in the compiled stylesheets
const PREFIXED_SCSS_STYLES = `@use "sass:math";
@import "${pathSrc}/styles/common-imports";`
@ -46,7 +44,6 @@ function getSentryConfig(env: ImportMetaEnv): ViteSentryPluginOptions {
authToken: env.SENTRY_AUTH_TOKEN,
org: env.SENTRY_ORG,
project: env.SENTRY_PROJECT,
release: VERSION,
cleanSourcemapsAfterUpload: true,
legacyErrorHandlingMode: true,
deploy: {

15
go.mod
View File

@ -31,7 +31,7 @@ require (
github.com/disintegration/imaging v1.6.2
github.com/dustinkirkland/golang-petname v0.0.0-20231002161417-6a283f1aaaf2
github.com/gabriel-vasile/mimetype v1.4.3
github.com/getsentry/sentry-go v0.26.0
github.com/getsentry/sentry-go v0.27.0
github.com/go-sql-driver/mysql v1.7.1
github.com/go-testfixtures/testfixtures/v3 v3.9.0
github.com/gocarina/gocsv v0.0.0-20231116093920-b87c2d0e983a
@ -39,6 +39,7 @@ require (
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
github.com/google/uuid v1.6.0
github.com/hashicorp/go-version v1.6.0
github.com/hhsnopek/etag v0.0.0-20171206181245-aea95f647346
github.com/iancoleman/strcase v0.3.0
github.com/jinzhu/copier v0.4.0
github.com/jszwedko/go-datemath v0.1.1-0.20230526204004-640a500621d6
@ -65,12 +66,12 @@ require (
github.com/ulule/limiter/v3 v3.11.2
github.com/wneessen/go-mail v0.4.0
github.com/yuin/goldmark v1.7.0
golang.org/x/crypto v0.18.0
golang.org/x/crypto v0.19.0
golang.org/x/image v0.15.0
golang.org/x/oauth2 v0.16.0
golang.org/x/oauth2 v0.17.0
golang.org/x/sync v0.6.0
golang.org/x/sys v0.16.0
golang.org/x/term v0.16.0
golang.org/x/sys v0.17.0
golang.org/x/term v0.17.0
golang.org/x/text v0.14.0
gopkg.in/d4l3k/messagediff.v1 v1.2.1
gopkg.in/yaml.v3 v3.0.1
@ -78,7 +79,7 @@ require (
src.techknowlogick.com/xgo v1.7.1-0.20240206231429-45b9ea635e03
src.techknowlogick.com/xormigrate v1.7.1
xorm.io/builder v0.3.13
xorm.io/xorm v1.3.7
xorm.io/xorm v1.3.8
)
require (
@ -173,7 +174,7 @@ require (
golang.org/x/arch v0.4.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.13.0 // indirect
google.golang.org/appengine v1.6.8 // indirect

16
go.sum
View File

@ -113,6 +113,8 @@ github.com/getsentry/sentry-go v0.25.0 h1:q6Eo+hS+yoJlTO3uu/azhQadsD8V+jQn2D8VvX
github.com/getsentry/sentry-go v0.25.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY=
github.com/getsentry/sentry-go v0.26.0 h1:IX3++sF6/4B5JcevhdZfdKIHfyvMmAq/UnqcyT2H6mA=
github.com/getsentry/sentry-go v0.26.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY=
github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps=
github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
@ -219,6 +221,8 @@ github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mO
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hhsnopek/etag v0.0.0-20171206181245-aea95f647346 h1:Odeq5rB6OZSkib5gqTG+EM1iF0bUVjYYd33XB1ULv00=
github.com/hhsnopek/etag v0.0.0-20171206181245-aea95f647346/go.mod h1:4ggHM2qnyyZjenBb7RpwVzIj+JMsu9kHCVxMjB30hGs=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
@ -597,6 +601,8 @@ golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
@ -635,10 +641,14 @@ golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ=
golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM=
golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ=
golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o=
golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ=
golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@ -682,6 +692,8 @@ golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
@ -690,6 +702,8 @@ golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE=
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
@ -833,3 +847,5 @@ xorm.io/xorm v1.3.6 h1:hfpWHkDIWWqUi8FRF2H2M9O8lO3Ov47rwFcS9gPzPkU=
xorm.io/xorm v1.3.6/go.mod h1:qFJGFoVYbbIdnz2vaL5OxSQ2raleMpyRRalnq3n9OJo=
xorm.io/xorm v1.3.7 h1:mLceAGu0b87r9pD4qXyxGHxifOXIIrAdVcA6k95/osw=
xorm.io/xorm v1.3.7/go.mod h1:LsCCffeeYp63ssk0pKumP6l96WZcHix7ChpurcLNuMw=
xorm.io/xorm v1.3.8 h1:CJmplmWqfSRpLWSPMmqz+so8toBp3m7ehuRehIWedZo=
xorm.io/xorm v1.3.8/go.mod h1:LsCCffeeYp63ssk0pKumP6l96WZcHix7ChpurcLNuMw=

View File

@ -64,6 +64,7 @@ var (
"build": Build.Build,
"do-the-swag": DoTheSwag,
"check:got-swag": Check.GotSwag,
"release": Release.Release,
"release:os-package": Release.OsPackage,
"dev:make-migration": Dev.MakeMigration,
"dev:make-event": Dev.MakeEvent,

View File

@ -47,7 +47,7 @@ var testmailCmd = &cobra.Command{
Subject("Test from Vikunja").
Line("This is a test mail!").
Line("If you received this, Vikunja is correctly set up to send emails.").
Action("Go to your instance", config.ServiceFrontendurl.GetString())
Action("Go to your instance", config.ServicePublicURL.GetString())
opts, err := notifications.RenderMail(message)
if err != nil {

View File

@ -44,10 +44,9 @@ const (
ServiceInterface Key = `service.interface`
ServiceUnixSocket Key = `service.unixsocket`
ServiceUnixSocketMode Key = `service.unixsocketmode`
ServiceFrontendurl Key = `service.frontendurl`
ServicePublicURL Key = `service.publicurl`
ServiceEnableCaldav Key = `service.enablecaldav`
ServiceRootpath Key = `service.rootpath`
ServiceStaticpath Key = `service.staticpath`
ServiceMaxItemsPerPage Key = `service.maxitemsperpage`
ServiceDemoMode Key = `service.demomode`
// Deprecated: Use metrics.enabled
@ -59,11 +58,17 @@ const (
ServiceTimeZone Key = `service.timezone`
ServiceEnableTaskComments Key = `service.enabletaskcomments`
ServiceEnableTotp Key = `service.enabletotp`
ServiceSentryDsn Key = `service.sentrydsn`
ServiceTestingtoken Key = `service.testingtoken`
ServiceEnableEmailReminders Key = `service.enableemailreminders`
ServiceEnableUserDeletion Key = `service.enableuserdeletion`
ServiceMaxAvatarSize Key = `service.maxavatarsize`
ServiceAllowIconChanges Key = `service.allowiconchanges`
ServiceCustomLogoURL Key = `service.customlogourl`
SentryEnabled Key = `sentry.enabled`
SentryDsn Key = `sentry.dsn`
SentryFrontendEnabled Key = `sentry.frontendenabled`
SentryFrontendDsn Key = `sentry.frontenddsn`
AuthLocalEnabled Key = `auth.local.enabled`
AuthOpenIDEnabled Key = `auth.openid.enabled`
@ -289,11 +294,10 @@ func InitDefaultConfig() {
ServiceJWTTTLLong.setDefault(2592000) // 30 days
ServiceInterface.setDefault(":3456")
ServiceUnixSocket.setDefault("")
ServiceFrontendurl.setDefault("")
ServicePublicURL.setDefault("")
ServiceEnableCaldav.setDefault(true)
ServiceRootpath.setDefault(getBinaryDirLocation())
ServiceStaticpath.setDefault("")
ServiceMaxItemsPerPage.setDefault(50)
ServiceEnableMetrics.setDefault(false)
ServiceMotd.setDefault("")
@ -307,6 +311,11 @@ func InitDefaultConfig() {
ServiceEnableUserDeletion.setDefault(true)
ServiceMaxAvatarSize.setDefault(1024)
ServiceDemoMode.setDefault(false)
ServiceAllowIconChanges.setDefault(true)
// Sentry
SentryDsn.setDefault("https://440eedc957d545a795c17bbaf477497c@o1047380.ingest.sentry.io/4504254983634944")
SentryFrontendDsn.setDefault("https://85694a2d757547cbbc90cd4b55c5a18d@o1047380.ingest.sentry.io/6024480")
// Auth
AuthLocalEnabled.setDefault(true)
@ -372,7 +381,7 @@ func InitDefaultConfig() {
FilesBasePath.setDefault("files")
FilesMaxSize.setDefault("20MB")
// Cors
CorsEnable.setDefault(true)
CorsEnable.setDefault(false)
CorsOrigins.setDefault([]string{"*"})
CorsMaxAge.setDefault(0)
// Migration
@ -446,20 +455,20 @@ func InitConfig() {
RateLimitStore.Set(KeyvalueType.GetString())
}
if ServiceFrontendurl.GetString() != "" && !strings.HasSuffix(ServiceFrontendurl.GetString(), "/") {
ServiceFrontendurl.Set(ServiceFrontendurl.GetString() + "/")
if ServicePublicURL.GetString() != "" && !strings.HasSuffix(ServicePublicURL.GetString(), "/") {
ServicePublicURL.Set(ServicePublicURL.GetString() + "/")
}
if MigrationTodoistRedirectURL.GetString() == "" {
MigrationTodoistRedirectURL.Set(ServiceFrontendurl.GetString() + "migrate/todoist")
MigrationTodoistRedirectURL.Set(ServicePublicURL.GetString() + "migrate/todoist")
}
if MigrationTrelloRedirectURL.GetString() == "" {
MigrationTrelloRedirectURL.Set(ServiceFrontendurl.GetString() + "migrate/trello")
MigrationTrelloRedirectURL.Set(ServicePublicURL.GetString() + "migrate/trello")
}
if MigrationMicrosoftTodoRedirectURL.GetString() == "" {
MigrationMicrosoftTodoRedirectURL.Set(ServiceFrontendurl.GetString() + "migrate/microsoft-todo")
MigrationMicrosoftTodoRedirectURL.Set(ServicePublicURL.GetString() + "migrate/microsoft-todo")
}
if DefaultSettingsTimezone.GetString() == "" {

View File

@ -1003,6 +1003,35 @@ func (err ErrReminderRelativeToMissing) HTTPError() web.HTTPError {
}
}
// ErrTaskRelationCycle represents an error where the user tries to create an already existing relation
type ErrTaskRelationCycle struct {
Kind RelationKind
TaskID int64
OtherTaskID int64
}
// IsErrTaskRelationCycle checks if an error is ErrTaskRelationCycle.
func IsErrTaskRelationCycle(err error) bool {
_, ok := err.(ErrTaskRelationCycle)
return ok
}
func (err ErrTaskRelationCycle) Error() string {
return fmt.Sprintf("Task relation cycle detectetd [TaskID: %v, OtherTaskID: %v, Kind: %v]", err.TaskID, err.OtherTaskID, err.Kind)
}
// ErrCodeTaskRelationCycle holds the unique world-error code of this error
const ErrCodeTaskRelationCycle = 4022
// HTTPError holds the http error description
func (err ErrTaskRelationCycle) HTTPError() web.HTTPError {
return web.HTTPError{
HTTPCode: http.StatusConflict,
Code: ErrCodeTaskRelationCycle,
Message: "This task relation would create a cycle.",
}
}
// ============
// Team errors
// ============

View File

@ -19,8 +19,10 @@ package models
import (
"archive/zip"
"encoding/json"
"errors"
"fmt"
"io"
"io/fs"
"os"
"strconv"
"time"
@ -219,15 +221,20 @@ func exportTaskAttachments(s *xorm.Session, wr *zip.Writer, taskIDs []int64) (er
return err
}
fs := make(map[int64]io.ReadCloser)
attachmentFiles := make(map[int64]io.ReadCloser)
for _, ta := range tas {
if err := ta.File.LoadFileByID(); err != nil {
err = ta.File.LoadFileByID()
if err != nil {
var pathError *fs.PathError
if errors.As(err, &pathError) {
continue
}
return err
}
fs[ta.FileID] = ta.File.File
attachmentFiles[ta.FileID] = ta.File.File
}
return utils.WriteFilesToZip(fs, wr)
return utils.WriteFilesToZip(attachmentFiles, wr)
}
func exportSavedFilters(s *xorm.Session, u *user.User, wr *zip.Writer) (err error) {
@ -256,7 +263,7 @@ func exportProjectBackgrounds(s *xorm.Session, u *user.User, wr *zip.Writer) (er
return err
}
fs := make(map[int64]io.ReadCloser)
backgroundFiles := make(map[int64]io.ReadCloser)
for _, l := range projects {
if l.BackgroundFileID == 0 {
continue
@ -267,13 +274,17 @@ func exportProjectBackgrounds(s *xorm.Session, u *user.User, wr *zip.Writer) (er
}
err = bgFile.LoadFileByID()
if err != nil {
return
var pathError *fs.PathError
if errors.As(err, &pathError) {
continue
}
return err
}
fs[l.BackgroundFileID] = bgFile.File
backgroundFiles[l.BackgroundFileID] = bgFile.File
}
return utils.WriteFilesToZip(fs, wr)
return utils.WriteFilesToZip(backgroundFiles, wr)
}
func RegisterOldExportCleanupCron() {

View File

@ -747,6 +747,48 @@ func (wl *WebhookListener) Handle(msg *message.Message) (err error) {
return nil
}
// Load event data again so that it is always populated in the webhook payload
var doerID int64
if doer, has := event["doer"]; has {
d := doer.(map[string]interface{})
if rawDoerID, has := d["id"]; has {
doerID = getIDAsInt64(rawDoerID)
fullDoer, err := user.GetUserByID(s, doerID)
if err != nil && !user.IsErrUserDoesNotExist(err) {
return err
}
if err == nil {
event["doer"] = fullDoer
}
}
}
if task, has := event["task"]; has && doerID != 0 {
t := task.(map[string]interface{})
if taskID, has := t["id"]; has {
id := getIDAsInt64(taskID)
fullTask := Task{ID: id}
err = fullTask.ReadOne(s, &user.User{ID: doerID})
if err != nil && !IsErrTaskDoesNotExist(err) {
return err
}
if err == nil {
event["task"] = fullTask
}
}
}
if _, has := event["project"]; has && doerID != 0 {
project := &Project{ID: projectID}
err = project.ReadOne(s, &user.User{ID: doerID})
if err != nil && !IsErrProjectDoesNotExist(err) {
return err
}
if err == nil {
event["project"] = project
}
}
err = webhook.sendWebhookPayload(&WebhookPayload{
EventName: wl.EventName,
Time: time.Now(),

View File

@ -44,7 +44,7 @@ func (n *ReminderDueNotification) ToMail() *notifications.Mail {
Subject(`Reminder for "`+n.Task.Title+`" (`+n.Project.Title+`)`).
Greeting("Hi "+n.User.GetName()+",").
Line(`This is a friendly reminder of the task "`+n.Task.Title+`" (`+n.Project.Title+`).`).
Action("Open Task", config.ServiceFrontendurl.GetString()+"tasks/"+strconv.FormatInt(n.Task.ID, 10)).
Action("Open Task", config.ServicePublicURL.GetString()+"tasks/"+strconv.FormatInt(n.Task.ID, 10)).
Line("Have a nice day!")
}
@ -173,7 +173,7 @@ func (n *ProjectCreatedNotification) ToMail() *notifications.Mail {
return notifications.NewMail().
Subject(n.Doer.GetName()+` created the project "`+n.Project.Title+`"`).
Line(n.Doer.GetName()+` created the project "`+n.Project.Title+`"`).
Action("View Project", config.ServiceFrontendurl.GetString()+"projects/")
Action("View Project", config.ServicePublicURL.GetString()+"projects/")
}
// ToDB returns the ProjectCreatedNotification notification in a format which can be saved in the db
@ -200,7 +200,7 @@ func (n *TeamMemberAddedNotification) ToMail() *notifications.Mail {
From(n.Doer.GetNameAndFromEmail()).
Greeting("Hi "+n.Member.GetName()+",").
Line(n.Doer.GetName()+" has just added you to the "+n.Team.Name+" team in Vikunja.").
Action("View Team", config.ServiceFrontendurl.GetString()+"teams/"+strconv.FormatInt(n.Team.ID, 10)+"/edit")
Action("View Team", config.ServicePublicURL.GetString()+"teams/"+strconv.FormatInt(n.Team.ID, 10)+"/edit")
}
// ToDB returns the TeamMemberAddedNotification notification in a format which can be saved in the db
@ -227,7 +227,7 @@ func (n *UndoneTaskOverdueNotification) ToMail() *notifications.Mail {
Subject(`Task "`+n.Task.Title+`" (`+n.Project.Title+`) is overdue`).
Greeting("Hi "+n.User.GetName()+",").
Line(`This is a friendly reminder of the task "`+n.Task.Title+`" (`+n.Project.Title+`) which is overdue since `+utils.HumanizeDuration(until)+` and not yet done.`).
Action("Open Task", config.ServiceFrontendurl.GetString()+"tasks/"+strconv.FormatInt(n.Task.ID, 10)).
Action("Open Task", config.ServicePublicURL.GetString()+"tasks/"+strconv.FormatInt(n.Task.ID, 10)).
Line("Have a nice day!")
}
@ -263,7 +263,7 @@ func (n *UndoneTasksOverdueNotification) ToMail() *notifications.Mail {
overdueLine := ""
for _, task := range sortedTasks {
until := time.Until(task.DueDate).Round(1*time.Hour) * -1
overdueLine += `* [` + task.Title + `](` + config.ServiceFrontendurl.GetString() + "tasks/" + strconv.FormatInt(task.ID, 10) + `) (` + n.Projects[task.ProjectID].Title + `), overdue since ` + utils.HumanizeDuration(until) + "\n"
overdueLine += `* [` + task.Title + `](` + config.ServicePublicURL.GetString() + "tasks/" + strconv.FormatInt(task.ID, 10) + `) (` + n.Projects[task.ProjectID].Title + `), overdue since ` + utils.HumanizeDuration(until) + "\n"
}
return notifications.NewMail().
@ -271,7 +271,7 @@ func (n *UndoneTasksOverdueNotification) ToMail() *notifications.Mail {
Greeting("Hi "+n.User.GetName()+",").
Line("You have the following overdue tasks:").
Line(overdueLine).
Action("Open Vikunja", config.ServiceFrontendurl.GetString()).
Action("Open Vikunja", config.ServicePublicURL.GetString()).
Line("Have a nice day!")
}
@ -338,7 +338,7 @@ func (n *DataExportReadyNotification) ToMail() *notifications.Mail {
Subject("Your Vikunja Data Export is ready").
Greeting("Hi "+n.User.GetName()+",").
Line("Your Vikunja Data Export is ready for you to download. Click the button below to download it:").
Action("Download", config.ServiceFrontendurl.GetString()+"user/export/download").
Action("Download", config.ServicePublicURL.GetString()+"user/export/download").
Line("The download will be available for the next 7 days.").
Line("Have a nice day!")
}

View File

@ -138,6 +138,54 @@ func getInverseRelation(kind RelationKind) RelationKind {
return RelationKindUnknown
}
func checkTaskRelationCycle(s *xorm.Session, relation *TaskRelation, otherTaskIDToCheck int64, visited map[int64]bool, currentPath map[int64]bool) (err error) {
if visited == nil {
visited = make(map[int64]bool)
}
if currentPath == nil {
currentPath = make(map[int64]bool)
}
if visited[relation.TaskID] {
return nil // Node already visited, no cycle detected
}
if relation.TaskID == otherTaskIDToCheck || // This checks for cycles between leaf nodes
currentPath[relation.TaskID] ||
currentPath[otherTaskIDToCheck] {
// Cycle detected
return ErrTaskRelationCycle{
TaskID: relation.TaskID,
OtherTaskID: relation.OtherTaskID,
Kind: relation.RelationKind,
}
}
visited[relation.TaskID] = true
currentPath[relation.TaskID] = true
parenttasks := []*TaskRelation{}
// where child = relation.id
err = s.Where("other_task_id = ? AND relation_kind = ?", relation.TaskID, relation.RelationKind).
Find(&parenttasks)
if err != nil {
return
}
for _, parent := range parenttasks {
err = checkTaskRelationCycle(s, parent, otherTaskIDToCheck, visited, currentPath)
if err != nil {
return err
}
}
// Remove the current node from the currentPath to avoid false positives
delete(currentPath, relation.TaskID)
return nil
}
// Create creates a new task relation
// @Summary Create a new relation between two tasks
// @Description Creates a new relation between two tasks. The user needs to have update rights on the base task and at least read rights on the other task. Both tasks do not need to be on the same project. Take a look at the docs for available task relation kinds.
@ -191,6 +239,14 @@ func (rel *TaskRelation) Create(s *xorm.Session, a web.Auth) error {
RelationKind: getInverseRelation(rel.RelationKind),
}
// If we're creating a subtask relation, check if we're about to create a cycle
if rel.RelationKind == RelationKindSubtask || rel.RelationKind == RelationKindParenttask {
err = checkTaskRelationCycle(s, rel, rel.OtherTaskID, nil, nil)
if err != nil {
return err
}
}
// Finally insert everything
_, err = s.Insert(&[]*TaskRelation{
rel,

View File

@ -96,6 +96,182 @@ func TestTaskRelation_Create(t *testing.T) {
require.Error(t, err)
assert.True(t, IsErrRelationTasksCannotBeTheSame(err))
})
t.Run("cycle with one subtask", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
s := db.NewSession()
defer s.Close()
rel := TaskRelation{
TaskID: 29,
OtherTaskID: 1,
RelationKind: RelationKindSubtask,
}
err := rel.Create(s, &user.User{ID: 1})
require.Error(t, err)
assert.True(t, IsErrTaskRelationCycle(err))
})
t.Run("cycle with multiple subtasks", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
s := db.NewSession()
defer s.Close()
rel1 := TaskRelation{
TaskID: 1,
OtherTaskID: 2,
RelationKind: RelationKindSubtask,
}
err := rel1.Create(s, &user.User{ID: 1})
require.NoError(t, err)
rel2 := TaskRelation{
TaskID: 2,
OtherTaskID: 3,
RelationKind: RelationKindSubtask,
}
err = rel2.Create(s, &user.User{ID: 1})
require.NoError(t, err)
rel3 := TaskRelation{
TaskID: 3,
OtherTaskID: 4,
RelationKind: RelationKindSubtask,
}
err = rel3.Create(s, &user.User{ID: 1})
require.NoError(t, err)
// Cycle happens here
rel4 := TaskRelation{
TaskID: 4,
OtherTaskID: 2,
RelationKind: RelationKindSubtask,
}
err = rel4.Create(s, &user.User{ID: 1})
require.Error(t, err)
assert.True(t, IsErrTaskRelationCycle(err))
})
t.Run("cycle with multiple subtasks tasks and relation back to parent", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
s := db.NewSession()
defer s.Close()
rel1 := TaskRelation{
TaskID: 1,
OtherTaskID: 2,
RelationKind: RelationKindSubtask,
}
err := rel1.Create(s, &user.User{ID: 1})
require.NoError(t, err)
rel2 := TaskRelation{
TaskID: 2,
OtherTaskID: 3,
RelationKind: RelationKindSubtask,
}
err = rel2.Create(s, &user.User{ID: 1})
require.NoError(t, err)
rel3 := TaskRelation{
TaskID: 3,
OtherTaskID: 4,
RelationKind: RelationKindSubtask,
}
err = rel3.Create(s, &user.User{ID: 1})
require.NoError(t, err)
// Cycle happens here
rel4 := TaskRelation{
TaskID: 4,
OtherTaskID: 1,
RelationKind: RelationKindSubtask,
}
err = rel4.Create(s, &user.User{ID: 1})
require.Error(t, err)
assert.True(t, IsErrTaskRelationCycle(err))
})
t.Run("cycle with one parenttask", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
s := db.NewSession()
defer s.Close()
rel := TaskRelation{
TaskID: 1,
OtherTaskID: 29,
RelationKind: RelationKindParenttask,
}
err := rel.Create(s, &user.User{ID: 1})
require.Error(t, err)
assert.True(t, IsErrTaskRelationCycle(err))
})
t.Run("cycle with multiple parenttasks", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
s := db.NewSession()
defer s.Close()
rel1 := TaskRelation{
TaskID: 1,
OtherTaskID: 2,
RelationKind: RelationKindParenttask,
}
err := rel1.Create(s, &user.User{ID: 1})
require.NoError(t, err)
rel2 := TaskRelation{
TaskID: 2,
OtherTaskID: 3,
RelationKind: RelationKindParenttask,
}
err = rel2.Create(s, &user.User{ID: 1})
require.NoError(t, err)
rel3 := TaskRelation{
TaskID: 3,
OtherTaskID: 4,
RelationKind: RelationKindParenttask,
}
err = rel3.Create(s, &user.User{ID: 1})
require.NoError(t, err)
// Cycle happens here
rel4 := TaskRelation{
TaskID: 4,
OtherTaskID: 2,
RelationKind: RelationKindParenttask,
}
err = rel4.Create(s, &user.User{ID: 1})
require.Error(t, err)
assert.True(t, IsErrTaskRelationCycle(err))
})
t.Run("cycle with multiple parenttasks and relation back to parent", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
s := db.NewSession()
defer s.Close()
rel1 := TaskRelation{
TaskID: 1,
OtherTaskID: 2,
RelationKind: RelationKindParenttask,
}
err := rel1.Create(s, &user.User{ID: 1})
require.NoError(t, err)
rel2 := TaskRelation{
TaskID: 2,
OtherTaskID: 3,
RelationKind: RelationKindParenttask,
}
err = rel2.Create(s, &user.User{ID: 1})
require.NoError(t, err)
rel3 := TaskRelation{
TaskID: 3,
OtherTaskID: 4,
RelationKind: RelationKindParenttask,
}
err = rel3.Create(s, &user.User{ID: 1})
require.NoError(t, err)
// Cycle happens here
rel4 := TaskRelation{
TaskID: 4,
OtherTaskID: 1,
RelationKind: RelationKindParenttask,
}
err = rel4.Create(s, &user.User{ID: 1})
require.Error(t, err)
assert.True(t, IsErrTaskRelationCycle(err))
})
}
func TestTaskRelation_Delete(t *testing.T) {

View File

@ -156,7 +156,7 @@ func (t *Task) GetFullIdentifier() string {
}
func (t *Task) GetFrontendURL() string {
return config.ServiceFrontendurl.GetString() + "tasks/" + strconv.FormatInt(t.ID, 10)
return config.ServicePublicURL.GetString() + "tasks/" + strconv.FormatInt(t.ID, 10)
}
type taskFilterConcatinator string

View File

@ -36,7 +36,7 @@ func (n *MigrationDoneNotification) ToMail() *notifications.Mail {
return notifications.NewMail().
Subject("The migration from "+kind+" to Vikunja was completed").
Line("Vikunja has imported all lists/projects, tasks, notes, reminders and files from "+kind+" you have access to.").
Action("View your imported projects in Vikunja", config.ServiceFrontendurl.GetString()).
Action("View your imported projects in Vikunja", config.ServicePublicURL.GetString()).
Line("Have fun with your new (old) projects!")
}

View File

@ -115,7 +115,7 @@ func RenderMail(m *Mail) (mailOpts *mail.Opts, err error) {
data["ActionText"] = m.actionText
data["ActionURL"] = m.actionURL
data["Boundary"] = boundary
data["FrontendURL"] = config.ServiceFrontendurl.GetString()
data["FrontendURL"] = config.ServicePublicURL.GetString()
var introLinesHTML []templatehtml.HTML
for _, line := range m.introLines {

View File

@ -82,7 +82,7 @@ type legalInfo struct {
func Info(c echo.Context) error {
info := vikunjaInfos{
Version: version.Version,
FrontendURL: config.ServiceFrontendurl.GetString(),
FrontendURL: config.ServicePublicURL.GetString(),
Motd: config.ServiceMotd.GetString(),
LinkSharingEnabled: config.ServiceEnableLinkSharing.GetBool(),
MaxFileSize: config.FilesMaxSize.GetString(),

View File

@ -114,39 +114,7 @@ func NewEcho() *echo.Echo {
// panic recover
e.Use(middleware.Recover())
if config.ServiceSentryDsn.GetString() != "" {
if err := sentry.Init(sentry.ClientOptions{
Dsn: config.ServiceSentryDsn.GetString(),
AttachStacktrace: true,
Release: version.Version,
}); err != nil {
log.Criticalf("Sentry init failed: %s", err)
}
defer sentry.Flush(5 * time.Second)
e.Use(sentryecho.New(sentryecho.Options{
Repanic: true,
}))
e.HTTPErrorHandler = func(err error, c echo.Context) {
// Only capture errors not already handled by echo
var herr *echo.HTTPError
if errors.As(err, &herr) && herr.Code > 403 {
hub := sentryecho.GetHubFromContext(c)
if hub != nil {
hub.WithScope(func(scope *sentry.Scope) {
scope.SetExtra("url", c.Request().URL)
hub.CaptureException(err)
})
} else {
sentry.CaptureException(err)
log.Debugf("Could not add context for sending error '%s' to sentry", err.Error())
}
log.Debugf("Error '%s' sent to sentry", err.Error())
}
e.DefaultHTTPErrorHandler(err, c)
}
}
setupSentry(e)
// Validation
e.Validator = &CustomValidator{}
@ -162,6 +130,44 @@ func NewEcho() *echo.Echo {
return e
}
func setupSentry(e *echo.Echo) {
if !config.SentryEnabled.GetBool() {
return
}
if err := sentry.Init(sentry.ClientOptions{
Dsn: config.SentryDsn.GetString(),
AttachStacktrace: true,
Release: version.Version,
}); err != nil {
log.Criticalf("Sentry init failed: %s", err)
}
defer sentry.Flush(5 * time.Second)
e.Use(sentryecho.New(sentryecho.Options{
Repanic: true,
}))
e.HTTPErrorHandler = func(err error, c echo.Context) {
// Only capture errors not already handled by echo
var herr *echo.HTTPError
if errors.As(err, &herr) && herr.Code > 403 {
hub := sentryecho.GetHubFromContext(c)
if hub != nil {
hub.WithScope(func(scope *sentry.Scope) {
scope.SetExtra("url", c.Request().URL)
hub.CaptureException(err)
})
} else {
sentry.CaptureException(err)
log.Debugf("Could not add context for sending error '%s' to sentry", err.Error())
}
log.Debugf("Error '%s' sent to sentry", err.Error())
}
e.DefaultHTTPErrorHandler(err, c)
}
}
// RegisterRoutes registers all routes for the application
func RegisterRoutes(e *echo.Echo) {
@ -178,15 +184,9 @@ func RegisterRoutes(e *echo.Echo) {
// healthcheck
e.GET("/health", HealthcheckHandler)
// static files
if static := config.ServiceStaticpath.GetString(); static != "" {
e.Use(middleware.StaticWithConfig(middleware.StaticConfig{
Root: static,
HTML5: true,
}))
}
setupStaticFrontendFilesHandler(e)
// CORS_SHIT
// CORS
if config.CorsEnable.GetBool() {
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
AllowOrigins: config.CorsOrigins.GetStringSlice(),

293
pkg/routes/static.go Normal file
View File

@ -0,0 +1,293 @@
// Vikunja is a to-do list application to facilitate your life.
// Copyright 2018-present Vikunja and contributors. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public Licensee as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public Licensee for more details.
//
// You should have received a copy of the GNU Affero General Public Licensee
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package routes
import (
"bytes"
"errors"
"fmt"
"io"
"mime"
"net/http"
"net/url"
"os"
"path"
"path/filepath"
"strings"
"sync"
"text/template"
"code.vikunja.io/api/frontend"
"code.vikunja.io/api/pkg/config"
etaggenerator "github.com/hhsnopek/etag"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
const (
indexFile = `index.html`
rootPath = `dist/`
cacheControlMax = `max-age=315360000, public, max-age=31536000, s-maxage=31536000, immutable`
cacheControlNone = `public, max-age=0, s-maxage=0, must-revalidate`
configScriptTagTemplate = `
<script>
window.SENTRY_ENABLED = {{ .SENTRY_ENABLED }}
window.SENTRY_DSN = '{{ .SENTRY_DSN }}'
window.ALLOW_ICON_CHANGES = {{ .ALLOW_ICON_CHANGES }}
window.CUSTOM_LOGO_URL = '{{ .CUSTOM_LOGO_URL }}'
</script>`
)
// Because the files are embedded into the final binary, we can be absolutely sure the etag will never change
// and we can cache its generation pretty heavily.
var etagCache map[string]string
var etagLock sync.Mutex
var scriptConfigString string
var scriptConfigStringLock sync.Mutex
func init() {
etagCache = make(map[string]string)
etagLock = sync.Mutex{}
scriptConfigStringLock = sync.Mutex{}
}
func serveIndexFile(c echo.Context, assetFs http.FileSystem) (err error) {
index, err := assetFs.Open(path.Join(rootPath, indexFile))
if err != nil {
return err
}
defer index.Close()
if scriptConfigString == "" {
scriptConfigStringLock.Lock()
defer scriptConfigStringLock.Unlock()
// replace config variables
tmpl, err := template.New("config").Parse(configScriptTagTemplate)
if err != nil {
return err
}
var tplOutput bytes.Buffer
data := make(map[string]string)
data["SENTRY_ENABLED"] = "false"
if config.SentryFrontendEnabled.GetBool() {
data["SENTRY_ENABLED"] = "true"
}
data["SENTRY_DSN"] = config.SentryFrontendDsn.GetString()
data["ALLOW_ICON_CHANGES"] = "false"
if config.ServiceAllowIconChanges.GetBool() {
data["ALLOW_ICON_CHANGES"] = "true"
}
data["CUSTOM_LOGO_URL"] = config.ServiceCustomLogoURL.GetString()
err = tmpl.Execute(&tplOutput, data)
if err != nil {
return err
}
scriptConfig := tplOutput.String()
buf := bytes.Buffer{}
_, err = buf.ReadFrom(index)
if err != nil {
return err
}
scriptConfigString = strings.ReplaceAll(buf.String(), `<div id="app"></div>`, `<div id="app"></div>`+scriptConfig)
publicURL := config.ServicePublicURL.GetString()
if publicURL == "" {
publicURL = "/"
}
scriptConfigString = strings.ReplaceAll(scriptConfigString, "'http://localhost:3456/api/v1'", "'"+publicURL+"api/v1'")
}
reader := strings.NewReader(scriptConfigString)
info, err := index.Stat()
if err != nil {
return err
}
etag, err := generateEtag(index, info.Name())
if err != nil {
return err
}
return serveFile(c, reader, info, etag)
}
// Copied from echo's middleware.StaticWithConfig simplified and adjusted for caching
func static() echo.MiddlewareFunc {
assetFs := http.FS(frontend.Files)
return func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) (err error) {
p := c.Request().URL.Path
if strings.HasSuffix(c.Path(), "*") { // When serving from a group, e.g. `/static*`.
p = c.Param("*")
}
p, err = url.PathUnescape(p)
if err != nil {
return
}
name := path.Join(rootPath, path.Clean("/"+p)) // "/"+ for security
file, err := assetFs.Open(name)
if err != nil {
if !os.IsNotExist(err) {
return err
}
// file with that path did not exist, so we continue down in middleware/handler chain, hoping that we end up in
// handler that is meant to handle this request
if err = next(c); err == nil {
return err
}
var he *echo.HTTPError
if !(errors.As(err, &he) && he.Code == http.StatusNotFound) {
return err
}
// Handle all other requests with the index file
return serveIndexFile(c, assetFs)
}
defer file.Close()
info, err := file.Stat()
if err != nil {
return err
}
if info.IsDir() {
return serveIndexFile(c, assetFs)
}
etag, err := generateEtag(file, name)
if err != nil {
return err
}
return serveFile(c, file, info, etag)
}
}
}
func generateEtag(file http.File, name string) (etag string, err error) {
etagLock.Lock()
defer etagLock.Unlock()
etag, has := etagCache[name]
if !has {
buf := bytes.Buffer{}
_, err = buf.ReadFrom(file)
if err != nil {
return "", err
}
etag = etaggenerator.Generate(buf.Bytes(), true)
etagCache[name] = etag
}
return etag, nil
}
// copied from http.serveContent
func getMimeType(name string, file io.ReadSeeker) (mineType string, err error) {
mineType = mime.TypeByExtension(filepath.Ext(name))
if mineType == "" {
// read a chunk to decide between utf-8 text and binary
var buf [512]byte
n, _ := io.ReadFull(file, buf[:])
mineType = http.DetectContentType(buf[:n])
_, err := file.Seek(0, io.SeekStart) // rewind to output whole file
if err != nil {
return "", fmt.Errorf("seeker can't seek")
}
}
return mineType, nil
}
func getCacheControlHeader(info os.FileInfo, file io.ReadSeeker) (header string, err error) {
// Don't cache service worker and related files
if info.Name() == "robots.txt" ||
info.Name() == "sw.js" ||
info.Name() == "manifest.webmanifest" {
return cacheControlNone, nil
}
if strings.HasPrefix(info.Name(), "workbox-") {
return cacheControlMax, nil
}
contentType, err := getMimeType(info.Name(), file)
if err != nil {
return "", err
}
// Cache everything looking like an asset
if strings.HasPrefix(contentType, "image/") ||
strings.HasPrefix(contentType, "font/") ||
strings.HasPrefix(contentType, "~images/") ||
strings.HasPrefix(contentType, "~font/") ||
contentType == "text/css" ||
contentType == "application/javascript" ||
contentType == "text/javascript" ||
contentType == "application/vnd.ms-fontobject" ||
contentType == "application/x-font-ttf" ||
contentType == "font/opentype" ||
contentType == "font/woff2" ||
contentType == "image/svg+xml" ||
contentType == "image/x-icon" ||
contentType == "audio/wav" {
return cacheControlMax, nil
}
return cacheControlNone, nil
}
func serveFile(c echo.Context, file io.ReadSeeker, info os.FileInfo, etag string) error {
c.Response().Header().Set("Server", "Vikunja")
c.Response().Header().Set("Vary", "Accept-Encoding")
c.Response().Header().Set("Etag", etag)
cacheControl, err := getCacheControlHeader(info, file)
if err != nil {
return err
}
c.Response().Header().Set("Cache-Control", cacheControl)
http.ServeContent(c.Response(), c.Request(), info.Name(), info.ModTime(), file)
return nil
}
func setupStaticFrontendFilesHandler(e *echo.Echo) {
e.Use(middleware.GzipWithConfig(middleware.GzipConfig{
Level: 6,
MinLength: 256,
Skipper: func(c echo.Context) bool {
return strings.HasPrefix(c.Path(), "/api/")
},
}))
e.Use(static())
}

View File

@ -48,7 +48,7 @@ func (n *EmailConfirmNotification) ToMail() *notifications.Mail {
return nn.
Line("To confirm your email address, click the link below:").
Action("Confirm your email address", config.ServiceFrontendurl.GetString()+"?userEmailConfirm="+n.ConfirmToken).
Action("Confirm your email address", config.ServicePublicURL.GetString()+"?userEmailConfirm="+n.ConfirmToken).
Line("Have a nice day!")
}
@ -98,7 +98,7 @@ func (n *ResetPasswordNotification) ToMail() *notifications.Mail {
Subject("Reset your password on Vikunja").
Greeting("Hi "+n.User.GetName()+",").
Line("To reset your password, click the link below:").
Action("Reset your password", config.ServiceFrontendurl.GetString()+"?userPasswordReset="+n.Token.Token).
Action("Reset your password", config.ServicePublicURL.GetString()+"?userPasswordReset="+n.Token.Token).
Line("This link will be valid for 24 hours.").
Line("Have a nice day!")
}
@ -125,7 +125,7 @@ func (n *InvalidTOTPNotification) ToMail() *notifications.Mail {
Greeting("Hi "+n.User.GetName()+",").
Line("Someone just tried to log in into your account with correct username and password but a wrong TOTP passcode.").
Line("**If this was not you, someone else knows your password. You should set a new one immediately!**").
Action("Reset your password", config.ServiceFrontendurl.GetString()+"get-password-reset")
Action("Reset your password", config.ServicePublicURL.GetString()+"get-password-reset")
}
// ToDB returns the InvalidTOTPNotification notification in a format which can be saved in the db
@ -150,7 +150,7 @@ func (n *PasswordAccountLockedAfterInvalidTOTOPNotification) ToMail() *notificat
Greeting("Hi " + n.User.GetName() + ",").
Line("Someone tried to log in with your credentials but failed to provide a valid TOTP passcode.").
Line("After 10 failed attempts, we've disabled your account and reset your password. To set a new one, follow the instructions in the reset email we just sent you.").
Line("If you did not receive an email with reset instructions, you can always request a new one at [" + config.ServiceFrontendurl.GetString() + "get-password-reset](" + config.ServiceFrontendurl.GetString() + "get-password-reset).")
Line("If you did not receive an email with reset instructions, you can always request a new one at [" + config.ServicePublicURL.GetString() + "get-password-reset](" + config.ServicePublicURL.GetString() + "get-password-reset).")
}
// ToDB returns the PasswordAccountLockedAfterInvalidTOTOPNotification notification in a format which can be saved in the db
@ -176,7 +176,7 @@ func (n *FailedLoginAttemptNotification) ToMail() *notifications.Mail {
Line("Someone just tried to log in into your account with a wrong password three times in a row.").
Line("If this was not you, this could be someone else trying to break into your account.").
Line("To enhance the security of you account you may want to set a stronger password or enable TOTP authentication in the settings:").
Action("Go to settings", config.ServiceFrontendurl.GetString()+"user/settings")
Action("Go to settings", config.ServicePublicURL.GetString()+"user/settings")
}
// ToDB returns the FailedLoginAttemptNotification notification in a format which can be saved in the db
@ -201,7 +201,7 @@ func (n *AccountDeletionConfirmNotification) ToMail() *notifications.Mail {
Subject("Please confirm the deletion of your Vikunja account").
Greeting("Hi "+n.User.GetName()+",").
Line("You have requested the deletion of your account. To confirm this, please click the link below:").
Action("Confirm the deletion of my account", config.ServiceFrontendurl.GetString()+"?accountDeletionConfirm="+n.ConfirmToken).
Action("Confirm the deletion of my account", config.ServicePublicURL.GetString()+"?accountDeletionConfirm="+n.ConfirmToken).
Line("This link will be valid for 24 hours.").
Line("Once you confirm the deletion we will schedule the deletion of your account in three days and send you another email until then.").
Line("If you proceed with the deletion of your account, we will remove all of your projects and tasks you created. Everything you shared with another user or team will transfer ownership to them.").
@ -239,7 +239,7 @@ func (n *AccountDeletionNotification) ToMail() *notifications.Mail {
Line("You recently requested the deletion of your Vikunja account.").
Line("We will delete your account "+durationString+".").
Line("If you changed your mind, simply click the link below to cancel the deletion and follow the instructions there:").
Action("Abort the deletion", config.ServiceFrontendurl.GetString()).
Action("Abort the deletion", config.ServicePublicURL.GetString()).
Line("Have a nice day!")
}