Skip to content
Snippets Groups Projects
Verified Commit ead8ca52 authored by Maarten de Waard's avatar Maarten de Waard :angel:
Browse files

Add the possibility to install apps from GitHub releases. Add renovate configuration to update them

parent 20b76ff4
No related branches found
No related tags found
1 merge request!273Resolve "Pin nextcloud onlyoffice plugin version"
Pipeline #28274 failed with stages
in 3 minutes and 24 seconds
...@@ -59,6 +59,9 @@ possible to specify which applications from the app store are available for ...@@ -59,6 +59,9 @@ possible to specify which applications from the app store are available for
installation. It is also possible to enable them by default. Apps that are not installation. It is also possible to enable them by default. Apps that are not
enabled by default can be enabled through the Apps screen in Nextcloud. enabled by default can be enabled through the Apps screen in Nextcloud.
Apps that are installed this way are automatically updated to their newest
version every time Nextcloud is updated.
To install apps, edit the values.yaml file: To install apps, edit the values.yaml file:
```yaml ```yaml
...@@ -67,6 +70,27 @@ apps: ...@@ -67,6 +70,27 @@ apps:
enabled: false # Disables sociallogin by default enabled: false # Disables sociallogin by default
``` ```
Additionally, we have added an option to install Apps immediately from GitHub
releases. The benefit of this, compared to installing them with `occ`, is that
we can pin the versions to specific GitHub releases. To install an app from
GitHub releases:
```yaml
apps:
- name: onlyoffice
# The name of the repository. This is the name for a repository located at
# https://github.com/ONLYOFFICE/onlyoffice-nextcloud:
github_repository: ONLYOFFICE/onlyoffice-nextcloud
# The version to install or upgrade the app to
version: 7.5.4
# The name of the "asset" to download from this release. This name can be
# found on https://github.com/ONLYOFFICE/onlyoffice-nextcloud/releases
release_filename: onlyoffice.tar.gz
# Enable the app after installing it
enabled: true
```
## Values ## Values
The included `values.yaml` file configures Nextcloud to use a Mariadb database, The included `values.yaml` file configures Nextcloud to use a Mariadb database,
......
...@@ -2,5 +2,16 @@ ...@@ -2,5 +2,16 @@
"$schema": "https://docs.renovatebot.com/renovate-schema.json", "$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [ "extends": [
"local>stackspin/renovate-config" "local>stackspin/renovate-config"
],
"regexManagers": [
{
"fileMatch": [
"(^|/)values\\.yaml*$"
],
"matchStrings": [
"github_repository: (?<depName>.*)\n*version: (?<currentValue>.*)"
],
"datasourceTemplate": "github-releases"
}
] ]
} }
...@@ -49,25 +49,62 @@ data: ...@@ -49,25 +49,62 @@ data:
# Enable app store so we can run `install` and `enable` commands # Enable app store so we can run `install` and `enable` commands
php $occ config:system:set appstoreenabled --type boolean --value true php $occ config:system:set appstoreenabled --type boolean --value true
# Update all apps to their latest version, so they are compatible
# with the new NC version.
# Unfortunatly the occ app:install cmd doesn't allow to pin apps to
# a certain version.
php $occ app:update --all --no-interaction
# Install all apps declared in the `apps` helm values array # Install all apps declared in the `apps` helm values array
{{- range .Values.apps }} {{- range .Values.apps }}
# -- Begin {{ .name }} {{- if and .github_repository .version }}
# Only install {{ .name }} if it's not installed already # Apps with a pinned version number are downloaded from GitHub so we can
# update the pin with Renovatebot
# Get currently installed app version without using jq. Empty string if
# nothing is installed
# This counts on pipefail being off!
current_version=$(php occ app:list --output json | grep -o '"{{ .name }}":"[0-9]\+.[0-9]\+.[0-9]\+"' | grep -o '[0-9]\+.[0-9]\+.[0-9]\+' | cat)
if [ "$current_version" != "{{ .version }}" ]
then
echo "Upgrading app {{ .github_repository }} from '$current_version' to '{{ .version }}'"
# Where to install the app
target_directory="/var/www/html/custom_apps/{{ .name }}"
tmpdir=$(mktemp --directory)
cd $tmpdir
# We need to edit $ to be able to use `tpl` inside a `range`,
# see https://github.com/helm/helm/issues/5979#issuecomment-518231758
# allows us to use version variable in the release_filename
{{- $_ := set $ "version" .version}}
curl "https://github.com/{{ .github_repository }}/releases/download/v{{ .version }}/{{ tpl .release_filename $ }}" -Lo {{ .name }}.tar.gz
tar -xf {{ .name }}.tar.gz
# Remove old version of the app
if [[ -d $target_directory ]]
then
rm -r $target_directory
fi
# Move app directory into target directory
mv {{ .name }} $target_directory
cd -
rm -r $tmpdir
else
echo "App {{ .name }} is up-to-date"
fi
{{- else }}
# Unpinned app
if ! php $occ app:list | grep -q {{ .name }}; then if ! php $occ app:list | grep -q {{ .name }}; then
php $occ app:install {{ .name }} --keep-disabled --no-interaction php $occ app:install {{ .name }} --keep-disabled --no-interaction
else
# Update the app to its latest version
php $occ app:update --all --no-interaction
fi fi
{{ end }}
{{- if .enabled }} {{- if .enabled }}
# Enable {{ .name }} app # Enable {{ .name }} app
php $occ app:enable {{ .name }} php $occ app:enable {{ .name }}
{{ end }} # -- end {{ .name }} {{ end }} # -- end {{ .name }}
{{ end }} # end range {{ .Values.apps }} {{ end }} # end range {{ .Values.apps }}
# Some of the manually installed apps might need to run upgrade scripts, run
# them now
php $occ upgrade
# Config settings from the configmap above # Config settings from the configmap above
php $occ config:import /var/local/onlyoffice-config.json php $occ config:import /var/local/onlyoffice-config.json
php $occ config:app:set sociallogin custom_providers --value='{"custom_oidc": [{{ .Values.sociallogin.custom_oidc | toJson }}]}' php $occ config:app:set sociallogin custom_providers --value='{"custom_oidc": [{{ .Values.sociallogin.custom_oidc | toJson }}]}'
......
...@@ -66,6 +66,14 @@ rabbitmq: ...@@ -66,6 +66,14 @@ rabbitmq:
# enabled: false # enabled: false
# - name: onlyoffice # - name: onlyoffice
# enabled: true # enabled: true
# - name: polls
# # Install an app from a github repository. This has the advantage that you
# # can pin the version number, so it does not get auto-updated to breaking
# # versions
# github_repository: nextcloud/polls
# version: 3.8.1
# release_filename: polls-.8.1.tar.gz
# enabled: true
# sociallogin enables login via oAuth/Open-ID Connect # sociallogin enables login via oAuth/Open-ID Connect
# sociallogin: # sociallogin:
......
...@@ -30,11 +30,21 @@ nextcloud: ...@@ -30,11 +30,21 @@ nextcloud:
failureThreshold: 60 failureThreshold: 60
apps: apps:
# OIDC consumer
- name: sociallogin - name: sociallogin
enabled: true # apps[0].enabled needs to be set to true if you want to enable login via an external
# List of applications that are installed *and enabled* # oauth server. In that case you need to configure all the values in `sociallogin`
enabled: false
# Line order is important here for renovatebot! first github_repository,
# then version
github_repository: zorn-v/nextcloud-social-login
version: 4.17.1
release_filename: release.tar.gz
- name: onlyoffice - name: onlyoffice
# Line order is important here for renovatebot! first github_repository,
# then version
github_repository: ONLYOFFICE/onlyoffice-nextcloud
version: 7.5.4
release_filename: onlyoffice.tar.gz
enabled: true enabled: true
setupApps: setupApps:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment