mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 13:40:28 +03:00
x2t: init at 8.3.2
This commit is contained in:
parent
2c8d3f48d3
commit
ea0b776f71
16 changed files with 996 additions and 27 deletions
|
@ -31,6 +31,8 @@ in
|
|||
|
||||
package = lib.mkPackageOption pkgs "onlyoffice-documentserver" { };
|
||||
|
||||
x2t = lib.mkPackageOption pkgs "x2t" { };
|
||||
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 8000;
|
||||
|
@ -104,34 +106,53 @@ in
|
|||
|
||||
virtualHosts.${cfg.hostname} = {
|
||||
locations = {
|
||||
# resources that are generated and thus cannot be taken from the cfg.package yet:
|
||||
"~ ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\w]+)?\\/(sdkjs/common/AllFonts.js)$".extraConfig = ''
|
||||
proxy_pass http://onlyoffice-docservice/$2$3;
|
||||
'';
|
||||
"~ ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\w]+)?\\/(fonts/.*)$".extraConfig = ''
|
||||
proxy_pass http://onlyoffice-docservice/$2$3;
|
||||
'';
|
||||
# /etc/nginx/includes/ds-docservice.conf
|
||||
"~ ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\d]+)?\\/(web-apps\\/apps\\/api\\/documents\\/api\\.js)$".extraConfig =
|
||||
#disable caching for api.js
|
||||
"~ ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\w]+)?\\/(web-apps\\/apps\\/api\\/documents\\/api\\.js)$".extraConfig =
|
||||
''
|
||||
expires -1;
|
||||
# gzip_static on;
|
||||
alias ${cfg.package}/var/www/onlyoffice/documentserver/$2;
|
||||
'';
|
||||
"~ ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\d]+)?\\/(web-apps)(\\/.*\\.json)$".extraConfig = ''
|
||||
expires 365d;
|
||||
error_log /dev/null crit;
|
||||
alias ${cfg.package}/var/www/onlyoffice/documentserver/$2$3;
|
||||
'';
|
||||
"~ ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\d]+)?\\/(sdkjs-plugins)(\\/.*\\.json)$".extraConfig = ''
|
||||
expires 365d;
|
||||
error_log /dev/null crit;
|
||||
alias ${cfg.package}/var/www/onlyoffice/documentserver/$2$3;
|
||||
'';
|
||||
"~ ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\d]+)?\\/(web-apps|sdkjs|sdkjs-plugins|fonts)(\\/.*)$".extraConfig =
|
||||
"~ ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\w]+)?\\/(document_editor_service_worker\\.js)$".extraConfig =
|
||||
''
|
||||
expires 365d;
|
||||
# gzip_static on;
|
||||
alias ${cfg.package}/var/www/onlyoffice/documentserver/sdkjs/common/serviceworker/$2;
|
||||
'';
|
||||
#suppress logging the unsupported locale error in web-apps
|
||||
"~ ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\w]+)?\\/(web-apps)(\\/.*\\.json)$".extraConfig = ''
|
||||
expires 365d;
|
||||
error_log /dev/null crit;
|
||||
alias ${cfg.package}/var/www/onlyoffice/documentserver/$2$3;
|
||||
'';
|
||||
#suppress logging the unsupported locale error in plugins
|
||||
"~ ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\w]+)?\\/(sdkjs-plugins)(\\/.*\\.json)$".extraConfig = ''
|
||||
expires 365d;
|
||||
error_log /dev/null crit;
|
||||
# gzip_static on;
|
||||
alias ${cfg.package}/var/www/onlyoffice/documentserver/$2$3;
|
||||
'';
|
||||
"~ ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\w]+)?\\/(web-apps|sdkjs|sdkjs-plugins|fonts|dictionaries)(\\/.*)$".extraConfig =
|
||||
''
|
||||
expires 365d;
|
||||
# gzip_static on;
|
||||
alias ${cfg.package}/var/www/onlyoffice/documentserver/$2$3;
|
||||
'';
|
||||
"~* ^(\\/cache\\/files.*)(\\/.*)".extraConfig = ''
|
||||
alias /var/lib/onlyoffice/documentserver/App_Data$1;
|
||||
add_header Content-Disposition "attachment; filename*=UTF-8''$arg_filename";
|
||||
|
||||
set $secret_string verysecretstring;
|
||||
set $secure_link_secret verysecretstring;
|
||||
secure_link $arg_md5,$arg_expires;
|
||||
secure_link_md5 "$secure_link_expires$uri$secret_string";
|
||||
secure_link_md5 "$secure_link_expires$uri$secure_link_secret";
|
||||
|
||||
if ($secure_link = "") {
|
||||
return 403;
|
||||
|
@ -141,12 +162,17 @@ in
|
|||
return 410;
|
||||
}
|
||||
'';
|
||||
"~* ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\d]+)?\\/(internal)(\\/.*)$".extraConfig = ''
|
||||
# Allow "/internal" interface only from 127.0.0.1
|
||||
# Don't comment out the section below for the security reason!
|
||||
"~* ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\w]+)?\\/(internal)(\\/.*)$".extraConfig = ''
|
||||
allow 127.0.0.1;
|
||||
deny all;
|
||||
proxy_pass http://onlyoffice-docservice/$2$3;
|
||||
'';
|
||||
"~* ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\d]+)?\\/(info)(\\/.*)$".extraConfig = ''
|
||||
# Allow "/info" interface only from 127.0.0.1 by default
|
||||
# Comment out lines allow 127.0.0.1; and deny all;
|
||||
# of below section to turn on the info page
|
||||
"~* ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\w]+)?\\/(info)(\\/.*)$".extraConfig = ''
|
||||
allow 127.0.0.1;
|
||||
deny all;
|
||||
proxy_pass http://onlyoffice-docservice/$2$3;
|
||||
|
@ -154,19 +180,16 @@ in
|
|||
"/".extraConfig = ''
|
||||
proxy_pass http://onlyoffice-docservice;
|
||||
'';
|
||||
"~ ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\d]+)?(\\/doc\\/.*)".extraConfig = ''
|
||||
proxy_pass http://onlyoffice-docservice$2;
|
||||
"~ ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\w]+)?(\\/(doc|downloadas)\\/.*)".extraConfig = ''
|
||||
proxy_pass http://onlyoffice-docservice$2$is_args$args;
|
||||
proxy_http_version 1.1;
|
||||
'';
|
||||
# end of /etc/nginx/includes/ds-docservice.conf
|
||||
"/${cfg.package.version}/".extraConfig = ''
|
||||
proxy_pass http://onlyoffice-docservice/;
|
||||
'';
|
||||
"~ ^(\\/[\\d]+\\.[\\d]+\\.[\\d]+[\\.|-][\\d]+)?\\/(dictionaries)(\\/.*)$".extraConfig = ''
|
||||
expires 365d;
|
||||
alias ${cfg.package}/var/www/onlyoffice/documentserver/$2$3;
|
||||
'';
|
||||
# /etc/nginx/includes/ds-example.conf
|
||||
"~ ^(\\/welcome\\/.*)$".extraConfig = ''
|
||||
"~ ^(\\/welcome\\/.*)$".extraConfig = lib.mkIf cfg.enableExampleServer ''
|
||||
expires 365d;
|
||||
alias ${cfg.package}/var/www/onlyoffice/documentserver-example$1;
|
||||
index docker.html;
|
||||
|
@ -278,6 +301,11 @@ in
|
|||
.rabbitmq.url = "${cfg.rabbitmqUrl}"
|
||||
' /run/onlyoffice/config/default.json | sponge /run/onlyoffice/config/default.json
|
||||
|
||||
chmod u+w /run/onlyoffice/config/production-linux.json
|
||||
jq '
|
||||
.FileConverter.converter.x2tPath = "${cfg.x2t}/bin/x2t"
|
||||
' /run/onlyoffice/config/production-linux.json | sponge /run/onlyoffice/config/production-linux.json
|
||||
|
||||
if psql -d onlyoffice -c "SELECT 'task_result'::regclass;" >/dev/null; then
|
||||
psql -f ${cfg.package}/var/www/onlyoffice/documentserver/server/schema/postgresql/removetbl.sql
|
||||
psql -f ${cfg.package}/var/www/onlyoffice/documentserver/server/schema/postgresql/createdb.sql
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue