blob: 9c4ef948fea6b8ccb825885929d79b08db5a6ff0 [file] [log] [blame]
Skyler Grey22428b02023-11-19 13:20:56 +00001{ config, ... }: {
2 #Collabora Containers
3 virtualisation.oci-containers.containers.collabora = {
4 image = "collabora/code:latest";
5 ports = [ "9980:9980/tcp" ];
6 environment = {
7 server_name = "collabora.clicks.codes";
8 aliasgroup1 = "https://nextcloud.clicks.codes:443";
Skyler Greyefb3ee22024-03-22 11:21:01 +00009 aliasgroup2 = "https://www.nextcloud.clicks.codes:443";
Skyler Grey22428b02023-11-19 13:20:56 +000010 dictionaries = "en_US";
11 extra_params = "--o:ssl.enable=false --o:ssl.termination=true";
12 };
Skyler Greyefb3ee22024-03-22 11:21:01 +000013 extraOptions = [
Skyler Grey915067d2023-12-03 13:46:53 +000014 "--pull=always"
Skyler Grey7bad08a2024-02-07 21:59:46 +000015 "--privileged" # needed for fast jail creation via bind mounts
Skyler Grey22428b02023-11-19 13:20:56 +000016 ];
17 };
18 virtualisation.oci-containers.backend = "docker";
19
20 #Collabora Virtual Hosts
Skyler Greyefb3ee22024-03-22 11:21:01 +000021 services.nginx.virtualHosts.${config.virtualisation.oci-containers.containers.collabora.environment.server_name} =
22 {
23 serverAliases = [
24 "www.${config.virtualisation.oci-containers.containers.collabora.environment.server_name}"
25 "docs.clicks.codes"
26 "www.docs.clicks.codes"
27 ];
28 enableACME = true;
29 forceSSL = true;
30 addSSL = false;
31 listenAddresses = [ "0.0.0.0" ];
Skyler Grey22428b02023-11-19 13:20:56 +000032
Skyler Greyefb3ee22024-03-22 11:21:01 +000033 extraConfig = ''
34 location = / {
35 proxy_pass http://standard:9980;
36 proxy_set_header Host $host;
37 }
Skyler Grey22428b02023-11-19 13:20:56 +000038
Skyler Greyefb3ee22024-03-22 11:21:01 +000039 # static files
40 location ^~ /browser {
41 proxy_pass http://standard:9980;
42 proxy_set_header Host $host;
43 }
Skyler Grey22428b02023-11-19 13:20:56 +000044
Skyler Greyefb3ee22024-03-22 11:21:01 +000045 # WOPI discovery URL
46 location ^~ /hosting/discovery {
47 proxy_pass http://standard:9980;
48 proxy_set_header Host $host;
49 }
Skyler Grey22428b02023-11-19 13:20:56 +000050
Skyler Greyefb3ee22024-03-22 11:21:01 +000051 # Capabilities
52 location ^~ /hosting/capabilities {
53 proxy_pass http://standard:9980;
54 proxy_set_header Host $host;
55 }
Skyler Grey22428b02023-11-19 13:20:56 +000056
Skyler Greyefb3ee22024-03-22 11:21:01 +000057 # main websocket
58 location ~ ^/cool/(.*)/ws$ {
59 proxy_pass http://standard:9980;
60 proxy_set_header Upgrade $http_upgrade;
61 proxy_set_header Connection "Upgrade";
62 proxy_set_header Host $host;
63 proxy_read_timeout 36000s;
64 }
Skyler Grey22428b02023-11-19 13:20:56 +000065
Skyler Greyefb3ee22024-03-22 11:21:01 +000066 # download, presentation and image upload
67 location ~ ^/(c|l)ool {
68 proxy_pass http://standard:9980;
69 proxy_set_header Host $host;
70 }
Skyler Grey22428b02023-11-19 13:20:56 +000071
Skyler Greyefb3ee22024-03-22 11:21:01 +000072 # Admin Console websocket
73 location ^~ /cool/adminws {
74 proxy_pass http://standard:9980;
75 proxy_set_header Upgrade $http_upgrade;
76 proxy_set_header Connection "Upgrade";
77 proxy_set_header Host $host;
78 proxy_read_timeout 36000s;
79 }
80 '';
81 };
Skyler Grey22428b02023-11-19 13:20:56 +000082}