mastostart-guix/mastostart-gnu/system/mastostart.scm
Giacomo Leidi f5408c4399 mastostart-gnu: Aggiunge crawl job alla configurazione.
* mastostart-gnu/services/mastostart.scm: Fix per quando si condivide
la webroot con l'host.
* mastostart-gnu/system/mastostart.scm: Aggiunge crawl job alla configurazione.
2020-05-11 15:32:48 +02:00

126 lines
3.4 KiB
Scheme

(define-module (mastostart-gnu system mastostart)
#:use-module (gnu)
#:use-module (guix)
#:use-module (guix packages)
#:use-module (gnu packages databases)
#:use-module (guix packages)
#:use-module (guix build syscalls)
#:use-module (mastostart-gnu packages mastostart)
#:use-module (mastostart-gnu services mastostart))
(use-service-modules base
databases
mcron
networking
shepherd
ssh
web)
(define-public crawl-job
;; Lancia 'crawl.sh' alle 3AM ogni giorno. Qui scriviamo
;; il job sotto forma di procedura Scheme.
#~(job '(next-hour '(3))
(lambda ()
(execl (string-append #$mastostart "/web/mustard/crawler/crawl.sh")))))
(define-public %apache-listen-ports '("80"))
(define-public %apache-server-name "127.0.0.1")
(define-public %apache-webroot "/srv")
(define-public %apache-conf
(string-append "
<Directory / >
Options FollowSymLinks
AllowOverride All
</Directory>
<FilesMatch \\.php$>
SetHandler \"proxy:unix:/var/run/php-fpm.sock|fcgi://localhost/\"
</FilesMatch>"))
(define-public %apache-modules
(cons*
(httpd-module
(name "rewrite_module")
(file "modules/mod_rewrite.so"))
(httpd-module
(name "proxy_module")
(file "modules/mod_proxy.so"))
(httpd-module
(name "proxy_fcgi_module")
(file "modules/mod_proxy_fcgi.so"))
%default-httpd-modules))
(define-public %mastostart-services
(append
(list (service dhcp-client-service-type)
(mysql-service)
(service mcron-service-type
(mcron-configuration
(jobs (list crawl-job))))
(service mastostart-service-type
(mastostart-configuration
(webroot %apache-webroot)))
(service openssh-service-type
(openssh-configuration
(port-number 10022)
(permit-root-login #t)))
(service httpd-service-type
(httpd-configuration
(config
(httpd-config-file
(server-name %apache-server-name)
(listen %apache-listen-ports)
(document-root %apache-webroot)
(modules %apache-modules)
(extra-config (list %apache-conf))))))
(service php-fpm-service-type
(php-fpm-configuration
(socket "/var/run/php-fpm.sock")
(socket-group "httpd"))))
%base-services))
(define-public mastostart-conf
(operating-system
(locale "it_IT.utf8")
(timezone "Europe/Rome")
(host-name "mastostart")
(keyboard-layout
(keyboard-layout "it" "nodeadkeys"))
(bootloader
(bootloader-configuration
(bootloader grub-bootloader)
(target "/dev/sda")
(keyboard-layout keyboard-layout)))
(file-systems
(cons* (file-system
(mount-point "/")
(device (file-system-label "root"))
(type "ext4"))
%base-file-systems))
(packages
(append
(map specification->package
'("glibc-utf8-locales"
"font-dejavu"
"font-gnu-freefont"
"gs-fonts"
"mariadb"
"php"
"rsync"))
%base-packages))
(services %mastostart-services)))
mastostart-conf