aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-11-02 15:28:48 +0300
committerFrederick Muriuki Muriithi2023-11-02 15:28:48 +0300
commit16fab26ceb824732915d460e1096dd118f0c9fc5 (patch)
tree90a70e43a4014babd47ef99206635669bc2175fc
parentf14e21d68847cf433555649b3b0ed7159842ddeb (diff)
downloadgn-machines-16fab26ceb824732915d460e1096dd118f0c9fc5.tar.gz
gn-auth: Remove automated migrations.
-rw-r--r--genenetwork-development.scm91
1 files changed, 7 insertions, 84 deletions
diff --git a/genenetwork-development.scm b/genenetwork-development.scm
index 62a9b9b..579e0c2 100644
--- a/genenetwork-development.scm
+++ b/genenetwork-development.scm
@@ -31,7 +31,7 @@
((gnu packages check) #:select (python-pylint))
((gnu packages ci) #:select (laminar))
((gnu packages compression) #:select (gzip))
- ((gnu packages databases) #:select (virtuoso-ose yoyo-migrations))
+ ((gnu packages databases) #:select (virtuoso-ose))
((gnu packages gnupg) #:select (guile-gcrypt))
((gnu packages graphviz) #:select (graphviz))
((gnu packages guile) #:select (guile-3.0 guile-git guile-zlib))
@@ -227,66 +227,6 @@ command to be executed."
(genenetwork3-tests (list "pytest" "-k" "unit_test")
(package->development-manifest genenetwork3)))
-(define (gn-auth-migrations-yoyo-ini-gexp config)
- "Return a G-expression to construct a @file{yoyo.ini} configuration
-file for a genenetwork service described by @var{config}, a
-@code{<genenetwork-configuration>} object."
- (match-record config <genenetwork-configuration>
- (auth-db-path)
- (with-extensions (list guile-ini guile-lib guile-smc)
- #~ (begin
- (use-modules (srfi srfi-26)
- (ini))
-
- (call-with-output-file #$output
- (cut scm->ini
- `(("DEFAULT"
- ("sources" . "gn-auth/migrations/auth/")
- ("database" . #$(string-append "sqlite:///" auth-db-path))
- ("migration_table" . "_yoyo_migration")
- ("batch_mode" . "on")
- ("verbosity" . "2")))
- #:port <>))))))
-
-(define (gn-auth-migrations config)
- "Return a G-expression that runs the migrations for the
-auth(entic|oris)ation database. This is the actual migration run by
-the genenetwork user."
- (match-record config <genenetwork-configuration>
- (auth-db-path)
- (with-imported-modules '((guix build utils))
- #~(begin
- (use-modules (guix build utils))
-
- ;; Initialize an empty database file if it does not
- ;; already exist.
- (unless (file-exists? #$auth-db-path)
- (call-with-output-file #$auth-db-path
- (const #t)))
- ;; Run migrations.
- (invoke #$(file-append yoyo-migrations "/bin/yoyo")
- "apply" "--config"
- #$(computed-file "yoyo.ini"
- (gn-auth-migrations-yoyo-ini-gexp config)))))))
-
-(define (gn-auth-migrations-laminar config)
- "Return a G-expression that runs the migrations for the
-auth(entic|oris)ation database. This is the wrapper script run by the
-laminar user."
- (match-record config <genenetwork-configuration>
- (gn-auth-repository)
- (with-packages (list git-minimal nss-certs)
- (with-imported-modules '((guix build utils))
- #~(begin
- (use-modules (guix build utils))
-
- ;; Clone the latest gn-auth repository.
- (invoke "git" "clone" "--depth" "1" #$gn-auth-repository)
- ;; Run the actual migrations as the genenetwork user.
- (invoke #$sudo "--user=genenetwork"
- #$(program-file "gn-auth-migrations"
- (gn-auth-migrations config))))))))
-
(define genenetwork3-pylint
(with-imported-modules (source-module-closure '((genenetwork development-helper))
#:select? import-module?)
@@ -441,14 +381,15 @@ genenetwork3 source from the latest commit of @var{project}."
(url (forge-project-repository this-forge-project))
(branch "main")))
#:guix-daemon-uri %guix-daemon-uri))
- ;; If unit tests pass, trigger the auth migrations.
- (after (with-imported-modules '((guix build utils))
+ ;; If unit tests pass, restart the auth server.
+ (after (with-imported-modules '((guix build utils))
#~(begin
(use-modules (guix build utils))
(when (string=? (getenv "RESULT") "success")
- (invoke #$(file-append laminar "/bin/laminarc")
- "queue" "gn-auth-migrations"))))))
+ (invoke #$sudo
+ #$(file-append shepherd "/bin/herd")
+ "restart" "gn-auth"))))))
(forge-laminar-job
(name "gn-auth-pylint")
(run (derivation-job-gexp
@@ -464,20 +405,7 @@ genenetwork3 source from the latest commit of @var{project}."
(genenetwork3-tests (list "mypy" ".")
(manifest-cons python-mypy
(package->development-manifest gn-auth)))
- #:guix-daemon-uri %guix-daemon-uri)))
- (forge-laminar-job
- (name "gn-auth-migrations")
- (run (gn-auth-migrations-laminar config))
- ;; If migrations run successfully, redeploy gn-auth
- (after (with-imported-modules '((guix build utils))
- #~(begin
- (use-modules (guix build utils))
-
- (when (string=? (getenv "RESULT") "success")
- (invoke #$sudo
- #$(file-append shepherd "/bin/herd")
- "restart" "gn-auth")))))
- (trigger? #f))))
+ #:guix-daemon-uri %guix-daemon-uri)))))
(ci-jobs-trigger 'webhook)))))
(define (genenetwork2-cd-gexp config)
@@ -1160,11 +1088,6 @@ gn-auth."
(file-append shepherd "/bin/herd") " start gn-auth, "
(file-append shepherd "/bin/herd") " stop gn-auth, "
(file-append shepherd "/bin/herd") " restart gn-auth\n"
- ;; Permit the laminar user to run auth db
- ;; migrations as the genenetwork user.
- "\nlaminar ALL = (genenetwork) NOPASSWD: "
- (program-file "gn-auth-migrations"
- (gn-auth-migrations (genenetwork-configuration)))
;; Permit the acme user to restart nginx.
"\nacme ALL = NOPASSWD: " (file-append shepherd "/bin/herd") " restart nginx\n"))
(services (cons* (service forge-service-type