blob: 9ea307f891cd8d8c4ae6dae8eaf037c468237c7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
;;; genenetwork-machines --- Guix configuration for genenetwork machines
;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This file is part of genenetwork-machines.
;;;
;;; genenetwork-machines is free software: you can redistribute it
;;; and/or modify it under the terms of the GNU General Public License
;;; as published by the Free Software Foundation, either version 3 of
;;; the License, or (at your option) any later version.
;;;
;;; genenetwork-machines 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 General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with genenetwork-machines. If not, see
;;; <https://www.gnu.org/licenses/>.
(use-modules (guix records)
(gnu)
(gnu services web)
(gnu packages admin)
(gn services databases)
(forge acme)
(forge nginx)
(forge socket))
(define %virtuoso-port 8981)
(define-record-type* <sparql-configuration>
sparql-configuration make-sparql-configuration sparql-configuration?
(server-name sparql-configuration-server-name
(default "sparql.genenetwork.org"))
(virtuoso-configuration sparql-configuration-virtuoso-configuration
(default (virtuoso-configuration
(server-port 8981)
(http-server-port 8982)
(number-of-buffers 4000000)
(dirs-allowed "/var/lib/virtuoso")
(maximum-dirty-buffers 3000000)
(database-file "/var/lib/virtuoso/public-virtuoso.db")
(transaction-file "/var/lib/virtuoso/public-virtuoso.trx")))))
(define (virtuoso-reverse-proxy-server-block config)
"Return an <nginx-server-configuration> to reverse proxy the Virtuoso server."
(match-record config <sparql-configuration> (server-name virtuoso-configuration)
(list (nginx-server-configuration
(server-name (list server-name))
(locations
(list (nginx-location-configuration
(uri "/")
(body (list (string-append
"proxy_pass http://localhost:"
(number->string
(virtuoso-configuration-http-server-port virtuoso-configuration))
";")
"proxy_set_header Host $host;")))))))))
(define sparql-service-type
(service-type
(name 'public-sparql)
(description "Expose a virtuoso service to the public")
(extensions
(list (service-extension forge-nginx-service-type
virtuoso-reverse-proxy-server-block)))))
(let ((sparql-config (sparql-configuration)))
(operating-system
(host-name "sparql")
(timezone "UTC")
(locale "en_US.utf8")
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
(targets (list "/dev/sdX"))))
(file-systems %base-file-systems)
(users %base-user-accounts)
(sudoers-file
(mixed-text-file "sudoers"
"@include " %sudoers-specification
"\nacme ALL = NOPASSWD: " (file-append shepherd "/bin/herd") " restart nginx\n"))
(packages %base-packages)
(services (cons* (service forge-nginx-service-type
(forge-nginx-configuration
(http-listen (forge-ip-socket
(ip "0.0.0.0")
(port 8990)))
(https-listen (forge-ip-socket
(ip "0.0.0.0")
(port 8991)))))
(service acme-service-type
(acme-configuration
(email "arunisaac@systemreboot.net")))
(service virtuoso-service-type
(sparql-configuration-virtuoso-configuration sparql-config))
(service sparql-service-type sparql-config)
%base-services))))
|