mirror of
https://github.com/YunoHost-Apps/onlyoffice_ynh.git
synced 2024-09-03 19:56:11 +02:00
Merge pull request #9 from yalh76/master
Apply last example_ynh + Fix scripts
This commit is contained in:
commit
96f2543def
15 changed files with 746 additions and 582 deletions
54
README.md
54
README.md
|
@ -1,34 +1,42 @@
|
||||||
# OnlyOffice app for YunoHost
|
# OnlyOffice for YunoHost
|
||||||
|
|
||||||
|
[](https://dash.yunohost.org/appci/app/onlyoffice)
|
||||||
|
[](https://install-app.yunohost.org/?app=onlyoffice)
|
||||||
|
|
||||||
|
> *This package allow you to install OnlyOffice quickly and simply on a YunoHost server.
|
||||||
|
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||||
|
|
||||||
|
## Overview
|
||||||
OnlyOffice Document Server
|
OnlyOffice Document Server
|
||||||
|
|
||||||
- [Yunohost project](https://yunohost.org)
|
**Shipped version:** 5.2.8
|
||||||
- [OnlyOffice website](https://www.onlyoffice.com)
|
|
||||||
|
|
||||||

|
## YunoHost specific features
|
||||||
|
|
||||||
[](https://dash.yunohost.org/appci/app/onlyoffice_ynh)
|
#### Supported architectures
|
||||||
[](https://install-app.yunohost.org/?app=onlyoffice)
|
|
||||||
|
|
||||||
### Version
|
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/onlyoffice/)
|
||||||
|
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/onlyoffice/)
|
||||||
|
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/onlyoffice/)
|
||||||
|
|
||||||
1. Master = Is stable and work version
|
## Links
|
||||||
|
|
||||||
2. BETA_VERSION = Beta is version for multi-instances and add possibility to install on same domain as nextcloud (not work need fix).
|
* Report a bug: https://github.com/YunoHost-Apps/onlyoffice_ynh/issues
|
||||||
|
* App website: https://www.onlyoffice.com
|
||||||
|
* Github App website: https://github.com/ONLYOFFICE/CommunityServer
|
||||||
|
* YunoHost website: https://yunohost.org/
|
||||||
|
|
||||||
3. YHN_VERSION = This version respect rules of yunohost for app install (not work need fix).
|
---
|
||||||
|
|
||||||
### Installing guide
|
Developers info
|
||||||
|
----------------
|
||||||
1. App can be installed by YunoHost **admin web-interface** or by **running following command**:
|
|
||||||
|
|
||||||
$ sudo yunohost app install https://github.com/YunoHost-Apps/onlyoffice_ynh
|
|
||||||
|
|
||||||
$ sudo yunohost app install --debug https://github.com/YunoHost-Apps/onlyoffice_ynh
|
|
||||||
|
|
||||||
2. Need to restart yunohost.
|
|
||||||
|
|
||||||
### Upgrade this package:
|
|
||||||
|
|
||||||
$ sudo yunohost app upgrade --verbose example -u https://github.com/YunoHost-Apps/onlyoffice_ynh
|
|
||||||
|
|
||||||
|
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
|
||||||
|
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/onlyoffice_ynh/tree/testing).
|
||||||
|
|
||||||
|
To try the testing branch, please proceed like that.
|
||||||
|
```
|
||||||
|
sudo yunohost app install https://github.com/YunoHost-Apps/onlyoffice_ynh/tree/testing --debug
|
||||||
|
or
|
||||||
|
sudo yunohost app upgrade onlyoffice -u https://github.com/YunoHost-Apps/onlyoffice_ynh/tree/testing --debug
|
||||||
|
```
|
||||||
|
|
|
@ -6,31 +6,29 @@
|
||||||
;; Test complet
|
;; Test complet
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld" (DOMAIN)
|
||||||
path="/" (PATH)
|
path="/path" (PATH)
|
||||||
|
nextclouddomain="domain.tld"
|
||||||
is_public=1 (PUBLIC|public=1|private=0)
|
is_public=1 (PUBLIC|public=1|private=0)
|
||||||
# password="pass"
|
|
||||||
# nextclouddomain="domain.tld"
|
|
||||||
port="9980" (PORT)
|
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=0
|
setup_sub_dir=1
|
||||||
setup_root=1
|
setup_root=1
|
||||||
setup_nourl=0
|
setup_nourl=0
|
||||||
setup_private=0
|
setup_private=1
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
|
upgrade=1 from_commit=c7d09d7f15a01e85e0354561d737523e1cb18749
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=0
|
||||||
incorrect_path=1
|
incorrect_path=1
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
change_url=0
|
change_url=1
|
||||||
;;; Levels
|
;;; Levels
|
||||||
Level 1=auto
|
Level 1=auto
|
||||||
Level 2=auto
|
Level 2=auto
|
||||||
Level 3=auto
|
Level 3=auto
|
||||||
# Level 4:
|
# Level 4: (This app supports the Nextcloud LDAP auth)
|
||||||
Level 4=1 (This app supports the Nextcloud LDAP auth)
|
Level 4=1
|
||||||
# Level 5:
|
|
||||||
Level 5=auto
|
Level 5=auto
|
||||||
Level 6=auto
|
Level 6=auto
|
||||||
Level 7=auto
|
Level 7=auto
|
||||||
|
|
|
@ -1,244 +0,0 @@
|
||||||
{
|
|
||||||
"statsd": {
|
|
||||||
"useMetrics": false,
|
|
||||||
"host": "localhost",
|
|
||||||
"port": "8125",
|
|
||||||
"prefix": "ds."
|
|
||||||
},
|
|
||||||
"log": {
|
|
||||||
"filePath": "",
|
|
||||||
"options": {
|
|
||||||
"reloadSecs": 60,
|
|
||||||
"replaceConsole": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"queue": {
|
|
||||||
"visibilityTimeout": 300,
|
|
||||||
"retentionPeriod": 900
|
|
||||||
},
|
|
||||||
"storage": {
|
|
||||||
"name": "storage-fs",
|
|
||||||
"fs": {
|
|
||||||
"folderPath": "",
|
|
||||||
"urlExpires": 900,
|
|
||||||
"secretString": "onlyoffice"
|
|
||||||
},
|
|
||||||
"region": "",
|
|
||||||
"endpoint": "http://localhost/s3",
|
|
||||||
"bucketName": "cache",
|
|
||||||
"storageFolderName": "files",
|
|
||||||
"urlExpires": 604800,
|
|
||||||
"accessKeyId": "AKID",
|
|
||||||
"secretAccessKey": "SECRET",
|
|
||||||
"useRequestToGetUrl": false,
|
|
||||||
"useSignedUrl": false,
|
|
||||||
"externalHost": ""
|
|
||||||
},
|
|
||||||
"rabbitmq": {
|
|
||||||
"url": "amqp://guest:guest@localhost:5672",
|
|
||||||
"socketOptions": {},
|
|
||||||
"exchangepubsub": "ds.pubsub",
|
|
||||||
"queueconverttask": "ds.converttask",
|
|
||||||
"queueconvertresponse": "ds.convertresponse",
|
|
||||||
"exchangeconvertdead": "ds.exchangeconvertdead",
|
|
||||||
"queueconvertdead": "ds.convertdead"
|
|
||||||
},
|
|
||||||
"dnscache": {
|
|
||||||
"enable" : true,
|
|
||||||
"ttl" : 300,
|
|
||||||
"cachesize" : 1000
|
|
||||||
},
|
|
||||||
"services": {
|
|
||||||
"CoAuthoring": {
|
|
||||||
"server": {
|
|
||||||
"port": 8000,
|
|
||||||
"workerpercpu": 1,
|
|
||||||
"mode": "development",
|
|
||||||
"limits_tempfile_upload": 104857600,
|
|
||||||
"limits_image_size": 26214400,
|
|
||||||
"limits_image_download_timeout": 120,
|
|
||||||
"callbackRequestTimeout": 120,
|
|
||||||
"healthcheckfilepath": "../public/healthcheck.docx",
|
|
||||||
"savetimeoutdelay": 5000,
|
|
||||||
"edit_singleton": false,
|
|
||||||
"forgottenfiles": "forgotten",
|
|
||||||
"forgottenfilesname": "output",
|
|
||||||
"maxRequestChanges": 20000,
|
|
||||||
"openProtectedFile": true
|
|
||||||
},
|
|
||||||
"requestDefaults": {
|
|
||||||
"headers": {
|
|
||||||
"userAgent": "Node.js/6.13"
|
|
||||||
},
|
|
||||||
"rejectUnauthorized": false
|
|
||||||
},
|
|
||||||
"autoAssembly": {
|
|
||||||
"enable": false,
|
|
||||||
"interval": "5m",
|
|
||||||
"step": "1m"
|
|
||||||
},
|
|
||||||
"utils": {
|
|
||||||
"utils_common_fontdir": "null",
|
|
||||||
"utils_fonts_search_patterns": "*.ttf;*.ttc;*.otf",
|
|
||||||
"resource_expires": 31536000,
|
|
||||||
"limits_image_types_upload": "jpg;png;gif;bmp"
|
|
||||||
},
|
|
||||||
"sql": {
|
|
||||||
"type": "postgres",
|
|
||||||
"tableChanges": "doc_changes",
|
|
||||||
"tableResult": "task_result",
|
|
||||||
"dbHost": "localhost",
|
|
||||||
"dbPort": 5432,
|
|
||||||
"dbName": "onlyoffice",
|
|
||||||
"dbUser": "onlyoffice",
|
|
||||||
"dbPass": "onlyoffice",
|
|
||||||
"charset": "utf8",
|
|
||||||
"connectionlimit": 10,
|
|
||||||
"max_allowed_packet": 1048575
|
|
||||||
},
|
|
||||||
"redis": {
|
|
||||||
"name": "redis",
|
|
||||||
"prefix": "ds:",
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 6379
|
|
||||||
},
|
|
||||||
"pubsub": {
|
|
||||||
"name": "pubsubRabbitMQ",
|
|
||||||
"maxChanges": 1000
|
|
||||||
},
|
|
||||||
"expire": {
|
|
||||||
"saveLock": 60,
|
|
||||||
"presence": 300,
|
|
||||||
"locks": 604800,
|
|
||||||
"changeindex": 86400,
|
|
||||||
"lockDoc": 30,
|
|
||||||
"message": 86400,
|
|
||||||
"lastsave": 604800,
|
|
||||||
"forcesave": 604800,
|
|
||||||
"saved": 3600,
|
|
||||||
"documentsCron": "0 */2 * * * *",
|
|
||||||
"files": 86400,
|
|
||||||
"filesCron": "00 00 */1 * * *",
|
|
||||||
"filesremovedatonce": 100,
|
|
||||||
"sessionidle": "0",
|
|
||||||
"sessionabsolute": "30d",
|
|
||||||
"sessionclosecommand": "2m",
|
|
||||||
"pemStdTTL": "1h",
|
|
||||||
"pemCheckPeriod": "10m",
|
|
||||||
"updateVersionStatus": "5m"
|
|
||||||
},
|
|
||||||
"ipfilter": {
|
|
||||||
"rules": [{"address": "*", "allowed": true}],
|
|
||||||
"useforrequest": false,
|
|
||||||
"errorcode": 401
|
|
||||||
},
|
|
||||||
"secret": {
|
|
||||||
"browser": {"string": "secret", "file": "", "tenants": {}},
|
|
||||||
"inbox": {"string": "secret", "file": "", "tenants": {}},
|
|
||||||
"outbox": {"string": "secret", "file": ""},
|
|
||||||
"session": {"string": "secret", "file": ""}
|
|
||||||
},
|
|
||||||
"token": {
|
|
||||||
"enable": {
|
|
||||||
"browser": false,
|
|
||||||
"request": {
|
|
||||||
"inbox": false,
|
|
||||||
"outbox": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"browser": {
|
|
||||||
"secretFromInbox": true
|
|
||||||
},
|
|
||||||
"inbox": {
|
|
||||||
"header": "Authorization",
|
|
||||||
"prefix": "Bearer ",
|
|
||||||
"inBody": false
|
|
||||||
},
|
|
||||||
"outbox": {
|
|
||||||
"header": "Authorization",
|
|
||||||
"prefix": "Bearer ",
|
|
||||||
"algorithm": "HS256",
|
|
||||||
"expires": "5m",
|
|
||||||
"inBody": false
|
|
||||||
},
|
|
||||||
"session": {
|
|
||||||
"algorithm": "HS256",
|
|
||||||
"expires": "30d"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"plugins": {
|
|
||||||
"uri": "/sdkjs-plugins",
|
|
||||||
"autostart": []
|
|
||||||
},
|
|
||||||
"editor":{
|
|
||||||
"spellcheckerUrl": "/spellchecker",
|
|
||||||
"reconnection":{
|
|
||||||
"attempts": 50,
|
|
||||||
"delay": "2s"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"sockjs": {
|
|
||||||
"sockjs_url": "",
|
|
||||||
"websocket": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"license" : {
|
|
||||||
"license_file": "",
|
|
||||||
"warning_limit_percents": "70"
|
|
||||||
},
|
|
||||||
"FileConverter": {
|
|
||||||
"converter": {
|
|
||||||
"maxDownloadBytes": 104857600,
|
|
||||||
"downloadTimeout": 120,
|
|
||||||
"downloadAttemptMaxCount": 3,
|
|
||||||
"downloadAttemptDelay": 1000,
|
|
||||||
"maxprocesscount": 1,
|
|
||||||
"fontDir": "null",
|
|
||||||
"presentationThemesDir": "null",
|
|
||||||
"x2tPath": "null",
|
|
||||||
"docbuilderPath": "null",
|
|
||||||
"docbuilderAllFontsPath": "null",
|
|
||||||
"args": "",
|
|
||||||
"spawnOptions": {},
|
|
||||||
"errorfiles": "",
|
|
||||||
"streamWriterBufferSize": 8388608,
|
|
||||||
"maxRedeliveredCount": 2,
|
|
||||||
"inputLimits": [
|
|
||||||
{
|
|
||||||
"type": "docx;dotx;docm;dotm",
|
|
||||||
"zip": {
|
|
||||||
"uncompressed": "50MB",
|
|
||||||
"template": "*.xml"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "xlsx;xltx;xlsm;xltm",
|
|
||||||
"zip": {
|
|
||||||
"uncompressed": "300MB",
|
|
||||||
"template": "*.xml"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "pptx;ppsx;potx;pptm;ppsm;potm",
|
|
||||||
"zip": {
|
|
||||||
"uncompressed": "50MB",
|
|
||||||
"template": "*.xml"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"FileStorage": {
|
|
||||||
"host": "",
|
|
||||||
"port": 4567,
|
|
||||||
"directory": "",
|
|
||||||
"silent": true
|
|
||||||
},
|
|
||||||
"SpellChecker": {
|
|
||||||
"server": {
|
|
||||||
"port": 8080,
|
|
||||||
"mode": "development"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
Section: misc
|
|
||||||
Priority: optional
|
|
||||||
Package: nodejs
|
|
||||||
Version: 8.0.0
|
|
||||||
Depends:
|
|
||||||
Architecture: all
|
|
||||||
Description: Fake package for nodejs
|
|
|
@ -1,7 +0,0 @@
|
||||||
Section: misc
|
|
||||||
Priority: optional
|
|
||||||
Package: postgresql-client
|
|
||||||
Version: 9.1
|
|
||||||
Depends:
|
|
||||||
Architecture: all
|
|
||||||
Description: Fake package for postgresql-client
|
|
|
@ -1,14 +1,14 @@
|
||||||
location ^~ __PATH__/ {
|
location ^~ __PATH__/ {
|
||||||
proxy_pass http://127.0.0.1:__PORT__;
|
proxy_pass http://127.0.0.1:__PORT__/;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
#proxy_set_header Connection $proxy_connection;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_set_header X-Forwarded-Host $server_name__SUB_PATH__;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
add_header X-Frame-Options "ALLOW-FROM https://__NEXTCLOUDDOMAIN__" always;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Host $server_name;
|
|
||||||
add_header X-Frame-Options "ALLOW-FROM https://__NEXTCLOUDDOMAIN__/";
|
|
||||||
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
}
|
}
|
|
@ -1,70 +0,0 @@
|
||||||
include /etc/nginx/includes/onlyoffice-http.conf;
|
|
||||||
|
|
||||||
## Normal HTTP host
|
|
||||||
server {
|
|
||||||
listen 0.0.0.0:80;
|
|
||||||
listen [::]:80 default_server;
|
|
||||||
server_name _;
|
|
||||||
server_tokens off;
|
|
||||||
|
|
||||||
## Redirects all traffic to the HTTPS host
|
|
||||||
root /nowhere; ## root doesn't have to be a valid path since we are redirecting
|
|
||||||
rewrite ^ https://$host$request_uri? permanent;
|
|
||||||
}
|
|
||||||
|
|
||||||
#HTTP host for internal services
|
|
||||||
server {
|
|
||||||
listen 127.0.0.1:80;
|
|
||||||
listen [::1]:80;
|
|
||||||
server_name localhost;
|
|
||||||
server_tokens off;
|
|
||||||
|
|
||||||
include /etc/nginx/includes/onlyoffice-documentserver-common.conf;
|
|
||||||
include /etc/nginx/includes/onlyoffice-documentserver-docservice.conf;
|
|
||||||
}
|
|
||||||
|
|
||||||
## HTTPS host
|
|
||||||
server {
|
|
||||||
listen 0.0.0.0:443 ssl;
|
|
||||||
listen [::]:443 ssl default_server;
|
|
||||||
server_tokens off;
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
|
|
||||||
## Strong SSL Security
|
|
||||||
## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
|
|
||||||
ssl on;
|
|
||||||
ssl_certificate {{SSL_CERTIFICATE_PATH}};
|
|
||||||
ssl_certificate_key {{SSL_KEY_PATH}};
|
|
||||||
ssl_verify_client off;
|
|
||||||
|
|
||||||
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
|
|
||||||
|
|
||||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
|
||||||
ssl_session_cache builtin:1000 shared:SSL:10m;
|
|
||||||
|
|
||||||
ssl_prefer_server_ciphers on;
|
|
||||||
|
|
||||||
add_header Strict-Transport-Security max-age=31536000;
|
|
||||||
# add_header X-Frame-Options SAMEORIGIN;
|
|
||||||
add_header X-Content-Type-Options nosniff;
|
|
||||||
|
|
||||||
## [Optional] If your certficate has OCSP, enable OCSP stapling to reduce the overhead and latency of running SSL.
|
|
||||||
## Replace with your ssl_trusted_certificate. For more info see:
|
|
||||||
## - https://medium.com/devops-programming/4445f4862461
|
|
||||||
## - https://www.ruby-forum.com/topic/4419319
|
|
||||||
## - https://www.digitalocean.com/community/tutorials/how-to-configure-ocsp-stapling-on-apache-and-nginx
|
|
||||||
# ssl_stapling on;
|
|
||||||
# ssl_stapling_verify on;
|
|
||||||
# ssl_trusted_certificate /etc/nginx/ssl/stapling.trusted.crt;
|
|
||||||
# resolver 208.67.222.222 208.67.222.220 valid=300s; # Can change to your DNS resolver if desired
|
|
||||||
# resolver_timeout 10s;
|
|
||||||
|
|
||||||
## [Optional] Generate a stronger DHE parameter:
|
|
||||||
## cd /etc/ssl/certs
|
|
||||||
## sudo openssl dhparam -out dhparam.pem 4096
|
|
||||||
##
|
|
||||||
# ssl_dhparam /etc/ssl/certs/dhparam.pem;
|
|
||||||
|
|
||||||
include /etc/nginx/includes/onlyoffice-documentserver-*.conf;
|
|
||||||
|
|
||||||
}
|
|
|
@ -3,26 +3,26 @@
|
||||||
"id": "onlyoffice",
|
"id": "onlyoffice",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"description": {
|
"description": {
|
||||||
"en": "OnlyOffice package for YunoHost.",
|
"en": "OnlyOffice Document Server.",
|
||||||
"fr": "OnlyOffice pour YunoHost."
|
"fr": "Serveur de documents OnlyOffice."
|
||||||
},
|
},
|
||||||
"url": "https://www.plex.tv/",
|
"version": "5.2.8~ynh1",
|
||||||
"license": "free",
|
"url": "https://www.onlyoffice.com",
|
||||||
|
"license": "GPL-3.0-or-later",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "liberodark",
|
"name": "liberodark",
|
||||||
"email": "liberodark@gmail.com"
|
"email": "liberodark@gmail.com"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 2.7.2"
|
"yunohost": ">= 3.4"
|
||||||
},
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx",
|
"nginx"
|
||||||
"php5-fpm",
|
|
||||||
"mysql"
|
|
||||||
],
|
],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install": [{
|
"install" : [
|
||||||
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain",
|
||||||
"ask": {
|
"ask": {
|
||||||
|
@ -31,7 +31,16 @@
|
||||||
},
|
},
|
||||||
"example": "example.com"
|
"example": "example.com"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "path",
|
||||||
|
"type": "path",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a path for OnlyOffice",
|
||||||
|
"fr": "Choisissez un chemin pour OnlyOffice"
|
||||||
|
},
|
||||||
|
"example": "/onlyoffice",
|
||||||
|
"default": "/onlyoffice"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "nextclouddomain",
|
"name": "nextclouddomain",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
@ -42,26 +51,14 @@
|
||||||
"example": "example.com",
|
"example": "example.com",
|
||||||
"default": "example.com"
|
"default": "example.com"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
"name": "path",
|
|
||||||
"type": "path",
|
|
||||||
"ask": {
|
|
||||||
"en": "Choose a path for OnlyOffice only / is accepted",
|
|
||||||
"fr": "Choisissez un chemin pour OnlyOffice uniquement / est accepté"
|
|
||||||
},
|
|
||||||
"example": "/",
|
|
||||||
"default": "/"
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Is it a public site ?",
|
"en": "Is it a public application?",
|
||||||
"fr": "Est-ce un site public ?"
|
"fr": "Est-ce une application publique ?"
|
||||||
},
|
},
|
||||||
"default": "true"
|
"default": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,15 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# PERSONAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
source="https://github.com/ONLYOFFICE/DocumentServer/releases/download/ONLYOFFICE-DocumentServer-5.2.8/onlyoffice-documentserver_amd64.deb"
|
||||||
|
version="5.2.8"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# EXPERIMENTAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# FUTURE OFFICIAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
|
@ -1,34 +1,69 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
#=================================================
|
||||||
set -eu
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# See comments in install script
|
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
source ../settings/scripts/_common.sh
|
||||||
|
|
||||||
# Source YunoHost helpers
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Backup sources & data
|
#=================================================
|
||||||
# Note: the last argument is where to save this path, see the restore script.
|
# MANAGE SCRIPT FAILURE
|
||||||
ynh_backup "/var/www/${app}" "sources"
|
#=================================================
|
||||||
|
|
||||||
### MySQL (remove if not used) ###
|
ynh_clean_setup () {
|
||||||
# If a MySQL database is used:
|
### Remove this function if there's nothing to clean before calling the remove script.
|
||||||
# # Dump the database
|
true
|
||||||
# dbname=$app
|
}
|
||||||
# dbuser=$app
|
# Exit if an error occurs during the execution of the script
|
||||||
# dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
ynh_abort_if_errors
|
||||||
# mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql
|
|
||||||
### MySQL end ###
|
|
||||||
|
|
||||||
# Copy NGINX configuration
|
#=================================================
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
# LOAD SETTINGS
|
||||||
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
|
#=================================================
|
||||||
ynh_backup "/etc/onlyoffice/documentserver/default.json"
|
ynh_print_info "Loading installation settings..."
|
||||||
|
|
||||||
### PHP (remove if not used) ###
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
# If a dedicated php-fpm process is used:
|
|
||||||
# # Copy PHP-FPM pool configuration
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
# ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf"
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
### PHP end ###
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD BACKUP STEPS
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Backing up the main app directory..."
|
||||||
|
|
||||||
|
ynh_backup "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Backing up nginx web server configuration..."
|
||||||
|
|
||||||
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE POSTGRESQL DATABASE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Backing up the PostgreSQL database..."
|
||||||
|
|
||||||
|
ynh_psql_dump_db "$db_name" > db.sql
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC BACKUP
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Backing up the configuration..."
|
||||||
|
|
||||||
|
ynh_backup "/etc/onlyoffice"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
123
scripts/change_url
Normal file
123
scripts/change_url
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC STARTING
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RETRIEVE ARGUMENTS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
old_domain=$YNH_APP_OLD_DOMAIN
|
||||||
|
old_path=$YNH_APP_OLD_PATH
|
||||||
|
|
||||||
|
new_domain=$YNH_APP_NEW_DOMAIN
|
||||||
|
new_path=$YNH_APP_NEW_PATH
|
||||||
|
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Loading installation settings..."
|
||||||
|
|
||||||
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
port=$(ynh_app_setting_get $app port)
|
||||||
|
nextclouddomain=$(ynh_app_setting_get $app nextclouddomain)
|
||||||
|
|
||||||
|
# Add settings here as needed by your application
|
||||||
|
#db_name=$(ynh_app_setting_get "$app" db_name)
|
||||||
|
#db_pwd=$(ynh_app_setting_get $app db_pwd)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK THE SYNTAX OF THE PATHS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
test -n "$old_path" || old_path="/"
|
||||||
|
test -n "$new_path" || new_path="/"
|
||||||
|
new_path=$(ynh_normalize_url_path $new_path)
|
||||||
|
old_path=$(ynh_normalize_url_path $old_path)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
change_domain=0
|
||||||
|
if [ "$old_domain" != "$new_domain" ]
|
||||||
|
then
|
||||||
|
change_domain=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
change_path=0
|
||||||
|
if [ "$old_path" != "$new_path" ]
|
||||||
|
then
|
||||||
|
change_path=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD MODIFICATIONS
|
||||||
|
#=================================================
|
||||||
|
# MODIFY URL IN NGINX CONF
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Updating nginx web server configuration..."
|
||||||
|
|
||||||
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
|
# Change the path in the nginx config file
|
||||||
|
if [ $change_path -eq 1 ]
|
||||||
|
then
|
||||||
|
# Make a backup of the original nginx config file if modified
|
||||||
|
ynh_backup_if_checksum_is_different "$nginx_conf_path"
|
||||||
|
# Set global variables for nginx helper
|
||||||
|
domain="$old_domain"
|
||||||
|
path_url="$new_path"
|
||||||
|
|
||||||
|
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
||||||
|
if [ $new_path = "/" ]; then
|
||||||
|
ynh_replace_string "__SUB_PATH__" "" "../conf/nginx.conf"
|
||||||
|
else
|
||||||
|
ynh_replace_string "__SUB_PATH__" "$new_path" "../conf/nginx.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create a dedicated nginx config
|
||||||
|
ynh_add_nginx_config "nextclouddomain"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Change the domain for nginx
|
||||||
|
if [ $change_domain -eq 1 ]
|
||||||
|
then
|
||||||
|
# Delete file checksum for the old conf file location
|
||||||
|
ynh_delete_file_checksum "$nginx_conf_path"
|
||||||
|
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||||
|
# Store file checksum for the new config file location
|
||||||
|
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
|
ynh_replace_string "X-Frame-Options : ALLOW-FROM https://$nextclouddomain" "X-Frame-Options : SAMEORIGIN" "/etc/nginx/conf.d/$old_domain.conf"
|
||||||
|
ynh_replace_string "X-Frame-Options : SAMEORIGIN" "X-Frame-Options : ALLOW-FROM https://$nextclouddomain" "/etc/nginx/conf.d/$new_domain.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC MODIFICATIONS
|
||||||
|
#=================================================
|
||||||
|
# ...
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALISATION
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Reloading nginx web server..."
|
||||||
|
|
||||||
|
systemctl reload nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Change of URL completed for $app"
|
185
scripts/install
185
scripts/install
|
@ -6,7 +6,7 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
#source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -24,7 +24,6 @@ ynh_abort_if_errors
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Retrieve arguments
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
@ -45,32 +44,35 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Validating installation parameters..."
|
||||||
|
|
||||||
### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
|
### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
|
||||||
### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
|
### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
|
||||||
final_path=/opt/yunohost/$app
|
final_path=/var/www/$app
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
|
|
||||||
# Normalize the url path syntax
|
# Normalize the url path syntax
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
path_url=$(ynh_normalize_url_path $path_url)
|
||||||
|
|
||||||
# Check web path availability
|
|
||||||
ynh_webpath_available $domain $path_url
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register $app $domain $path_url
|
ynh_webpath_register $app $domain $path_url
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Storing installation settings..."
|
||||||
|
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_app_setting_set $app domain $domain
|
||||||
ynh_app_setting_set $app nextclouddomain $nextclouddomain
|
|
||||||
ynh_app_setting_set $app path $path_url
|
ynh_app_setting_set $app path $path_url
|
||||||
ynh_app_setting_set $app is_public $is_public
|
ynh_app_setting_set $app is_public $is_public
|
||||||
|
ynh_app_setting_set $app nextclouddomain $nextclouddomain
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIND AND OPEN A PORT
|
# FIND AND OPEN A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring firewall..."
|
||||||
|
|
||||||
### Use these lines if you have to open a port for the application
|
### Use these lines if you have to open a port for the application
|
||||||
### `ynh_find_port` will find the first available port starting from the given port.
|
### `ynh_find_port` will find the first available port starting from the given port.
|
||||||
|
@ -78,98 +80,125 @@ ynh_app_setting_set $app is_public $is_public
|
||||||
### - Remove the section "CLOSE A PORT" in the remove script
|
### - Remove the section "CLOSE A PORT" in the remove script
|
||||||
|
|
||||||
# Find a free port
|
# Find a free port
|
||||||
port=$(ynh_find_port 9980)
|
port=$(ynh_find_port 8095)
|
||||||
# Open this port
|
# Open this port
|
||||||
yunohost firewall allow --no-upnp TCP $port 2>&1
|
#ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
||||||
ynh_app_setting_set $app port $port
|
ynh_app_setting_set $app port $port
|
||||||
|
|
||||||
#==============================================
|
|
||||||
# INSTALL POSTGRES
|
|
||||||
#==============================================
|
|
||||||
|
|
||||||
#Master
|
|
||||||
#ynh_install_app_dependencies postgresql redis-server apt-transport-https libasound2 libboost-regex-dev libboost1.62-dev libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libfontenc1 libgail-common libgail18 libgconf-2-4 libgconf2-4 libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libglu1-mesa libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libgtkglext1 libice6 libicu-dev libllvm3.9 libpangox-1.0-0 libpciaccess0 librsvg2-2 librsvg2-common libsm6 libtxc-dxtn-s2tc libx11-xcb1 libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-sync1 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxfont1 libxfont2 libxi6 libxinerama1 libxkbfile1 libxmu6 libxrandr2 libxshmfence1 libxt6 libxtst6 libxxf86vm1 postgresql-client pwgen python-meld3 supervisor x11-xkb-utils xfonts-base xfonts-encodings xfonts-utils xserver-common xvfb
|
|
||||||
|
|
||||||
#Beta
|
|
||||||
sudo apt-get install -y postgresql redis-server rabbitmq-server apt-transport-https
|
|
||||||
|
|
||||||
#Old
|
|
||||||
# ynh_install_app_dependencies postgresql redis-server rabbitmq-server apt-transport-https
|
|
||||||
# ynh_install_app_dependencies postgresql redis-server rabbitmq-server apt-transport-https libcurl3 libxml2 supervisor fonts-dejavu fonts-liberation ttf-mscorefonts-installer fonts-crosextra-carlito fonts-takao-gothic fonts-opensymbol
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL NODEJS
|
# ADD NODEJS REPOSITORY
|
||||||
#=================================================
|
#=================================================
|
||||||
# Use Helper instead of package from the repo
|
ynh_print_info "Add nodejs repository..."
|
||||||
|
|
||||||
#Master
|
|
||||||
#ynh_install_nodejs 8.12.0
|
|
||||||
|
|
||||||
#Beta
|
|
||||||
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
|
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
|
||||||
|
|
||||||
#===============================================
|
#=================================================
|
||||||
# ADD ONLYOFFCE REPOSITORY
|
# ADD ONLYOFFICE REPOSITORY
|
||||||
#===============================================
|
#=================================================
|
||||||
|
ynh_print_info "Add OnlyOffice repository..."
|
||||||
|
|
||||||
#Beta no for Master version
|
|
||||||
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
|
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
|
||||||
echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
|
echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
|
||||||
ynh_package_update
|
|
||||||
|
|
||||||
#==============================================
|
#=================================================
|
||||||
# CREATE DB
|
# INSTALL DEPENDENCIES
|
||||||
#==============================================
|
#=================================================
|
||||||
|
ynh_print_info "Installing dependencies..."
|
||||||
|
|
||||||
sudo -i -u postgres psql -c "CREATE DATABASE onlyoffice;"
|
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
|
||||||
sudo -i -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
|
### Those deb packages will be installed as dependencies of this package.
|
||||||
sudo -i -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"
|
### If you're not using this helper:
|
||||||
|
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
|
||||||
|
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
||||||
|
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
||||||
|
|
||||||
#==============================================
|
ynh_install_app_dependencies postgresql libstdc++6 redis-server rabbitmq-server
|
||||||
# DEFINE PORT
|
|
||||||
#==============================================
|
|
||||||
|
|
||||||
echo onlyoffice-documentserver onlyoffice/ds-port select ${port} | sudo debconf-set-selections
|
#=================================================
|
||||||
|
# CREATE A POSTGRESQL DATABASE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Creating a PostgreSQL database..."
|
||||||
|
|
||||||
#==============================================
|
### Use these lines if you need a database for the application.
|
||||||
# INSTALL ONLYOFFICE
|
### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password.
|
||||||
#==============================================
|
### The password will be stored as 'mysqlpwd' into the app settings,
|
||||||
|
### and will be available as $db_pwd
|
||||||
|
### If you're not using these lines:
|
||||||
|
### - Remove the section "BACKUP THE POSTGRESQL DATABASE" in the backup script
|
||||||
|
### - Remove also the section "REMOVE THE POSTGRESQL DATABASE" in the remove script
|
||||||
|
### - As well as the section "RESTORE THE POSTGRESQL DATABASE" in the restore script
|
||||||
|
|
||||||
#Master
|
db_name=$(ynh_sanitize_dbid $app)
|
||||||
#ynh_package_install_from_equivs ../conf/fakenode-deps.control
|
db_pwd="onlyoffice"
|
||||||
#ynh_package_install_from_equivs ../conf/fakepostgres-deps.control
|
ynh_app_setting_set $app db_name $db_name
|
||||||
#wget --no-verbose https://github.com/ONLYOFFICE/DocumentServer/releases/download/ONLYOFFICE-DocumentServer-5.2.3/onlyoffice-documentserver_amd64.deb
|
ynh_app_setting_set $app db_pwd $db_pwd
|
||||||
#dpkg --install onlyoffice-documentserver_amd64.deb
|
ynh_psql_test_if_first_run
|
||||||
|
ynh_psql_create_db $db_name $db_name $db_pwd
|
||||||
|
|
||||||
#Beta
|
#=================================================
|
||||||
sudo apt-get install -y onlyoffice-documentserver
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Setting up source files..."
|
||||||
|
|
||||||
|
### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
|
||||||
|
### downloaded from an upstream source, like a git repository.
|
||||||
|
### `ynh_setup_source` use the file conf/app.src
|
||||||
|
|
||||||
|
ynh_app_setting_set $app final_path $final_path
|
||||||
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
#ynh_setup_source "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring nginx web server..."
|
||||||
|
|
||||||
|
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
||||||
|
if [ $path_url = "/" ]; then
|
||||||
|
ynh_replace_string "__SUB_PATH__" "" "../conf/nginx.conf"
|
||||||
|
else
|
||||||
|
ynh_replace_string "__SUB_PATH__" "$path_url" "../conf/nginx.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config "nextclouddomain"
|
ynh_add_nginx_config "nextclouddomain"
|
||||||
|
|
||||||
|
# Fix main domain X-Frame-Options
|
||||||
|
ynh_replace_string "X-Frame-Options : SAMEORIGIN" "X-Frame-Options : ALLOW-FROM https://$nextclouddomain" "/etc/nginx/conf.d/$domain.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring system user..."
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create $app $final_path
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC SETUP
|
||||||
|
#=================================================
|
||||||
|
# DEFINE PORT
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Define OnlyOffice server port..."
|
||||||
|
|
||||||
|
echo onlyoffice-documentserver onlyoffice/ds-port select ${port} | sudo debconf-set-selections
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL ONLYOFFICE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Install OnlyOffice..."
|
||||||
|
|
||||||
|
wget $source
|
||||||
|
apt install -y ./onlyoffice-documentserver_amd64.deb
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Fix https://github.com/ONLYOFFICE/onlyoffice-owncloud/issues/172#issuecomment-411746394
|
### `ynh_replace_string` is used to replace a string in a file.
|
||||||
cp -a ../conf/default.json /etc/onlyoffice/documentserver/default.json
|
### (It's compatible with sed regular expressions syntax)
|
||||||
|
|
||||||
# Fix Nextcloud http://dev.onlyoffice.org/viewtopic.php?f=53&t=10001
|
#ynh_replace_string "match_string" "replace_string" "$final_path/CONFIG_FILE"
|
||||||
#sed -i "/# Add headers to serve security.*/a \ \ \ \ add_header X-Frame-Options \"ALLOW-FROM https://$domain/\";" /etc/nginx/conf.d/$nextcloud_domain.d/nextcloud.conf
|
|
||||||
|
|
||||||
# Fix OnlyOffice http://dev.onlyoffice.org/viewtopic.php?f=53&t=10001
|
|
||||||
#sed -i "/# Add headers to serve security.*/a \ \ \ \ add_header X-Frame-Options \"ALLOW-FROM https://$domain/\";" /etc/nginx/conf.d/$domain.d/onlyoffice.conf
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
|
@ -194,19 +223,39 @@ cp -a ../conf/default.json /etc/onlyoffice/documentserver/default.json
|
||||||
### that really need such authorization.
|
### that really need such authorization.
|
||||||
|
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
#chown -R root: /etc/loolwsd
|
#chown -R $app: $final_path
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring SSOwat..."
|
||||||
|
|
||||||
# If app is public, add url to SSOWat conf as skipped_uris
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 1 ]; then
|
if [ $is_public -eq 1 ]
|
||||||
|
then
|
||||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
# unprotected_uris allows SSO credentials to be passed anyway.
|
||||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
ynh_app_setting_set $app unprotected_uris "/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Reload services
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Reloading nginx web server..."
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
supervisorctl restart all
|
|
||||||
|
#=================================================
|
||||||
|
# RELOAD ONLYOFFICE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Reloading OnlyOffice..."
|
||||||
|
|
||||||
|
supervisorctl stop all
|
||||||
|
supervisorctl start all
|
||||||
|
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Installation of $app completed"
|
||||||
|
|
|
@ -12,19 +12,44 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
port=$(ynh_app_setting_get $app port)
|
port=$(ynh_app_setting_get $app port)
|
||||||
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
# STOP ONLYOFFICE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Stopping OnlyOffice"
|
||||||
|
|
||||||
|
supervisorctl stop all
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE ONLYOFFICE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Removing OnlyOffice"
|
||||||
|
|
||||||
|
ynh_secure_remove /var/lib/dpkg/info/onlyoffice-documentserver.prerm
|
||||||
|
ynh_package_autopurge onlyoffice-documentserver
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE THE POSTGRESQL DATABASE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Removing the PostgreSQL database"
|
||||||
|
|
||||||
|
# Remove a database if it exists, along with the associated user
|
||||||
|
ynh_psql_remove_db $db_name $db_name
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing dependencies"
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
@ -32,6 +57,7 @@ ynh_remove_app_dependencies
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing app main directory"
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove "$final_path"
|
ynh_secure_remove "$final_path"
|
||||||
|
@ -39,6 +65,7 @@ ynh_secure_remove "$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing nginx web server configuration"
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
@ -49,8 +76,8 @@ ynh_remove_nginx_config
|
||||||
|
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
if yunohost firewall list | grep -q "\- $port$"
|
||||||
then
|
then
|
||||||
echo "Close port $port" >&2
|
ynh_print_info "Closing port $port"
|
||||||
yunohost firewall disallow TCP $port 2>&1
|
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -60,14 +87,14 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove a cron file
|
# Remove a cron file
|
||||||
ynh_secure_remove "/etc/cron.d/$app"
|
#ynh_secure_remove "/etc/cron.d/$app"
|
||||||
|
|
||||||
# Remove a directory securely
|
# Remove a directory securely
|
||||||
ynh_secure_remove "/etc/apt/sources.list.d/onlyoffice.list"
|
ynh_secure_remove "/etc/apt/sources.list.d/onlyoffice.list"
|
||||||
|
ynh_secure_remove "/etc/apt/sources.list.d/nodesource.list"
|
||||||
# Remove DB
|
ynh_secure_remove "/etc/onlyoffice"
|
||||||
sudo -i -u postgres psql -c "DROP DATABASE onlyoffice;"
|
ynh_secure_remove "/var/lib/onlyoffice"
|
||||||
sudo -i -u postgres psql -c "DROP USER onlyoffice;"
|
ynh_secure_remove "/var/cache/nginx/onlyoffice"
|
||||||
|
|
||||||
# Remove the log files
|
# Remove the log files
|
||||||
ynh_secure_remove "/var/log/$app/"
|
ynh_secure_remove "/var/log/$app/"
|
||||||
|
@ -77,6 +104,14 @@ ynh_secure_remove "/var/log/$app/"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing the dedicated system user"
|
||||||
|
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
|
gpasswd -d www-data onlyoffice
|
||||||
ynh_system_user_delete $app
|
ynh_system_user_delete $app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Removal of $app completed"
|
||||||
|
|
186
scripts/restore
186
scripts/restore
|
@ -1,52 +1,160 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Note: each files and directories you've saved using the ynh_backup helper
|
#=================================================
|
||||||
# will be located in the current directory, regarding the last argument.
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
source ../settings/scripts/_common.sh
|
||||||
set -eu
|
|
||||||
|
|
||||||
# See comments in install script
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
# Source YunoHost helpers
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Retrieve old app settings
|
#=================================================
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
# MANAGE SCRIPT FAILURE
|
||||||
path_url=$(ynh_app_setting_get "$app" path_url)
|
#=================================================
|
||||||
|
|
||||||
# Check domain/path availability
|
ynh_clean_setup () {
|
||||||
sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \
|
#### Remove this function if there's nothing to clean before calling the remove script.
|
||||||
|
true
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Loading settings..."
|
||||||
|
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
|
path_url=$(ynh_app_setting_get $app path)
|
||||||
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
|
db_pwd=$(ynh_app_setting_get $app db_pwd)
|
||||||
|
port=$(ynh_app_setting_get $app port)
|
||||||
|
nextclouddomain=$(ynh_app_setting_get $app nextclouddomain)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Validating restoration parameters..."
|
||||||
|
|
||||||
|
ynh_webpath_available $domain $path_url \
|
||||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||||
|
test ! -d $final_path \
|
||||||
|
|| ynh_die "There is already a directory: $final_path "
|
||||||
|
|
||||||
# Restore sources & data
|
#=================================================
|
||||||
src_path="/var/www/${app}"
|
# STANDARD RESTORATION STEPS
|
||||||
sudo cp -a ./sources "$src_path"
|
#=================================================
|
||||||
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Restore permissions to app files
|
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
# you may need to make some file and/or directory writeable by www-data (nginx user)
|
|
||||||
sudo chown -R root: "$src_path"
|
|
||||||
|
|
||||||
### MySQL (remove if not used) ###
|
# Fix main domain X-Frame-Options
|
||||||
# If a MySQL database is used:
|
ynh_replace_string "X-Frame-Options : SAMEORIGIN" "X-Frame-Options : ALLOW-FROM https://$nextclouddomain" "/etc/nginx/conf.d/$domain.conf"
|
||||||
# # Create and restore the database
|
|
||||||
# dbname=$app
|
|
||||||
# dbuser=$app
|
|
||||||
# dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
|
||||||
# ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
|
|
||||||
# ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./dump.sql
|
|
||||||
### MySQL end ###
|
|
||||||
|
|
||||||
# Restore NGINX configuration
|
#=================================================
|
||||||
sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
# RESTORE THE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Restoring the app main directory..."
|
||||||
|
|
||||||
### PHP (remove if not used) ###
|
ynh_restore_file "$final_path"
|
||||||
# If a dedicated php-fpm process is used:
|
|
||||||
# # Copy PHP-FPM pool configuration and reload the service
|
|
||||||
# sudo cp -a ./php-fpm.conf "/etc/php5/fpm/pool.d/${app}.conf"
|
|
||||||
# sudo service php5-fpm reload
|
|
||||||
### PHP end ###
|
|
||||||
|
|
||||||
# Restart webserver
|
#=================================================
|
||||||
sudo service nginx reload
|
# RECREATE THE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Recreating the dedicated system user..."
|
||||||
|
|
||||||
|
# Create the dedicated user (if not existing)
|
||||||
|
ynh_system_user_create $app $final_path
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE USER RIGHTS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Restore permissions on app files
|
||||||
|
chown -R $app: $final_path
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC RESTORATION
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Restoring the configuration..."
|
||||||
|
|
||||||
|
ynh_restore_file "/etc/onlyoffice"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ADD NODEJS REPOSITORY
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Add nodejs repository..."
|
||||||
|
|
||||||
|
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ADD ONLYOFFICE REPOSITORY
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Add OnlyOffice repository..."
|
||||||
|
|
||||||
|
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
|
||||||
|
echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REINSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Reinstalling dependencies..."
|
||||||
|
|
||||||
|
# Define and install dependencies
|
||||||
|
ynh_install_app_dependencies postgresql libstdc++6 redis-server rabbitmq-server
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Restoring the PostgreSQL database..."
|
||||||
|
|
||||||
|
ynh_psql_test_if_first_run
|
||||||
|
ynh_psql_create_db $db_name $db_name $db_pwd
|
||||||
|
ynh_psql_execute_file_as_root ./db.sql "$db_name"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# DEFINE PORT
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Define OnlyOffice server port..."
|
||||||
|
|
||||||
|
echo onlyoffice-documentserver onlyoffice/ds-port select ${port} | sudo debconf-set-selections
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REINSTALL ONLYOFFICE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Reinstalling OnlyOffice..."
|
||||||
|
|
||||||
|
wget $source
|
||||||
|
apt install -y ./onlyoffice-documentserver_amd64.deb
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Reloading nginx web server..."
|
||||||
|
|
||||||
|
systemctl reload nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RELOAD ONLYOFFICE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Reloading OnlyOffice..."
|
||||||
|
|
||||||
|
supervisorctl stop all
|
||||||
|
supervisorctl start all
|
||||||
|
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Restoration completed for $app"
|
||||||
|
|
207
scripts/upgrade
207
scripts/upgrade
|
@ -1,57 +1,182 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
#=================================================
|
||||||
set -eu
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Loading installation settings..."
|
||||||
|
|
||||||
# See comments in install script
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Source YunoHost helpers
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
source /usr/share/yunohost/helpers
|
path_url=$(ynh_app_setting_get $app path)
|
||||||
source _common.sh
|
is_public=$(ynh_app_setting_get $app is_public)
|
||||||
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
# Retrieve app settings
|
port=$(ynh_app_setting_get $app port)
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
nextclouddomain=$(ynh_app_setting_get $app nextclouddomain)
|
||||||
password=$(ynh_app_setting_get "$app" password)
|
|
||||||
is_public=$(ynh_app_setting_get "$app" is_public)
|
|
||||||
nextclouddomain=$(ynh_app_setting_get "$app" nextclouddomain)
|
|
||||||
|
|
||||||
|
|
||||||
# Set permissions to app files
|
|
||||||
# you may need to make some file and/or directory writeable by www-data (nginx user)
|
|
||||||
sudo chown -R root: $src_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE COLLABORA
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_package_update
|
ynh_print_info "Ensuring downward compatibility..."
|
||||||
ynh_install_app_dependencies loolwsd code-brand
|
|
||||||
|
|
||||||
|
# Fix is_public as a boolean value
|
||||||
|
if [ "$is_public" = "Yes" ]; then
|
||||||
|
ynh_app_setting_set $app is_public 1
|
||||||
|
is_public=1
|
||||||
|
elif [ "$is_public" = "No" ]; then
|
||||||
|
ynh_app_setting_set $app is_public 0
|
||||||
|
is_public=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If db_name doesn't exist, create it
|
||||||
|
if [ -z $db_name ]; then
|
||||||
|
db_name=$(ynh_sanitize_dbid $app)
|
||||||
|
ynh_app_setting_set $app db_name $db_name
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If final_path doesn't exist, create it
|
||||||
|
if [ -z $final_path ]; then
|
||||||
|
final_path=/var/www/$app
|
||||||
|
ynh_app_setting_set $app final_path $final_path
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Backing up the app before upgrading (may take a while)..."
|
||||||
|
|
||||||
|
# Backup the current version of the app
|
||||||
|
ynh_backup_before_upgrade
|
||||||
|
ynh_clean_setup () {
|
||||||
|
# restore it if the upgrade fails
|
||||||
|
ynh_restore_upgradebackup
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK THE PATH
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Normalize the URL path syntax
|
||||||
|
path_url=$(ynh_normalize_url_path $path_url)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring nginx web server..."
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
||||||
ynh_add_nginx_config
|
if [ $path_url = "/" ]; then
|
||||||
|
ynh_replace_string "__SUB_PATH__" "" "../conf/nginx.conf"
|
||||||
|
else
|
||||||
#=================================================
|
ynh_replace_string "__SUB_PATH__" "$path_url" "../conf/nginx.conf"
|
||||||
# UPGRADE CONFIG
|
|
||||||
#=================================================
|
|
||||||
cp -a ../conf/loolwsd.xml /etc/loolwsd
|
|
||||||
ynh_replace_string "__NEXTCLOUDDOMAIN__" "$nextcloud_domain" "/etc/loolwsd/loolwsd.xml"
|
|
||||||
ynh_replace_string "__PASSWORD__" "$password" "/etc/loolwsd/loolwsd.xml"
|
|
||||||
systemctl restart loolwsd
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# If app is public, add url to SSOWat conf as skipped_uris
|
|
||||||
if [[ $is_public -eq 1 ]]; then
|
|
||||||
# See install script
|
|
||||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Reload nginx service
|
# Create a dedicated nginx config
|
||||||
systemctl restart nginx
|
ynh_add_nginx_config "nextclouddomain"
|
||||||
systemctl restart loolwsd
|
|
||||||
|
|
||||||
|
# Fix main domain X-Frame-Options
|
||||||
|
ynh_replace_string "X-Frame-Options : SAMEORIGIN" "X-Frame-Options : ALLOW-FROM https://$nextclouddomain" "/etc/nginx/conf.d/$domain.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Upgrading dependencies..."
|
||||||
|
|
||||||
|
ynh_install_app_dependencies postgresql libstdc++6 redis-server rabbitmq-server
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Making sure dedicated system user exists..."
|
||||||
|
|
||||||
|
# Create a dedicated user (if not existing)
|
||||||
|
ynh_system_user_create $app $final_path
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC UPGRADE
|
||||||
|
#=================================================
|
||||||
|
# ADD NODEJS REPOSITORY
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Add nodejs repository..."
|
||||||
|
|
||||||
|
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ADD ONLYOFFICE REPOSITORY
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Add OnlyOffice repository..."
|
||||||
|
|
||||||
|
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
|
||||||
|
echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE ONLYOFFICE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Upgrading OnlyOffice..."
|
||||||
|
|
||||||
|
wget $source
|
||||||
|
apt install -y ./onlyoffice-documentserver_amd64.deb
|
||||||
|
|
||||||
|
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||||
|
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
||||||
|
#ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE"
|
||||||
|
# Recalculate and store the checksum of the file for the next upgrade.
|
||||||
|
#ynh_store_file_checksum "$final_path/CONFIG_FILE"
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# SECURE FILES AND DIRECTORIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Set permissions on app files
|
||||||
|
#chown -R root: $final_path
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP SSOWAT
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Upgrading SSOwat configuration..."
|
||||||
|
|
||||||
|
# Make app public if necessary
|
||||||
|
if [ $is_public -eq 1 ]
|
||||||
|
then
|
||||||
|
# unprotected_uris allows SSO credentials to be passed anyway
|
||||||
|
ynh_app_setting_set $app unprotected_uris "/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Reloading nginx web server..."
|
||||||
|
|
||||||
|
systemctl reload nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RELOAD ONLYOFFICE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Reloading OnlyOffice..."
|
||||||
|
|
||||||
|
supervisorctl stop all
|
||||||
|
supervisorctl start all
|
||||||
|
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Upgrade of $app completed"
|
||||||
|
|
Loading…
Add table
Reference in a new issue