about summary refs log tree commit diff
path: root/test-r-container.scm
blob: 3167574437e0c4cc5f1819a1f0e611d99634aa0d (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
99
100
101
102
103
104
105
106
107
108
109
110
111
(use-modules (guix)
             (gnu)
             (guix git)
             (guix modules)
             (guix profiles)
             (guix records)
             (guix packages)
             (guix git-download)
             (guix build-system trivial)
             (gnu services dbus)
             (gnu services networking)
             (gnu services ssh)
             (gnu services web)
             (gnu services certbot)
             (gnu services docker)
             (gnu services desktop)
             (gnu services shepherd)
             (gnu packages admin)
             (gnu packages statistics)
             (gnu packages cran)
             (gnu packages curl)
             (gnu packages lsof)
             (srfi srfi-1)
             (ice-9 match)
             (genenetwork services mouse-longevity)
             (gn services rshiny)
             (gn packages mouse-longevity)
             (forge acme)
             (forge nginx)
             (forge socket)
             (gnu services))

(define %nginx-configuration
  (nginx-configuration
   (server-blocks
    (list
     ;; Redirect domains that don't explicitly support HTTP (below) to HTTPS.
     (nginx-server-configuration
      (listen '("8080")))

     ;; Domains that still explicitly support plain HTTP.
     (nginx-server-configuration
      (listen '("80"))
      (server-name '("longevity-explorer.genenetwork.org"))
      (locations
       (list
        (nginx-location-configuration
         (uri "/")
         (body (list "proxy_pass http://127.0.0.1:3979;")))))
      (raw-content
       (list
        "proxy_set_header Host $host;"
        "proxy_set_header X-Real-IP $remote_addr;"
        "proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;"
        "proxy_set_header X-Forwarded-Proto $scheme;")))))))

(operating-system
 (host-name "testing-genenetwork-services")
 (keyboard-layout (keyboard-layout "us"))
 (kernel-arguments
    (cons* "console=ttyS0,115200" "console=tty0"
           %default-kernel-arguments))
 (bootloader (bootloader-configuration (bootloader grub-bootloader)))
 (issue "This is a GeneNetwork container.  Welcome!\n")
 (file-systems %base-file-systems)
 (sudoers-file
   (mixed-text-file "sudoers"
     "@include " %sudoers-specification
     "\nacme ALL = NOPASSWD: " (file-append shepherd "/bin/herd") " restart nginx\n"))
 (packages (cons* lsof curl %base-packages))
 (services
  (cons*
   (service dhcp-client-service-type)
   (service dbus-root-service-type)
   (service polkit-service-type)
   (service forge-nginx-service-type
            (forge-nginx-configuration
             (http-listen (forge-ip-socket
                           (ip "127.0.0.1")
                           (port "8080")))
             (https-listen (forge-ip-socket
                            (ip "127.0.0.1")
                            (port "8443")))
             (server-blocks
              (list
               (nginx-server-configuration
                (server-name '("longevity-explorer.genenetwork.org"))
                (locations
                 (list (nginx-location-configuration
                        (uri "/")
                        (body (list "proxy_pass http://localhost:3979;"
                                    "proxy_set_header Host $host;"))))))))))
   (service acme-service-type
            (acme-configuration
             (email "jgart@dismail.de")
             (acme-url %letsencrypt-staging-url)))
   ;; (service certbot-service-type
   ;;          (certbot-configuration
   ;;           (email "jgart@dismail.de")
   ;;           (certificates
   ;;            (list
   ;;             (certificate-configuration
   ;;              (domains '("longevity-explorer.genenetwork.org"
   ;;                         "www.longevity-explorer.genenetwork.org")))))))
   ;; (mouse-longevity-service )
   (service rshiny-service-type
            (rshiny-configuration
             (package mouse-longevity-app)
             (binary "mouse-longevity-app")))
   ;; (service nginx-service-type %nginx-configuration)
   %base-services)))